[SCM] Lisaac compiler branch, stable, updated. lisaac-0.12-546-g2442565
Mildred Ki'Lya
silkensedai at online.fr
Fri Oct 9 23:17:40 UTC 2009
The following commit has been merged in the stable branch:
commit 1b93ce798c8b9e5c90fb978e9bb87f1543bc6adf
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Fri Oct 9 22:39:13 2009 +0200
LIP: exit can take the exit code as parameter
diff --git a/make.lip b/make.lip
index efa740d..74fb590 100644
--- a/make.lip
+++ b/make.lip
@@ -45,6 +45,7 @@ Section Private
+ is_java:BOOLEAN;
+ is_cop:BOOLEAN; // Correct value after compilation.
+ execute_back_end:BOOLEAN := TRUE;
+ + execute_status_code:INTEGER := 0;
// Other.
+ is_statistic:BOOLEAN;
@@ -164,11 +165,28 @@ Section Private
cmd.print;
"'\n".print;
};
- (run cmd != 0).if {
- "FAILURE!\n".print;
+ execute_status_code := run cmd;
+ (execute_status_code != 0).if {
+ (is_quiet).if {
+ "FAILURE run `".print;
+ cmd.print;
+ "' (".print;
+ } else {
+ "FAILURE (".print;
+ };
+ execute_status_code.print;
+ ")\n".print;
};
);
-
+
+ - execute_fail cmd:STRING <-
+ (
+ execute cmd;
+ (execute_status_code != 0).if {
+ exit execute_status_code;
+ };
+ );
+
//
// Execute function.
//
@@ -183,19 +201,19 @@ Section Private
(
(execute_back_end).if {
(target = "java").if {
- execute ("javac " + output_file + ".java");
+ execute_fail ("javac " + output_file + ".java");
};
(target = "dos").if {
- execute ("gcc " + output_file + ".c -o " + output_file + ".exe " + option_gcc + lib_gcc);
+ execute_fail ("gcc " + output_file + ".c -o " + output_file + ".exe " + option_gcc + lib_gcc);
};
(target = "windows").if {
- execute ("gcc " + output_file + ".c -o " + output_file + ".exe -lgdi32 " + option_gcc + lib_gcc);
+ execute_fail ("gcc " + output_file + ".c -o " + output_file + ".exe -lgdi32 " + option_gcc + lib_gcc);
};
(target = "unix").if {
(is_cop).if {
lib_gcc := lib_gcc + " -lpthread";
};
- execute ("gcc " + output_file + ".c -o " + output_file + " -lm " + option_gcc + lib_gcc);
+ execute_fail ("gcc " + output_file + ".c -o " + output_file + " -lm " + option_gcc + lib_gcc);
};
};
);
diff --git a/src/lip/lip_call.li b/src/lip/lip_call.li
index 6916a60..77950f8 100644
--- a/src/lip/lip_call.li
+++ b/src/lip/lip_call.li
@@ -68,7 +68,8 @@ Section Public
- run <-
( + slot:LIP_SLOT_CODE;
+ val,rec:LIP_CONSTANT;
- + str:LIP_STRING;
+ + str:LIP_STRING;
+ + int:LIP_INTEGER;
+ path:STRING_CONSTANT;
+ is_rec:BOOLEAN;
@@ -87,10 +88,17 @@ Section Public
};
rec.print;
}.elseif {name = ALIAS_STR.slot_exit} then {
- (val != NULL).if {
- warning_error (position,"No argument for `exit' method.");
+ int ?= val;
+ ((val != NULL) && {int = NULL}).if {
+ warning_error (position,"Optional integer argument for `exit' method.");
};
- die_with_code exit_failure_code;
+ (int = NULL).if {
+ die_with_code exit_failure_code;
+ }.elseif { (int.value != 0) && {int.value % 256 = 0} } then {
+ die_with_code exit_failure_code;
+ } else {
+ die_with_code (int.value);
+ }
}.elseif {name = ALIAS_STR.slot_help} then {
(val != NULL).if {
warning_error (position,"No argument for `help' method.");
--
Lisaac compiler
More information about the Lisaac-commits
mailing list