diff --git a/ds_files/ds_types.anubis b/ds_files/ds_types.anubis index 0848b31..9c605f5 100644 --- a/ds_files/ds_types.anubis +++ b/ds_files/ds_types.anubis @@ -245,34 +245,40 @@ public define List(DS_Type_File) hayamiki_lib_types_description = ), ds_type_file(auto, name("hk_editor_table"), [ + ds_type("HK_Editor_Table_Cell_Attribute", [ + alternative("colspan", [ + component(int, "number") + ]), + alternative("rowspan", [ + component(int, "number") + ]) + ]), + ds_type("HK_Editor_Table_Cell", [ - enum("empty"), + alternative("empty", [ + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), + ]), alternative("column", [ + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), component(string, "column_name") ]), alternative("column_label", [ + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), component(string, "column_name") ]), alternative("label", [ + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), component(string, "label"), ]), alternative("table", [ + component(list, ds_type("HK_Editor_Table_Cell_Attribute"), "cell_attr"), component(list, ds_type("HK_Editor_Table_Line"), "lines") ]) ]), - ds_type("HK_Editor_Table_Line_Attribute", [ - alternative("colspan", [ - component(int, "number") - ]), - alternative("rowspan", [ - component(int, "number") - ]) - ]), ds_type("HK_Editor_Table_Line", [ alternative("line", [ - component(list, ds_type("HK_Editor_Table_Line_Attribute"), "line_attr"), component(list, ds_type("HK_Editor_Table_Cell"), "cells") ]) ]), @@ -286,27 +292,30 @@ public define List(DS_Type_File) hayamiki_lib_types_description = ds_type_file(auto, name("hk_form_table"), [ + ds_type("HK_Form_Table_Cell_Attribute", no_message, [ + alternative("colspan", [ + component(int, "number") + ]), + alternative("rowspan", [ + component(int, "number") + ]) + ]), + ds_type("HK_Form_Table_Cell", no_message, [ alternative("hk_form_table_cell", [ + component(list, ds_type("HK_Form_Table_Cell_Attribute"), "cell_attr"), component(extern_type("HK_Form_Entry", view_types+"hk_form_entry.anubis"), "form_entry") ]), alternative("hk_form_table_cell_table", [ + component(list, ds_type("HK_Form_Table_Cell_Attribute"), "cell_attr"), component(list, ds_type("HK_Form_Table_Line"), "form_lines") ]) ]), - ds_type("HK_Form_Table_Line_Attribute", no_message, [ - alternative("colspan", [ - component(int, "number") - ]), - alternative("rowspan", [ - component(int, "number") - ]) - ]), + ds_type("HK_Form_Table_Line", no_message, [ alternative("hk_form_table_line", [ - component(list, ds_type("HK_Form_Table_Line_Attribute"), "line_attr"), component(list, ds_type("HK_Form_Table_Cell"), "form_table_cells") ]) ]), diff --git a/view/types/hk_editor_table.anubis b/view/types/hk_editor_table.anubis index 2886da6..7f7d666 100644 --- a/view/types/hk_editor_table.anubis +++ b/view/types/hk_editor_table.anubis @@ -1,8 +1,8 @@ /* * Created by 伝作 (Densaku). * Types & Messages generator written by フランスのトトロ aka (David RENÉ) - * Date: 2017-04-25 - * Time: 19:28:19 + * Date: 2017-04-28 + * Time: 18:53:19 * */ @@ -27,37 +27,42 @@ public define Message ). +public type HK_Editor_Table_Cell_Attribute: + colspan( + Int number + ), + rowspan( + Int number + ) +. + + public type HK_Editor_Table_Cell: - empty, + empty( + List(HK_Editor_Table_Cell_Attribute) cell_attr + ), column( - String column_name + List(HK_Editor_Table_Cell_Attribute) cell_attr, + String column_name ), column_label( - String column_name + List(HK_Editor_Table_Cell_Attribute) cell_attr, + String column_name ), label( - String label + List(HK_Editor_Table_Cell_Attribute) cell_attr, + String label ), table( - List(HK_Editor_Table_Line) lines - ) -. - - -public type HK_Editor_Table_Line_Attribute: - colspan( - Int number - ), - rowspan( - Int number + List(HK_Editor_Table_Cell_Attribute) cell_attr, + List(HK_Editor_Table_Line) lines ) . public type HK_Editor_Table_Line: line( - List(HK_Editor_Table_Line_Attribute) line_attr, - List(HK_Editor_Table_Cell) cells + List(HK_Editor_Table_Cell) cells ) . @@ -68,6 +73,69 @@ public type HK_Editor_Table: ) . + HK_Editor_Table_Cell_Attribute message format + ============================================= + + +public define Message + to_Message + ( + HK_Editor_Table_Cell_Attribute _hk_editor_table_cell_attribute + )= + with _hk_editor_table_cell_attribute_message = message((Word32)0), // + forget(add_string(_hk_editor_table_cell_attribute_message, "__TYPE__", "HK_Editor_Table_Cell_Attribute")); + if _hk_editor_table_cell_attribute is + { + //Alternative colspan + colspan(_number) then + forget(add_string(_hk_editor_table_cell_attribute_message, "__TYPE_ALT__", "colspan")); + // [type = Int] colspan.number + forget(add_string(_hk_editor_table_cell_attribute_message, "number", to_String(_number))), + + //Alternative rowspan + rowspan(_number) then + forget(add_string(_hk_editor_table_cell_attribute_message, "__TYPE_ALT__", "rowspan")); + // [type = Int] rowspan.number + forget(add_string(_hk_editor_table_cell_attribute_message, "number", to_String(_number))), + + }; + _hk_editor_table_cell_attribute_message +. + +public define Maybe(HK_Editor_Table_Cell_Attribute) + from_Message + ( + Message _hk_editor_table_cell_attribute_message + )= + if find_string(_hk_editor_table_cell_attribute_message, "__TYPE__") is {failure then failure, success(__type__) then + if find_string(_hk_editor_table_cell_attribute_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then + if __type__ = "HK_Editor_Table_Cell_Attribute" then + //Alternative colspan + if __type_alt__ = "colspan" then //Alternative colspan + // [type = Int] colspan.number + if find_string(_hk_editor_table_cell_attribute_message, "number") is {failure then failure, success(__number_) then + if decimal_scan(__number_) is { failure then failure, success(_number_) then + + success(colspan(_number_)) + }} + else //Alternative rowspan + if __type_alt__ = "rowspan" then //Alternative rowspan + // [type = Int] rowspan.number + if find_string(_hk_editor_table_cell_attribute_message, "number") is {failure then failure, success(__number_) then + if decimal_scan(__number_) is { failure then failure, success(_number_) then + + success(rowspan(_number_)) + }} + else + failure //No valid Alternative found ! + else + failure //Type not found in message ! + }} +. + + + + HK_Editor_Table_Cell message format =================================== @@ -81,31 +149,41 @@ public define Message forget(add_string(_hk_editor_table_cell_message, "__TYPE__", "HK_Editor_Table_Cell")); if _hk_editor_table_cell is { - //Alternative empty (NO TYPE) - empty then - forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "empty")), + //Alternative empty + empty(__cell_attr) then + forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "empty")); + // [type = List(HK_Editor_Table_Cell_Attribute)] empty.cell_attr + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr), //Alternative column - column(_column_name) then + column(__cell_attr, _column_name) then forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "column")); + // [type = List(HK_Editor_Table_Cell_Attribute)] column.cell_attr + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr); // [type = String] column.column_name forget(add_string(_hk_editor_table_cell_message, "column_name", _column_name)), //Alternative column_label - column_label(_column_name) then + column_label(__cell_attr, _column_name) then forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "column_label")); + // [type = List(HK_Editor_Table_Cell_Attribute)] column_label.cell_attr + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr); // [type = String] column_label.column_name forget(add_string(_hk_editor_table_cell_message, "column_name", _column_name)), //Alternative label - label(_label) then + label(__cell_attr, _label) then forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "label")); + // [type = List(HK_Editor_Table_Cell_Attribute)] label.cell_attr + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr); // [type = String] label.label forget(add_string(_hk_editor_table_cell_message, "label", _label)), //Alternative table - table(__lines) then + table(__cell_attr, __lines) then forget(add_string(_hk_editor_table_cell_message, "__TYPE_ALT__", "table")); + // [type = List(HK_Editor_Table_Cell_Attribute)] table.cell_attr + map_forget((HK_Editor_Table_Cell_Attribute _cell_attr) |-> add_message(_hk_editor_table_cell_message, "cell_attr", to_Message(_cell_attr)), __cell_attr); // [type = List(HK_Editor_Table_Line)] table.lines map_forget((HK_Editor_Table_Line _lines) |-> add_message(_hk_editor_table_cell_message, "lines", to_Message(_lines)), __lines), @@ -121,100 +199,54 @@ public define Maybe(HK_Editor_Table_Cell) if find_string(_hk_editor_table_cell_message, "__TYPE__") is {failure then failure, success(__type__) then if find_string(_hk_editor_table_cell_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then if __type__ = "HK_Editor_Table_Cell" then - //Alternative empty (NO TYPE) - if __type_alt__ = "empty" then - success(empty) + //Alternative empty + if __type_alt__ = "empty" then //Alternative empty + // [type = List(HK_Editor_Table_Cell_Attribute)] empty.cell_attr + 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")), + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then + + success(empty(_cell_attr_)) + } else //Alternative column if __type_alt__ = "column" then //Alternative column + // [type = List(HK_Editor_Table_Cell_Attribute)] column.cell_attr + 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")), + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then // [type = String] column.column_name if find_string(_hk_editor_table_cell_message, "column_name") is {failure then failure, success(_column_name_) then - success(column(_column_name_)) - } + success(column(_cell_attr_, _column_name_)) + }} else //Alternative column_label if __type_alt__ = "column_label" then //Alternative column_label + // [type = List(HK_Editor_Table_Cell_Attribute)] column_label.cell_attr + 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")), + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then // [type = String] column_label.column_name if find_string(_hk_editor_table_cell_message, "column_name") is {failure then failure, success(_column_name_) then - success(column_label(_column_name_)) - } + success(column_label(_cell_attr_, _column_name_)) + }} else //Alternative label if __type_alt__ = "label" then //Alternative label + // [type = List(HK_Editor_Table_Cell_Attribute)] label.cell_attr + 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")), + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then // [type = String] label.label if find_string(_hk_editor_table_cell_message, "label") is {failure then failure, success(_label_) then - success(label(_label_)) - } + success(label(_cell_attr_, _label_)) + }} else //Alternative table if __type_alt__ = "table" then //Alternative table + // [type = List(HK_Editor_Table_Cell_Attribute)] table.cell_attr + 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")), + if mb__cell_attr_ is {failure then failure, success(_cell_attr_) then // [type = List(HK_Editor_Table_Line)] table.lines with mb__lines_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Line)) from_Message(msg), find_messages(_hk_editor_table_cell_message, "lines")), if mb__lines_ is {failure then failure, success(_lines_) then - success(table(_lines_)) - } - else - failure //No valid Alternative found ! - else - failure //Type not found in message ! - }} -. - - - - - HK_Editor_Table_Line_Attribute message format - ============================================= - - -public define Message - to_Message - ( - HK_Editor_Table_Line_Attribute _hk_editor_table_line_attribute - )= - with _hk_editor_table_line_attribute_message = message((Word32)0), // - forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE__", "HK_Editor_Table_Line_Attribute")); - if _hk_editor_table_line_attribute is - { - //Alternative colspan - colspan(_number) then - forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__", "colspan")); - // [type = Int] colspan.number - forget(add_string(_hk_editor_table_line_attribute_message, "number", to_String(_number))), - - //Alternative rowspan - rowspan(_number) then - forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__", "rowspan")); - // [type = Int] rowspan.number - forget(add_string(_hk_editor_table_line_attribute_message, "number", to_String(_number))), - - }; - _hk_editor_table_line_attribute_message -. - -public define Maybe(HK_Editor_Table_Line_Attribute) - from_Message - ( - Message _hk_editor_table_line_attribute_message - )= - if find_string(_hk_editor_table_line_attribute_message, "__TYPE__") is {failure then failure, success(__type__) then - if find_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then - if __type__ = "HK_Editor_Table_Line_Attribute" then - //Alternative colspan - if __type_alt__ = "colspan" then //Alternative colspan - // [type = Int] colspan.number - if find_string(_hk_editor_table_line_attribute_message, "number") is {failure then failure, success(__number_) then - if decimal_scan(__number_) is { failure then failure, success(_number_) then - - success(colspan(_number_)) - }} - else //Alternative rowspan - if __type_alt__ = "rowspan" then //Alternative rowspan - // [type = Int] rowspan.number - if find_string(_hk_editor_table_line_attribute_message, "number") is {failure then failure, success(__number_) then - if decimal_scan(__number_) is { failure then failure, success(_number_) then - - success(rowspan(_number_)) + success(table(_cell_attr_, _lines_)) }} else failure //No valid Alternative found ! @@ -240,10 +272,8 @@ public define Message if _hk_editor_table_line is { //Alternative line - line(__line_attr, __cells) then + line(__cells) then forget(add_string(_hk_editor_table_line_message, "__TYPE_ALT__", "line")); - // [type = List(HK_Editor_Table_Line_Attribute)] line.line_attr - map_forget((HK_Editor_Table_Line_Attribute _line_attr) |-> add_message(_hk_editor_table_line_message, "line_attr", to_Message(_line_attr)), __line_attr); // [type = List(HK_Editor_Table_Cell)] line.cells map_forget((HK_Editor_Table_Cell _cells) |-> add_message(_hk_editor_table_line_message, "cells", to_Message(_cells)), __cells), @@ -261,15 +291,12 @@ public define Maybe(HK_Editor_Table_Line) if __type__ = "HK_Editor_Table_Line" then //Alternative line if __type_alt__ = "line" then //Alternative line - // [type = List(HK_Editor_Table_Line_Attribute)] line.line_attr - 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")), - if mb__line_attr_ is {failure then failure, success(_line_attr_) then // [type = List(HK_Editor_Table_Cell)] line.cells with mb__cells_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell)) from_Message(msg), find_messages(_hk_editor_table_line_message, "cells")), if mb__cells_ is {failure then failure, success(_cells_) then - success(line(_line_attr_, _cells_)) - }} + success(line(_cells_)) + } else failure //No valid Alternative found ! else diff --git a/view/types/hk_form_table.anubis b/view/types/hk_form_table.anubis index 5e9b86f..b601787 100644 --- a/view/types/hk_form_table.anubis +++ b/view/types/hk_form_table.anubis @@ -1,8 +1,8 @@ /* * Created by 伝作 (Densaku). * Types & Messages generator written by フランスのトトロ aka (David RENÉ) - * Date: 2017-04-19 - * Time: 16:17:58 + * Date: 2017-04-28 + * Time: 18:53:20 * */ @@ -28,30 +28,31 @@ public define Message ). -public type HK_Form_Table_Cell: - hk_form_table_cell( - HK_Form_Entry form_entry +public type HK_Form_Table_Cell_Attribute: + colspan( + Int number ), - hk_form_table_cell_table( - List(HK_Form_Table_Line) form_lines + rowspan( + Int number ) . -public type HK_Form_Table_Line_Attribute: - colspan( - Int number +public type HK_Form_Table_Cell: + hk_form_table_cell( + List(HK_Form_Table_Cell_Attribute) cell_attr, + HK_Form_Entry form_entry ), - rowspan( - Int number + hk_form_table_cell_table( + List(HK_Form_Table_Cell_Attribute) cell_attr, + List(HK_Form_Table_Line) form_lines ) . public type HK_Form_Table_Line: hk_form_table_line( - List(HK_Form_Table_Line_Attribute) line_attr, - List(HK_Form_Table_Cell) form_table_cells + List(HK_Form_Table_Cell) form_table_cells ) . -- libgit2 0.21.4