Commit 1cfeb79a339090ab869238df96d267371ea1118d
Merge branch 'release/ANUBIS_1_19' of ssh://gitlab.anubis-lang.com:33000/anubis/…
…xlib into release/ANUBIS_1_19 # Conflicts: # web/CXM_multihost_http_server.anubis
Showing
4 changed files
with
119 additions
and
31 deletions
Show diff stats
net_services_protocols/logger_client.anubis
| ... | ... | @@ -62,8 +62,8 @@ public define One |
| 62 | 62 | forget(add_string(register_msg, "LOG_NAME", logger_name)); |
| 63 | 63 | forget(add_int32(register_msg, "FORMAT_SIZE", truncate_to_Word32(format_size))); |
| 64 | 64 | forget(add_string(register_msg, "FILE_NAME", file_name)); |
| 65 | - forget( add_int32(register_msg, "FILE_LEVEL", truncate_to_Word32(get_log_level_value(file_level)))); | |
| 66 | - forget( add_int32(register_msg, "CONS_LEVEL", truncate_to_Word32(get_log_level_value(cons_level)))); | |
| 65 | + forget( add_int32(register_msg, "FILE_LEVEL", truncate_to_Word32(to_Int(file_level)))); | |
| 66 | + forget( add_int32(register_msg, "CONS_LEVEL", truncate_to_Word32(to_Int(cons_level)))); | |
| 67 | 67 | local_net_logger("127.0.0.1", register_msg) |
| 68 | 68 | . |
| 69 | 69 | |
| ... | ... | @@ -90,7 +90,7 @@ public define One |
| 90 | 90 | String logger_name, |
| 91 | 91 | String log_string |
| 92 | 92 | )= |
| 93 | - local_net_logger("127.0.0.1", create_log_msg(uid, logger_name, log_string, get_log_level_value(level))) | |
| 93 | + local_net_logger("127.0.0.1", create_log_msg(uid, logger_name, log_string, to_Int(level))) | |
| 94 | 94 | . |
| 95 | 95 | |
| 96 | 96 | public define One | ... | ... |
web/CXM_making_a_web_site.anubis
| ... | ... | @@ -1571,6 +1571,63 @@ public define HTML_Off_Form strong(CoreAttrs attr, HTML_Off_Form content) |
| 1571 | 1571 | public define HTML_Off_Form strong(List(HTML_Off_Form) content) = html_tag("strong", [], content). |
| 1572 | 1572 | public define HTML_Off_Form strong(HTML_Off_Form content) = html_tag("strong", [], [content]). |
| 1573 | 1573 | |
| 1574 | + // <table> | |
| 1575 | +public define HTML_Off_Form table(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("table", attrs, content). | |
| 1576 | +public define HTML_Off_Form table(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("table", attrs, [content]). | |
| 1577 | +public define HTML_Off_Form table(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("table", [attr], content). | |
| 1578 | +public define HTML_Off_Form table(CoreAttrs attr, HTML_Off_Form content) = html_tag("table", [attr], [content]). | |
| 1579 | +public define HTML_Off_Form table(List(HTML_Off_Form) content) = html_tag("table", [], content). | |
| 1580 | +public define HTML_Off_Form table(HTML_Off_Form content) = html_tag("table", [], [content]). | |
| 1581 | + | |
| 1582 | + // <thead> | |
| 1583 | +public define HTML_Off_Form thead(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("thead", attrs, content). | |
| 1584 | +public define HTML_Off_Form thead(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("thead", attrs, [content]). | |
| 1585 | +public define HTML_Off_Form thead(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("thead", [attr], content). | |
| 1586 | +public define HTML_Off_Form thead(CoreAttrs attr, HTML_Off_Form content) = html_tag("thead", [attr], [content]). | |
| 1587 | +public define HTML_Off_Form thead(List(HTML_Off_Form) content) = html_tag("thead", [], content). | |
| 1588 | +public define HTML_Off_Form thead(HTML_Off_Form content) = html_tag("thead", [], [content]). | |
| 1589 | + | |
| 1590 | + // <tbody> | |
| 1591 | +public define HTML_Off_Form tbody(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tbody", attrs, content). | |
| 1592 | +public define HTML_Off_Form tbody(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tbody", attrs, [content]). | |
| 1593 | +public define HTML_Off_Form tbody(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tbody", [attr], content). | |
| 1594 | +public define HTML_Off_Form tbody(CoreAttrs attr, HTML_Off_Form content) = html_tag("tbody", [attr], [content]). | |
| 1595 | +public define HTML_Off_Form tbody(List(HTML_Off_Form) content) = html_tag("tbody", [], content). | |
| 1596 | +public define HTML_Off_Form tbody(HTML_Off_Form content) = html_tag("tbody", [], [content]). | |
| 1597 | + | |
| 1598 | + // <tfoot> | |
| 1599 | +public define HTML_Off_Form tfoot(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tfoot", attrs, content). | |
| 1600 | +public define HTML_Off_Form tfoot(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tfoot", attrs, [content]). | |
| 1601 | +public define HTML_Off_Form tfoot(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tfoot", [attr], content). | |
| 1602 | +public define HTML_Off_Form tfoot(CoreAttrs attr, HTML_Off_Form content) = html_tag("tfoot", [attr], [content]). | |
| 1603 | +public define HTML_Off_Form tfoot(List(HTML_Off_Form) content) = html_tag("tfoot", [], content). | |
| 1604 | +public define HTML_Off_Form tfoot(HTML_Off_Form content) = html_tag("tfoot", [], [content]). | |
| 1605 | + | |
| 1606 | + // <th> | |
| 1607 | +public define HTML_Off_Form th(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("th", attrs, content). | |
| 1608 | +public define HTML_Off_Form th(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("th", attrs, [content]). | |
| 1609 | +public define HTML_Off_Form th(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("th", [attr], content). | |
| 1610 | +public define HTML_Off_Form th(CoreAttrs attr, HTML_Off_Form content) = html_tag("th", [attr], [content]). | |
| 1611 | +public define HTML_Off_Form th(List(HTML_Off_Form) content) = html_tag("th", [], content). | |
| 1612 | +public define HTML_Off_Form th(HTML_Off_Form content) = html_tag("th", [], [content]). | |
| 1613 | + | |
| 1614 | + // <td> | |
| 1615 | +public define HTML_Off_Form td(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("td", attrs, content). | |
| 1616 | +public define HTML_Off_Form td(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("td", attrs, [content]). | |
| 1617 | +public define HTML_Off_Form td(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("td", [attr], content). | |
| 1618 | +public define HTML_Off_Form td(CoreAttrs attr, HTML_Off_Form content) = html_tag("td", [attr], [content]). | |
| 1619 | +public define HTML_Off_Form td(List(HTML_Off_Form) content) = html_tag("td", [], content). | |
| 1620 | +public define HTML_Off_Form td(HTML_Off_Form content) = html_tag("td", [], [content]). | |
| 1621 | + | |
| 1622 | + // <tr> | |
| 1623 | +public define HTML_Off_Form tr(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tr", attrs, content). | |
| 1624 | +public define HTML_Off_Form tr(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tr", attrs, [content]). | |
| 1625 | +public define HTML_Off_Form tr(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tr", [attr], content). | |
| 1626 | +public define HTML_Off_Form tr(CoreAttrs attr, HTML_Off_Form content) = html_tag("tr", [attr], [content]). | |
| 1627 | +public define HTML_Off_Form tr(List(HTML_Off_Form) content) = html_tag("tr", [], content). | |
| 1628 | +public define HTML_Off_Form tr(HTML_Off_Form content) = html_tag("tr", [], [content]). | |
| 1629 | + | |
| 1630 | + | |
| 1574 | 1631 | // <textarea> |
| 1575 | 1632 | public define HTML_Off_Form textarea(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("textarea", attrs, content). |
| 1576 | 1633 | public define HTML_Off_Form textarea(List(CoreAttrs) attrs, Int cols, Int rows, List(HTML_Off_Form) content) | ... | ... |
web/CXM_multihost_http_server.anubis
| ... | ... | @@ -902,7 +902,7 @@ define Maybe(ByteArray) |
| 902 | 902 | else |
| 903 | 903 | with t0 = (UTime) unow, |
| 904 | 904 | //if unow > dead_line then record_dubious_connection(connection,dead_line,dos) else |
| 905 | - if read(connection.conn, 32768, 0) is // the connection is closed after 10 minutes of inactivity | |
| 905 | + if read(connection.conn, 32768, time_out) is // read with timeout | |
| 906 | 906 | { |
| 907 | 907 | failure then println(pid + "read failed ["+to_string(result_buffer)+"]"); failure, |
| 908 | 908 | success(ba) then |
| ... | ... | @@ -938,7 +938,7 @@ define Result(Error,Word8) |
| 938 | 938 | if nth(*connection.read_pos, *connection.buffer) is |
| 939 | 939 | { |
| 940 | 940 | failure then |
| 941 | - if read_from_connexion(connection,1,600, constant_byte_array(1,0),0) is // the connection is closed after 10 minutes of inactivity | |
| 941 | + if read_from_connexion(connection,1,0, constant_byte_array(1,0),0) is | |
| 942 | 942 | { |
| 943 | 943 | failure then /*accumulate_t2(t2_tmp);*/ error(cannot_read_from_connection), |
| 944 | 944 | //record_dubious_connection(connection,dead_line,dos), |
| ... | ... | @@ -1898,7 +1898,7 @@ public define Result(Error, ByteArray) |
| 1898 | 1898 | if body_size = 0 then ok(constant_byte_array(0,0)) else |
| 1899 | 1899 | if retries =< 0 then error(cannot_read_from_connection) else |
| 1900 | 1900 | |
| 1901 | - if read_from_connexion(connection,body_size,60,constant_byte_array(body_size,0),0) is | |
| 1901 | + if read_from_connexion(connection,body_size,0,constant_byte_array(body_size,0),0) is | |
| 1902 | 1902 | { |
| 1903 | 1903 | failure then error(cannot_read_from_connection), |
| 1904 | 1904 | success(new_bytes) then | ... | ... |
web/plugin/plugin.anubis
| ... | ... | @@ -35,54 +35,85 @@ public type WEB_Plugin: |
| 35 | 35 | public define Maybe(WEB_Plugin) |
| 36 | 36 | load_plugin |
| 37 | 37 | ( |
| 38 | - String file_name | |
| 39 | - ) | |
| 40 | - = | |
| 38 | + String file_name, | |
| 39 | + (LogLevel, String) -> One logger | |
| 40 | + )= | |
| 41 | 41 | if (LoadAdm(WEB_Plugin))load_adm(file_name) is |
| 42 | 42 | { |
| 43 | - file_not_found then print("File '"+file_name+"' not found.\n\n");failure, | |
| 44 | - read_error then print("Error reading file '"+file_name+"'.\n\n");failure, | |
| 45 | - timeout then print("Timeout when loading '"+file_name+"'.\n\n");failure, | |
| 46 | - file_damaged then print("File '"+file_name+"' is damaged.\n\n");failure, | |
| 47 | - bad_version(expected,found) then print("Secondary module '"+file_name+"' doesn't have the same\n"+ | |
| 43 | + file_not_found then logger(logError, "File '"+file_name+"' not found.\n\n");failure, | |
| 44 | + read_error then logger(logError, "Error reading file '"+file_name+"'.\n\n");failure, | |
| 45 | + timeout then logger(logError, "Timeout when loading '"+file_name+"'.\n\n");failure, | |
| 46 | + file_damaged then logger(logError, "File '"+file_name+"' is damaged.\n\n");failure, | |
| 47 | + bad_version(expected,found) then logger(logError, "Secondary module '"+file_name+"' doesn't have the same\n"+ | |
| 48 | 48 | " version ("+found+") as primary module ("+expected+").\n\n");failure, |
| 49 | - wrong_type(expected,found) then print("Secondary module '"+file_name+"' has different type as expected by primary module\n");failure, | |
| 50 | - ok(ptah_plugin) then println("ptah plugin: APP ["+ptah_plugin.app_name+"] SPACE ["+ptah_plugin.space_name+"] version: "+ptah_plugin.version+" date: "+ptah_plugin.date+" loaded ");success(ptah_plugin) | |
| 51 | - }. | |
| 52 | - | |
| 49 | + wrong_type(expected,found) then logger(logError, "Secondary module '"+file_name+"' has different type as expected by primary module\n");failure, | |
| 50 | + ok(web_plugin) then logger(logInfo, "web plugin loaded: APP ["+web_plugin.app_name+"] SPACE ["+web_plugin.space_name+"] version: "+web_plugin.version+" date: "+web_plugin.date+" loaded ");success(web_plugin) | |
| 51 | + } | |
| 52 | +. | |
| 53 | + | |
| 54 | +public define Maybe(WEB_Plugin) | |
| 55 | + load_plugin | |
| 56 | + ( | |
| 57 | + String file_name | |
| 58 | + )= | |
| 59 | + load_plugin(file_name, (LogLevel lvl, String string) |-> println(to_String(lvl)+" "+string)) | |
| 60 | +. | |
| 61 | + | |
| 62 | + | |
| 53 | 63 | public define List(WEB_Plugin) |
| 54 | 64 | all_plugins |
| 55 | 65 | ( |
| 56 | - String directory, //directory where search the plugin file below | |
| 57 | - String plugin_file_mask //mask for loading plugin like "my_app_plugin_*.adm" | |
| 58 | - ) | |
| 59 | - = | |
| 66 | + String directory, //directory where search the plugin file below | |
| 67 | + String plugin_file_mask, //mask for loading plugin like "my_app_plugin_*.adm" | |
| 68 | + (LogLevel, String) -> One logger // | |
| 69 | + )= | |
| 60 | 70 | with files = directory_list(directory, plugin_file_mask), |
| 61 | - map_select((String file_name) |-> load_plugin(directory+file_name), files) | |
| 62 | - //merge_sort(all_list, migration_less) | |
| 71 | + map_select( | |
| 72 | + (String file_name) |-> | |
| 73 | + load_plugin(directory+file_name, logger) | |
| 74 | + , | |
| 75 | + files | |
| 76 | + ) | |
| 77 | +. | |
| 78 | + | |
| 79 | +public define List(WEB_Plugin) | |
| 80 | + all_plugins | |
| 81 | + ( | |
| 82 | + String directory, //directory where search the plugin file below | |
| 83 | + String plugin_file_mask //mask for loading plugin like "my_app_plugin_*.adm" | |
| 84 | + )= | |
| 85 | + all_plugins(directory, plugin_file_mask, (LogLevel lvl, String string) |-> println(to_String(lvl)+" "+string)) | |
| 63 | 86 | . |
| 64 | 87 | |
| 65 | 88 | public define Maybe(WEB_Plugin) |
| 66 | 89 | get_WEB_Plugin |
| 67 | 90 | ( |
| 68 | - List(WEB_Plugin) plugins, | |
| 69 | - String _app, | |
| 70 | - String _space | |
| 91 | + List(WEB_Plugin) plugins, | |
| 92 | + String _app, | |
| 93 | + String _space, | |
| 94 | + (LogLevel, String) -> One logger | |
| 71 | 95 | )= |
| 72 | 96 | if plugins is |
| 73 | 97 | { |
| 74 | - [] then println("get_WEB_Plugin for app ["+_app+"] space ["+_space+"] NOT FOUND");failure, | |
| 98 | + [] then logger(logError, "get_WEB_Plugin for app ["+_app+"] space ["+_space+"] NOT FOUND");failure, | |
| 75 | 99 | [h . t] then |
| 76 | 100 | if h.app_name = _app & h.space_name = _space then |
| 77 | 101 | //println("get_WEB_Plugin for app ["+_app+"] space ["+_space+"] OK"); |
| 78 | 102 | success(h) |
| 79 | 103 | else |
| 80 | - get_WEB_Plugin(t, _app, _space) | |
| 104 | + get_WEB_Plugin(t, _app, _space, logger) | |
| 81 | 105 | } |
| 82 | 106 | . |
| 83 | 107 | |
| 84 | - | |
| 85 | - | |
| 108 | +public define Maybe(WEB_Plugin) | |
| 109 | + get_WEB_Plugin | |
| 110 | + ( | |
| 111 | + List(WEB_Plugin) plugins, | |
| 112 | + String _app, | |
| 113 | + String _space | |
| 114 | + )= | |
| 115 | + get_WEB_Plugin(plugins, _app, _space, (LogLevel lvl, String string) |-> println(to_String(lvl)+" "+string)) | |
| 116 | +. | |
| 86 | 117 | |
| 87 | 118 | public define World_Left_Menu |
| 88 | 119 | get_left_menu_from_plugins | ... | ... |