Commit 610b9aa15570312ff7d0267ea931edc87755c8a3
1 parent
f2348316
add support of word8, word16, word32, float32 and float64
Showing
4 changed files
with
33 additions
and
7 deletions
Show diff stats
densaku.aproj
| @@ -101,6 +101,8 @@ | @@ -101,6 +101,8 @@ | ||
| 101 | <Folder Include="library\xml" /> | 101 | <Folder Include="library\xml" /> |
| 102 | <Folder Include="src" /> | 102 | <Folder Include="src" /> |
| 103 | <Folder Include="src\generation" /> | 103 | <Folder Include="src\generation" /> |
| 104 | + <Folder Include="src\generation\anubis" /> | ||
| 105 | + <Folder Include="src\generation\javascript" /> | ||
| 104 | <Compile Include="calexium_lib\asterisk\ami.anubis" /> | 106 | <Compile Include="calexium_lib\asterisk\ami.anubis" /> |
| 105 | <Compile Include="calexium_lib\asterisk\ami_commands.anubis" /> | 107 | <Compile Include="calexium_lib\asterisk\ami_commands.anubis" /> |
| 106 | <Compile Include="calexium_lib\asterisk\ami_types.anubis" /> | 108 | <Compile Include="calexium_lib\asterisk\ami_types.anubis" /> |
densaku_lib @ 7be0acc189e
src/generation/types_header.anubis
| @@ -31,7 +31,7 @@ public define Maybe(One) | @@ -31,7 +31,7 @@ public define Maybe(One) | ||
| 31 | write_string(stream, | 31 | write_string(stream, |
| 32 | "/* | 32 | "/* |
| 33 | * Created by 伝作 (Densaku). | 33 | * Created by 伝作 (Densaku). |
| 34 | - * User: Automat | 34 | + * Types & Messages generator written by フランスのトトロ aka (David RENÉ) |
| 35 | * Date: "+_Int_to_ISO_8601_date(now)+" | 35 | * Date: "+_Int_to_ISO_8601_date(now)+" |
| 36 | * Time: "+_Int_to_ISO_8601_time(now)+" | 36 | * Time: "+_Int_to_ISO_8601_time(now)+" |
| 37 | * | 37 | * |
src/generation/types_messages.anubis
| @@ -56,10 +56,18 @@ public define String | @@ -56,10 +56,18 @@ public define String | ||
| 56 | "add_bool("+type_msg+", \""+field_name+"\", _"+name+")", | 56 | "add_bool("+type_msg+", \""+field_name+"\", _"+name+")", |
| 57 | int then | 57 | int then |
| 58 | "add_string("+type_msg+", \""+field_name+"\", to_String(_"+name+"))", | 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 | string then | 65 | string then |
| 60 | "add_string("+type_msg+", \""+field_name+"\", _"+name+")", | 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 | ds_type(type_name) then | 71 | ds_type(type_name) then |
| 64 | "add_message("+type_msg+", \""+field_name+"\", to_Message(_"+name+"))", | 72 | "add_message("+type_msg+", \""+field_name+"\", to_Message(_"+name+"))", |
| 65 | extern_type(type_name, _) then //external type. No need to check | 73 | extern_type(type_name, _) then //external type. No need to check |
| @@ -198,8 +206,12 @@ public define String | @@ -198,8 +206,12 @@ public define String | ||
| 198 | brace_counter <- *brace_counter + 1; | 206 | brace_counter <- *brace_counter + 1; |
| 199 | indent + "with mb_" + name + " = map_escape((String int_str) |-> decimal_scan(int_str), find_string_list("+type_msg+", \""+field_name+"\")),\n"+ | 207 | indent + "with mb_" + name + " = map_escape((String int_str) |-> decimal_scan(int_str), find_string_list("+type_msg+", \""+field_name+"\")),\n"+ |
| 200 | indent + " if mb_" + name + " is {failure then failure, success("+ name + ") then \n", | 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 | string then indent + "with " + name + " = find_string_list("+type_msg+", \""+field_name+"\"),\n", | 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 | ds_type(type_name) then | 215 | ds_type(type_name) then |
| 204 | brace_counter <- *brace_counter + 1; | 216 | brace_counter <- *brace_counter + 1; |
| 205 | indent +"with mb_"+name+" = map_escape(( Message msg ) |-> (Maybe("+dump(anb_type)+ ")) from_Message(msg), find_message_list("+type_msg+", \""+field_name+"\")),\n"+ | 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,12 +245,24 @@ public define String | ||
| 233 | brace_counter <- (*brace_counter + 2); | 245 | brace_counter <- (*brace_counter + 2); |
| 234 | indent + "if find_string("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success(_"+name+") then\n"+ | 246 | indent + "if find_string("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success(_"+name+") then\n"+ |
| 235 | indent + " if decimal_scan(_"+name+") is { failure then failure, success("+name+") then\n", | 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 | string then | 257 | string then |
| 237 | brace_counter <- (*brace_counter + 1); | 258 | brace_counter <- (*brace_counter + 1); |
| 238 | indent + "if find_string("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+") then\n", | 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 | brace_counter <- (*brace_counter + 1); | 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 | ds_type(type_name) then | 266 | ds_type(type_name) then |
| 243 | brace_counter <- (*brace_counter + 2); | 267 | brace_counter <- (*brace_counter + 2); |
| 244 | indent + "if find_message("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+"_msg) then\n"+ | 268 | indent + "if find_message("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+"_msg) then\n"+ |