Commit bc1ed4c9 authored by Mart Lubbers's avatar Mart Lubbers

cpm, make bytecode accept default option

parent b1ddd765
Pipeline #23192 passed with stage
in 57 seconds
......@@ -23,6 +23,7 @@ from StdMaybe import :: Maybe
| SetRelativeRoot String
| SetTarget String
| SetExec String
| SetBytecode (Maybe String)
| SetProjectOptions [ProjectOption]
| ProjectHelp
......@@ -59,7 +60,6 @@ from StdMaybe import :: Maybe
| Output !Output
| LinkerGenerateSymbolsOn
| LinkerGenerateSymbolsOff
| ByteCodePath !FilePath
| PO_OptimiseABC !Bool
| PO_GenerateByteCode !Bool
| PO_StripByteCode !Bool
......
......@@ -153,6 +153,11 @@ doProjectAction cleanhome pwd pn (SetTarget target) world
doProjectAction cleanhome pwd pn (SetExec exec) world
= withProject pwd pn cleanhome (PR_SetExecPath exec) world
doProjectAction cleanhome pwd pn (SetBytecode Nothing) world
= withProject pwd pn cleanhome (\p->PR_SetByteCodePath (PR_GetExecPath p +++ ".bc") p) world
doProjectAction cleanhome pwd pn (SetBytecode (Just bcfile)) world
= withProject pwd pn cleanhome (PR_SetByteCodePath bcfile) world
doProjectAction cleanhome pwd pn (SetProjectOptions project_options) world
= withProject pwd pn cleanhome (set_project_options project_options) world
where
......@@ -200,8 +205,6 @@ where
= PR_SetLinkOptions project {PR_GetLinkOptions project & generate_symbol_table=True}
set_project_option LinkerGenerateSymbolsOff project
= PR_SetLinkOptions project {PR_GetLinkOptions project & generate_symbol_table=False}
set_project_option (ByteCodePath path) project
= PR_SetByteCodePath path project
set_project_option (PO_OptimiseABC val) project
= PR_SetCodeGenOptions {PR_GetCodeGenOptions project & optimise_abc=val} project
set_project_option (PO_GenerateByteCode val) project
......@@ -226,6 +229,7 @@ doProjectAction _ _ _ _ world =
, " : . is the same dir, .. the parent, ... the grandparent, etc."
, " target <env> : set target environment to <env>"
, " exec <execname> : set executable name to <execname>"
, " bytecode [bc] : set bytecode file to <bcfile> or <execname>.bc if no file given"
, " set <option> [<option>] : Set one or more of the following options:"
, " : -h SIZE"
, " : Change the heapsize (e.g. 2M)"
......@@ -250,8 +254,6 @@ doProjectAction _ _ _ _ world =
, " : Note that these are mutually exclusive and if you select multiple, the last one will take effect"
, " : -mp, -nmp"
, " : Enable or disable memory profiling"
, " : -bytecode FILE"
, " : Set the bytecode file target, usually mainmodule.bc"
, " : -optimiseabc, -noptimiseabc"
, " : Enable or disable ABC optimization for bytecode targets"
, " : -genbytecode, -ngenbytecode"
......@@ -266,8 +268,9 @@ doProjectAction _ _ _ _ world =
, "Examples: "
, " - To create an iTasks project for module test, run:"
, " cpm project test create"
, " cpm project test bytecode"
, " cpm project test.prj target iTasks"
, " cpm project test.prj set -dynamics -h 200m -s 2m -descexl -bytecode -optimiseabc -genbytecode -stripbytecode -keepbytecodesymbols -prelinkbytecode"
, " cpm project test.prj set -dynamics -h 200m -s 2m -descexl -optimiseabc -genbytecode -stripbytecode -keepbytecodesymbols -prelinkbytecode"
, " cpm project test.prj build"
] world
......
......@@ -31,6 +31,8 @@ parse_Project ["root",s] project_name
= Project project_name (SetRelativeRoot s);
parse_Project ["target",s] project_name = Project project_name (SetTarget s);
parse_Project ["exec",s] project_name = Project project_name (SetExec s);
parse_Project ["bytecode",s] project_name = Project project_name (SetBytecode (Just s));
parse_Project ["bytecode"] project_name = Project project_name (SetBytecode Nothing);
parse_Project ["set":project_option_args] project_name
# (ok,project_options) = parse_Project_options project_option_args;
| ok
......@@ -149,9 +151,6 @@ parse_Project_options ["-mp":project_option_args]
parse_Project_options ["-nmp":project_option_args]
# (ok,project_options) = parse_Project_options project_option_args;
= (ok, [MemoryProfileOff:project_options]);
parse_Project_options ["-bytecode":path:project_option_args]
# (ok,project_options) = parse_Project_options project_option_args;
= (ok, [ByteCodePath path:project_options]);
parse_Project_options ["-optimiseabc":project_option_args]
# (ok,project_options) = parse_Project_options project_option_args;
= (ok, [PO_OptimiseABC True:project_options]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment