[SCM] Lisaac compiler branch, master, updated. 477c15004842b5eaa8fd32cae2051f3911f778f2

Jeremy Cowgar jeremy at cowgar.com
Fri Jul 31 15:00:33 UTC 2009


The following commit has been merged in the master branch:
commit 477c15004842b5eaa8fd32cae2051f3911f778f2
Author: Jeremy Cowgar <jeremy at cowgar.com>
Date:   Fri Jul 31 10:58:49 2009 -0400

    * Added bench to TOOLS that will benchmark a block and return
      the number of seconds the block took to execute.
    * Fixed ENVIRONMENT to compile under 0.14
    * Minor code formatting in DATE and TIME

diff --git a/lib2/base/tools.li b/lib2/base/tools.li
index 78e9a6d..e448da7 100644
--- a/lib2/base/tools.li
+++ b/lib2/base/tools.li
@@ -22,10 +22,11 @@ Section Header
   
   + name    := TOOLS;
 
-
   - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
     
   - comment := "Miscellaneous Tools";
+
+  - external := `#include <time.h>`;
   
 Section Public
   
@@ -46,3 +47,11 @@ Section Public
     };
     uni.put 0 to i;    
   );
+
+  - bench b:{} :REAL_32 <-
+  ( + ts:REAL_32;
+
+    ts := `clock()`:REAL_32;
+    b.value;
+    ((`clock()`:REAL_32 - ts) / `CLOCKS_PER_SEC`:REAL_32)
+  );
diff --git a/lib2/time/date.li b/lib2/time/date.li
index 68db299..a40961d 100644
--- a/lib2/time/date.li
+++ b/lib2/time/date.li
@@ -20,9 +20,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 Section Header
   
-  + name        :=Expanded  DATE;
-
-
+  + name        := Expanded  DATE;
 
   - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
   
@@ -151,5 +149,3 @@ Section Public
   (
     to_string.print;
   );
-
-
diff --git a/lib2/time/time.li b/lib2/time/time.li
index 7326bb1..c5a1a01 100644
--- a/lib2/time/time.li
+++ b/lib2/time/time.li
@@ -20,9 +20,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 Section Header
   
-  + name        :=Expanded  TIME;
-
-
+  + name        := Expanded  TIME;
 
   - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
   
@@ -42,6 +40,7 @@ Section Private
   (
     CONVERT(SELF, UINTEGER_32).on Self
   );
+
 Section Public
 
   - hour:UINTEGER_8 <-
@@ -75,9 +74,9 @@ Section Public
   - Self:SELF '<=' Right 60 other:SELF :BOOLEAN <- to_raw <= other.to_raw;
   
   - to_csecond:INTEGER <- hour.to_integer * (60*60*100) + 
-  minute.to_integer * (60*100) + 
-  second.to_integer * 100 + 
-  csecond;
+    minute.to_integer * (60*100) + 
+    second.to_integer * 100 + 
+    csecond;
   
   - Self:SELF '-' Right 60 other:SELF :SELF <- 
   ( 
@@ -122,7 +121,7 @@ Section Public
     
     create (h,m,s,cs)
   );
-  
+    
   - to_string:STRING <-
   ( + result:STRING;
     result := STRING.create 8;
@@ -157,6 +156,3 @@ Section Public
   (
     to_string.print;
   );
-
-
-
diff --git a/lib2_os/unix/system/environment.li b/lib2_os/unix/system/environment.li
index 6fa01c1..4e25a04 100644
--- a/lib2_os/unix/system/environment.li
+++ b/lib2_os/unix/system/environment.li
@@ -36,7 +36,7 @@ Section Public
   // Under Windows, this function also look in the system registery.
   (
     + result:STRING;
-    + p:NATIVE_ARRAY[CHARACTER];
+    + p:NATIVE_ARRAY(CHARACTER);
     ? { variable != NULL };
     
     p := basic_getenv(variable.to_external);
@@ -72,18 +72,18 @@ Section Public
   
 Section Private
 
-  - basic_getenv environment_variable:NATIVE_ARRAY[CHARACTER] :NATIVE_ARRAY[CHARACTER] <-
+  - basic_getenv environment_variable:NATIVE_ARRAY(CHARACTER) :NATIVE_ARRAY(CHARACTER) <-
   // To implement `get_environment_variable'.
   (
-    `getenv((char*)@environment_variable)`:NATIVE_ARRAY[CHARACTER]
+    `getenv((char*)@environment_variable)`:NATIVE_ARRAY(CHARACTER)
   );
   
   - basic_putenv (variable,value:ABSTRACT_STRING) <-
   // To implement `set_environment_variable'.
   (
-    + v:NATIVE_ARRAY[CHARACTER];
+    + v:NATIVE_ARRAY(CHARACTER);
     
-    v := NATIVE_ARRAY[CHARACTER].calloc (variable.count + value.count + 2);
+    v := NATIVE_ARRAY(CHARACTER).calloc (variable.count + value.count + 2);
     v.copy_from (variable.to_external) until (variable.upper);
     v.put '=' to (variable.count);
     v.copy (value.to_external) to (variable.count + 1) until (value.capacity);
@@ -91,7 +91,7 @@ Section Private
     `putenv((char*)@v)`;
   );
   
-  - basic_system_execute_command system_command_line:NATIVE_ARRAY[CHARACTER] :INTEGER <-
+  - basic_system_execute_command system_command_line:NATIVE_ARRAY(CHARACTER) :INTEGER <-
   (
     `system(((char*)(@system_command_line)))`:(INTEGER)
   );

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list