[SCM] Lisaac compiler branch, master+stable, updated. lisaac-0.12-606-gf445725
Mildred Ki'Lya
silkensedai at online.fr
Mon Mar 1 00:35:59 UTC 2010
The following commit has been merged in the master+stable branch:
commit 666a03bbc499545d661b0ab7a17d1f81bfb40482
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Sat Feb 20 01:33:27 2010 +0100
Add support for different extensions for output_file
diff --git a/make.lip.sample b/make.lip.sample
index f0ad76f..53a4a9b 100644
--- a/make.lip.sample
+++ b/make.lip.sample
@@ -27,10 +27,11 @@ Section Private
// Compiler variables.
//
- // File information.
- + lisaac:STRING; // is environment variable value (auto-loading).
- + input_file:STRING; // is input file name value without extension (auto-loading, if possible).
- + output_file:STRING; // is output file name value without extension (auto-loading, if possible).
+ // File information (auto-loading variables).
+ + lisaac :STRING; // is environment variable value (auto-loading).
+ + input_file :STRING; // is input file name value without extension.
+ + output_file :STRING; // is output file name value without extension.
+ + output_extension:STRING; // is extension of `output_file'
// Debug information.
+ debug_level:INTEGER := 15;
@@ -209,10 +210,12 @@ Section Private
};
option_gcc := option_gcc + " -U_FORTIFY_SOURCE ";
(is_library).if {
- execute_fail ("gcc " + output_file + ".c -c " + option_gcc);
+ execute_fail ("gcc " + output_file + output_extension + " -c " + option_gcc);
} else {
- execute_fail ("gcc " + output_file + ".c -o " + output_file + option_gcc + lib_gcc);
+ execute_fail ("gcc " + output_file + output_extension + " -o " + output_file + option_gcc + lib_gcc);
};
+ } else {
+ ("Written: " + output_file + output_extension + "\n").print;
};
);
diff --git a/src/lisaac.li b/src/lisaac.li
index b441829..6d2f7f8 100644
--- a/src/lisaac.li
+++ b/src/lisaac.li
@@ -193,8 +193,24 @@ Section Private
(input_name != NULL).if {
display_usage;
};
- input_name := ALIAS_STR.get (COMMAND_LINE.item j);
+ // Remove extension and replace '\'
+ string_tmp.copy (COMMAND_LINE.item j);
+ string_tmp.replace_all '\\' with '/';
+ i := last_index_str (string_tmp,'.');
+ (i > string_tmp.lower).if {
+ string_tmp.remove_last (string_tmp.upper-i+1);
+ };
+ input_name := ALIAS_STR.get (string_tmp);
+ // get dirname
+ i := last_index_str (string_tmp,'/');
+ (i < string_tmp.lower).if {
+ string_tmp.copy "./";
+ } else {
+ string_tmp.remove_last (string_tmp.upper-i);
+ };
+ input_path := ALIAS_STR.get (string_tmp);
LIP_CODE.put_string input_name to (ALIAS_STR.slot_input_file);
+ LIP_CODE.put_string input_name to (ALIAS_STR.slot_output_file);
};
};
j := j+1;
@@ -224,6 +240,7 @@ Section Private
// Loading variable.
input_name := LIP_CODE.get_string (ALIAS_STR.slot_input_file);
output_name := LIP_CODE.get_string (ALIAS_STR.slot_output_file);
+ output_extension := LIP_CODE.get_string (ALIAS_STR.slot_output_extension);
debug_level_option := LIP_CODE.get_integer (ALIAS_STR.slot_debug_level);
debug_with_code := LIP_CODE.get_boolean (ALIAS_STR.slot_debug_with_code);
is_all_warning := LIP_CODE.get_boolean (ALIAS_STR.slot_is_all_warning);
@@ -237,9 +254,9 @@ Section Private
"ERROR: `input_file' is empty.\n".print;
display_usage;
};
+ // Separate path (string_tmp) and file (string_tmp2)
string_tmp.copy input_name;
string_tmp2.copy string_tmp;
- string_tmp.replace_all '\\' with '/';
i := last_index_str (string_tmp,'/');
(i < string_tmp.lower).if {
string_tmp.copy "./";
@@ -247,10 +264,6 @@ Section Private
string_tmp.remove_last (string_tmp.upper-i);
string_tmp2.remove_first i;
};
- i := last_index_str (string_tmp2,'.');
- (i > string_tmp2.lower).if {
- string_tmp2.remove_last (string_tmp2.upper-i+1);
- };
LIP_CALL.load_directory (ALIAS_STR.get string_tmp) is_recursive FALSE;
//
string_tmp.copy (path_file.last);
@@ -269,6 +282,14 @@ Section Private
output_name := ALIAS_STR.get string_tmp;
LIP_CODE.put_string output_name to (ALIAS_STR.slot_output_file);
};
+ ((output_extension = NULL) || {output_extension.is_empty}).if {
+ (is_java).if {
+ output_extension := ALIAS_STR.extension_java;
+ } else {
+ output_extension := ALIAS_STR.extension_c;
+ };
+ LIP_CODE.put_string output_extension to (ALIAS_STR.slot_output_extension);
+ };
LIP_CODE.init_path_file FALSE;
);
@@ -569,7 +590,8 @@ Section Public
string_tmp.append input_name;
string_tmp.append ".li\noutput file: ";
string_tmp.append output_name;
- string_tmp.append ".c\npath directory :\n";
+ string_tmp.append output_extension;
+ string_tmp.append "\npath directory :\n";
path_file.lower.to (path_file.upper) do { j:INTEGER;
string_tmp.append " ";
string_tmp.append (path_file.item j);
@@ -703,7 +725,7 @@ Section Public
// Saving File Output.
//
string_tmp.copy output_name;
- string_tmp.append ".c";
+ string_tmp.append output_extension;
(! FS_MIN.make_file string_tmp).if {
STD_ERROR.put_string "Error: File ";
STD_ERROR.put_string string_tmp;
diff --git a/src/tools/alias_str.li b/src/tools/alias_str.li
index 30e16dc..31ef4f8 100644
--- a/src/tools/alias_str.li
+++ b/src/tools/alias_str.li
@@ -165,6 +165,7 @@ Section Public
- slot_back_end :STRING_CONSTANT := "back_end";
- slot_input_file :STRING_CONSTANT := "input_file";
- slot_output_file :STRING_CONSTANT := "output_file";
+ - slot_output_extension:STRING_CONSTANT := "output_extension";
- slot_debug_level :STRING_CONSTANT := "debug_level";
- slot_debug_with_code:STRING_CONSTANT := "debug_with_code";
- slot_is_all_warning:STRING_CONSTANT := "is_all_warning";
@@ -244,6 +245,9 @@ Section Public
- short_file_list_item :STRING_CONSTANT := "file_list_item";
- short_file_list_end :STRING_CONSTANT := "file_list_end";
+ - extension_c :STRING_CONSTANT := ".c";
+ - extension_java :STRING_CONSTANT := ".java";
+
- is_integer n:STRING_CONSTANT :BOOLEAN <-
(
(n = prototype_uinteger_64) ||
@@ -467,6 +471,8 @@ Section Public
list.add slot_back_end;
list.add slot_input_file;
list.add slot_output_file;
+ list.add slot_output_extension;
+ list.add slot_input_file;
list.add slot_debug_level;
list.add slot_debug_with_code;
list.add slot_is_all_warning;
@@ -541,6 +547,9 @@ Section Public
list.add short_file_list_item;
list.add short_file_list_end;
+ list.add extension_c;
+ list.add extension_java;
+
// Operator '=' and '!=' :
operator_equal := operator slot_infix name symbol_equal;
operator_not_equal := operator slot_infix name symbol_not_equal;
@@ -551,8 +560,3 @@ Section Private
- tmp_name:STRING;
- count_variable:INTEGER;
-
-
-
-
-
--
Lisaac compiler
More information about the Lisaac-commits
mailing list