Commit 5c7cd864b6cc8232c2e719fe3a1e3740288cc0e2

Authored by totoro
1 parent 7e965783

Update the API call with message list

Showing 2 changed files with 71 additions and 9 deletions   Show diff stats
ds_generator.anubis
@@ -12,7 +12,7 @@ transmit types/densaku.anubis @@ -12,7 +12,7 @@ transmit types/densaku.anubis
12 12
13 public type DS_Generator_API: 13 public type DS_Generator_API:
14 ds_api( 14 ds_api(
15 - ((List(DS_Type), String) -> Maybe(One)) generate_type_files). 15 + ((List(DS_Type), List(DS_Message), String) -> Maybe(One)) generate_type_files).
16 16
17 public define Maybe(DS_Generator_API) 17 public define Maybe(DS_Generator_API)
18 load_ds_generator 18 load_ds_generator
types/ds_message.anubis
@@ -7,23 +7,78 @@ @@ -7,23 +7,78 @@
7 */ 7 */
8 8
9 transmit densaku_lib/types/ds_types.anubis 9 transmit densaku_lib/types/ds_types.anubis
10 - 10 +read system/string.anubis
  11 +read tools/list.anubis
  12 +read tools/basis.anubis
  13 +read system/lists.anubis
11 14
12 public type DS_Field: 15 public type DS_Field:
13 field( 16 field(
14 String field_name, 17 String field_name,
  18 + Bool_List list, //'list' if the component is a list, otherwise 'none'
15 DS_Anubis_Type field_type, 19 DS_Anubis_Type field_type,
16 DS_Comment comment 20 DS_Comment comment
17 ). 21 ).
18 22
19 public type DS_Message: 23 public type DS_Message:
20 ds_message( 24 ds_message(
21 - Word32 what_code, //if what_code is not provided, it's considered as value 0  
22 - String message_name, //if message_name is not provided, it's consired as empty "" 25 + String message_name,
  26 + String what_code, //if what_code is not provided, it's considered as value 0
23 List(DS_Field) fields 27 List(DS_Field) fields
24 - ), 28 + ).
  29 +
  30 + /****************** ********************/
  31 +
  32 +public define DS_Field
  33 + field
  34 + (
  35 + String field_name,
  36 + DS_Anubis_Type field_type,
  37 + DS_Comment comment
  38 + )=
  39 + field(field_name, none, field_type, comment)
  40 +.
  41 +
  42 + /****************** ********************/
  43 +
  44 +define List(Extern_type)
  45 + extract_extern_type
  46 + (
  47 + List(DS_Field) field,
  48 + List(Extern_type) so_far
  49 + )=
  50 + if field is
  51 + {
  52 + [] then so_far,
  53 + [h . t] then
  54 + since h is field(_, _, _anb_type, _),
  55 +
  56 + if _anb_type is ds_type(_type_name) then
  57 + extract_extern_type(
  58 + t, append_once(so_far, extern(_type_name, "types/generated/"+to_lower(_type_name)+".anubis")))
  59 +
  60 + else if _anb_type is extern_type(_type_name, read_file) then
  61 + extract_extern_type(
  62 + t, append_once(so_far, extern(_type_name, read_file)))
  63 + else
  64 + extract_extern_type(t, so_far)
  65 + }
  66 +.
  67 +
  68 +public define List(Extern_type)
  69 + get_all_extern_type
  70 + (
  71 + DS_Message ds_message
  72 + )=
  73 + since ds_message is ds_message(_, _, fields_list),
  74 + extract_extern_type(fields_list, [])
  75 +.
  76 +
  77 + /*********************************************************************************************/
25 ds_message( 78 ds_message(
26 - Word32 what_code, 79 + String name,
  80 + String what_code,
  81 + //Word32 what_code,
27 String message_name, 82 String message_name,
28 DS_Anubis_Type from_type 83 DS_Anubis_Type from_type
29 ). 84 ).
@@ -38,8 +93,15 @@ public type DS_Message: @@ -38,8 +93,15 @@ public type DS_Message:
38 field(field_name("tables"), field_type(ds_type("HK_Table")), list, comment("List of tables of that application contained in message id _HK_TABLE")) 93 field(field_name("tables"), field_type(ds_type("HK_Table")), list, comment("List of tables of that application contained in message id _HK_TABLE"))
39 ]). 94 ]).
40 95
41 -public define List(DS_Message) the_message_list = 96 +
  97 + ds_message("Get_Domain_Name", what(_CXM_DOMAIN_GET_NAME),
42 [ 98 [
43 - ds_message((Word32)0, "_HK_APP", ds_type("HK_App"))  
44 - ]. 99 + field(field_name("SERIAL"), field_type(string), comment("MF Serial number")),
  100 + field(field_name("CXM_Key"), field_type(ds_type("HK_Icon")), comment("Calexium Key provided during the order process")),
  101 + ]
  102 +
  103 + Message msg_set_Get_Domain_Name(String serial, String cxm_key),
  104 + (String serial, String cxm_key) msg_getGet_Domain_Name(Message msg)
45 105
  106 + net_service
  107 + _CXM_DOMAIN_GET_NAME, toto(String serial, String cxm_key)