Export ops definitions.
This commit is contained in:
parent
f2930ae169
commit
2b5478288c
@ -3,6 +3,7 @@
|
|||||||
-export([ gen_and_halt/1
|
-export([ gen_and_halt/1
|
||||||
, generate/0
|
, generate/0
|
||||||
, generate_documentation/1
|
, generate_documentation/1
|
||||||
|
, get_ops/0
|
||||||
, test_asm_generator/1]).
|
, test_asm_generator/1]).
|
||||||
|
|
||||||
gen_and_halt([SrcDirArg, IncludeDirArg]) ->
|
gen_and_halt([SrcDirArg, IncludeDirArg]) ->
|
||||||
@ -10,11 +11,12 @@ gen_and_halt([SrcDirArg, IncludeDirArg]) ->
|
|||||||
atom_to_list(IncludeDirArg)),
|
atom_to_list(IncludeDirArg)),
|
||||||
halt().
|
halt().
|
||||||
|
|
||||||
generate() ->
|
generate() -> generate("src/", "include/").
|
||||||
generate("src/", "include/").
|
|
||||||
|
get_ops() -> gen(ops_defs()).
|
||||||
|
|
||||||
generate(Src, Include) ->
|
generate(Src, Include) ->
|
||||||
Ops = gen(ops_defs()),
|
Ops = get_ops(),
|
||||||
%% io:format("ops: ~p\n", [Ops]),
|
%% io:format("ops: ~p\n", [Ops]),
|
||||||
HrlFile = Include ++ "aeb_fate_opcodes.hrl",
|
HrlFile = Include ++ "aeb_fate_opcodes.hrl",
|
||||||
generate_header_file(HrlFile, Ops),
|
generate_header_file(HrlFile, Ops),
|
||||||
@ -519,7 +521,7 @@ gen_format(#{opname := Name, format := Args}) ->
|
|||||||
|
|
||||||
test_asm_generator(Filename) ->
|
test_asm_generator(Filename) ->
|
||||||
{ok, File} = file:open(Filename, [write]),
|
{ok, File} = file:open(Filename, [write]),
|
||||||
Instructions = lists:flatten([gen_instruction(Op)++"\n" || Op <- gen(ops_defs())]),
|
Instructions = lists:flatten([gen_instruction(Op)++"\n" || Op <- get_ops()]),
|
||||||
io:format(File,
|
io:format(File,
|
||||||
";; CONTRACT all_instructions\n\n"
|
";; CONTRACT all_instructions\n\n"
|
||||||
";; Dont expect this contract to typecheck or run.\n"
|
";; Dont expect this contract to typecheck or run.\n"
|
||||||
@ -641,7 +643,7 @@ gen_variant() ->
|
|||||||
%% TODO: add gas cost.
|
%% TODO: add gas cost.
|
||||||
generate_documentation(Filename) ->
|
generate_documentation(Filename) ->
|
||||||
{ok, File} = file:open(Filename, [write]),
|
{ok, File} = file:open(Filename, [write]),
|
||||||
Instructions = lists:flatten([gen_doc(Op)++"\n" || Op <- gen(ops_defs())]),
|
Instructions = lists:flatten([gen_doc(Op)++"\n" || Op <- get_ops()]),
|
||||||
io:format(File,
|
io:format(File,
|
||||||
"### Operations\n\n"
|
"### Operations\n\n"
|
||||||
"| OpCode | Name | Args | Description |\n"
|
"| OpCode | Name | Args | Description |\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user