[SCM] Lisaac compiler branch, stable, updated. lisaac-0.12-476-ga7d7c0b
Mildred Ki'Lya
silkensedai at online.fr
Sat Sep 5 22:26:37 UTC 2009
The following commit has been merged in the stable branch:
commit a7d7c0b8b8edf41880663f61e3c603ea4e0e87e5
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Sun Sep 6 00:07:15 2009 +0200
adding paths in lip file is relative to the lip file
diff --git a/make.lip b/make.lip
index 64658a0..3784bc1 100644
--- a/make.lip
+++ b/make.lip
@@ -64,7 +64,7 @@ Section Private
- standard_path <-
// Standard library.
(
- path (lisaac + "lib/*");
+ path ("lib/*");
);
//
@@ -73,31 +73,31 @@ Section Private
- unix_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/unix/file_system/");
- path (lisaac + "lib_os/unix/video/");
+ path ("lib_os/unix/system/");
+ path ("lib_os/unix/file_system/");
+ path ("lib_os/unix/video/");
);
- windows_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/windows/file_system/");
- path (lisaac + "lib_os/unix/file_system/"); // BSBS: ??
- path (lisaac + "lib_os/windows/video/");
+ path ("lib_os/unix/system/");
+ path ("lib_os/windows/file_system/");
+ path ("lib_os/unix/file_system/"); // BSBS: ??
+ path ("lib_os/windows/video/");
);
- dos_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/unix/file_system/"); // BSBS: ??
- path (lisaac + "lib_os/dos/file_system/");
- path (lisaac + "lib_os/dos/video/");
+ path ("lib_os/unix/system/");
+ path ("lib_os/unix/file_system/"); // BSBS: ??
+ path ("lib_os/dos/file_system/");
+ path ("lib_os/dos/video/");
);
- java_target <-
(
- path (lisaac + "lib_os/java/system/");
- path (lisaac + "lib_os/java/file_system/");
+ path ("lib_os/java/system/");
+ path ("lib_os/java/file_system/");
);
- get_target <-
diff --git a/src/lip/lip_call.li b/src/lip/lip_call.li
index 12c52a3..76f0c98 100644
--- a/src/lip/lip_call.li
+++ b/src/lip/lip_call.li
@@ -89,7 +89,9 @@ Section Public
path := ALIAS_STR.get string_tmp;
is_rec := TRUE;
};
- load_directory path is_recursive is_rec;
+ load_directory path
+ base_path (stack_base_directory.last)
+ is_recursive is_rec;
}.elseif {name = ALIAS_STR.slot_run} then {
str ?= val;
(str = NULL).if {
@@ -164,11 +166,20 @@ Section Public
result
);
- - load_directory path:ABSTRACT_STRING is_recursive is_rec:BOOLEAN <-
+ - load_directory path:ABSTRACT_STRING
+ base_path base:ABSTRACT_STRING
+ is_recursive is_rec:BOOLEAN <-
( + entry:ENTRY;
- + dir:DIRECTORY;
-
- entry := FILE_SYSTEM.get_entry path;
+ + dir, base_dir:DIRECTORY;
+
+ ((base != NULL) && {base.count > 0}).if {
+ base_dir ?= FILE_SYSTEM.get_entry base;
+ };
+ (base_dir = NULL).if {
+ base_dir := FILE_SYSTEM;
+ };
+
+ entry := base_dir.get_entry path;
((entry != NULL) && {entry.is_directory} && {entry.open}).if {
dir ?= entry;
(dir.lower).to (dir.upper) do { j:INTEGER;
@@ -176,13 +187,24 @@ Section Public
(entry.name.has_suffix ".li").if {
path_file.add_last (entry.path);
}.elseif {(is_rec) && {entry.is_directory}} then {
- load_directory (entry.path) is_recursive TRUE;
+ load_directory (entry.path) base_path NULL is_recursive TRUE;
};
};
} else {
string_tmp.copy "Incorrect directory `";
string_tmp.append path;
- string_tmp.append "'.";
+ string_tmp.add_last '\'';
+ string_tmp.append " from: `";
+ string_tmp.append (base_dir.path);
+ string_tmp.add_last '\'';
+ /*
+ (base != NULL).if {
+ string_tmp.append " from: `";
+ string_tmp.append base;
+ string_tmp.add_last '\'';
+ };
+ */
+ string_tmp.add_last '.';
warning_error (position,string_tmp);
};
- );
\ No newline at end of file
+ );
diff --git a/src/lip/lip_code.li b/src/lip/lip_code.li
index ce2578f..5d4e20c 100644
--- a/src/lip/lip_code.li
+++ b/src/lip/lip_code.li
@@ -41,6 +41,8 @@ Section Public
HASHED_DICTIONARY(LIP_SLOT_DATA,STRING_CONSTANT).create;
- stack:FAST_ARRAY(LIP_SLOT_DATA) := FAST_ARRAY(LIP_SLOT_DATA).create_with_capacity 8;
+
+ - stack_base_directory:FAST_ARRAY(STRING_CONSTANT) := FAST_ARRAY(STRING_CONSTANT).create_with_capacity 8;
- get_data n:STRING_CONSTANT :LIP_SLOT_DATA <-
(
diff --git a/src/lip/lip_slot_code.li b/src/lip/lip_slot_code.li
index 38211c9..a292bf2 100644
--- a/src/lip/lip_slot_code.li
+++ b/src/lip/lip_slot_code.li
@@ -40,6 +40,8 @@ Section Public
+ argument:LIP_SLOT_DATA;
+ code:FAST_ARRAY(LIP_CODE);
+
+ + base_directory:STRING_CONSTANT;
+ comment:STRING_CONSTANT;
@@ -61,7 +63,9 @@ Section Public
// Creation.
//
- - create p:POSITION section sec:STRING_CONSTANT
+ - create p:POSITION
+ dir d:STRING_CONSTANT
+ section sec:STRING_CONSTANT
name n:STRING_CONSTANT
argument arg:LIP_SLOT_DATA
code c:FAST_ARRAY(LIP_CODE) :LIP_SLOT_CODE <-
@@ -75,21 +79,29 @@ Section Public
ALIAS_ARRAY(LIP_CODE).free c;
} else {
result := clone;
- result.make p section sec name n argument arg code c;
+ result.make p
+ dir d
+ section sec
+ name n
+ argument arg
+ code c;
};
result
);
- - make p:POSITION section sec:STRING_CONSTANT
+ - make p:POSITION
+ dir d:STRING_CONSTANT
+ section sec:STRING_CONSTANT
name n:STRING_CONSTANT
argument arg:LIP_SLOT_DATA
code c:FAST_ARRAY(LIP_CODE) <-
- (
- position := p;
- section := sec;
- name := n;
- argument := arg;
- code := c;
+ (
+ position := p;
+ section := sec;
+ name := n;
+ argument := arg;
+ code := c;
+ base_directory := d;
list_method.add_last Self;
);
@@ -110,9 +122,11 @@ Section Public
stack.add_last NULL;
};
(result).if {
+ stack_base_directory.add_last base_directory;
(code.lower).to (code.upper) do { j:INTEGER;
code.item j.run;
- };
+ };
+ stack_base_directory.remove_last;
};
stack.remove_last;
};
diff --git a/src/lisaac.li b/src/lisaac.li
index 50b96e2..b94155c 100644
--- a/src/lisaac.li
+++ b/src/lisaac.li
@@ -227,7 +227,7 @@ Section Private
(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;
+ LIP_CALL.load_directory (ALIAS_STR.get string_tmp) base_path NULL is_recursive FALSE;
input_name := ALIAS_STR.get string_tmp2;
LIP_CODE.put_string input_name to (ALIAS_STR.slot_input_file);
};
diff --git a/src/make.lip b/src/make.lip
index 1a28d39..863516e 100755
--- a/src/make.lip
+++ b/src/make.lip
@@ -30,33 +30,33 @@ Section Private
- src_path <-
(
- path (lisaac + "src/");
- path (lisaac + "src/tools/");
- path (lisaac + "src/type/");
- path (lisaac + "src/item/");
- path (lisaac + "src/constant/");
- path (lisaac + "src/variable/");
- path (lisaac + "src/external/");
- path (lisaac + "src/external/logic/");
- path (lisaac + "src/external/arithmetic/");
- path (lisaac + "src/external/comparison/");
- path (lisaac + "src/dispatcher/");
- path (lisaac + "src/code_life/");
- path (lisaac + "src/lip/");
+ path (".");
+ path ("tools/");
+ path ("type/");
+ path ("item/");
+ path ("constant/");
+ path ("variable/");
+ path ("external/");
+ path ("external/logic/");
+ path ("external/arithmetic/");
+ path ("external/comparison/");
+ path ("dispatcher/");
+ path ("code_life/");
+ path ("lip/");
);
- compiler_path <-
(
src_path;
input_file := "lisaac";
- path (lisaac + "src/compiler_any/");
+ path ("compiler_any/");
);
- shorter_path <-
(
src_path;
input_file := "shorter";
- path (lisaac + "src/shorter_any/");
+ path ("shorter_any/");
);
//
diff --git a/src/parser.li b/src/parser.li
index 91257dc..6456348 100644
--- a/src/parser.li
+++ b/src/parser.li
@@ -102,6 +102,8 @@ Section Private
//
- object : PROTOTYPE;
+
+ - lip_dir :STRING_CONSTANT; // Compute from lip project
- source : STRING;
@@ -2791,7 +2793,7 @@ Section Private
warning_error (current_position,"Added ')' is needed.");
};
cod := ALIAS_ARRAY(LIP_CODE).copy cod;
- slot_code := LIP_SLOT_CODE.create pos section sec
+ slot_code := LIP_SLOT_CODE.create pos dir lip_dir section sec
name n argument data code cod;
(sec = ALIAS_STR.section_public).if {
(last_comment_slot = NULL).if {
@@ -3208,7 +3210,17 @@ Section Public
pos_cur := source.lower;
pos_line:=1;
pos_col :=0;
-
+
+ string_tmp.copy path_lip;
+ {
+ (!string_tmp.is_empty) &&
+ {string_tmp.last != '/'} &&
+ {string_tmp.last != '\\'}
+ }.while_do {
+ string_tmp.remove_last 1;
+ };
+ lip_dir := ALIAS_STR.get (string_tmp);
+
// Parse.
readlip_program;
//
--
Lisaac compiler
More information about the Lisaac-commits
mailing list