[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-606-g4554e79

Mildred Ki'Lya silkensedai at online.fr
Mon Mar 1 01:31:31 UTC 2010


The following commit has been merged in the master branch:
commit 759b07c8232ee93e7d7579b163424059d13e28b8
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date:   Sun Sep 6 13:16:20 2009 +0200

    Load .lip file looking first in li directory
    
    If a .li file is specified, look at make.lip in the directory of this li file
    first instead of the current directory. When the .lip file is not specified on
    the command line, its location is displayed by the compiler.

diff --git a/src/any.li b/src/any.li
index 83dae05..8200398 100644
--- a/src/any.li
+++ b/src/any.li
@@ -383,12 +383,36 @@ Section Public
   - last_position:POSITION;
 
   - load_lip file_lip:ABSTRACT_STRING <-
+    load_lip file_lip in NULL;
+
+  - load_lip file_lip:ABSTRACT_STRING in lip_dir:STRING_CONSTANT <-
   ( + path_lip:STRING_CONSTANT;
     + is_good:BOOLEAN;
     + count:INTEGER;
 
+    //
+    // Search in lip_dir
+    //
     string_tmp.clear;
-    {
+    (lip_dir != NULL).if {
+      string_tmp.append lip_dir;
+      (string_tmp.last != '/').if {
+        string_tmp.add_last '/';
+      };
+      string_tmp.append file_lip;
+      path_lip := ALIAS_STR.get string_tmp;
+      (is_good := PARSER.read_lip path_lip).if_false {
+        LIP_CALL.load_directory lip_dir is_recursive FALSE;
+        string_tmp.remove_last (file_lip.count);
+      } else {
+        "Load lip file: ".print; path_lip.println;
+      };
+    };
+
+    //
+    // Search in 5 parent directories
+    //
+    {(count < 5) && {! is_good}}.while_do {
       string_tmp.append file_lip;
       path_lip := ALIAS_STR.get string_tmp;
       (is_good := PARSER.read_lip path_lip).if_false {
@@ -396,8 +420,17 @@ Section Public
         string_tmp.remove_last (file_lip.count);
         string_tmp.append "../";
         count := count + 1;
+      } else {
+        // Display which lip file to use if we had to look parent directories
+        (count > 0).if {
+          "Load lip file: ".print; path_lip.println;
+        };
       };
-    }.do_while {(count < 5) && {! is_good}};
+    };
+
+    //
+    // Load default make.lip in LISAAC_DIRECTORY
+    //
     (is_good).if_false {
       string_tmp.copy path_lisaac;
       string_tmp.append "make.lip";
@@ -409,6 +442,10 @@ Section Public
         die_with_code exit_failure_code;
       };
     };
+
+    //
+    // Load parent .lip (inheritance)
+    //
     {LIP_CODE.list_parent.is_empty}.until_do {
       path_lip := LIP_CODE.list_parent.first;
       LIP_CODE.list_parent.remove_first;
diff --git a/src/lisaac.li b/src/lisaac.li
index 590af95..d8a1859 100644
--- a/src/lisaac.li
+++ b/src/lisaac.li
@@ -95,6 +95,9 @@ Section Private
     + t:STRING_CONSTANT;
     + arg:LIP_CONSTANT;
     + is_path_list:BOOLEAN;
+    + hook_after_load_lip :{};
+
+    hook_after_load_lip := {};
 
     // Default value.
     is_ansi := TRUE;
@@ -123,6 +126,7 @@ Section Private
         } else {
           (lip_ok).if_false {
             load_lip "make.lip";
+            hook_after_load_lip.value;
             lip_ok := TRUE;
           };
           string_tmp.copy cmd;
@@ -187,24 +191,24 @@ Section Private
             display_usage;
           };
           load_lip cmd;
+          hook_after_load_lip.value;
           lip_ok := TRUE;
         } else {
           // .li
-          (lip_ok).if_false {
-            load_lip "make.lip";
-            lip_ok := TRUE;
-          };
           (input_name != NULL).if {
             display_usage;
           };
           input_name := ALIAS_STR.get (COMMAND_LINE.item j);
-          LIP_CODE.put_string input_name to (ALIAS_STR.slot_input_file);
+          hook_after_load_lip := {
+            LIP_CODE.put_string input_name to (ALIAS_STR.slot_input_file);
+          };
         };
       };
       j := j+1;
     };
     (lip_ok).if_false {
-      load_lip "make.lip";
+      load_lip "make.lip" in input_path;
+      hook_after_load_lip.value;
     };
 
     LIP_CODE.call_front_end;

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list