[SCM] Lisaac compiler branch, mildred-backend, updated. lisaac-0.12-524-g7710f76

Mildred Ki'Lya silkensedai at online.fr
Tue Aug 25 21:54:01 UTC 2009


The following commit has been merged in the mildred-backend branch:
commit 1e1d7cf56a43ab90615a9d53e23dcc1c7f7ea8aa
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date:   Tue Aug 25 22:29:40 2009 +0200

    Separate code generation and error checking in TYPE.genere_struct + added comments

diff --git a/src/type/type.li b/src/type/type.li
index d6ca648..a5adcb0 100644
--- a/src/type/type.li
+++ b/src/type/type.li
@@ -457,7 +457,12 @@ Section Public
     + count_slot:SLOT_DATA;
     + storage_slot:SLOT_DATA;
     
-    ((slot_run.is_empty) || {slot_run.first != NULL}).if {                        
+    ((slot_run.is_empty) || {slot_run.first != NULL}).if {
+
+      //
+      // Detect recursivity
+      //
+
       (detect_recursivity_generation).if {
         string_tmp.copy "Compiler limit: Cyclic depending structure definition for ";
         append_name_in string_tmp;
@@ -465,8 +470,11 @@ Section Public
         semantic_error (position,string_tmp);
       };
       detect_recursivity_generation := TRUE;
-            
-      // Depending.
+
+      //
+      // Depending (generate structs we require)
+      //
+
       (slot_run.lower).to (slot_run.upper) do { j:INTEGER;
 	slot := slot_run.item j;
 	((slot.style = '+') && {slot.lower_style = 0}).if {
@@ -490,7 +498,11 @@ Section Public
 	  action.value (slot.slot_data);
 	};
       };
-      // Sort slot.
+
+      //
+      // Sort slot. (whatever that might mean)
+      //
+
       (slot_run.lower).to (slot_run.upper) do { j:INTEGER;
 	slot := slot_run.item j;		
 	(slot.style = '+').if {
@@ -515,8 +527,9 @@ Section Public
 	  ((slot_data != NULL) && {slot_data.ensure_count > 0}).if {
 	    add_slot_struct slot_data;
 	  };
-	} else {	    
+	} else {
 	  // In global.
+          // Mildred: is that useful to iterate? The action seems to do nothing
 	  (slot.lower_style = 0).if {
 	    action := { s:SLOT_DATA;
 	      (s.ensure_count > 0).if {
@@ -536,22 +549,45 @@ Section Public
 	  };
 	};
       };
-      
-      (
+
+      //
+      // For NATIVE_ARRAY, only generate the generic type, don't bother
+      // to generate the struct for the NATIVE_ARRAY itself
+      //
+
+      ( // TODO: Mildred: don't use prototype name for detection
+        // Possibly, try to find a way to extend that to any prototype
 	(prototype.shortname = ALIAS_STR.prototype_native_array) || 
 	{prototype.shortname = ALIAS_STR.prototype_native_array_volatile}
       ).if {
 	tg ?= Self;
 	tg.generic_list.first.raw.genere_struct;
-      } else {              
+      } else {
+
+	//
+	// Detect errors
+	//
+
 	(type_c != NULL).if {
 	  0.to 4 do { j:INTEGER;
 	    tab := slot_size.item j;
 	    // BSBS: A tester sont utilit� !
 	    (! tab.is_empty).if {
 	      semantic_error (tab.first.position,"Slot is not possible with a type C");
-	    };	  
+	    };
           };
+	} else {
+	  ((is_late_binding) && {prototype.is_mapping}).if {
+	    semantic_error (prototype.position,
+	      "Late binding is not possible with `mapping' object.");
+	  };
+	};
+
+        //
+        // Generate code
+        //
+
+	(type_c != NULL).if {
           (is_java).if_false {            
             ((shortname = ALIAS_STR.prototype_true) || 
             {shortname = ALIAS_STR.prototype_false}).if {
@@ -584,10 +620,10 @@ Section Public
             (prototype.style != '-').if {
               string_tmp.append "  unsigned long __id;\n";
             };
-	    (prototype.is_mapping).if {	    
-	      semantic_error (prototype.position,	    
-	      "Late binding is not possible with `mapping' object.");
-	    };
+// 	    (prototype.is_mapping).if {	    
+// 	      semantic_error (prototype.position,	    
+// 	      "Late binding is not possible with `mapping' object.");
+// 	    };
 	  } else {	  
 	    id_counter_without_type.append_in output_decl;	  
 	    id_counter_without_type := id_counter_without_type + 1;	  
@@ -729,11 +765,12 @@ Section Public
             output_glob.append "_)\n\n";	  
           };
 	};
+
       };
-      
-      // Flag on:
+
+      // Flag on (don't generate twice the code)
       slot_run.force NULL to 0;
-    };    
+    };
   );
   
   - genere_typedef <-

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list