Commit 610b9aa15570312ff7d0267ea931edc87755c8a3

Authored by totoro
1 parent f2348316

add support of word8, word16, word32, float32 and float64

densaku.aproj
... ... @@ -101,6 +101,8 @@
101 101 <Folder Include="library\xml" />
102 102 <Folder Include="src" />
103 103 <Folder Include="src\generation" />
  104 + <Folder Include="src\generation\anubis" />
  105 + <Folder Include="src\generation\javascript" />
104 106 <Compile Include="calexium_lib\asterisk\ami.anubis" />
105 107 <Compile Include="calexium_lib\asterisk\ami_commands.anubis" />
106 108 <Compile Include="calexium_lib\asterisk\ami_types.anubis" />
... ...
densaku_lib @ 7be0acc189e
1   -Subproject commit 5c7cd864b6cc8232c2e719fe3a1e3740288cc0e2
  1 +Subproject commit 7be0acc189ec7b831dce1255ac3e498c0002305e
... ...
src/generation/types_header.anubis
... ... @@ -31,7 +31,7 @@ public define Maybe(One)
31 31 write_string(stream,
32 32 "/*
33 33 * Created by 伝作 (Densaku).
34   - * User: Automat
  34 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
35 35 * Date: "+_Int_to_ISO_8601_date(now)+"
36 36 * Time: "+_Int_to_ISO_8601_time(now)+"
37 37 *
... ...
src/generation/types_messages.anubis
... ... @@ -56,10 +56,18 @@ public define String
56 56 "add_bool("+type_msg+", \""+field_name+"\", _"+name+")",
57 57 int then
58 58 "add_string("+type_msg+", \""+field_name+"\", to_String(_"+name+"))",
  59 + word8 then
  60 + "add_int8("+type_msg+", \""+field_name+"\", _"+name+")",
  61 + word16 then
  62 + "add_int16("+type_msg+", \""+field_name+"\", _"+name+")",
  63 + word32 then
  64 + "add_int32("+type_msg+", \""+field_name+"\", _"+name+")",
59 65 string then
60 66 "add_string("+type_msg+", \""+field_name+"\", _"+name+")",
61   - float then
62   - "add_float("+type_msg+", \""+field_name+"\", _"+name+")",
  67 + float32 then
  68 + "add_float32("+type_msg+", \""+field_name+"\", _"+name+")",
  69 + float64 then
  70 + "add_float64("+type_msg+", \""+field_name+"\", _"+name+")",
63 71 ds_type(type_name) then
64 72 "add_message("+type_msg+", \""+field_name+"\", to_Message(_"+name+"))",
65 73 extern_type(type_name, _) then //external type. No need to check
... ... @@ -198,8 +206,12 @@ public define String
198 206 brace_counter <- *brace_counter + 1;
199 207 indent + "with mb_" + name + " = map_escape((String int_str) |-> decimal_scan(int_str), find_string_list("+type_msg+", \""+field_name+"\")),\n"+
200 208 indent + " if mb_" + name + " is {failure then failure, success("+ name + ") then \n",
  209 + word8 then indent + "with " + name + " = find_int8_list("+type_msg+", \""+field_name+"\"),\n",
  210 + word16 then indent + "with " + name + " = find_int16_list("+type_msg+", \""+field_name+"\"),\n",
  211 + word32 then indent + "with " + name + " = find_int32_list("+type_msg+", \""+field_name+"\"),\n",
201 212 string then indent + "with " + name + " = find_string_list("+type_msg+", \""+field_name+"\"),\n",
202   - float then indent + "with " + name + " = find_float_list("+type_msg+", \""+field_name+"\"),\n",
  213 + float32 then indent + "with " + name + " = find_float32_list("+type_msg+", \""+field_name+"\"),\n",
  214 + float64 then indent + "with " + name + " = find_float64_list("+type_msg+", \""+field_name+"\"),\n",
203 215 ds_type(type_name) then
204 216 brace_counter <- *brace_counter + 1;
205 217 indent +"with mb_"+name+" = map_escape(( Message msg ) |-> (Maybe("+dump(anb_type)+ ")) from_Message(msg), find_message_list("+type_msg+", \""+field_name+"\")),\n"+
... ... @@ -233,12 +245,24 @@ public define String
233 245 brace_counter <- (*brace_counter + 2);
234 246 indent + "if find_string("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success(_"+name+") then\n"+
235 247 indent + " if decimal_scan(_"+name+") is { failure then failure, success("+name+") then\n",
  248 + word8 then
  249 + brace_counter <- (*brace_counter + 1);
  250 + indent + "if find_int8("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+") then\n",
  251 + word16 then
  252 + brace_counter <- (*brace_counter + 1);
  253 + indent + "if find_int16("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+") then\n",
  254 + word32 then
  255 + brace_counter <- (*brace_counter + 1);
  256 + indent + "if find_int32("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+") then\n",
236 257 string then
237 258 brace_counter <- (*brace_counter + 1);
238 259 indent + "if find_string("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+") then\n",
239   - float then
  260 + float32 then
  261 + brace_counter <- (*brace_counter + 1);
  262 + indent + "if find_float32("+type_msg+", \""+field_name+"\)"+" is {failure then failure, success("+name+") then\n",
  263 + float64 then
240 264 brace_counter <- (*brace_counter + 1);
241   - indent + "if find_float("+type_msg+", \""+field_name+"\)"+" is {failure then failure, success("+name+") then\n",
  265 + indent + "if find_float64("+type_msg+", \""+field_name+"\)"+" is {failure then failure, success("+name+") then\n",
242 266 ds_type(type_name) then
243 267 brace_counter <- (*brace_counter + 2);
244 268 indent + "if find_message("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+"_msg) then\n"+
... ...