Commit 60c981af56bab8a9ae07772b3e43df277a4fccd8
1 parent
3c636a92
add the generation of messages collections
Showing
10 changed files
with
525 additions
and
39 deletions
Show diff stats
.gitmodules
| 1 | [submodule "densaku_lib"] | 1 | [submodule "densaku_lib"] |
| 2 | path = densaku_lib | 2 | path = densaku_lib |
| 3 | url = git@gitlab.anubis-language.com:totoro/densaku_lib.git | 3 | url = git@gitlab.anubis-language.com:totoro/densaku_lib.git |
| 4 | +[submodule "calexium_lib"] | ||
| 5 | + path = calexium_lib | ||
| 6 | + url = ssh://git@gitlab.calexium.com:33022/calexium/calexium_lib.git |
calexium_lib @ a3acb343c74
| 1 | +Subproject commit a3acb343c746388ec4fb76fceabc1f22e9f3c37d |
densaku.aproj
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
| 6 | <OutputType>Exe</OutputType> | 6 | <OutputType>Exe</OutputType> |
| 7 | <RootNamespace>takaden</RootNamespace> | 7 | <RootNamespace>takaden</RootNamespace> |
| 8 | - <AssemblyName>takaden</AssemblyName> | 8 | + <AssemblyName>densaku</AssemblyName> |
| 9 | <StartupObject>src\main.anubis</StartupObject> | 9 | <StartupObject>src\main.anubis</StartupObject> |
| 10 | <MakeUsedFile>False</MakeUsedFile> | 10 | <MakeUsedFile>False</MakeUsedFile> |
| 11 | <MakeUnusedFile>False</MakeUnusedFile> | 11 | <MakeUnusedFile>False</MakeUnusedFile> |
| @@ -27,6 +27,31 @@ | @@ -27,6 +27,31 @@ | ||
| 27 | </PropertyGroup> | 27 | </PropertyGroup> |
| 28 | <Import Project="$(AnubisBinPath)\Anubis.Build.targets" /> | 28 | <Import Project="$(AnubisBinPath)\Anubis.Build.targets" /> |
| 29 | <ItemGroup> | 29 | <ItemGroup> |
| 30 | + <Folder Include="calexium_lib" /> | ||
| 31 | + <Folder Include="calexium_lib\asterisk" /> | ||
| 32 | + <Folder Include="calexium_lib\database" /> | ||
| 33 | + <Folder Include="calexium_lib\database\model" /> | ||
| 34 | + <Folder Include="calexium_lib\extensions" /> | ||
| 35 | + <Folder Include="calexium_lib\file_processor_io" /> | ||
| 36 | + <Folder Include="calexium_lib\file_processor_io\yaml" /> | ||
| 37 | + <Folder Include="calexium_lib\mail" /> | ||
| 38 | + <Folder Include="calexium_lib\mail\lexers" /> | ||
| 39 | + <Folder Include="calexium_lib\network" /> | ||
| 40 | + <Folder Include="calexium_lib\net_services" /> | ||
| 41 | + <Folder Include="calexium_lib\net_services_protocols" /> | ||
| 42 | + <Folder Include="calexium_lib\obj" /> | ||
| 43 | + <Folder Include="calexium_lib\os_tools" /> | ||
| 44 | + <Folder Include="calexium_lib\os_tools\freebsd" /> | ||
| 45 | + <Folder Include="calexium_lib\os_tools\linux" /> | ||
| 46 | + <Folder Include="calexium_lib\os_tools\linux\config" /> | ||
| 47 | + <Folder Include="calexium_lib\string" /> | ||
| 48 | + <Folder Include="calexium_lib\unit_test" /> | ||
| 49 | + <Folder Include="calexium_lib\web" /> | ||
| 50 | + <Folder Include="calexium_lib\web\jQuery" /> | ||
| 51 | + <Folder Include="calexium_lib\web\jQuery\ui-addon" /> | ||
| 52 | + <Folder Include="calexium_lib\web\js" /> | ||
| 53 | + <Folder Include="calexium_lib\web\piwik" /> | ||
| 54 | + <Folder Include="calexium_lib\web\widgets" /> | ||
| 30 | <Folder Include="densaku_lib" /> | 55 | <Folder Include="densaku_lib" /> |
| 31 | <Folder Include="densaku_lib\types" /> | 56 | <Folder Include="densaku_lib\types" /> |
| 32 | <Folder Include="library" /> | 57 | <Folder Include="library" /> |
| @@ -76,6 +101,100 @@ | @@ -76,6 +101,100 @@ | ||
| 76 | <Folder Include="library\xml" /> | 101 | <Folder Include="library\xml" /> |
| 77 | <Folder Include="src" /> | 102 | <Folder Include="src" /> |
| 78 | <Folder Include="src\generation" /> | 103 | <Folder Include="src\generation" /> |
| 104 | + <Compile Include="calexium_lib\asterisk\ami.anubis" /> | ||
| 105 | + <Compile Include="calexium_lib\asterisk\ami_commands.anubis" /> | ||
| 106 | + <Compile Include="calexium_lib\asterisk\ami_types.anubis" /> | ||
| 107 | + <Compile Include="calexium_lib\CXM_errors.anubis" /> | ||
| 108 | + <Compile Include="calexium_lib\CXM_message_constants.anubis" /> | ||
| 109 | + <Compile Include="calexium_lib\database\alter_table.anubis" /> | ||
| 110 | + <Compile Include="calexium_lib\database\db_types.anubis" /> | ||
| 111 | + <Compile Include="calexium_lib\database\db_utils.anubis" /> | ||
| 112 | + <Compile Include="calexium_lib\database\migration.anubis" /> | ||
| 113 | + <Compile Include="calexium_lib\database\migration_common.anubis" /> | ||
| 114 | + <Compile Include="calexium_lib\database\migration_common_sqlite3.anubis" /> | ||
| 115 | + <Compile Include="calexium_lib\database\migration_sqlite3.anubis" /> | ||
| 116 | + <Compile Include="calexium_lib\database\model\db_model.anubis" /> | ||
| 117 | + <Compile Include="calexium_lib\database\settings.anubis" /> | ||
| 118 | + <Compile Include="calexium_lib\database\settings_sqlite3.anubis" /> | ||
| 119 | + <Compile Include="calexium_lib\database\sqlite_foreign_key.anubis" /> | ||
| 120 | + <Compile Include="calexium_lib\extensions\json.anubis" /> | ||
| 121 | + <Compile Include="calexium_lib\file_processor_io\yaml\yaml.anubis" /> | ||
| 122 | + <Compile Include="calexium_lib\file_processor_io\yaml\yaml_parser.anubis" /> | ||
| 123 | + <Compile Include="calexium_lib\file_processor_io\yaml\yaml_type.anubis" /> | ||
| 124 | + <Compile Include="calexium_lib\mail\authentication.anubis" /> | ||
| 125 | + <Compile Include="calexium_lib\mail\lexers\enhanced_status.anubis" /> | ||
| 126 | + <Compile Include="calexium_lib\mail\send_mail.anubis" /> | ||
| 127 | + <Compile Include="calexium_lib\mail\send_mail_type.anubis" /> | ||
| 128 | + <Compile Include="calexium_lib\mail\smtp_client.anubis" /> | ||
| 129 | + <Compile Include="calexium_lib\mail\smtp_server_extensions.anubis" /> | ||
| 130 | + <Compile Include="calexium_lib\mail\tools.anubis" /> | ||
| 131 | + <Compile Include="calexium_lib\network\socket_pool.anubis" /> | ||
| 132 | + <Compile Include="calexium_lib\net_services\CXM_generic_client.anubis" /> | ||
| 133 | + <Compile Include="calexium_lib\net_services\CXM_generic_protocol.anubis" /> | ||
| 134 | + <Compile Include="calexium_lib\net_services\CXM_net_services.anubis" /> | ||
| 135 | + <Compile Include="calexium_lib\net_services_protocols\ftp_client.anubis" /> | ||
| 136 | + <Compile Include="calexium_lib\net_services_protocols\logger_service.anubis" /> | ||
| 137 | + <Compile Include="calexium_lib\net_services_protocols\pkg_updater_protocol.anubis" /> | ||
| 138 | + <Compile Include="calexium_lib\os_tools\freebsd\rc_conf.anubis" /> | ||
| 139 | + <Compile Include="calexium_lib\os_tools\linux\config\network_interface_file.anubis" /> | ||
| 140 | + <Compile Include="calexium_lib\string\crlf.anubis" /> | ||
| 141 | + <Compile Include="calexium_lib\unit_test\xml_rpc.unit_test.anubis" /> | ||
| 142 | + <Compile Include="calexium_lib\web\counter.anubis" /> | ||
| 143 | + <Compile Include="calexium_lib\web\CXM_common.anubis" /> | ||
| 144 | + <Compile Include="calexium_lib\web\CXM_cookies.anubis" /> | ||
| 145 | + <Compile Include="calexium_lib\web\CXM_dojo.anubis" /> | ||
| 146 | + <Compile Include="calexium_lib\web\CXM_dropzone.anubis" /> | ||
| 147 | + <Compile Include="calexium_lib\web\CXM_form.anubis" /> | ||
| 148 | + <Compile Include="calexium_lib\web\CXM_generic_form.anubis" /> | ||
| 149 | + <Compile Include="calexium_lib\web\CXM_generic_login.anubis" /> | ||
| 150 | + <Compile Include="calexium_lib\web\CXM_generic_table.anubis" /> | ||
| 151 | + <Compile Include="calexium_lib\web\CXM_html_tooltip.anubis" /> | ||
| 152 | + <Compile Include="calexium_lib\web\CXM_https_get.anubis" /> | ||
| 153 | + <Compile Include="calexium_lib\web\CXM_http_get.anubis" /> | ||
| 154 | + <Compile Include="calexium_lib\web\CXM_http_get_common.anubis" /> | ||
| 155 | + <Compile Include="calexium_lib\web\CXM_jquery.anubis" /> | ||
| 156 | + <Compile Include="calexium_lib\web\CXM_json.anubis" /> | ||
| 157 | + <Compile Include="calexium_lib\web\CXM_making_a_web_site.anubis" /> | ||
| 158 | + <Compile Include="calexium_lib\web\CXM_mime.anubis" /> | ||
| 159 | + <Compile Include="calexium_lib\web\CXM_multihost_http_server.anubis" /> | ||
| 160 | + <Compile Include="calexium_lib\web\CXM_style_tools.anubis" /> | ||
| 161 | + <Compile Include="calexium_lib\web\CXM_urllib.anubis" /> | ||
| 162 | + <Compile Include="calexium_lib\web\CXM_web_arg_encode.anubis" /> | ||
| 163 | + <Compile Include="calexium_lib\web\CXM_web_arg_utils.anubis" /> | ||
| 164 | + <Compile Include="calexium_lib\web\CXM_web_dump.anubis" /> | ||
| 165 | + <Compile Include="calexium_lib\web\CXM_widgets.anubis" /> | ||
| 166 | + <Compile Include="calexium_lib\web\CXM_xml_rpc.anubis" /> | ||
| 167 | + <Compile Include="calexium_lib\web\CXM_xml_rpc_parser.anubis" /> | ||
| 168 | + <Compile Include="calexium_lib\web\CXM_xml_rpc_types.anubis" /> | ||
| 169 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_animate.anubis" /> | ||
| 170 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_button.anubis" /> | ||
| 171 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_datatable.anubis" /> | ||
| 172 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_datatable_plugins.anubis" /> | ||
| 173 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_datatable_server_side.anubis" /> | ||
| 174 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_datatable_translation.anubis" /> | ||
| 175 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_datatable_types.anubis" /> | ||
| 176 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_dialog.anubis" /> | ||
| 177 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_easing.anubis" /> | ||
| 178 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_eudock.anubis" /> | ||
| 179 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_eudock_types.anubis" /> | ||
| 180 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_icons.anubis" /> | ||
| 181 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_jqplot.anubis" /> | ||
| 182 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_tabs.anubis" /> | ||
| 183 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_tiptip.anubis" /> | ||
| 184 | + <Compile Include="calexium_lib\web\jQuery\CXM_jquery_toolbar.anubis" /> | ||
| 185 | + <Compile Include="calexium_lib\web\jQuery\CXM_jq_checkbox.anubis" /> | ||
| 186 | + <Compile Include="calexium_lib\web\jQuery\CXM_jq_form.anubis" /> | ||
| 187 | + <Compile Include="calexium_lib\web\jQuery\CXM_jq_radio.anubis" /> | ||
| 188 | + <Compile Include="calexium_lib\web\jQuery\jq_flot.anubis" /> | ||
| 189 | + <Compile Include="calexium_lib\web\jQuery\ui-addon\datetimepicker.anubis" /> | ||
| 190 | + <Compile Include="calexium_lib\web\js_tools.anubis" /> | ||
| 191 | + <Compile Include="calexium_lib\web\piwik\CXM_piwik.anubis" /> | ||
| 192 | + <Compile Include="calexium_lib\web\widgets\button.anubis" /> | ||
| 193 | + <Compile Include="calexium_lib\web\widgets\css_helper.anubis" /> | ||
| 194 | + <Compile Include="calexium_lib\web\widgets\dashboard.anubis" /> | ||
| 195 | + <Compile Include="calexium_lib\web\widgets\fisheye_menu.anubis" /> | ||
| 196 | + <Compile Include="calexium_lib\web\widgets\icons_set.anubis" /> | ||
| 197 | + <Compile Include="calexium_lib\web\widgets\left_menu.anubis" /> | ||
| 79 | <Compile Include="densaku_lib\ds_generator.anubis" /> | 198 | <Compile Include="densaku_lib\ds_generator.anubis" /> |
| 80 | <Compile Include="densaku_lib\types\densaku.anubis" /> | 199 | <Compile Include="densaku_lib\types\densaku.anubis" /> |
| 81 | <Compile Include="densaku_lib\types\ds_message.anubis" /> | 200 | <Compile Include="densaku_lib\types\ds_message.anubis" /> |
| @@ -440,11 +559,20 @@ | @@ -440,11 +559,20 @@ | ||
| 440 | <Compile Include="library\xml\xml_parser.apg.anubis" /> | 559 | <Compile Include="library\xml\xml_parser.apg.anubis" /> |
| 441 | <Compile Include="library\xml\xml_parser_types.anubis" /> | 560 | <Compile Include="library\xml\xml_parser_types.anubis" /> |
| 442 | <Compile Include="src\generation\files.anubis" /> | 561 | <Compile Include="src\generation\files.anubis" /> |
| 562 | + <Compile Include="src\generation\messages.anubis" /> | ||
| 563 | + <Compile Include="src\generation\message_header.anubis" /> | ||
| 564 | + <Compile Include="src\generation\message_messages.anubis" /> | ||
| 443 | <Compile Include="src\generation\types.anubis" /> | 565 | <Compile Include="src\generation\types.anubis" /> |
| 444 | <Compile Include="src\generation\types_header.anubis" /> | 566 | <Compile Include="src\generation\types_header.anubis" /> |
| 445 | <Compile Include="src\generation\types_messages.anubis" /> | 567 | <Compile Include="src\generation\types_messages.anubis" /> |
| 446 | <Compile Include="src\main.anubis" /> | 568 | <Compile Include="src\main.anubis" /> |
| 447 | <Compile Include="src\types_checking.anubis" /> | 569 | <Compile Include="src\types_checking.anubis" /> |
| 570 | + <None Include="calexium_lib\.git" /> | ||
| 571 | + <None Include="calexium_lib\.gitignore" /> | ||
| 572 | + <None Include="calexium_lib\obj\unit_test.aproj.FileListAbsolute.txt" /> | ||
| 573 | + <None Include="calexium_lib\unit_test.aproj" /> | ||
| 574 | + <None Include="calexium_lib\unit_test.ide" /> | ||
| 575 | + <None Include="calexium_lib\web\js\cxm_jquery_animate.js" /> | ||
| 448 | <None Include="library\anubis_doc.maml" /> | 576 | <None Include="library\anubis_doc.maml" /> |
| 449 | <None Include="library\compile_all.inproj" /> | 577 | <None Include="library\compile_all.inproj" /> |
| 450 | <None Include="library\doc_tools\cows.jpg" /> | 578 | <None Include="library\doc_tools\cows.jpg" /> |
src/generation/files.anubis
| @@ -10,27 +10,28 @@ read densaku_lib/types/densaku.anubis | @@ -10,27 +10,28 @@ read densaku_lib/types/densaku.anubis | ||
| 10 | read densaku_lib/ds_generator.anubis | 10 | read densaku_lib/ds_generator.anubis |
| 11 | read tools/basis.anubis | 11 | read tools/basis.anubis |
| 12 | read types_checking.anubis | 12 | read types_checking.anubis |
| 13 | -read generation/types.anubis | 13 | +read generation/types.anubis //generate all types and the message for these types |
| 14 | +read generation/messages.anubis //generate all messages collection | ||
| 14 | 15 | ||
| 15 | public define Maybe(One) | 16 | public define Maybe(One) |
| 16 | generate_message_files | 17 | generate_message_files |
| 17 | ( | 18 | ( |
| 18 | List(DS_Type) types, //Types description | 19 | List(DS_Type) types, //Types description |
| 19 | -// DS_Messages messages, | ||
| 20 | - String destination_dir | 20 | + List(DS_Message) messages, |
| 21 | + String destination_dir | ||
| 21 | )= | 22 | )= |
| 22 | 23 | ||
| 23 | if check_types(types) is | 24 | if check_types(types) is |
| 24 | { | 25 | { |
| 25 | failure then failure, | 26 | failure then failure, |
| 26 | success(_) then | 27 | success(_) then |
| 27 | - //since _types is hk_database(name, apps), | 28 | + |
| 28 | println("Generating types and message files"); | 29 | println("Generating types and message files"); |
| 29 | make_all_types(types, destination_dir); | 30 | make_all_types(types, destination_dir); |
| 30 | - //make_vtm(apps, destination_dir); | ||
| 31 | - //if generate_create_table(apps, destination_dir) is failure then println("failure");failure else | ||
| 32 | - //println("Generating message collection"); | ||
| 33 | - //if generate_menus(apps, destination_dir) is failure then println("failure");failure else | 31 | + |
| 32 | + println("Generating messages collection"); | ||
| 33 | + make_all_messages(messages, destination_dir); | ||
| 34 | + | ||
| 34 | success(unique) | 35 | success(unique) |
| 35 | }. | 36 | }. |
| 36 | 37 |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ aka (David RENÉ) | ||
| 4 | + * Date: 23/01/2017 | ||
| 5 | + * Time: 22:37 | ||
| 6 | + * © Calexium | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +read tools/basis.anubis | ||
| 10 | +read tools/streams.anubis | ||
| 11 | +read tools/ISO-8601.anubis | ||
| 12 | +read system/string.anubis | ||
| 13 | +read densaku_lib/types/ds_types.anubis | ||
| 14 | +read densaku_lib/types/ds_message.anubis | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +public define String | ||
| 18 | + insert_read_foreign_type | ||
| 19 | + ( | ||
| 20 | + DS_Message ds_message //type description | ||
| 21 | + )= | ||
| 22 | + with foreign_type_list = get_all_extern_type(ds_message), | ||
| 23 | + join("", map((Extern_type ext_type) |-> since ext_type is extern(_, read_file), "read "+read_file+"\n", foreign_type_list)) | ||
| 24 | +. | ||
| 25 | + | ||
| 26 | +public define Maybe(One) | ||
| 27 | + generate_message_header | ||
| 28 | + ( | ||
| 29 | + Stream stream, | ||
| 30 | + DS_Message ds_message //type description | ||
| 31 | + )= | ||
| 32 | + write_string(stream, | ||
| 33 | +"/* | ||
| 34 | + * Created by 伝作 (Densaku) | ||
| 35 | + * Types & Messages generator written by フランスのトトロ aka (David RENÉ) | ||
| 36 | + * Date: "+_Int_to_ISO_8601_date(now)+" | ||
| 37 | + * Time: "+_Int_to_ISO_8601_time(now)+" | ||
| 38 | + * | ||
| 39 | + */ | ||
| 40 | + | ||
| 41 | +transmit system/muscle.anubis | ||
| 42 | +transmit system/convert.anubis | ||
| 43 | +transmit tools/basis.anubis | ||
| 44 | + | ||
| 45 | +" + | ||
| 46 | + insert_read_foreign_type(ds_message)+ | ||
| 47 | +"\n" | ||
| 48 | + ) | ||
| 49 | + . | ||
| 50 | + |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ aka (David RENÉ) | ||
| 4 | + * Date: 23/01/2017 | ||
| 5 | + * Time: 23:00 | ||
| 6 | + * © Calexium | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +read tools/basis.anubis | ||
| 10 | +read tools/streams.anubis | ||
| 11 | +read tools/ISO-8601.anubis | ||
| 12 | +read system/string.anubis | ||
| 13 | +read densaku_lib/types/ds_message.anubis | ||
| 14 | +read types_messages.anubis | ||
| 15 | + | ||
| 16 | +public define Maybe(One) | ||
| 17 | + generate_message_message_description | ||
| 18 | + ( | ||
| 19 | + Stream stream, | ||
| 20 | + DS_Message ds_message //type description | ||
| 21 | + )= | ||
| 22 | + since ds_message is ds_message(message_name, _, fields), | ||
| 23 | + with title = message_name+" message format", | ||
| 24 | + write_string(stream, | ||
| 25 | +"\n"+ | ||
| 26 | +" "+title+"\n"+ | ||
| 27 | +" "+fill(length(title), '=')+"\n\n"+ | ||
| 28 | +// insert_type_message_description(ds_type)+ | ||
| 29 | +"\n" | ||
| 30 | + ) | ||
| 31 | +. | ||
| 32 | + | ||
| 33 | + public define String | ||
| 34 | + anb_type_to_message | ||
| 35 | + ( | ||
| 36 | + String type_msg, | ||
| 37 | + DS_Anubis_Type anb_type, | ||
| 38 | + String name | ||
| 39 | + )= | ||
| 40 | + with arg_name = "_"+to_lower(name), | ||
| 41 | + if anb_type is | ||
| 42 | + { | ||
| 43 | + one then | ||
| 44 | + "add_string("+type_msg+", \""+name+"\", "+arg_name+")", | ||
| 45 | + bool then | ||
| 46 | + "add_bool("+type_msg+", \""+name+"\", "+arg_name+")", | ||
| 47 | + int then | ||
| 48 | + "add_string("+type_msg+", \""+name+"\", to_String("+arg_name+"))", | ||
| 49 | + string then | ||
| 50 | + "add_string("+type_msg+", \""+name+"\", "+arg_name+")", | ||
| 51 | + float then | ||
| 52 | + "add_float("+type_msg+", \""+name+"\", "+arg_name+")", | ||
| 53 | + ds_type(type_name) then | ||
| 54 | + "add_message("+type_msg+", \""+name+"\", to_Message("+arg_name+"))", | ||
| 55 | + extern_type(type_name, _) then //external type. No need to check | ||
| 56 | + "add_message("+type_msg+", \""+name+"\", to_Message("+arg_name+"))", | ||
| 57 | + } | ||
| 58 | +. | ||
| 59 | + | ||
| 60 | +define String | ||
| 61 | + generate_fields_to_message | ||
| 62 | + ( | ||
| 63 | + String indent, | ||
| 64 | + String message_msg, | ||
| 65 | + List(DS_Field) fields | ||
| 66 | + )= | ||
| 67 | + if fields is | ||
| 68 | + { | ||
| 69 | + [] then "\n", | ||
| 70 | + [h . t] then | ||
| 71 | + since h is field(field_name, b_list, anb_type, comment), | ||
| 72 | + with name = to_lower(field_name), | ||
| 73 | + indent +"// [type = "+(if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+"] "+name+"\n"+ | ||
| 74 | + (if b_list is list then | ||
| 75 | + indent +"map_forget(("+dump(anb_type)+ " _"+name+") |-> "+anb_type_to_message(message_msg, anb_type, field_name, name)+", __"+name+")" | ||
| 76 | + else | ||
| 77 | + indent +"forget("+anb_type_to_message(message_msg, anb_type, field_name, name)+")") | ||
| 78 | + + ";\n" + | ||
| 79 | + generate_fields_to_message(indent, message_msg, t) | ||
| 80 | + } | ||
| 81 | +. | ||
| 82 | + | ||
| 83 | +define String | ||
| 84 | + argument_list_from_fields | ||
| 85 | + ( | ||
| 86 | + String indent, | ||
| 87 | + List(DS_Field) fields | ||
| 88 | + )= | ||
| 89 | + if fields is | ||
| 90 | + { | ||
| 91 | + [] then "", | ||
| 92 | + [h . t] then | ||
| 93 | + since h is field(name, b_list, anb_type, comment), | ||
| 94 | + indent+(if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+" _"+to_lower(name)+ | ||
| 95 | + (if is_empty(t) then "" else ",")+ | ||
| 96 | + (if comment is comment(comment_str) then " //"+comment_str else "")+"\n"+ | ||
| 97 | + argument_list_from_fields(indent, t) | ||
| 98 | + } | ||
| 99 | +. | ||
| 100 | + | ||
| 101 | +public define Maybe(One) | ||
| 102 | + generate_to_message | ||
| 103 | + ( | ||
| 104 | + Stream stream, | ||
| 105 | + DS_Message ds_message //type description | ||
| 106 | + )= | ||
| 107 | + since ds_message is ds_message(message_name, what_code, fields), | ||
| 108 | + | ||
| 109 | + with lower_message_name = "_"+to_lower(message_name), | ||
| 110 | + message_msg = lower_message_name+"_message", | ||
| 111 | + write_string(stream, | ||
| 112 | + | ||
| 113 | +"public define Message\n"+ | ||
| 114 | +" make_"+message_name+"\n"+ | ||
| 115 | +" (\n"+ | ||
| 116 | +argument_list_from_fields(" ", fields)+ | ||
| 117 | +" )=\n"+ | ||
| 118 | +" with "+message_msg+" = message("+what_code+"), //\n"+ | ||
| 119 | +" forget(add_string("+message_msg+", \"__MSG__\", \""+what_code+"\"));\n\n"+ | ||
| 120 | +//" if "+lower_message_name+" is\n"+ | ||
| 121 | +generate_fields_to_message(" ", message_msg, fields) + | ||
| 122 | +//" };\n"+ | ||
| 123 | +" "+message_msg+"\n"+ | ||
| 124 | +".\n\n" | ||
| 125 | + ) | ||
| 126 | +. | ||
| 127 | + | ||
| 128 | +/****************************** FROM MESSAGE ***********************************/ | ||
| 129 | + | ||
| 130 | + | ||
| 131 | +define String | ||
| 132 | + generate_fields_from_message | ||
| 133 | + ( | ||
| 134 | + String indent, | ||
| 135 | + String type_msg, | ||
| 136 | + List(DS_Field) fields, | ||
| 137 | + Var(Int) brace_counter | ||
| 138 | + )= | ||
| 139 | + if fields is | ||
| 140 | + { | ||
| 141 | + [] then "", | ||
| 142 | + [h . t] then | ||
| 143 | + since h is field(field_name, b_list, anb_type, comment), | ||
| 144 | + with name = "_"+to_lower(field_name), | ||
| 145 | + indent + "// [Field's type = "+(if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+"] Field's name '"+field_name+"'\n"+ | ||
| 146 | + (if b_list is list then | ||
| 147 | + anb_type_list_from_message(indent, type_msg, anb_type, field_name, name, brace_counter) | ||
| 148 | + else | ||
| 149 | + anb_type_from_message(indent, type_msg, anb_type, field_name, name, brace_counter)) | ||
| 150 | + + | ||
| 151 | + generate_fields_from_message(indent, type_msg, t, brace_counter) | ||
| 152 | + | ||
| 153 | + } | ||
| 154 | +. | ||
| 155 | + | ||
| 156 | +define String | ||
| 157 | + anonymous_aggregat_from_fields | ||
| 158 | + ( | ||
| 159 | + List(DS_Field) fields | ||
| 160 | + )= | ||
| 161 | + if fields is | ||
| 162 | + { | ||
| 163 | + [] then "", | ||
| 164 | + [h . t] then | ||
| 165 | + since h is field(name, b_list, anb_type, comment), | ||
| 166 | + (if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+" _"+to_lower(name)+ | ||
| 167 | + (if is_empty(t) then "" else ", ")+ | ||
| 168 | + //(if comment is comment(comment_str) then " //"+comment_str else "")+"\n"+ | ||
| 169 | + anonymous_aggregat_from_fields(t) | ||
| 170 | + } | ||
| 171 | +. | ||
| 172 | + | ||
| 173 | +define String | ||
| 174 | + anonymous_aggregat_value_from_fields | ||
| 175 | + ( | ||
| 176 | + List(DS_Field) fields | ||
| 177 | + )= | ||
| 178 | + join(", ", map((DS_Field field) |-> "_"+to_lower(field.field_name), fields)). | ||
| 179 | + | ||
| 180 | + if fields is | ||
| 181 | + { | ||
| 182 | + [] then "", | ||
| 183 | + [h . t] then | ||
| 184 | + since h is field(name, b_list, anb_type, comment), | ||
| 185 | + (if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+" _"+to_lower(name)+ | ||
| 186 | + (if is_empty(t) then "" else ", ")+ | ||
| 187 | + //(if comment is comment(comment_str) then " //"+comment_str else "")+"\n"+ | ||
| 188 | + anonymous_aggregat_from_fields(t) | ||
| 189 | + } | ||
| 190 | +. | ||
| 191 | +public define Maybe(One) | ||
| 192 | +/* generate the function which return Maybe(anonymous aggregat) from message. | ||
| 193 | + * the aggregat contain all types used to construct the message | ||
| 194 | + */ | ||
| 195 | + | ||
| 196 | + generate_from_message | ||
| 197 | + ( | ||
| 198 | + Stream stream, //the file in which we write | ||
| 199 | + DS_Message ds_message //type description | ||
| 200 | + )= | ||
| 201 | + | ||
| 202 | + since ds_message is ds_message(message_name, what_code, fields), | ||
| 203 | + with brace_counter = (Var(Int))var(0), | ||
| 204 | + lower_message_name = "_"+to_lower(message_name), | ||
| 205 | + message_msg = lower_message_name+"_message", | ||
| 206 | + | ||
| 207 | + write_string(stream, | ||
| 208 | +"public define Maybe(("+anonymous_aggregat_from_fields(fields)+"))\n"+ | ||
| 209 | +" get_"+message_name+"\n"+ | ||
| 210 | +" (\n"+ | ||
| 211 | +" Message "+message_msg+"\n"+ | ||
| 212 | +" )=\n"+ | ||
| 213 | +" if find_string("+message_msg+", \"__MSG__\") is {failure then failure, success(__msg__) then\n"+ | ||
| 214 | +" if __msg__ = \""+what_code+"\" then \n"+ | ||
| 215 | +with fields_from_message = generate_fields_from_message(" ",message_msg, fields, brace_counter), | ||
| 216 | +fields_from_message+ | ||
| 217 | +" success(("+anonymous_aggregat_value_from_fields(fields)+"))\n"+ | ||
| 218 | +" "+fill(*brace_counter, '}') +"\n"+ | ||
| 219 | +" else\n"+ | ||
| 220 | +" failure //No valid message found !\n"+ | ||
| 221 | +" }\n"+ | ||
| 222 | +".\n\n" | ||
| 223 | + ) | ||
| 224 | +. |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ aka (David RENÉ) | ||
| 4 | + * Date: 23/01/2017 | ||
| 5 | + * Time: 10:09 | ||
| 6 | + * © Calexium | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +read generation/message_header.anubis | ||
| 10 | +read generation/message_messages.anubis | ||
| 11 | + | ||
| 12 | +read system/files.anubis | ||
| 13 | +read system/string.anubis | ||
| 14 | +read tools/streams.anubis | ||
| 15 | +read tools/basis.anubis | ||
| 16 | +read densaku_lib/types/ds_message.anubis | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +define Maybe(One) | ||
| 20 | + make_message_file | ||
| 21 | + ( | ||
| 22 | + DS_Message ds_message, //type description | ||
| 23 | + String dest_dir | ||
| 24 | + ) | ||
| 25 | + = | ||
| 26 | + since ds_message is ds_message(name, _, fields), | ||
| 27 | + println("Generating file for message ["+name+"]"); | ||
| 28 | + //TODO here replace all files by one with collection name | ||
| 29 | + with file_name = dest_dir+"messages/generated/"+to_lower(name)+".anubis", | ||
| 30 | + | ||
| 31 | + //create all necessary directories if doesn't exist. | ||
| 32 | + make_directories(file_name); | ||
| 33 | + | ||
| 34 | + if file(file_name, new) is | ||
| 35 | + { | ||
| 36 | + failure then println("can't create file "+file_name);failure, | ||
| 37 | + success(fd) then | ||
| 38 | + with strm = make_stream(fd), | ||
| 39 | + if generate_message_header(strm, ds_message) is { failure then failure, success(_) then | ||
| 40 | +// if generate_type(strm, ds_message) is { failure then failure, success(_) then | ||
| 41 | + if generate_message_message_description(strm, ds_message) is { failure then failure, success(_) then | ||
| 42 | + if generate_to_message(strm, ds_message) is { failure then failure, success(_) then | ||
| 43 | + if generate_from_message(strm, ds_message) is { failure then failure, success(_) then | ||
| 44 | + | ||
| 45 | + success(unique)}}}}//} | ||
| 46 | + } | ||
| 47 | +. | ||
| 48 | + | ||
| 49 | +public define One | ||
| 50 | + make_all_messages | ||
| 51 | + ( | ||
| 52 | + List(DS_Message) messages, | ||
| 53 | + String destination_dir | ||
| 54 | + )= | ||
| 55 | + map_forget((DS_Message message) |-> since message is ds_message(message_name, what_code, ds_fields), | ||
| 56 | + println("generating message file for Message ["+message_name+"]"); | ||
| 57 | + make_message_file(message, destination_dir), messages) | ||
| 58 | +. |
src/generation/types_header.anubis
| @@ -16,7 +16,6 @@ read densaku_lib/types/ds_types.anubis | @@ -16,7 +16,6 @@ read densaku_lib/types/ds_types.anubis | ||
| 16 | public define String | 16 | public define String |
| 17 | insert_read_foreign_type | 17 | insert_read_foreign_type |
| 18 | ( | 18 | ( |
| 19 | -// Stream stream, | ||
| 20 | DS_Type sd_type //type description | 19 | DS_Type sd_type //type description |
| 21 | )= | 20 | )= |
| 22 | with foreign_type_list = get_all_extern_type(sd_type), | 21 | with foreign_type_list = get_all_extern_type(sd_type), |
| @@ -41,6 +40,7 @@ public define Maybe(One) | @@ -41,6 +40,7 @@ public define Maybe(One) | ||
| 41 | transmit system/muscle.anubis | 40 | transmit system/muscle.anubis |
| 42 | transmit system/convert.anubis | 41 | transmit system/convert.anubis |
| 43 | transmit tools/basis.anubis | 42 | transmit tools/basis.anubis |
| 43 | + | ||
| 44 | " + | 44 | " + |
| 45 | insert_read_foreign_type(sd_type)+ | 45 | insert_read_foreign_type(sd_type)+ |
| 46 | "\n" | 46 | "\n" |
src/generation/types_messages.anubis
| @@ -40,29 +40,30 @@ public define Maybe(One) | @@ -40,29 +40,30 @@ public define Maybe(One) | ||
| 40 | ) | 40 | ) |
| 41 | . | 41 | . |
| 42 | 42 | ||
| 43 | -define String | 43 | +public define String |
| 44 | anb_type_to_message | 44 | anb_type_to_message |
| 45 | ( | 45 | ( |
| 46 | String type_msg, | 46 | String type_msg, |
| 47 | DS_Anubis_Type anb_type, | 47 | DS_Anubis_Type anb_type, |
| 48 | + String field_name, | ||
| 48 | String name | 49 | String name |
| 49 | )= | 50 | )= |
| 50 | if anb_type is | 51 | if anb_type is |
| 51 | { | 52 | { |
| 52 | one then | 53 | one then |
| 53 | - "add_string("+type_msg+", \""+name+"\", _"+name+")", | 54 | + "add_string("+type_msg+", \""+field_name+"\", _"+name+")", |
| 54 | bool then | 55 | bool then |
| 55 | - "add_bool("+type_msg+", \""+name+"\", _"+name+")", | 56 | + "add_bool("+type_msg+", \""+field_name+"\", _"+name+")", |
| 56 | int then | 57 | int then |
| 57 | - "add_string("+type_msg+", \""+name+"\", to_String(_"+name+"))", | 58 | + "add_string("+type_msg+", \""+field_name+"\", to_String(_"+name+"))", |
| 58 | string then | 59 | string then |
| 59 | - "add_string("+type_msg+", \""+name+"\", _"+name+")", | 60 | + "add_string("+type_msg+", \""+field_name+"\", _"+name+")", |
| 60 | float then | 61 | float then |
| 61 | - "add_float("+type_msg+", \""+name+"\", _"+name+")", | 62 | + "add_float("+type_msg+", \""+field_name+"\", _"+name+")", |
| 62 | ds_type(type_name) then | 63 | ds_type(type_name) then |
| 63 | - "add_message("+type_msg+", \""+name+"\", to_Message(_"+name+"))", | 64 | + "add_message("+type_msg+", \""+field_name+"\", to_Message(_"+name+"))", |
| 64 | extern_type(type_name, _) then //external type. No need to check | 65 | extern_type(type_name, _) then //external type. No need to check |
| 65 | - "add_message("+type_msg+", \""+name+"\", to_Message(_"+name+"))", | 66 | + "add_message("+type_msg+", \""+field_name+"\", to_Message(_"+name+"))", |
| 66 | } | 67 | } |
| 67 | . | 68 | . |
| 68 | 69 | ||
| @@ -82,9 +83,9 @@ define String | @@ -82,9 +83,9 @@ define String | ||
| 82 | ";\n"+ | 83 | ";\n"+ |
| 83 | prefix +"// [type = "+(if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+"] "+alt_name+"."+name+"\n"+ | 84 | prefix +"// [type = "+(if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+"] "+alt_name+"."+name+"\n"+ |
| 84 | (if b_list is list then | 85 | (if b_list is list then |
| 85 | - prefix +"map_forget(("+dump(anb_type)+ " _"+name+") |-> "+anb_type_to_message(type_msg, anb_type, name)+", __"+name+")" | 86 | + prefix +"map_forget(("+dump(anb_type)+ " _"+name+") |-> "+anb_type_to_message(type_msg, anb_type, name, name)+", __"+name+")" |
| 86 | else | 87 | else |
| 87 | - prefix +"forget("+anb_type_to_message(type_msg, anb_type, name)+")") | 88 | + prefix +"forget("+anb_type_to_message(type_msg, anb_type, name, name)+")") |
| 88 | + | 89 | + |
| 89 | generate_component_to_message(prefix, type_msg, alt_name, t) | 90 | generate_component_to_message(prefix, type_msg, alt_name, t) |
| 90 | } | 91 | } |
| @@ -165,7 +166,7 @@ public define Maybe(One) | @@ -165,7 +166,7 @@ public define Maybe(One) | ||
| 165 | 166 | ||
| 166 | /****************************** FROM MESSAGE ***********************************/ | 167 | /****************************** FROM MESSAGE ***********************************/ |
| 167 | 168 | ||
| 168 | -define String | 169 | +public define String |
| 169 | /* anb_type_list_from_message | 170 | /* anb_type_list_from_message |
| 170 | * Generate the function which get the list of the target type ie. Bool, complex type, etc. | 171 | * Generate the function which get the list of the target type ie. Bool, complex type, etc. |
| 171 | * To do so, we get in the given Message, all fields with the name and encoded type of expected type. | 172 | * To do so, we get in the given Message, all fields with the name and encoded type of expected type. |
| @@ -181,6 +182,7 @@ define String | @@ -181,6 +182,7 @@ define String | ||
| 181 | String indent, | 182 | String indent, |
| 182 | String type_msg, | 183 | String type_msg, |
| 183 | DS_Anubis_Type anb_type, | 184 | DS_Anubis_Type anb_type, |
| 185 | + String field_name, | ||
| 184 | String name, | 186 | String name, |
| 185 | Var(Int) brace_counter | 187 | Var(Int) brace_counter |
| 186 | )= | 188 | )= |
| @@ -189,32 +191,33 @@ define String | @@ -189,32 +191,33 @@ define String | ||
| 189 | //empty then indent + "with " + name + " = map_escape(( String str ) |-> (Maybe(String)) from_Message(msg), find_strings("+type_msg+", \""+name+"\")),\n", | 191 | //empty then indent + "with " + name + " = map_escape(( String str ) |-> (Maybe(String)) from_Message(msg), find_strings("+type_msg+", \""+name+"\")),\n", |
| 190 | one then | 192 | one then |
| 191 | brace_counter <- *brace_counter + 1; | 193 | brace_counter <- *brace_counter + 1; |
| 192 | - indent + "with mb_" + name + " = map_escape((Message msg) |-> (Maybe("+dump(anb_type)+ ")) from_Message(msg), find_messages("+type_msg+", \""+name+"\")),\n"+ | 194 | + indent + "with mb_" + name + " = map_escape((Message msg) |-> (Maybe("+dump(anb_type)+ ")) from_Message(msg), find_messages("+type_msg+", \""+field_name+"\")),\n"+ |
| 193 | indent + " if mb_" + name + " is {failure then failure, success("+ name + ") then \n", | 195 | indent + " if mb_" + name + " is {failure then failure, success("+ name + ") then \n", |
| 194 | - bool then indent + "with " + name + " = find_bool_list("+type_msg+", \""+name+"\"),\n", | 196 | + bool then indent + "with " + name + " = find_bool_list("+type_msg+", \""+field_name+"\"),\n", |
| 195 | int then | 197 | int then |
| 196 | brace_counter <- *brace_counter + 1; | 198 | brace_counter <- *brace_counter + 1; |
| 197 | - indent + "with mb_" + name + " = map_escape((String int_str) |-> decimal_scan(int_str), find_string_list("+type_msg+", \""+name+"\")),\n"+ | 199 | + indent + "with mb_" + name + " = map_escape((String int_str) |-> decimal_scan(int_str), find_string_list("+type_msg+", \""+field_name+"\")),\n"+ |
| 198 | indent + " if mb_" + name + " is {failure then failure, success("+ name + ") then \n", | 200 | indent + " if mb_" + name + " is {failure then failure, success("+ name + ") then \n", |
| 199 | - string then indent + "with " + name + " = find_string_list("+type_msg+", \""+name+"\"),\n", | ||
| 200 | - float then indent + "with " + name + " = find_float_list("+type_msg+", \""+name+"\"),\n", | 201 | + 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", | ||
| 201 | ds_type(type_name) then | 203 | ds_type(type_name) then |
| 202 | brace_counter <- *brace_counter + 1; | 204 | brace_counter <- *brace_counter + 1; |
| 203 | - indent +"with mb_"+name+" = map_escape(( Message msg ) |-> (Maybe("+dump(anb_type)+ ")) from_Message(msg), find_message_list("+type_msg+", \""+name+"\")),\n"+ | 205 | + indent +"with mb_"+name+" = map_escape(( Message msg ) |-> (Maybe("+dump(anb_type)+ ")) from_Message(msg), find_message_list("+type_msg+", \""+field_name+"\")),\n"+ |
| 204 | indent +" if mb_"+name+" is {failure then failure, success("+name+") then\n", | 206 | indent +" if mb_"+name+" is {failure then failure, success("+name+") then\n", |
| 205 | extern_type(type_name, _) then | 207 | extern_type(type_name, _) then |
| 206 | brace_counter <- *brace_counter + 1; | 208 | brace_counter <- *brace_counter + 1; |
| 207 | - indent +"with mb_"+name+" = map_escape(( Message msg ) |-> (Maybe("+dump(anb_type)+ ")) from_Message(msg), find_message_list("+type_msg+", \""+name+"\")),\n"+ | 209 | + indent +"with mb_"+name+" = map_escape(( Message msg ) |-> (Maybe("+dump(anb_type)+ ")) from_Message(msg), find_message_list("+type_msg+", \""+field_name+"\")),\n"+ |
| 208 | indent +" if mb_"+name+" is {failure then failure, success("+name+") then\n" | 210 | indent +" if mb_"+name+" is {failure then failure, success("+name+") then\n" |
| 209 | } | 211 | } |
| 210 | . | 212 | . |
| 211 | 213 | ||
| 212 | -define String | 214 | +public define String |
| 213 | anb_type_from_message | 215 | anb_type_from_message |
| 214 | ( | 216 | ( |
| 215 | String indent, | 217 | String indent, |
| 216 | String type_msg, | 218 | String type_msg, |
| 217 | DS_Anubis_Type anb_type, | 219 | DS_Anubis_Type anb_type, |
| 220 | + String field_name, | ||
| 218 | String name, | 221 | String name, |
| 219 | Var(Int) brace_counter | 222 | Var(Int) brace_counter |
| 220 | )= | 223 | )= |
| @@ -222,27 +225,27 @@ define String | @@ -222,27 +225,27 @@ define String | ||
| 222 | { | 225 | { |
| 223 | one then | 226 | one then |
| 224 | brace_counter <- (*brace_counter + 1); | 227 | brace_counter <- (*brace_counter + 1); |
| 225 | - indent + "if find_string("+type_msg+", \""+name+"\")"+" is {failure then failure, success(_) then with "+name+" = unique,\n", | 228 | + indent + "if find_string("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success(_) then with "+name+" = unique,\n", |
| 226 | bool then | 229 | bool then |
| 227 | brace_counter <- (*brace_counter + 1); | 230 | brace_counter <- (*brace_counter + 1); |
| 228 | - indent + "if find_bool("+type_msg+", \""+name+"\")"+" is {failure then failure, success("+name+") then\n", | 231 | + indent + "if find_bool("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+") then\n", |
| 229 | int then | 232 | int then |
| 230 | brace_counter <- (*brace_counter + 2); | 233 | brace_counter <- (*brace_counter + 2); |
| 231 | - indent + "if find_string("+type_msg+", \""+name+"\")"+" is {failure then failure, success(_"+name+") then\n"+ | 234 | + indent + "if find_string("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success(_"+name+") then\n"+ |
| 232 | indent + " if decimal_scan(_"+name+") is { failure then failure, success("+name+") then\n", | 235 | indent + " if decimal_scan(_"+name+") is { failure then failure, success("+name+") then\n", |
| 233 | string then | 236 | string then |
| 234 | brace_counter <- (*brace_counter + 1); | 237 | brace_counter <- (*brace_counter + 1); |
| 235 | - indent + "if find_string("+type_msg+", \""+name+"\")"+" is {failure then failure, success("+name+") then\n", | 238 | + indent + "if find_string("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+") then\n", |
| 236 | float then | 239 | float then |
| 237 | brace_counter <- (*brace_counter + 1); | 240 | brace_counter <- (*brace_counter + 1); |
| 238 | - indent + "if find_float("+type_msg+", \""+name+"\)"+" is {failure then failure, success("+name+") then\n", | 241 | + indent + "if find_float("+type_msg+", \""+field_name+"\)"+" is {failure then failure, success("+name+") then\n", |
| 239 | ds_type(type_name) then | 242 | ds_type(type_name) then |
| 240 | brace_counter <- (*brace_counter + 2); | 243 | brace_counter <- (*brace_counter + 2); |
| 241 | - indent + "if find_message("+type_msg+", \""+name+"\")"+" is {failure then failure, success("+name+"_msg) then\n"+ | 244 | + indent + "if find_message("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+"_msg) then\n"+ |
| 242 | indent + " if (Maybe("+type_name+"))from_Message("+name+"_msg)"+" is {failure then failure, success("+name+") then\n", | 245 | indent + " if (Maybe("+type_name+"))from_Message("+name+"_msg)"+" is {failure then failure, success("+name+") then\n", |
| 243 | extern_type(type_name, _) then //external type. No need to check | 246 | extern_type(type_name, _) then //external type. No need to check |
| 244 | brace_counter <- (*brace_counter + 2); | 247 | brace_counter <- (*brace_counter + 2); |
| 245 | - indent + "if find_message("+type_msg+", \""+name+"\")"+" is {failure then failure, success("+name+"_msg) then\n"+ | 248 | + indent + "if find_message("+type_msg+", \""+field_name+"\")"+" is {failure then failure, success("+name+"_msg) then\n"+ |
| 246 | indent + " if (Maybe("+type_name+"))from_Message("+name+"_msg)"+" is {failure then failure, success("+name+") then\n", | 249 | indent + " if (Maybe("+type_name+"))from_Message("+name+"_msg)"+" is {failure then failure, success("+name+") then\n", |
| 247 | } | 250 | } |
| 248 | . | 251 | . |
| @@ -271,9 +274,9 @@ define String | @@ -271,9 +274,9 @@ define String | ||
| 271 | since h is component(b_list, anb_type, name, comment), | 274 | since h is component(b_list, anb_type, name, comment), |
| 272 | indent + "// [type = "+(if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+"] "+alt_name+"."+name+"\n"+ | 275 | indent + "// [type = "+(if b_list is list then "List(" else "")+dump(anb_type)+(if b_list is list then ")" else "")+"] "+alt_name+"."+name+"\n"+ |
| 273 | (if b_list is list then | 276 | (if b_list is list then |
| 274 | - anb_type_list_from_message(indent, type_msg, anb_type, name, brace_counter) | 277 | + anb_type_list_from_message(indent, type_msg, anb_type, name, name, brace_counter) |
| 275 | else | 278 | else |
| 276 | - anb_type_from_message(indent, type_msg, anb_type, name, brace_counter)) | 279 | + anb_type_from_message(indent, type_msg, anb_type, name, name, brace_counter)) |
| 277 | + | 280 | + |
| 278 | generate_component_from_message(indent, type_msg, alt_name, t, brace_counter) | 281 | generate_component_from_message(indent, type_msg, alt_name, t, brace_counter) |
| 279 | 282 |
src/main.anubis
| @@ -22,7 +22,16 @@ | @@ -22,7 +22,16 @@ | ||
| 22 | 22 | ||
| 23 | read densaku_lib/types/densaku.anubis | 23 | read densaku_lib/types/densaku.anubis |
| 24 | read generation/files.anubis | 24 | read generation/files.anubis |
| 25 | +read calexium_lib/CXM_message_constants.anubis | ||
| 25 | 26 | ||
| 27 | +public define List(DS_Message) the_messages_list = | ||
| 28 | + [ | ||
| 29 | + ds_message("Get_Domain_Name", "_CXM_DOMAIN_GET_NAME", [ | ||
| 30 | + field("SERIAL", string, comment("MF Serial number")), | ||
| 31 | + field("CXM_Key", string, comment("Calexium Key provided during the order process")), | ||
| 32 | + ]) | ||
| 33 | + ]. | ||
| 34 | + | ||
| 26 | public define List(DS_Type) the_types_list = | 35 | public define List(DS_Type) the_types_list = |
| 27 | [ | 36 | [ |
| 28 | ds_type("User_Account", [ | 37 | ds_type("User_Account", [ |
| @@ -60,6 +69,13 @@ public define List(DS_Type) the_types_list = | @@ -60,6 +69,13 @@ public define List(DS_Type) the_types_list = | ||
| 60 | component(list, ds_type("HK_Table"),"hk_tables") | 69 | component(list, ds_type("HK_Table"),"hk_tables") |
| 61 | ]) | 70 | ]) |
| 62 | ]), | 71 | ]), |
| 72 | + ds_type("HK_Database", [ | ||
| 73 | + alternative("hk_database", [ | ||
| 74 | + component(string, "name", comment("name of the database")), | ||
| 75 | + component(list, ds_type("HK_App"), "apps", comment("list of applications")) | ||
| 76 | + ]) | ||
| 77 | + ]), | ||
| 78 | + | ||
| 63 | ds_type("HK_Help_Text", [ | 79 | ds_type("HK_Help_Text", [ |
| 64 | enum("no_help_text", comment("no help text available")), | 80 | enum("no_help_text", comment("no help text available")), |
| 65 | alternative("help_text_TAG", [component(string, "tag_name", comment("TAG use with Anubis translation tool /locale/L3.anubis"))]), | 81 | alternative("help_text_TAG", [component(string, "tag_name", comment("TAG use with Anubis translation tool /locale/L3.anubis"))]), |
| @@ -70,6 +86,8 @@ public define List(DS_Type) the_types_list = | @@ -70,6 +86,8 @@ public define List(DS_Type) the_types_list = | ||
| 70 | alternative("icon16", [component(string, "name")]) | 86 | alternative("icon16", [component(string, "name")]) |
| 71 | ]), | 87 | ]), |
| 72 | ]. | 88 | ]. |
| 89 | + | ||
| 90 | + | ||
| 73 | 91 | ||
| 74 | global define One | 92 | global define One |
| 75 | takaden | 93 | takaden |
| @@ -88,5 +106,5 @@ global define One | @@ -88,5 +106,5 @@ global define One | ||
| 88 | List(String) args | 106 | List(String) args |
| 89 | )= | 107 | )= |
| 90 | //print(dump_TK_Type_list(the_types_list)). | 108 | //print(dump_TK_Type_list(the_types_list)). |
| 91 | - forget(generate_message_files(the_types_list, "")). | 109 | + forget(generate_message_files(the_types_list, the_messages_list, "")). |
| 92 | 110 |