[SCM] Lisaac compiler branch, pierre-alex, updated. lisaac-0.12-564-g3f6afa1

ontologiae ontologiae at ordinateur-de-ontologiae.local
Mon Feb 1 15:01:20 UTC 2010


The following commit has been merged in the pierre-alex branch:
commit 3f6afa16412b25439b47bbbd60a8b3bc073ab991
Author: ontologiae <ontologiae at ordinateur-de-ontologiae.local>
Date:   Mon Feb 1 16:00:50 2010 +0100

    http server send files

diff --git a/lib/internal/portable/file_system/fs_min.li b/lib/internal/portable/file_system/fs_min.li
index d3b145b..e26ade6 100644
--- a/lib/internal/portable/file_system/fs_min.li
+++ b/lib/internal/portable/file_system/fs_min.li
@@ -99,3 +99,17 @@ Section Public
     result
   );
   
+  - open_as_string fname : ABSTRACT_STRING : STRING <-
+  ( + file:POINTER;
+    + sz:INTEGER;
+    + source : STRING;
+
+    source := STRING.create 4096;
+
+    file := open_read fname;
+    sz := file_size file;
+    source := STRING.create (sz+1);
+    read file in source size sz;
+    close file;
+    source
+  );
diff --git a/lib/standard/http/http_server.li b/lib/standard/http/http_server.li
index 0aac2d0..69c4de2 100644
--- a/lib/standard/http/http_server.li
+++ b/lib/standard/http/http_server.li
@@ -305,3 +305,10 @@ Section Public
                      .when "PUT"    then {put.value tmp_header;}
                      .when "DELETE" then {del.value tmp_header;};
     );
+
+
+    - get_file uri : ABSTRACT_STRING : STRING <-
+    ( + filename : ABSTRACT_STRING;
+      filename := uri.substring 2 to (uri.count -1);
+      FS_MIN.open_as_string filename
+    );

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list