[SCM] Lisaac compiler branch, pierre-alex, updated. lisaac-0.12-565-gfacd1f4
ontologiae
ontologiae at ordinateur-de-ontologiae.local
Mon Feb 1 20:48:28 UTC 2010
The following commit has been merged in the pierre-alex branch:
commit facd1f452b559b400523e6ac1ee3cae192b3a8df
Author: ontologiae <ontologiae at ordinateur-de-ontologiae.local>
Date: Mon Feb 1 21:48:01 2010 +0100
replace_all become replace_all_char (replace_all is now for string). Modifying shorter to specify returned type by function in Slot Summary
diff --git a/lib/standard/file_system/entry.li b/lib/standard/file_system/entry.li
index 51020f3..2067d30 100644
--- a/lib/standard/file_system/entry.li
+++ b/lib/standard/file_system/entry.li
@@ -115,7 +115,7 @@ Section ENTRY
+ stat:INTEGER;
+ car:CHARACTER;
- st.replace_all '\\' with '/';
+ st.replace_all_char '\\' with '/';
i := st.lower;
{i > st.upper}.until_do {
diff --git a/lib/standard/http/http_server.li b/lib/standard/http/http_server.li
index 69c4de2..6264b11 100644
--- a/lib/standard/http/http_server.li
+++ b/lib/standard/http/http_server.li
@@ -58,6 +58,13 @@ Section Private
- buffer:STRING := STRING.create 1024;
- tmp_header : HTTP_HEADER := HTTP_HEADER.create;
+
+ - post_block_list : HASHED_DICTIONARY(STRING,{HASHED_DICTIONARY(STRING,STRING);STRING}) := HASHED_DICTIONARY(STRING,{HASHED_DICTIONARY(STRING,STRING);STRING}).create;
+ // HASHED_DICTIONARY(
+ // STRING : post method name ,
+ //{HASHED_DICTIONARY(STRING,STRING);STRING} : Block with post method parameters arguments, and result
+ // )
+ //TODO : gestion des cookies !
//
// Error.
@@ -231,6 +238,8 @@ Section Public
value := buf.substring (idx+1) to (idx_end-1);
//dico.put value to key;
+ //TODO : Virer le http/1.1 à la fin de l'uri !
+
key.when "GET" then { header.set_verb "GET"; header.set_uri value;}
.when "POST" then { header.set_verb "POST"; header.set_uri value;}
.when "PUT" then { header.set_verb "PUT"; header.set_uri value;}
@@ -287,6 +296,10 @@ Section Public
);
+ //
+ // Receiver manager
+ //
+
- receive_get_do blc : {HTTP_HEADER;} <-
( + my_buf : STRING;
my_buf := STRING.create 512;
@@ -307,8 +320,79 @@ Section Public
);
+
+
+ - receive_do_get get : {HTTP_HEADER;} post post : {HTTP_HEADER;} <-
+ ( + my_buf : STRING;
+ my_buf := STRING.create 512;
+ receive my_buf;
+ convert my_buf to_http_header tmp_header;
+ tmp_header.verb.when "GET" then {get.value tmp_header;}
+ .when "POST" then {post.value tmp_header;};
+ );
+
+
+ //
+ // Tools
+ //
+
+
+
- get_file uri : ABSTRACT_STRING : STRING <-
( + filename : ABSTRACT_STRING;
filename := uri.substring 2 to (uri.count -1);
FS_MIN.open_as_string filename
);
+
+ // Pour le post : on reçoit une hash de clé/valeur ainsi qu'un nom de post : on regarde si on a un {HASH(STR,STR);STR} dans le HASH(STR, {HASH(STR,STR);STR}) et on l'exécute
+
+
+ - decode_parameters : HASHED_DICTIONARY(STRING,STRING) <-
+ ( + res : HASHED_DICTIONARY(STRING,STRING);
+ res := HASHED_DICTIONARY(STRING,STRING).create;
+ // On cherche le premier ?
+ // Ensuite on split avec le &
+ // Chaque morceaux est splité avec le =
+
+ );
+
+
+ //
+ // POST manager
+ //
+
+
+ - add_post name : ABSTRACT_STRING action blc : {HASHED_DICTIONARY(STRING,STRING); STRING} <-
+ (
+ post_block_list.put blc to name;
+ );
+
+
+
+
+ //
+ // Web Server
+ //
+
+
+ - start_server_on_port port : INTEGER <-
+ (
+ listen port action {
+ receive_get_do { h : HTTP_HEADER;
+ //TODO : Virer ce hack !!
+ s := h.uri;
+ s.replace_all "HTTP/1.1" with "";
+ ("Request with URI : " +s).printline;
+ my_buf := get_file s;
+ send my_buf type_mime "text/html";
+ } post { h : HTTP_HEADER;
+ //TODO : Virer ce hack !!
+ s := h.uri;
+ s.replace_all "HTTP/1.1" with "";
+ ("POST with URI : " +s).printline
+ // Decoupage des paramètres
+
+ };
+ close;
+ };
+ );
diff --git a/shorter/belinda.li b/shorter/belinda.li
index 052d54e..5539ca8 100644
--- a/shorter/belinda.li
+++ b/shorter/belinda.li
@@ -33,8 +33,8 @@
" <font color=\"#008000\">"+token+"</font>";
- prototype :=
- " <a href=\"" + token + ".html\">\
- \<font color=\"#008000\">"+token+"</font></a>";
+ "\n<!--Proto--> <a href=\"" + token + ".html\">\
+ \<font color=\"#008000\">"+token+"</font></a><!--Proto Fin-->\n";
- comment_line :=
"<br><font FACE=\"Helvetica\" color=\"#000000\"><B>" + token + "</B></font>";
@@ -66,12 +66,17 @@
- title := "<td align=\"right\"><em><b>Lisaac<sup><font size=\"-2\">TM</font></sup> Platform</b></em></td><hr><h2>" + token + "</h2><hr>";
- - table_begin := "<table summary=\"\" width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\"><tbody><tr class=\"TableHeadingColor\" bgcolor=\"#ccccff\"><td colspan=\"2\"><font size=\"+2\"><b>" + token + "</b></font></td></tr>";
+ - table_begin := "<table summary=\"\" width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\"><tbody><tr class=\"TableHeadingColor\" bgcolor=\"#ccccff\"><td colspan=\"2\"><font size=\"+2\"><b>" + token + "</b></font></td></tr>\n";
- - table_item := "<tr class=\"TableRowColor\" bgcolor=\"white\"><td>" + token + "</td></tr>";
+ - table_item := "\n<!-- Debut d'un table item --><tr class=\"TableRowColor\" bgcolor=\"white\"><td>" + token + "</td></tr><!-- FIN d'un table item -->\n";
+
+
+ - parle_a_mon_cul := "Parle à mon cul ma tête est malade !"+token;
+
+ - return_type := "<!--table_slot_return_type--> : "+token +" ";
- - table_slot_name := "<code><dt><b><a href=\"#"+token+"\">" + token + "</a></b></code>";
- - table_slot_comment := "<dd>" + token;
+ - table_slot_name := "\n<!-- Nom du slot --><code><dt><b><a href=\"#"+token+"\">" + token + "</a></b></code><!-- Nom du slot FIN -->\n";
+ - table_slot_comment := "\n<!-- Debut d'un table_slot_comment --><dd>" + token+"<!-- fin d'un table_slot_comment -->\n";
- table_end := "</tbody></table> ";
diff --git a/src/item/itm_slot.li b/src/item/itm_slot.li
index 32fbc1a..30067c9 100644
--- a/src/item/itm_slot.li
+++ b/src/item/itm_slot.li
@@ -329,6 +329,13 @@ Section Public
};
buffer.add_last (name.last);
);
+
+ - shorter_result_type_in buf :STRING <-
+ (
+ (result_type != ITM_TYPE_SIMPLE.type_void).if {
+ result_type.shorter_in buf;
+ };
+ );
- shorter_profile_in buf:STRING <-
(
diff --git a/src/shorter.li b/src/shorter.li
index 80ed3b7..ddca22d 100644
--- a/src/shorter.li
+++ b/src/shorter.li
@@ -205,7 +205,7 @@ Section Private
( + i:INTEGER;
string_tmp.copy st;
- string_tmp.replace_all '\\' with '/';
+ string_tmp.replace_all_char '\\' with '/';
i := last_index_str (string_tmp,'/');
(i >= string_tmp.lower).if {
string_tmp.remove_first i;
@@ -327,7 +327,7 @@ Section Private
string_tmp.remove_last (string_tmp.upper-idx+1);
string_tmp.remove_first path_begin;
string_tmp.is_empty.if_false {
- string_tmp.replace_all '/' with '-';
+ string_tmp.replace_all_char '/' with '-';
tok := ALIAS_STR.get string_tmp;
(PARSER.short_dico.fast_has (ALIAS_STR.short_directory_list_item)).if {
diff --git a/src/shorter_any/any_option.li b/src/shorter_any/any_option.li
index ed17ed4..8fd4a3a 100644
--- a/src/shorter_any/any_option.li
+++ b/src/shorter_any/any_option.li
@@ -53,7 +53,8 @@ Section Public
} else {
buf.append (lst.item j);
};
+ //("key ="+key+" buf="+buf+"\n").printline;
};
};
};
- );
\ No newline at end of file
+ );
diff --git a/src/tools/alias_str.li b/src/tools/alias_str.li
index ca97c94..aae5dc1 100644
--- a/src/tools/alias_str.li
+++ b/src/tools/alias_str.li
@@ -202,6 +202,7 @@ Section Public
- short_operator :STRING_CONSTANT := "operator";
- short_prototype :STRING_CONSTANT := "prototype";
- short_keyprototype:STRING_CONSTANT := "keyprototype";
+ - short_return_type :STRING_CONSTANT := "return_type";
- short_comment_line :STRING_CONSTANT := "comment_line";
- short_comment_slot_line :STRING_CONSTANT := "comment_slot_line";
- short_comment_header_line:STRING_CONSTANT := "comment_header_line";
@@ -225,6 +226,7 @@ Section Public
- short_table_begin :STRING_CONSTANT := "table_begin";
- short_table_item :STRING_CONSTANT := "table_item";
- short_table_slot_name :STRING_CONSTANT := "table_slot_name";
+
- short_table_slot_comment :STRING_CONSTANT := "table_slot_comment";
- short_table_end :STRING_CONSTANT := "table_end";
- short_sub_title :STRING_CONSTANT := "sub_title";
diff --git a/src/type/prototype.li b/src/type/prototype.li
index 9c96f0f..1439d53 100644
--- a/src/type/prototype.li
+++ b/src/type/prototype.li
@@ -592,11 +592,27 @@ Section PROTOTYPE
).if {
put " No developed." to string_tmp like (ALIAS_STR.short_warning);
};
+
+ string_tmp2.clear;
+ string_tmp3.clear;
+ s.shorter_result_type_in string_tmp2;
+ //put string_tmp3 to string_tmp2 like (ALIAS_STR.short_prototype);
+ //("\n\n\nLkigne 600 " + "tmp="+string_tmp + " tmp2="+string_tmp2+ " tmp3="+string_tmp3).printline;
+
+ string_tmp3.clear;
+ put string_tmp2 to string_tmp like (ALIAS_STR.short_local);// C le seul qui veut bien marcher :-(
+ //("Ligne 604 " + "tmp="+string_tmp + " tmp2="+string_tmp2+ " tmp3="+string_tmp3).printline;
+
+
+
string_tmp2.clear;
get_all_comment_slot (s.name) in string_tmp2;
string_tmp3.clear;
- shorter_comment string_tmp2 in string_tmp3 light TRUE;
+ shorter_comment string_tmp2 in string_tmp3 light TRUE;
+ //("Ligne 611 " + "tmp="+string_tmp + " tmp2="+string_tmp2+ " tmp3="+string_tmp3).printline;
+
put string_tmp3 to string_tmp like (ALIAS_STR.short_table_slot_comment);
+
put string_tmp to buf like (ALIAS_STR.short_table_item);
};
};
@@ -734,7 +750,7 @@ Section PROTOTYPE
(lst = NULL).if {
code_balise := NULL;
} else {
- str_tmp.replace_all '_' with ' ';
+ str_tmp.replace_all_char '_' with ' ';
str_tmp.add_last ':';
str_tmp.put (str_tmp.first.to_upper) to 1;
put str_tmp to buf like (ALIAS_STR.short_subsub_title);
@@ -797,4 +813,4 @@ Section PROTOTYPE
put str_tmp to buf like code_balise;
};
};
- );
\ No newline at end of file
+ );
--
Lisaac compiler
More information about the Lisaac-commits
mailing list