summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorAlasdair2020-05-12 15:41:23 +0100
committerAlasdair2020-05-12 15:41:23 +0100
commit81516c8ad7c30adb3d52741ad6a7c68d4436ec35 (patch)
tree9a9a56c495f2c9dba4e8613118f40c3f8bc2b33b /etc
parent199e10df8e776e4b27f9cfd2357db6babf674ed1 (diff)
Support for user-defined state and headers in new codegen
All the code-generator options can now be controlled via a json configuration file Extra fields can be added to the sail_state struct using a codegen.extra_state key in the configuration json for the code generator If primitives want to modify the state they can be specified via codegen.state_primops To import such state, codegen.extra_headers can be used to add user-defined headers to the generated .h file
Diffstat (limited to 'etc')
-rw-r--r--etc/default_config.json30
1 files changed, 30 insertions, 0 deletions
diff --git a/etc/default_config.json b/etc/default_config.json
new file mode 100644
index 00000000..79f166af
--- /dev/null
+++ b/etc/default_config.json
@@ -0,0 +1,30 @@
+{
+ "codegen": {
+ // Apply some default name mangling rules if true. If false,
+ // mangle everything.
+ "default_exports": true,
+ // An array containing either ["identifier", "string"] or
+ // "identifier". For the first case the identifier will be
+ // rewritten into string in the generated C source. For the
+ // second the identifier will be preserved without name
+ // mangling.
+ "exports": [],
+ // Generic functions must always have name mangling applied
+ // due to specialization. They can be renamed using ["symbol",
+ // "string"] pairs in this array, where "symbol" is any
+ // mangled symbol that appears in the generated C.
+ "exports_mangled": [
+ ["ztuple_z8z5i64zCz0z5iz9", "tuple_i64_int"]
+ ],
+ // Include the following extra headers in the generated
+ // C. Should be specified as either "<header.h>" or "header.h"
+ "extra_headers": [],
+ // An array of extra string lines that are added to the
+ // sail_state struct.
+ "extra_state": [],
+ // The sail_state struct will be passed to the following array
+ // of primops, which are specified via the "foo" string from
+ // val id = "foo" : ... in Sail.
+ "state_primops": []
+ }
+}