[SCM] Lisaac compiler branch, master+stable, updated. lisaac-0.12-606-gf445725

Mildred Ki'Lya silkensedai at online.fr
Mon Mar 1 00:35:53 UTC 2010


The following commit has been merged in the master+stable branch:
commit e0989bd5f655f6a8ba2892f334845f60ab838ead
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..b441829 100644
--- a/src/lisaac.li
+++ b/src/lisaac.li
@@ -190,10 +190,6 @@ Section Private
           lip_ok := TRUE;
         } else {
           // .li
-          (lip_ok).if_false {
-            load_lip "make.lip";
-            lip_ok := TRUE;
-          };
           (input_name != NULL).if {
             display_usage;
           };
@@ -204,7 +200,7 @@ Section Private
       j := j+1;
     };
     (lip_ok).if_false {
-      load_lip "make.lip";
+      load_lip "make.lip" in input_path;
     };
 
     LIP_CODE.call_front_end;

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list