[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-389-gdcc8b77

Benoit Sonntag sonntag at icps.u-strasbg.fr
Tue Aug 11 03:22:51 UTC 2009


The following commit has been merged in the master branch:
commit dcc8b779ec95b67422df7715a55bf165254bc8b7
Author: Benoit Sonntag <sonntag at icps.u-strasbg.fr>
Date:   Tue Aug 11 05:22:37 2009 +0200

    WARNING:Unstable, massive modification

diff --git a/src2/lip/lip_if.li b/src2/aliaser_local.li
similarity index 63%
copy from src2/lip/lip_if.li
copy to src2/aliaser_local.li
index 533ba48..3eb05f0 100644
--- a/src2/lip/lip_if.li
+++ b/src2/aliaser_local.li
@@ -20,65 +20,66 @@
 ///////////////////////////////////////////////////////////////////////////////
 Section Header
   
-  + name      := LIP_IF;
+  + name      := LOCAL_USE;
 
-  - copyright := "2003-2008 Sonntag Benoit";
+  - copyright := "2003-2009 Sonntag Benoit";
 
   - author    := "Sonntag Benoit (sonntag at icps.u-strasbg.fr)";
   - comment   := "The main prototype";
 
 Section Inherit
 
-  + parent_lip_code:Expanded LIP_CODE;
-
-Section Public
+  - parent_any:ANY := ANY;
   
-  + condition:LIP_CODE;
+Section Private
   
-  + then:FAST_ARRAY(LIP_CODE);
+  - free:FAST_ARRAY[LOCAL_USE] := FAST_ARRAY[LOCAL_USE].create_with_capacity 128;
   
-  + else:FAST_ARRAY(LIP_CODE);
+  - list:FAST_ARRAY[LOCAL_USE] := FAST_ARRAY[LOCAL_USE].create_with_capacity 128;
   
-  //
-  // Creation.
-  //
-
-  - create p:POSITION if rec:LIP_CODE then the:FAST_ARRAY(LIP_CODE) 
-  else els:FAST_ARRAY(LIP_CODE) :SELF <-
-  ( + result:SELF;
-    result := clone;
-    result.make p if rec then the else els;
-    result
+  + local:LOCAL;
+  
+  + level:INTEGER;
+  
+  - is_free:BOOLEAN <-
+  (
+    
   );
-
-  - make p:POSITION if rec:LIP_CODE then the:FAST_ARRAY(LIP_CODE) 
-  else els:FAST_ARRAY(LIP_CODE) <-
-  ( 
-    position := p;
-    condition := rec;
-    then := the;
-    else := els;
+  
+  - set_local loc:LOCAL <-
+  (
+    local := loc;
+    level := current_list_level;
   );
   
-  //
-  // Run.
-  //
+Section Public
   
-  - run <-
-  ( + val:LIP_BOOLEAN;
+  - write loc:LOCAL :STRING_CONSTANT <-
+  // True, if alias found.
+  [ -? {loc.my_alias = NULL}; ]
+  ( + tab:FAST_ARRAY(LOCAL);    
+    + t:TYPE_FULL;
     
-    val ?= condition.run_expr;
-    (val = NULL).if {
-      semantic_error (position,"BOOLEAN needed.");
-    };
-    (val.value).if {
-      (then.lower).to (then.upper) do { i:INTEGER;
-        then.item i.run;
-      };
-    }.elseif {else != NULL} then {
-      (else.lower).to (else.upper) do { i:INTEGER;
-        else.item i.run;
+
+    (v.my_alias = NULL).if {
+      (ALIASER_LOCAL.new_alias v).if_false {              
+        t := v.type;
+        tab := var_size.item (v.type.size);
+        tab.add_last v;
       };
     };
-    val.free;
-  );
+    v.my_alias.intern_name
+    
+    + elt:LOCAL_USE;
+    (free.is_empty).if {
+      elt := clone;
+    } else {
+      elt := free.last;
+      free.remove_last;
+    };
+    elt.set_local loc;
+    list.add_last elt;
+  )
+  [ -? {loc.my_alias != NULL}; ];
+
+  - read loc:LOCAL :STRING_CONSTANT <-
diff --git a/src2/any.li b/src2/any.li
index 2d6d7b4..9df0bbc 100644
--- a/src2/any.li
+++ b/src2/any.li
@@ -175,38 +175,7 @@ Section Public
     };
     result
   );
-  
-  - add_var_size v:LOCAL <-
-  ( + tab:FAST_ARRAY(LOCAL);
-    + j:INTEGER;
-    + t:TYPE_FULL;
-    
-    ? {v.style = '+'};
     
-    (v.style != '+').if {
-      v.intern_name.print; " style [".print; v.style.print; "] ".print;
-      '\n'.print;
-      warning_error (v.position,"BUG ANY.add_var_size Error");
-    };
-    // BSBS: C'est pas top, avec des HASHED_SET ce serait mieux...
-    t := v.type;
-    tab := var_size.item (v.type.size);
-    j := tab.lower;    
-    {(j <= tab.upper) && {tab.item j.type != t}}.while_do {
-      j := j + 1;
-    };
-    (j > tab.upper).if {
-      tab.add_last v;
-    } else {
-      {(j <= tab.upper) && {tab.item j != v} && {tab.item j.type = t}}.while_do {
-	j := j + 1;
-      };
-      ((j > tab.upper) || {tab.item j != v}).if {
-	tab.add v to j;	
-      };
-    };
-  );
-  
   - output_decl:STRING := STRING.create 60000;
   - output_glob:STRING := STRING.create 10000;
   - output_code:STRING := STRING.create 4000000;
diff --git a/src2/code_life/call_slot.li b/src2/code_life/call_slot.li
index be3552d..acd672f 100644
--- a/src2/code_life/call_slot.li
+++ b/src2/code_life/call_slot.li
@@ -66,7 +66,7 @@ Section Public
   
   + argument_list:FAST_ARRAY(WRITE);
   
-  + result_list:Expanded SLIM_ARRAY(RESULT);
+  + result_list:Expanded SLIM_ARRAY(RESULT); // BSBS: utiliter de RESULT ? => WRITE_LOCAL
   
   + cop_argument:EXPR;
   
@@ -407,10 +407,6 @@ Section Public
     string_tmp.append ")\n";
     string_tmp.print;
   );
-  
-  //////////////////////////////////////////////////////////////////////////
-  // CODE SLOT
-  //////////////////////////////////////////////////////////////////////////
 
   //
   // Generation.
diff --git a/src2/code_life/list.li b/src2/code_life/list.li
index 286f528..4d9fcb8 100644
--- a/src2/code_life/list.li
+++ b/src2/code_life/list.li
@@ -328,18 +328,32 @@ Section Private
   ( + loc:LOCAL;
     + t:TYPE_FULL;
     + cur:INTEGER;
+    + i:INTEGER;
     
     (! tab.is_empty).if {
       (tab.lower).to (tab.upper) do { j:INTEGER;
 	loc := tab.item j;	
         loc.is_result.if_false {
           local_counter := local_counter + 1;
-          /*
-          ((loc.ensure_count != 0) && {! loc.is_result}).if {
-            loc.intern_name.print;
-            warning_error (loc.position,"LIST.add_local Error!");
+          
+          (loc.ensure_count != 0).if {
+            i := profil_current.result_list.lower;
+            {
+              (i <= profil_current.result_list.upper) && 
+              {profil_current.result_list.item i != loc}
+            }.while_do {
+              i := i + 1;
+            };
+            (i > profil_current.result_list.upper).if {
+              
+              loc.intern_name.print;
+              ' '.print;
+              loc.ensure_count.print; 
+              '\n'.print;
+              
+            };
           };
-          */
+          
           (((buf.count + loc.intern_name.count - cur) > 70) || {t != loc.type}).if {
             // New line
             (t != NULL).if {
diff --git a/src2/code_life/read_local.li b/src2/code_life/read_local.li
index d2851fd..c394792 100644
--- a/src2/code_life/read_local.li
+++ b/src2/code_life/read_local.li
@@ -83,21 +83,13 @@ Section Public
     
   - genere buffer:STRING <-
   ( + tb:PROFIL_BLOCK;
-
+    + idf:STRING_CONSTANT;
+    
+    idf := ALIASER_LOCAL.read local;
     (variable.ensure_count = -1).if {
       buffer.add_last '*';
-    } else {
-      (variable.style = '+').if {        
-        variable.set_ensure_count (variable.ensure_count - 1);
-        (variable.ensure_count < 0).if {
-          variable.intern_name.print; '\n'.print;
-          warning_error (variable.position,"READ_LOCAL.genere : Bug local !\n");
-          variable.set_ensure_count 0;
-          buffer.append "/* BUG READ_LOCAL !*/";
-        };        
-      };
     };
-    buffer.append (variable.intern_name);     
+    buffer.append idf;
     //
     tb ?= local.type.raw;    
     (tb != NULL).if {
diff --git a/src2/code_life/write.li b/src2/code_life/write.li
index b5125dd..84a2fd4 100644
--- a/src2/code_life/write.li
+++ b/src2/code_life/write.li
@@ -191,25 +191,7 @@ Section Public
   //
   // Genere
   //
-  
-  - genere buffer:STRING <-
-  ( + loc:LOCAL;
-    + slo:SLOT;
     
-    (is_local).if { // BSBS: Pour finir, il faut spécialiser les READ, WRITE avec multiheritage
-      loc ?= variable;
-      add_var_size loc;
-    } else {
-      slo ?= variable;
-      slo.receiver_type.add_genere_list;
-    };
-    (quiet_generation).if_false {
-      genere_access buffer;
-      buffer.add_last '=';    
-      genere_value buffer;
-    };
-  );
-  
   - genere_value buffer:STRING <-
   (            
     (is_java).if {
diff --git a/src2/code_life/write_local.li b/src2/code_life/write_local.li
index 7187d03..184c58e 100644
--- a/src2/code_life/write_local.li
+++ b/src2/code_life/write_local.li
@@ -103,13 +103,14 @@ Section Public
   //
   
   - genere buffer:STRING <-
-  ( 
-    add_var_size local;        
+  ( + idf:STRING_CONSTANT;
+    
+    idf := ALIASER_LOCAL.write local;        
     (quiet_generation).if_false {
       (variable.ensure_count = -1).if { // BSBS : Bidouille !!!
         buffer.add_last '*';
       };    
-      buffer.append (variable.intern_name);     
+      buffer.append idf; 
       //
       ((value.static_type.raw = TYPE_NULL) && {variable.type.raw.is_block}).if {
         buffer.append ".__id=0";
@@ -121,22 +122,23 @@ Section Public
   );
   
   - genere_first_result buffer:STRING <-
-  (
-    add_var_size local;        
+  ( + idf:STRING_CONSTANT;
+    
+    idf := ALIASER_LOCAL.write local;        
     (variable.ensure_count = -1).if { // BSBS : Bidouille !!!
       buffer.add_last '*';
     };
-    buffer.append (variable.intern_name);     
+    buffer.append idf;
     //    
     buffer.add_last '=';    
   );
   
   - genere_argument_result buffer:STRING <-
-  ( 
+  ( + idf:STRING_CONSTANT;
+    
+    idf := ALIASER_LOCAL.write local;
     buffer.add_last '&';
-    buffer.append (variable.intern_name);    
-    local.set_ensure_count 1; // BSBS: Bidouille !
-    add_var_size local;
+    buffer.append idf; 
   );
   
 
diff --git a/src2/item/itm_write_cast.li b/src2/item/itm_write_cast.li
index 80e3995..395cac4 100644
--- a/src2/item/itm_write_cast.li
+++ b/src2/item/itm_write_cast.li
@@ -81,9 +81,9 @@ Section Public
     node := NODE.new_cast position type typ_cast with val;
     list_current.add_last node;    
     // Assignment result.
-    affect nm with (node.result_expr);
+    affect nm with (node.result_expr)
     // Value result.
-    assign.to_run_expr
+    //assign.to_run_expr
   );
 
 
diff --git a/src2/lisaac.li b/src2/lisaac.li
index bfe77ff..ce48016 100644
--- a/src2/lisaac.li
+++ b/src2/lisaac.li
@@ -359,6 +359,7 @@ Section Private
         \    print_char(*str); \n\
         \    str++; \n\
         \  };\n\
+        \  return(0);\n\
         \}\n\
         \\n";
       };
diff --git a/src2/profil.li b/src2/profil.li
index 3edb176..f0b9641 100644
--- a/src2/profil.li
+++ b/src2/profil.li
@@ -394,6 +394,7 @@ Section Public
     + np:INTEGER;
     + low:INTEGER;
     
+    profil_current := Self;
     ((link_count != 0) || {result_list.count != 0}).if {
       ((cop_link_count != 0) && {result_list.count = 0}).if {
         // COP link.
diff --git a/src2/variable/local.li b/src2/variable/local.li
index a776f92..ef2dd3d 100644
--- a/src2/variable/local.li
+++ b/src2/variable/local.li
@@ -303,7 +303,7 @@ Section Public
     name        := n;
     is_result   := r;
     intern_name := ALIAS_STR.get_intern n; 
-       
+           
     ((t.is_expanded) && {! t.is_expanded_c}).if {
       type := t + TYPE_FULL.expanded_ref_bit;
     } else {
@@ -371,7 +371,7 @@ Section VARIABLE
   
   - new_read p:POSITION with r:EXPR :READ <- 
   [ -? {r = NULL}; ]
-  (
+  (             
     READ_LOCAL.create p with Self
   );
   
diff --git a/src2/variable/variable.li b/src2/variable/variable.li
index 268bf94..1bc745b 100644
--- a/src2/variable/variable.li
+++ b/src2/variable/variable.li
@@ -77,7 +77,7 @@ Section Public
 
   - set_ensure_count c:INTEGER <-
   // Necessary for `context' local, `External' argument slot and `BLOCK' manager.
-  (
+  (        
     ensure_count := c;
   );
   
@@ -291,21 +291,37 @@ Section Public
         
     result := new_read position with r;   
     ensure_count := ensure_count + 1;    
+    /*
+    (intern_name == "Self__GMKU").if {
+      "Create : ".print;
+      result.object_id.print;
+      '\n'.print;
+      //crash;
+      IO.read_character;
+    };
+    */
     result
   );
   //[ ? {ensure_count := Old ensure_count + 1}; ];
   
   - unread e:READ <-
   (    
-        
+    /*
+    (intern_name == "Self__AJIU").if {
+      "Delete : ".print;
+      e.object_id.print;
+      '\n'.print;
+      IO.read_character;
+    };
+    */    
     ensure_count := ensure_count - 1;
     (ensure_count < 0).if {
       "C'est : ".print;
       e.debug_display;
       "\n dans :\n".print;
-      list_current.debug_display;
+      //list_current.debug_display;
       '\n'.print;
-      crash;
+      //crash;
     };
   /*  
     (intern_name == "Result__ID").if {
@@ -314,7 +330,7 @@ Section Public
     };
 */
     
-    ? {ensure_count >= 0};
+//    ? {ensure_count >= 0};
   );
     
   //

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list