Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
f22626ee
Commit
f22626ee
authored
Apr 10, 2014
by
Damien George
Browse files
unix: Add option to only compile, and not execute code.
parent
87bb093e
Changes
1
Hide whitespace changes
Inline
Side-by-side
unix/main.c
View file @
f22626ee
...
...
@@ -29,7 +29,8 @@
#include <readline/history.h>
#endif
// Default emit options
// Command line options, with their defaults
bool
compile_only
=
false
;
uint
emit_opt
=
MP_EMIT_OPT_NONE
;
#if MICROPY_ENABLE_GC
...
...
@@ -87,6 +88,10 @@ STATIC void execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind
return
;
}
if
(
compile_only
)
{
return
;
}
// execute it
nlr_buf_t
nlr
;
if
(
nlr_push
(
&
nlr
)
==
0
)
{
...
...
@@ -226,6 +231,7 @@ int usage(char **argv) {
);
int
impl_opts_cnt
=
0
;
printf
(
" compile-only -- parse and compile only
\n
"
" emit={bytecode,native,viper} -- set the default code emitter
\n
"
);
impl_opts_cnt
++
;
...
...
@@ -273,6 +279,8 @@ void pre_process_options(int argc, char **argv) {
exit
(
usage
(
argv
));
}
if
(
0
)
{
}
else
if
(
strcmp
(
argv
[
a
+
1
],
"compile-only"
)
==
0
)
{
compile_only
=
true
;
}
else
if
(
strcmp
(
argv
[
a
+
1
],
"emit=bytecode"
)
==
0
)
{
emit_opt
=
MP_EMIT_OPT_BYTE_CODE
;
}
else
if
(
strcmp
(
argv
[
a
+
1
],
"emit=native"
)
==
0
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment