[SCM] Lisaac compiler branch, mildred-string-cst-rebase, updated. lisaac-0.12-650-g485353b

Mildred Ki'Lya silkensedai at online.fr
Sat Aug 21 09:35:59 UTC 2010


The following commit has been merged in the mildred-string-cst-rebase branch:
commit bdc74a7c9cae74b533a9545b95decb1e38ffb3c2
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date:   Thu Aug 27 09:32:16 2009 +0200

    convert STRING and STRING_CONSTANT to and from NATIVE_ARRAY(...)

diff --git a/lib/standard/string/abstract_string.li b/lib/standard/string/abstract_string.li
index e98a1b7..afe921e 100644
--- a/lib/standard/string/abstract_string.li
+++ b/lib/standard/string/abstract_string.li
@@ -22,6 +22,11 @@ Section Header
 
   + name    := ABSTRACT_STRING;
 
+
+  - export := NATIVE_ARRAY(CHARACTER),
+              NATIVE_ARRAY(INTEGER_8),
+              NATIVE_ARRAY(UINTEGER_8);
+
   - export  := STRING;
 
   - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
@@ -1369,4 +1374,16 @@ Section Public
     NULL
   );
 
+  //
+  // Export NATIVE_ARRAY
+  //
+
+  - to_native_array_of_character :NATIVE_ARRAY(CHARACTER) <-
+    to_external;
+
+  - to_native_array_of_integer_8 :NATIVE_ARRAY(INTEGER_8) <-
+    CONVERT(NATIVE_ARRAY(CHARACTER),NATIVE_ARRAY(INTEGER_8)).on (to_external);
+
+  - to_native_array_of_uinteger_8 :NATIVE_ARRAY(UINTEGER_8) <-
+    CONVERT(NATIVE_ARRAY(CHARACTER),NATIVE_ARRAY(INTEGER_8)).on (to_external);
 
diff --git a/lib/standard/string/string.li b/lib/standard/string/string.li
index 2f76595..7d039e1 100644
--- a/lib/standard/string/string.li
+++ b/lib/standard/string/string.li
@@ -23,6 +23,14 @@ Section Header
   + name    := STRING;
 
 
+  - import := NATIVE_ARRAY(CHARACTER),
+              NATIVE_ARRAY(INTEGER_8),
+              NATIVE_ARRAY(UINTEGER_8);
+  - export := NATIVE_ARRAY(CHARACTER),
+              NATIVE_ARRAY(INTEGER_8),
+              NATIVE_ARRAY(UINTEGER_8);
+
+
   - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
 
   - comment := "String library.";
@@ -788,4 +796,17 @@ Section Public
     {storage.item count = '\0'}.until_do {
       count := count + 1;
     };
-  );
\ No newline at end of file
+  );
+
+  //
+  // Import/Export NATIVE_ARRAY
+  //
+
+  - from_native_array_of_character p:NATIVE_ARRAY(CHARACTER) :STRING_CONSTANT <-
+    from_external_copy p;
+
+  - from_native_array_of_integer_8 p:NATIVE_ARRAY(INTEGER_8) :STRING_CONSTANT <-
+    from_external_copy(CONVERT(NATIVE_ARRAY(INTEGER_8),NATIVE_ARRAY(CHARACTER)).on p);
+
+  - from_native_array_of_uinteger_8 p:NATIVE_ARRAY(UINTEGER_8) :STRING_CONSTANT <-
+    from_external_copy(CONVERT(NATIVE_ARRAY(UINTEGER_8),NATIVE_ARRAY(CHARACTER)).on p);
diff --git a/lib/standard/string/string_constant.li b/lib/standard/string/string_constant.li
index efeffd9..e2628a2 100644
--- a/lib/standard/string/string_constant.li
+++ b/lib/standard/string/string_constant.li
@@ -22,6 +22,12 @@ Section Header
 
   + name    := Strict STRING_CONSTANT;
 
+  - import := NATIVE_ARRAY(CHARACTER),
+              NATIVE_ARRAY(INTEGER_8),
+              NATIVE_ARRAY(UINTEGER_8);
+  - export := NATIVE_ARRAY(CHARACTER),
+              NATIVE_ARRAY(INTEGER_8),
+              NATIVE_ARRAY(UINTEGER_8);
 
   - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
 
@@ -77,6 +83,12 @@ Section Public
     result
   );
 
+  - from_external p:NATIVE_ARRAY(CHARACTER) :STRING_CONSTANT <-
+  ( + i:INTEGER;
+    {n.item i = '\0'}.until_do { i := i + 1; };
+    new_intern n count i
+  );
+
   - to_external:NATIVE_ARRAY(CHARACTER) <-
   // Gives C access to the internal `storage' (may be dangerous).
   // To be compatible with C, a null character is added at the end
@@ -124,4 +136,15 @@ Section Public
 
   - Self:SELF '+?' test:{BOOLEAN} <- test +? Self;
 
+  //
+  // Import NATIVE_ARRAY
+  //
+
+  - from_native_array_of_character p:NATIVE_ARRAY(CHARACTER) :STRING_CONSTANT <-
+    from_external p;
+
+  - from_native_array_of_integer_8 p:NATIVE_ARRAY(INTEGER_8) :STRING_CONSTANT <-
+    from_external(CONVERT(NATIVE_ARRAY(INTEGER_8),NATIVE_ARRAY(CHARACTER)).on p);
 
+  - from_native_array_of_uinteger_8 p:NATIVE_ARRAY(UINTEGER_8) :STRING_CONSTANT <-
+    from_external(CONVERT(NATIVE_ARRAY(UINTEGER_8),NATIVE_ARRAY(CHARACTER)).on p);

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list