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

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


The following commit has been merged in the master+stable branch:
commit 087779b7c5c7e3b71232043a7be0dc5f5ba91ed4
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date:   Sun Oct 11 00:51:52 2009 +0200

    added test for a bug with Expanded

diff --git a/tests/expanded_global/container.li b/tests/expanded_global/container.li
new file mode 100644
index 0000000..7af1e6a
--- /dev/null
+++ b/tests/expanded_global/container.li
@@ -0,0 +1,11 @@
+Section Header
+
+  + name := CONTAINER;
+
+Section Mapping
+
+  + m_keyword :ITM_KEYWORD;
+
+Section Public
+
+  - keyword :ITM_KEYWORD <- m_keyword;
diff --git a/src/variable/argument.li b/tests/expanded_global/itm_keyword.li
similarity index 52%
copy from src/variable/argument.li
copy to tests/expanded_global/itm_keyword.li
index e054ab3..e50890d 100644
--- a/src/variable/argument.li
+++ b/tests/expanded_global/itm_keyword.li
@@ -19,64 +19,68 @@
 //                     http://isaacproject.u-strasbg.fr/                     //
 ///////////////////////////////////////////////////////////////////////////////
 Section Header
-  
-  + name      := ARGUMENT;
-
-  - copyright := "2003-2007 Benoit Sonntag";
-
-  
-  - author    := "Sonntag Benoit (bsonntag at loria.fr)";
-  - comment   := "Argument runnable";
-  
-Section Inherit
-  
-  + parent_itm_object:Expanded ITM_OBJECT;
-  
+
+  + name      := Expanded ITM_KEYWORD;
+
+  - copyright := "2009 Mildred Ki'Lya";
+  - author    := "Mildred Ki'Lya <http://ki.lya.online.fr>";
+  - comment   := "Flags for keywords";
+
+  - import    := UINTEGER_8;
+  - export    := UINTEGER_8;
+
+Section Private
+
+  - make f:INTEGER_8 :ITM_KEYWORD <-
+  (
+    flags := f;
+    Self
+  );
+
 Section Public
-  
-  + name:STRING_CONSTANT;
-  
-  + type:TYPE_FULL;
-  
-  //
-  // Creation.
-  //
-  
-  - create p:POSITION name n:STRING_CONSTANT type t:TYPE_FULL :SELF <-
-  ( + result:SELF;
-    
-    result := clone;
-    result.make p name n type t;
+
+  + flags :INTEGER_8;
+
+  - create f:INTEGER_8 :ITM_KEYWORD <-
+  ( + result :ITM_KEYWORD;
+    result.make f;
     result
   );
-  
-  - make p:POSITION name n:STRING_CONSTANT type t:TYPE_FULL <-
-  (
-    position := p;
-    name := n;
-    type := t;
-  );
-  
-  //
-  // To profil
-  //
-  
-  - to_local:LOCAL <-
+
+  - keyword_empty    :ITM_KEYWORD := create 0;
+  - keyword_strict   :ITM_KEYWORD := create flag_strict;
+  - keyword_expanded :ITM_KEYWORD := create flag_expanded;
+
+  - flag_strict   :INTEGER_8 := 0000_0001b;
+  - flag_expanded :INTEGER_8 := 0000_0010b;
+
+  - is_strict   :BOOLEAN <- (flags & flag_strict)   != 0;
+  - is_expanded :BOOLEAN <- (flags & flag_expanded) != 0;
+
+  - to_strict   :ITM_KEYWORD <- Self + flag_strict;
+  - to_expanded :ITM_KEYWORD <- Self + flag_expanded;
+
+  - to_not_strict   :ITM_KEYWORD <- Self - flag_strict;
+  - to_not_expanded :ITM_KEYWORD <- Self - flag_expanded;
+
+  - is_empty :BOOLEAN <- (flags = 0);
+
+  + Self:SELF '+' flag:INTEGER_8 :ITM_KEYWORD <- create (flags |  flag);
+
+  + Self:SELF '-' flag:INTEGER_8 :ITM_KEYWORD <- create (flags & ~flag);
+
+  + Self:SELF '&' flag:INTEGER_8 :ITM_KEYWORD <- create (flags &  flag);
+
+  - append_in buffer:STRING <-
   (
-    LOCAL.create position name name style ' ' type (type.fix)
-  );
-  
-  //
-  // Display.
-  //
-  
-  - print <-
-  (    
-    string_tmp.clear;
-    string_tmp.append name;
-    string_tmp.add_last ':';
-    type.append_name_in string_tmp;
-    string_tmp.print;
+    is_strict.if {
+      buffer.append (ALIAS_STR.keyword_strict);
+    };
+    is_expanded.if {
+      is_strict.if { buffer.add_last ' '; };
+      buffer.append (ALIAS_STR.keyword_expanded);
+    };
   );
-    
-  
\ No newline at end of file
+
+  - from_uinteger_8 i:UINTEGER_8 :ITM_KEYWORD <- create i;
+  - to_uinteger_8 :UINTEGER_8 <- flags;
diff --git a/tests/expanded_global/main.li b/tests/expanded_global/main.li
new file mode 100644
index 0000000..c41ec26
--- /dev/null
+++ b/tests/expanded_global/main.li
@@ -0,0 +1,24 @@
+Section Header
+
+  + name := MAIN;
+
+  - external := `struct { char flag; } container = { 1 };`;
+
+Section External
+
+  - test i:ITM_KEYWORD :INTEGER <-
+  ( + c:CONTAINER;
+    c := `&container`:CONTAINER;
+    (c.keyword = i).if {
+      "equal".println;
+    };
+    i.flags
+  );
+
+Section Public
+
+  - main <-
+  (
+    test (ITM_KEYWORD.keyword_empty).println;
+  );
+
diff --git a/tests/inherit_generic/make.lip b/tests/expanded_global/make.lip
similarity index 94%
copy from tests/inherit_generic/make.lip
copy to tests/expanded_global/make.lip
index 893df71..2ac6ef7 100644
--- a/tests/inherit_generic/make.lip
+++ b/tests/expanded_global/make.lip
@@ -35,6 +35,6 @@ Section Private
   );
 
   + m_test_description :STRING :=
-    "Test inheritance from a generic prototype from a non generic one\n";
+    "Test that Expanded globals are compiled correctly\n";
 
-  + m_test_run :BOOLEAN := FALSE;
+  + m_test_run_pattern :STRING := "0";

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list