Commit 95c6d5064c6062446d1d22c6b4cc3ad5a93f4df5
1 parent
8bf8743e
move line attribute to cell attribute
Showing
3 changed files
with
177 additions
and
140 deletions
Show diff stats
ds_files/ds_types.anubis
| @@ -245,34 +245,40 @@ public define List(DS_Type_File) hayamiki_lib_types_description = | @@ -245,34 +245,40 @@ public define List(DS_Type_File) hayamiki_lib_types_description = | ||
| 245 | ), | 245 | ), |
| 246 | ds_type_file(auto, name("hk_editor_table"), | 246 | ds_type_file(auto, name("hk_editor_table"), |
| 247 | [ | 247 | [ |
| 248 | + ds_type("HK_Editor_Table_Cell_Attribute", [ | ||
| 249 | + alternative("colspan", [ | ||
| 250 | + component(int, "number") | ||
| 251 | + ]), | ||
| 252 | + alternative("rowspan", [ | ||
| 253 | + component(int, "number") | ||
| 254 | + ]) | ||
| 255 | + ]), | ||
| 256 | + | ||
| 248 | ds_type("HK_Editor_Table_Cell", [ | 257 | ds_type("HK_Editor_Table_Cell", [ |
| 249 | - enum("empty"), | 258 | + alternative("empty", [ |
| 259 | + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), | ||
| 260 | + ]), | ||
| 250 | alternative("column", [ | 261 | alternative("column", [ |
| 262 | + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), | ||
| 251 | component(string, "column_name") | 263 | component(string, "column_name") |
| 252 | ]), | 264 | ]), |
| 253 | alternative("column_label", [ | 265 | alternative("column_label", [ |
| 266 | + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), | ||
| 254 | component(string, "column_name") | 267 | component(string, "column_name") |
| 255 | ]), | 268 | ]), |
| 256 | alternative("label", [ | 269 | alternative("label", [ |
| 270 | + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), | ||
| 257 | component(string, "label"), | 271 | component(string, "label"), |
| 258 | ]), | 272 | ]), |
| 259 | alternative("table", [ | 273 | alternative("table", [ |
| 274 | + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), | ||
| 260 | component(list, ds_type("HK_Editor_Table_Line"), "lines") | 275 | component(list, ds_type("HK_Editor_Table_Line"), "lines") |
| 261 | ]) | 276 | ]) |
| 262 | ]), | 277 | ]), |
| 263 | 278 | ||
| 264 | - ds_type("HK_Editor_Table_Line_Attribute", [ | ||
| 265 | - alternative("colspan", [ | ||
| 266 | - component(int, "number") | ||
| 267 | - ]), | ||
| 268 | - alternative("rowspan", [ | ||
| 269 | - component(int, "number") | ||
| 270 | - ]) | ||
| 271 | - ]), | ||
| 272 | 279 | ||
| 273 | ds_type("HK_Editor_Table_Line", [ | 280 | ds_type("HK_Editor_Table_Line", [ |
| 274 | alternative("line", [ | 281 | alternative("line", [ |
| 275 | - component(list, ds_type("HK_Editor_Table_Line_Attribute"), "line_attr"), | ||
| 276 | component(list, ds_type("HK_Editor_Table_Cell"), "cells") | 282 | component(list, ds_type("HK_Editor_Table_Cell"), "cells") |
| 277 | ]) | 283 | ]) |
| 278 | ]), | 284 | ]), |
| @@ -286,27 +292,30 @@ public define List(DS_Type_File) hayamiki_lib_types_description = | @@ -286,27 +292,30 @@ public define List(DS_Type_File) hayamiki_lib_types_description = | ||
| 286 | 292 | ||
| 287 | ds_type_file(auto, name("hk_form_table"), | 293 | ds_type_file(auto, name("hk_form_table"), |
| 288 | [ | 294 | [ |
| 295 | + ds_type("HK_Form_Table_Cell_Attribute", no_message, [ | ||
| 296 | + alternative("colspan", [ | ||
| 297 | + component(int, "number") | ||
| 298 | + ]), | ||
| 299 | + alternative("rowspan", [ | ||
| 300 | + component(int, "number") | ||
| 301 | + ]) | ||
| 302 | + ]), | ||
| 303 | + | ||
| 289 | ds_type("HK_Form_Table_Cell", no_message, [ | 304 | ds_type("HK_Form_Table_Cell", no_message, [ |
| 290 | alternative("hk_form_table_cell", [ | 305 | alternative("hk_form_table_cell", [ |
| 306 | + component(list, ds_type("HK_Form_Table_Cell_Attribute"), "cell_attr"), | ||
| 291 | component(extern_type("HK_Form_Entry", view_types+"hk_form_entry.anubis"), "form_entry") | 307 | component(extern_type("HK_Form_Entry", view_types+"hk_form_entry.anubis"), "form_entry") |
| 292 | ]), | 308 | ]), |
| 293 | alternative("hk_form_table_cell_table", [ | 309 | alternative("hk_form_table_cell_table", [ |
| 310 | + component(list, ds_type("HK_Form_Table_Cell_Attribute"), "cell_attr"), | ||
| 294 | component(list, ds_type("HK_Form_Table_Line"), "form_lines") | 311 | component(list, ds_type("HK_Form_Table_Line"), "form_lines") |
| 295 | ]) | 312 | ]) |
| 296 | ]), | 313 | ]), |
| 297 | 314 | ||
| 298 | - ds_type("HK_Form_Table_Line_Attribute", no_message, [ | ||
| 299 | - alternative("colspan", [ | ||
| 300 | - component(int, "number") | ||
| 301 | - ]), | ||
| 302 | - alternative("rowspan", [ | ||
| 303 | - component(int, "number") | ||
| 304 | - ]) | ||
| 305 | - ]), | 315 | + |
| 306 | 316 | ||
| 307 | ds_type("HK_Form_Table_Line", no_message, [ | 317 | ds_type("HK_Form_Table_Line", no_message, [ |
| 308 | alternative("hk_form_table_line", [ | 318 | alternative("hk_form_table_line", [ |
| 309 | - component(list, ds_type("HK_Form_Table_Line_Attribute"), "line_attr"), | ||
| 310 | component(list, ds_type("HK_Form_Table_Cell"), "form_table_cells") | 319 | component(list, ds_type("HK_Form_Table_Cell"), "form_table_cells") |
| 311 | ]) | 320 | ]) |
| 312 | ]), | 321 | ]), |
view/types/hk_editor_table.anubis
| 1 | /* | 1 | /* |
| 2 | * Created by 伝作 (Densaku). | 2 | * Created by 伝作 (Densaku). |
| 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) | 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) |
| 4 | - * Date: 2017-04-25 | ||
| 5 | - * Time: 19:28:19 | 4 | + * Date: 2017-04-28 |
| 5 | + * Time: 18:53:19 | ||
| 6 | * | 6 | * |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| @@ -27,37 +27,42 @@ public define Message | @@ -27,37 +27,42 @@ public define Message | ||
| 27 | ). | 27 | ). |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | +public type HK_Editor_Table_Cell_Attribute: | ||
| 31 | + colspan( | ||
| 32 | + Int number | ||
| 33 | + ), | ||
| 34 | + rowspan( | ||
| 35 | + Int number | ||
| 36 | + ) | ||
| 37 | +. | ||
| 38 | + | ||
| 39 | + | ||
| 30 | public type HK_Editor_Table_Cell: | 40 | public type HK_Editor_Table_Cell: |
| 31 | - empty, | 41 | + empty( |
| 42 | + List(HK_Editor_Table_Cell_Attribute) cell_attr | ||
| 43 | + ), | ||
| 32 | column( | 44 | column( |
| 33 | - String column_name | 45 | + List(HK_Editor_Table_Cell_Attribute) cell_attr, |
| 46 | + String column_name | ||
| 34 | ), | 47 | ), |
| 35 | column_label( | 48 | column_label( |
| 36 | - String column_name | 49 | + List(HK_Editor_Table_Cell_Attribute) cell_attr, |
| 50 | + String column_name | ||
| 37 | ), | 51 | ), |
| 38 | label( | 52 | label( |
| 39 | - String label | 53 | + List(HK_Editor_Table_Cell_Attribute) cell_attr, |
| 54 | + String label | ||
| 40 | ), | 55 | ), |
| 41 | table( | 56 | table( |
| 42 | - List(HK_Editor_Table_Line) lines | ||
| 43 | - ) | ||
| 44 | -. | ||
| 45 | - | ||
| 46 | - | ||
| 47 | -public type HK_Editor_Table_Line_Attribute: | ||
| 48 | - colspan( | ||
| 49 | - Int number | ||
| 50 | - ), | ||
| 51 | - rowspan( | ||
| 52 | - Int number | 57 | + List(HK_Editor_Table_Cell_Attribute) cell_attr, |
| 58 | + List(HK_Editor_Table_Line) lines | ||
| 53 | ) | 59 | ) |
| 54 | . | 60 | . |
| 55 | 61 | ||
| 56 | 62 | ||
| 57 | public type HK_Editor_Table_Line: | 63 | public type HK_Editor_Table_Line: |
| 58 | line( | 64 | line( |
| 59 | - List(HK_Editor_Table_Line_Attribute) line_attr, | ||
| 60 | - List(HK_Editor_Table_Cell) cells | 65 | + List(HK_Editor_Table_Cell) cells |
| 61 | ) | 66 | ) |
| 62 | . | 67 | . |
| 63 | 68 | ||
| @@ -68,6 +73,69 @@ public type HK_Editor_Table: | @@ -68,6 +73,69 @@ public type HK_Editor_Table: | ||
| 68 | ) | 73 | ) |
| 69 | . | 74 | . |
| 70 | 75 | ||
| 76 | + HK_Editor_Table_Cell_Attribute message format | ||
| 77 | + ============================================= | ||
| 78 | + | ||
| 79 | + | ||
| 80 | +public define Message | ||
| 81 | + to_Message | ||
| 82 | + ( | ||
| 83 | + HK_Editor_Table_Cell_Attribute _hk_editor_table_cell_attribute | ||
| 84 | + )= | ||
| 85 | + with _hk_editor_table_cell_attribute_message = message((Word32)0), // | ||
| 86 | + forget(add_string(_hk_editor_table_cell_attribute_message, "__TYPE__", "HK_Editor_Table_Cell_Attribute")); | ||
| 87 | + if _hk_editor_table_cell_attribute is | ||
| 88 | + { | ||
| 89 | + //Alternative colspan | ||
| 90 | + colspan(_number) then | ||
| 91 | + forget(add_string(_hk_editor_table_cell_attribute_message, "__TYPE_ALT__", "colspan")); | ||
| 92 | + // [type = Int] colspan.number | ||
| 93 | + forget(add_string(_hk_editor_table_cell_attribute_message, "number", to_String(_number))), | ||
| 94 | + | ||
| 95 | + //Alternative rowspan | ||
| 96 | + rowspan(_number) then | ||
| 97 | + forget(add_string(_hk_editor_table_cell_attribute_message, "__TYPE_ALT__", "rowspan")); | ||
| 98 | + // [type = Int] rowspan.number | ||
| 99 | + forget(add_string(_hk_editor_table_cell_attribute_message, "number", to_String(_number))), | ||
| 100 | + | ||
| 101 | + }; | ||
| 102 | + _hk_editor_table_cell_attribute_message | ||
| 103 | +. | ||
| 104 | + | ||
| 105 | +public define Maybe(HK_Editor_Table_Cell_Attribute) | ||
| 106 | + from_Message | ||
| 107 | + ( | ||
| 108 | + Message _hk_editor_table_cell_attribute_message | ||
| 109 | + )= | ||
| 110 | + if find_string(_hk_editor_table_cell_attribute_message, "__TYPE__") is {failure then failure, success(__type__) then | ||
| 111 | + if find_string(_hk_editor_table_cell_attribute_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then | ||
| 112 | + if __type__ = "HK_Editor_Table_Cell_Attribute" then | ||
| 113 | + //Alternative colspan | ||
| 114 | + if __type_alt__ = "colspan" then //Alternative colspan | ||
| 115 | + // [type = Int] colspan.number | ||
| 116 | + if find_string(_hk_editor_table_cell_attribute_message, "number") is {failure then failure, success(__number_) then | ||
| 117 | + if decimal_scan(__number_) is { failure then failure, success(_number_) then | ||
| 118 | + | ||
| 119 | + success(colspan(_number_)) | ||
| 120 | + }} | ||
| 121 | + else //Alternative rowspan | ||
| 122 | + if __type_alt__ = "rowspan" then //Alternative rowspan | ||
| 123 | + // [type = Int] rowspan.number | ||
| 124 | + if find_string(_hk_editor_table_cell_attribute_message, "number") is {failure then failure, success(__number_) then | ||
| 125 | + if decimal_scan(__number_) is { failure then failure, success(_number_) then | ||
| 126 | + | ||
| 127 | + success(rowspan(_number_)) | ||
| 128 | + }} | ||
| 129 | + else | ||
| 130 | + failure //No valid Alternative found ! | ||
| 131 | + else | ||
| 132 | + failure //Type not found in message ! | ||
| 133 | + }} | ||
| 134 | +. | ||
| 135 | + | ||
| 136 | + | ||
| 137 | + | ||
| 138 | + | ||
| 71 | HK_Editor_Table_Cell message format | 139 | HK_Editor_Table_Cell message format |
| 72 | =================================== | 140 | =================================== |
| 73 | 141 | ||
| @@ -81,31 +149,41 @@ public define Message | @@ -81,31 +149,41 @@ public define Message | ||
| 81 | forget(add_string(_hk_editor_table_cell_message, "__TYPE__", "HK_Editor_Table_Cell")); | 149 | forget(add_string(_hk_editor_table_cell_message, "__TYPE__", "HK_Editor_Table_Cell")); |
| 82 | if _hk_editor_table_cell is | 150 | if _hk_editor_table_cell is |
| 83 | { | 151 | { |
| 84 | - //Alternative empty (NO TYPE) | ||
| 85 | - empty then | ||
| 86 | - forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "empty")), | 152 | + //Alternative empty |
| 153 | + empty(__cell_attr) then | ||
| 154 | + forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "empty")); | ||
| 155 | + // [type = List(HK_Editor_Table_Cell_Attribute)] empty.cell_attr | ||
| 156 | + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr), | ||
| 87 | 157 | ||
| 88 | //Alternative column | 158 | //Alternative column |
| 89 | - column(_column_name) then | 159 | + column(__cell_attr, _column_name) then |
| 90 | forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "column")); | 160 | forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "column")); |
| 161 | + // [type = List(HK_Editor_Table_Cell_Attribute)] column.cell_attr | ||
| 162 | + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr); | ||
| 91 | // [type = String] column.column_name | 163 | // [type = String] column.column_name |
| 92 | forget(add_string(_hk_editor_table_cell_message, "column_name", _column_name)), | 164 | forget(add_string(_hk_editor_table_cell_message, "column_name", _column_name)), |
| 93 | 165 | ||
| 94 | //Alternative column_label | 166 | //Alternative column_label |
| 95 | - column_label(_column_name) then | 167 | + column_label(__cell_attr, _column_name) then |
| 96 | forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "column_label")); | 168 | forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "column_label")); |
| 169 | + // [type = List(HK_Editor_Table_Cell_Attribute)] column_label.cell_attr | ||
| 170 | + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr); | ||
| 97 | // [type = String] column_label.column_name | 171 | // [type = String] column_label.column_name |
| 98 | forget(add_string(_hk_editor_table_cell_message, "column_name", _column_name)), | 172 | forget(add_string(_hk_editor_table_cell_message, "column_name", _column_name)), |
| 99 | 173 | ||
| 100 | //Alternative label | 174 | //Alternative label |
| 101 | - label(_label) then | 175 | + label(__cell_attr, _label) then |
| 102 | forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "label")); | 176 | forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "label")); |
| 177 | + // [type = List(HK_Editor_Table_Cell_Attribute)] label.cell_attr | ||
| 178 | + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr); | ||
| 103 | // [type = String] label.label | 179 | // [type = String] label.label |
| 104 | forget(add_string(_hk_editor_table_cell_message, "label", _label)), | 180 | forget(add_string(_hk_editor_table_cell_message, "label", _label)), |
| 105 | 181 | ||
| 106 | //Alternative table | 182 | //Alternative table |
| 107 | - table(__lines) then | 183 | + table(__cell_attr, __lines) then |
| 108 | forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "table")); | 184 | forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "table")); |
| 185 | + // [type = List(HK_Editor_Table_Cell_Attribute)] table.cell_attr | ||
| 186 | + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr); | ||
| 109 | // [type = List(HK_Editor_Table_Line)] table.lines | 187 | // [type = List(HK_Editor_Table_Line)] table.lines |
| 110 | map_forget((HK_Editor_Table_Line _lines) |-> add_message(_hk_editor_table_cell_message, "lines", to_Message(_lines)), __lines), | 188 | map_forget((HK_Editor_Table_Line _lines) |-> add_message(_hk_editor_table_cell_message, "lines", to_Message(_lines)), __lines), |
| 111 | 189 | ||
| @@ -121,100 +199,54 @@ public define Maybe(HK_Editor_Table_Cell) | @@ -121,100 +199,54 @@ public define Maybe(HK_Editor_Table_Cell) | ||
| 121 | if find_string(_hk_editor_table_cell_message, "__TYPE__") is {failure then failure, success(__type__) then | 199 | if find_string(_hk_editor_table_cell_message, "__TYPE__") is {failure then failure, success(__type__) then |
| 122 | if find_string(_hk_editor_table_cell_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then | 200 | if find_string(_hk_editor_table_cell_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then |
| 123 | if __type__ = "HK_Editor_Table_Cell" then | 201 | if __type__ = "HK_Editor_Table_Cell" then |
| 124 | - //Alternative empty (NO TYPE) | ||
| 125 | - if __type_alt__ = "empty" then | ||
| 126 | - success(empty) | 202 | + //Alternative empty |
| 203 | + if __type_alt__ = "empty" then //Alternative empty | ||
| 204 | + // [type = List(HK_Editor_Table_Cell_Attribute)] empty.cell_attr | ||
| 205 | + with mb__cell_attr_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell_Attribute)) from_Message(msg), find_messages(_hk_editor_table_cell_message, "cell_attr")), | ||
| 206 | + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then | ||
| 207 | + | ||
| 208 | + success(empty(_cell_attr_)) | ||
| 209 | + } | ||
| 127 | else //Alternative column | 210 | else //Alternative column |
| 128 | if __type_alt__ = "column" then //Alternative column | 211 | if __type_alt__ = "column" then //Alternative column |
| 212 | + // [type = List(HK_Editor_Table_Cell_Attribute)] column.cell_attr | ||
| 213 | + with mb__cell_attr_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell_Attribute)) from_Message(msg), find_messages(_hk_editor_table_cell_message, "cell_attr")), | ||
| 214 | + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then | ||
| 129 | // [type = String] column.column_name | 215 | // [type = String] column.column_name |
| 130 | if find_string(_hk_editor_table_cell_message, "column_name") is {failure then failure, success(_column_name_) then | 216 | if find_string(_hk_editor_table_cell_message, "column_name") is {failure then failure, success(_column_name_) then |
| 131 | 217 | ||
| 132 | - success(column(_column_name_)) | ||
| 133 | - } | 218 | + success(column(_cell_attr_, _column_name_)) |
| 219 | + }} | ||
| 134 | else //Alternative column_label | 220 | else //Alternative column_label |
| 135 | if __type_alt__ = "column_label" then //Alternative column_label | 221 | if __type_alt__ = "column_label" then //Alternative column_label |
| 222 | + // [type = List(HK_Editor_Table_Cell_Attribute)] column_label.cell_attr | ||
| 223 | + with mb__cell_attr_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell_Attribute)) from_Message(msg), find_messages(_hk_editor_table_cell_message, "cell_attr")), | ||
| 224 | + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then | ||
| 136 | // [type = String] column_label.column_name | 225 | // [type = String] column_label.column_name |
| 137 | if find_string(_hk_editor_table_cell_message, "column_name") is {failure then failure, success(_column_name_) then | 226 | if find_string(_hk_editor_table_cell_message, "column_name") is {failure then failure, success(_column_name_) then |
| 138 | 227 | ||
| 139 | - success(column_label(_column_name_)) | ||
| 140 | - } | 228 | + success(column_label(_cell_attr_, _column_name_)) |
| 229 | + }} | ||
| 141 | else //Alternative label | 230 | else //Alternative label |
| 142 | if __type_alt__ = "label" then //Alternative label | 231 | if __type_alt__ = "label" then //Alternative label |
| 232 | + // [type = List(HK_Editor_Table_Cell_Attribute)] label.cell_attr | ||
| 233 | + with mb__cell_attr_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell_Attribute)) from_Message(msg), find_messages(_hk_editor_table_cell_message, "cell_attr")), | ||
| 234 | + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then | ||
| 143 | // [type = String] label.label | 235 | // [type = String] label.label |
| 144 | if find_string(_hk_editor_table_cell_message, "label") is {failure then failure, success(_label_) then | 236 | if find_string(_hk_editor_table_cell_message, "label") is {failure then failure, success(_label_) then |
| 145 | 237 | ||
| 146 | - success(label(_label_)) | ||
| 147 | - } | 238 | + success(label(_cell_attr_, _label_)) |
| 239 | + }} | ||
| 148 | else //Alternative table | 240 | else //Alternative table |
| 149 | if __type_alt__ = "table" then //Alternative table | 241 | if __type_alt__ = "table" then //Alternative table |
| 242 | + // [type = List(HK_Editor_Table_Cell_Attribute)] table.cell_attr | ||
| 243 | + with mb__cell_attr_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell_Attribute)) from_Message(msg), find_messages(_hk_editor_table_cell_message, "cell_attr")), | ||
| 244 | + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then | ||
| 150 | // [type = List(HK_Editor_Table_Line)] table.lines | 245 | // [type = List(HK_Editor_Table_Line)] table.lines |
| 151 | with mb__lines_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Line)) from_Message(msg), find_messages(_hk_editor_table_cell_message, "lines")), | 246 | with mb__lines_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Line)) from_Message(msg), find_messages(_hk_editor_table_cell_message, "lines")), |
| 152 | if mb__lines_ is {failure then failure, success(_lines_) then | 247 | if mb__lines_ is {failure then failure, success(_lines_) then |
| 153 | 248 | ||
| 154 | - success(table(_lines_)) | ||
| 155 | - } | ||
| 156 | - else | ||
| 157 | - failure //No valid Alternative found ! | ||
| 158 | - else | ||
| 159 | - failure //Type not found in message ! | ||
| 160 | - }} | ||
| 161 | -. | ||
| 162 | - | ||
| 163 | - | ||
| 164 | - | ||
| 165 | - | ||
| 166 | - HK_Editor_Table_Line_Attribute message format | ||
| 167 | - ============================================= | ||
| 168 | - | ||
| 169 | - | ||
| 170 | -public define Message | ||
| 171 | - to_Message | ||
| 172 | - ( | ||
| 173 | - HK_Editor_Table_Line_Attribute _hk_editor_table_line_attribute | ||
| 174 | - )= | ||
| 175 | - with _hk_editor_table_line_attribute_message = message((Word32)0), // | ||
| 176 | - forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE__", "HK_Editor_Table_Line_Attribute")); | ||
| 177 | - if _hk_editor_table_line_attribute is | ||
| 178 | - { | ||
| 179 | - //Alternative colspan | ||
| 180 | - colspan(_number) then | ||
| 181 | - forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__", "colspan")); | ||
| 182 | - // [type = Int] colspan.number | ||
| 183 | - forget(add_string(_hk_editor_table_line_attribute_message, "number", to_String(_number))), | ||
| 184 | - | ||
| 185 | - //Alternative rowspan | ||
| 186 | - rowspan(_number) then | ||
| 187 | - forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__", "rowspan")); | ||
| 188 | - // [type = Int] rowspan.number | ||
| 189 | - forget(add_string(_hk_editor_table_line_attribute_message, "number", to_String(_number))), | ||
| 190 | - | ||
| 191 | - }; | ||
| 192 | - _hk_editor_table_line_attribute_message | ||
| 193 | -. | ||
| 194 | - | ||
| 195 | -public define Maybe(HK_Editor_Table_Line_Attribute) | ||
| 196 | - from_Message | ||
| 197 | - ( | ||
| 198 | - Message _hk_editor_table_line_attribute_message | ||
| 199 | - )= | ||
| 200 | - if find_string(_hk_editor_table_line_attribute_message, "__TYPE__") is {failure then failure, success(__type__) then | ||
| 201 | - if find_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then | ||
| 202 | - if __type__ = "HK_Editor_Table_Line_Attribute" then | ||
| 203 | - //Alternative colspan | ||
| 204 | - if __type_alt__ = "colspan" then //Alternative colspan | ||
| 205 | - // [type = Int] colspan.number | ||
| 206 | - if find_string(_hk_editor_table_line_attribute_message, "number") is {failure then failure, success(__number_) then | ||
| 207 | - if decimal_scan(__number_) is { failure then failure, success(_number_) then | ||
| 208 | - | ||
| 209 | - success(colspan(_number_)) | ||
| 210 | - }} | ||
| 211 | - else //Alternative rowspan | ||
| 212 | - if __type_alt__ = "rowspan" then //Alternative rowspan | ||
| 213 | - // [type = Int] rowspan.number | ||
| 214 | - if find_string(_hk_editor_table_line_attribute_message, "number") is {failure then failure, success(__number_) then | ||
| 215 | - if decimal_scan(__number_) is { failure then failure, success(_number_) then | ||
| 216 | - | ||
| 217 | - success(rowspan(_number_)) | 249 | + success(table(_cell_attr_, _lines_)) |
| 218 | }} | 250 | }} |
| 219 | else | 251 | else |
| 220 | failure //No valid Alternative found ! | 252 | failure //No valid Alternative found ! |
| @@ -240,10 +272,8 @@ public define Message | @@ -240,10 +272,8 @@ public define Message | ||
| 240 | if _hk_editor_table_line is | 272 | if _hk_editor_table_line is |
| 241 | { | 273 | { |
| 242 | //Alternative line | 274 | //Alternative line |
| 243 | - line(__line_attr, __cells) then | 275 | + line(__cells) then |
| 244 | forget(add_string(_hk_editor_table_line_message, "__TYPE_ALT__", "line")); | 276 | forget(add_string(_hk_editor_table_line_message, "__TYPE_ALT__", "line")); |
| 245 | - // [type = List(HK_Editor_Table_Line_Attribute)] line.line_attr | ||
| 246 | - map_forget((HK_Editor_Table_Line_Attribute _line_attr) |-> add_message(_hk_editor_table_line_message, "line_attr", to_Message(_line_attr)), __line_attr); | ||
| 247 | // [type = List(HK_Editor_Table_Cell)] line.cells | 277 | // [type = List(HK_Editor_Table_Cell)] line.cells |
| 248 | map_forget((HK_Editor_Table_Cell _cells) |-> add_message(_hk_editor_table_line_message, "cells", to_Message(_cells)), __cells), | 278 | map_forget((HK_Editor_Table_Cell _cells) |-> add_message(_hk_editor_table_line_message, "cells", to_Message(_cells)), __cells), |
| 249 | 279 | ||
| @@ -261,15 +291,12 @@ public define Maybe(HK_Editor_Table_Line) | @@ -261,15 +291,12 @@ public define Maybe(HK_Editor_Table_Line) | ||
| 261 | if __type__ = "HK_Editor_Table_Line" then | 291 | if __type__ = "HK_Editor_Table_Line" then |
| 262 | //Alternative line | 292 | //Alternative line |
| 263 | if __type_alt__ = "line" then //Alternative line | 293 | if __type_alt__ = "line" then //Alternative line |
| 264 | - // [type = List(HK_Editor_Table_Line_Attribute)] line.line_attr | ||
| 265 | - with mb__line_attr_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Line_Attribute)) from_Message(msg), find_messages(_hk_editor_table_line_message, "line_attr")), | ||
| 266 | - if mb__line_attr_ is {failure then failure, success(_line_attr_) then | ||
| 267 | // [type = List(HK_Editor_Table_Cell)] line.cells | 294 | // [type = List(HK_Editor_Table_Cell)] line.cells |
| 268 | with mb__cells_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell)) from_Message(msg), find_messages(_hk_editor_table_line_message, "cells")), | 295 | with mb__cells_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell)) from_Message(msg), find_messages(_hk_editor_table_line_message, "cells")), |
| 269 | if mb__cells_ is {failure then failure, success(_cells_) then | 296 | if mb__cells_ is {failure then failure, success(_cells_) then |
| 270 | 297 | ||
| 271 | - success(line(_line_attr_, _cells_)) | ||
| 272 | - }} | 298 | + success(line(_cells_)) |
| 299 | + } | ||
| 273 | else | 300 | else |
| 274 | failure //No valid Alternative found ! | 301 | failure //No valid Alternative found ! |
| 275 | else | 302 | else |
view/types/hk_form_table.anubis
| 1 | /* | 1 | /* |
| 2 | * Created by 伝作 (Densaku). | 2 | * Created by 伝作 (Densaku). |
| 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) | 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) |
| 4 | - * Date: 2017-04-19 | ||
| 5 | - * Time: 16:17:58 | 4 | + * Date: 2017-04-28 |
| 5 | + * Time: 18:53:20 | ||
| 6 | * | 6 | * |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| @@ -28,30 +28,31 @@ public define Message | @@ -28,30 +28,31 @@ public define Message | ||
| 28 | ). | 28 | ). |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | -public type HK_Form_Table_Cell: | ||
| 32 | - hk_form_table_cell( | ||
| 33 | - HK_Form_Entry form_entry | 31 | +public type HK_Form_Table_Cell_Attribute: |
| 32 | + colspan( | ||
| 33 | + Int number | ||
| 34 | ), | 34 | ), |
| 35 | - hk_form_table_cell_table( | ||
| 36 | - List(HK_Form_Table_Line) form_lines | 35 | + rowspan( |
| 36 | + Int number | ||
| 37 | ) | 37 | ) |
| 38 | . | 38 | . |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | -public type HK_Form_Table_Line_Attribute: | ||
| 42 | - colspan( | ||
| 43 | - Int number | 41 | +public type HK_Form_Table_Cell: |
| 42 | + hk_form_table_cell( | ||
| 43 | + List(HK_Form_Table_Cell_Attribute) cell_attr, | ||
| 44 | + HK_Form_Entry form_entry | ||
| 44 | ), | 45 | ), |
| 45 | - rowspan( | ||
| 46 | - Int number | 46 | + hk_form_table_cell_table( |
| 47 | + List(HK_Form_Table_Cell_Attribute) cell_attr, | ||
| 48 | + List(HK_Form_Table_Line) form_lines | ||
| 47 | ) | 49 | ) |
| 48 | . | 50 | . |
| 49 | 51 | ||
| 50 | 52 | ||
| 51 | public type HK_Form_Table_Line: | 53 | public type HK_Form_Table_Line: |
| 52 | hk_form_table_line( | 54 | hk_form_table_line( |
| 53 | - List(HK_Form_Table_Line_Attribute) line_attr, | ||
| 54 | - List(HK_Form_Table_Cell) form_table_cells | 55 | + List(HK_Form_Table_Cell) form_table_cells |
| 55 | ) | 56 | ) |
| 56 | . | 57 | . |
| 57 | 58 |