Commit 74af23777806dd696c5ed3ba365b7b3db3fa693e
1 parent
27c7ece0
Migrating to Anubis 1.9 which biggest change is the migration from Int32 to Int or Word32.
Showing
19 changed files
with
704 additions
and
685 deletions
Show diff stats
calexium_lib/CXM_errors.anubis
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | |
| 10 | 10 | public type GeneralError: |
| 11 | 11 | ok, |
| 12 | - unknown(Int32 val), | |
| 12 | + unknown(Word32 val), | |
| 13 | 13 | bad_type, |
| 14 | 14 | bad_value, |
| 15 | 15 | bad_parameters, |
| ... | ... | @@ -20,8 +20,8 @@ public type GeneralError: |
| 20 | 20 | io_error, // general error on reading or writing from/to IO (file, socket, etc...) |
| 21 | 21 | cant_start_process. // A execute to an external process has failed |
| 22 | 22 | |
| 23 | -public define Int32 | |
| 24 | - to_Int32 | |
| 23 | +public define Word32 | |
| 24 | + to_Word32 | |
| 25 | 25 | ( |
| 26 | 26 | GeneralError e |
| 27 | 27 | ) = | ... | ... |
calexium_lib/CXM_message_constants.anubis
| ... | ... | @@ -10,66 +10,66 @@ |
| 10 | 10 | |
| 11 | 11 | // **************** PACKAGE BUILDER *************** |
| 12 | 12 | |
| 13 | -public define Int32 _CXM_PKG_MSG_BASIS = 0x33770400. // | |
| 14 | -public define Int32 _CXM_PKG_CONTAINER = 0x33770401. | |
| 15 | -public define Int32 _CXM_PKG_HEADER_PART = 0x33770402. // Header Message for Script | |
| 16 | -public define Int32 _CXM_PKG_SCRIPT_PART = 0x33770403. // Main Message for Script | |
| 17 | -public define Int32 _CXM_PKG_S_ADD_FILE = 0x33770404. // script action to add file in the destination | |
| 18 | -public define Int32 _CXM_PKG_INDEX_PART = 0x33770440. // ID of package Index part | |
| 19 | -public define Int32 _CXM_PKG_IDX_ENTRY = 0x33770441. // Index entry information | |
| 13 | +public define Word32 _CXM_PKG_MSG_BASIS = 0x33770400. // | |
| 14 | +public define Word32 _CXM_PKG_CONTAINER = 0x33770401. | |
| 15 | +public define Word32 _CXM_PKG_HEADER_PART = 0x33770402. // Header Message for Script | |
| 16 | +public define Word32 _CXM_PKG_SCRIPT_PART = 0x33770403. // Main Message for Script | |
| 17 | +public define Word32 _CXM_PKG_S_ADD_FILE = 0x33770404. // script action to add file in the destination | |
| 18 | +public define Word32 _CXM_PKG_INDEX_PART = 0x33770440. // ID of package Index part | |
| 19 | +public define Word32 _CXM_PKG_IDX_ENTRY = 0x33770441. // Index entry information | |
| 20 | 20 | |
| 21 | 21 | // **************** UPDATE SERVICE *************** |
| 22 | 22 | |
| 23 | -public define Int32 _CXM_UPDATE_SERVICE_MSG_BASIS = 0x33770800. // | |
| 24 | -public define Int32 _CXM_UPD_SERVICE_ID = 0x33770801. | |
| 25 | -public define Int32 _CXM_UPD_HAS_UPDATE = 0x33770802. // | |
| 23 | +public define Word32 _CXM_UPDATE_SERVICE_MSG_BASIS = 0x33770800. // | |
| 24 | +public define Word32 _CXM_UPD_SERVICE_ID = 0x33770801. | |
| 25 | +public define Word32 _CXM_UPD_HAS_UPDATE = 0x33770802. // | |
| 26 | 26 | |
| 27 | 27 | // **************** SERVICE NEGOCIATION *************** |
| 28 | 28 | |
| 29 | -public define Int32 _CXM_SERVICE_NEGOCIATION_BASIS = 0x33770C00. // | |
| 30 | -public define Int32 _CXM_REQUEST_FOR_SERVICE = 0x33770C01. // | |
| 29 | +public define Word32 _CXM_SERVICE_NEGOCIATION_BASIS = 0x33770C00. // | |
| 30 | +public define Word32 _CXM_REQUEST_FOR_SERVICE = 0x33770C01. // | |
| 31 | 31 | |
| 32 | 32 | // **************** GENERIC PROTOCOL *************** |
| 33 | 33 | |
| 34 | -public define Int32 _CXM_GENERIC_PROTOCOL_BASIS = 0x33771000. // | |
| 35 | -public define Int32 _CXM_ACK = 0x33771001. // | |
| 36 | -public define Int32 _CXM_ACK_RESULT_MSG = 0x33771002. // | |
| 34 | +public define Word32 _CXM_GENERIC_PROTOCOL_BASIS = 0x33771000. // | |
| 35 | +public define Word32 _CXM_ACK = 0x33771001. // | |
| 36 | +public define Word32 _CXM_ACK_RESULT_MSG = 0x33771002. // | |
| 37 | 37 | |
| 38 | 38 | // **************** FTP SERVICE *************** |
| 39 | 39 | |
| 40 | -public define Int32 _CXM_FTP_SERVICE_MSG_BASIS = 0x33771400. // | |
| 41 | -public define Int32 _CXM_FTP_SERVICE_ID = 0x33771401. | |
| 42 | -public define Int32 _CXM_FTP_GET_FILE = 0x33771402. | |
| 43 | -public define Int32 _CXM_FTP_START_TRANSFERT = 0x33771403. | |
| 44 | -public define Int32 _CXM_FTP_DATA = 0x33771404. | |
| 40 | +public define Word32 _CXM_FTP_SERVICE_MSG_BASIS = 0x33771400. // | |
| 41 | +public define Word32 _CXM_FTP_SERVICE_ID = 0x33771401. | |
| 42 | +public define Word32 _CXM_FTP_GET_FILE = 0x33771402. | |
| 43 | +public define Word32 _CXM_FTP_START_TRANSFERT = 0x33771403. | |
| 44 | +public define Word32 _CXM_FTP_DATA = 0x33771404. | |
| 45 | 45 | |
| 46 | 46 | // ************** LOGGER SERVICE ************** |
| 47 | 47 | |
| 48 | -public define Int32 _CXM_LOGGER_SERVICE_MSG_BASIS = 0x33771800. // | |
| 49 | -public define Int32 _CXM_LOGGER_SERVICE_ID = 0x33771801. | |
| 50 | -public define Int32 _CXM_LOGGER_LOG = 0x33771802. | |
| 48 | +public define Word32 _CXM_LOGGER_SERVICE_MSG_BASIS = 0x33771800. // | |
| 49 | +public define Word32 _CXM_LOGGER_SERVICE_ID = 0x33771801. | |
| 50 | +public define Word32 _CXM_LOGGER_LOG = 0x33771802. | |
| 51 | 51 | |
| 52 | 52 | // ************** DOMAIN SERVICE ************** |
| 53 | 53 | |
| 54 | 54 | // MF <-> DomainManager |
| 55 | -public define Int32 _CXM_DOMAIN_SERVICE_MSG_BASIS = 0x33771C00. // | |
| 56 | -public define Int32 _CXM_DOMAIN_SERVICE_ID = 0x33771C01. | |
| 57 | -public define Int32 _CXM_DOMAIN_PUBLISH_MF_CONFIG = 0x33771C02. | |
| 58 | -public define Int32 _CXM_DOMAIN_GET_NAME = 0x33771C03. | |
| 59 | -public define Int32 _CXM_DOMAIN_GET_MY_IP = 0x33771C04. | |
| 60 | -public define Int32 _CXM_DOMAIN_PUBLISH_MY_IP = 0x33771C05. | |
| 61 | -public define Int32 _CXM_DOMAIN_PUBLISH_DYN_TEST = 0x33771C06. | |
| 62 | -public define Int32 _CXM_DOMAIN_GET_STATUS = 0x33771C07. | |
| 63 | -public define Int32 _CXM_DOMAIN_GET_DOMAIN_INFO = 0x33771C08. | |
| 55 | +public define Word32 _CXM_DOMAIN_SERVICE_MSG_BASIS = 0x33771C00. // | |
| 56 | +public define Word32 _CXM_DOMAIN_SERVICE_ID = 0x33771C01. | |
| 57 | +public define Word32 _CXM_DOMAIN_PUBLISH_MF_CONFIG = 0x33771C02. | |
| 58 | +public define Word32 _CXM_DOMAIN_GET_NAME = 0x33771C03. | |
| 59 | +public define Word32 _CXM_DOMAIN_GET_MY_IP = 0x33771C04. | |
| 60 | +public define Word32 _CXM_DOMAIN_PUBLISH_MY_IP = 0x33771C05. | |
| 61 | +public define Word32 _CXM_DOMAIN_PUBLISH_DYN_TEST = 0x33771C06. | |
| 62 | +public define Word32 _CXM_DOMAIN_GET_STATUS = 0x33771C07. | |
| 63 | +public define Word32 _CXM_DOMAIN_GET_DOMAIN_INFO = 0x33771C08. | |
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | // DomainManager <-> Gandi |
| 67 | -public define Int32 _CXM_GANDI_SERVICE_ID = 0x33771D00. | |
| 68 | -public define Int32 _CXM_GANDI_CHECK_AVAILABILITY = 0x33771D01. // 'NAME' (String): Base names (without extension) of the wanted domains | |
| 67 | +public define Word32 _CXM_GANDI_SERVICE_ID = 0x33771D00. | |
| 68 | +public define Word32 _CXM_GANDI_CHECK_AVAILABILITY = 0x33771D01. // 'NAME' (String): Base names (without extension) of the wanted domains | |
| 69 | 69 | // --> CXM_ACK with 'DOMAINS' (String): Array of avaiblable domains |
| 70 | -public define Int32 _CXM_GANDI_CREATE_CONTACT = 0x33771D02. // 'CLASS' (String): | |
| 70 | +public define Word32 _CXM_GANDI_CREATE_CONTACT = 0x33771D02. // 'CLASS' (String): | |
| 71 | 71 | // 'FIRSTNAME', 'LASTNAME', 'ADDRESS', 'ZIPCODE', 'CITY', 'COUNTRY', 'PHONE', 'EMAIL' (String) |
| 72 | 72 | // --> CXM_ACK with 'CONTACT_HANDLE' (String): Created handle for this contact |
| 73 | -public define Int32 _CXM_GANDI_CREATE_DOMAIN = 0x33771D03. // 'DOMAIN' (String): Domain full name | |
| 73 | +public define Word32 _CXM_GANDI_CREATE_DOMAIN = 0x33771D03. // 'DOMAIN' (String): Domain full name | |
| 74 | 74 | // 'OWNER' (String): Owner handle |
| 75 | 75 | // --> CXM_ACK with 'DOMAIN_HANDLE' (String): Created handle for this domain | ... | ... |
calexium_lib/database/db_utils.anubis
| ... | ... | @@ -19,7 +19,7 @@ define Result(SQLite3Error, SQLite3HeadersOrRow -> SQLite3Row) |
| 19 | 19 | ( |
| 20 | 20 | SQLite3DataBase db, |
| 21 | 21 | String sql_command, |
| 22 | - Int32 timeout | |
| 22 | + Int timeout | |
| 23 | 23 | ) = |
| 24 | 24 | |
| 25 | 25 | if sql_query(db, sql_command) is |
| ... | ... | @@ -101,17 +101,17 @@ public define List(String) |
| 101 | 101 | db_get_string_list(table_cursor, [s . so_far]) |
| 102 | 102 | }. |
| 103 | 103 | |
| 104 | -public define List(Int32) | |
| 104 | +public define List(Int) | |
| 105 | 105 | db_get_integer_list |
| 106 | 106 | ( |
| 107 | 107 | SQLite3HeadersOrRow -> SQLite3Row table_cursor, |
| 108 | - List(Int32) so_far | |
| 108 | + List(Int) so_far | |
| 109 | 109 | ) = |
| 110 | 110 | if table_cursor(next_row) is |
| 111 | 111 | { |
| 112 | 112 | error(sql_error) then logError("DB", db_error(sql_error, "db_get_integer_list")); reverse(so_far), |
| 113 | 113 | no_more_row then reverse(so_far), //can't find the symbol in the table, because the row is empty |
| 114 | 114 | row(explorer) then |
| 115 | - with s = (Int32)db_integer(explorer)(0), | |
| 115 | + with s = (Int)db_integer(explorer)(0), | |
| 116 | 116 | db_get_integer_list(table_cursor, [s . so_far]) |
| 117 | 117 | }. | ... | ... |
calexium_lib/net_services/CXM_generic_client.anubis
| ... | ... | @@ -22,10 +22,10 @@ read calexium_lib/net_services/CXM_generic_protocol.anubis |
| 22 | 22 | |
| 23 | 23 | // --Generic types--------------------------------------------------------------------- |
| 24 | 24 | public type NetServiceAnswer: |
| 25 | - netservice_error (Int32 cmd, | |
| 26 | - Int32 result_code, | |
| 25 | + netservice_error (Word32 cmd, | |
| 26 | + Word32 result_code, | |
| 27 | 27 | String result_string), |
| 28 | - netservice_ok (Int32 cmd, | |
| 28 | + netservice_ok (Word32 cmd, | |
| 29 | 29 | Maybe(Message) result_msg). |
| 30 | 30 | |
| 31 | 31 | // --Generic functions--------------------------------------------------------------------- |
| ... | ... | @@ -36,7 +36,7 @@ public define Maybe(NetServiceAnswer) |
| 36 | 36 | ( |
| 37 | 37 | MessageQueue queue, |
| 38 | 38 | Message msg_to_send, |
| 39 | - Int32 timeout, | |
| 39 | + Int timeout, | |
| 40 | 40 | (String) -> One logger |
| 41 | 41 | )= |
| 42 | 42 | queue.add_Message_to_send(msg_to_send); |
| ... | ... | @@ -66,7 +66,7 @@ public define Maybe($T) |
| 66 | 66 | generic_handler |
| 67 | 67 | ( |
| 68 | 68 | MessageQueue queue, |
| 69 | - Int32 timeout, | |
| 69 | + Int timeout, | |
| 70 | 70 | Message msg_to_send, |
| 71 | 71 | (Message) -> Maybe($T) handler, |
| 72 | 72 | (String) -> One logger |
| ... | ... | @@ -96,7 +96,7 @@ public define Maybe($T) |
| 96 | 96 | public define (MessageQueue, String) -> Maybe($T) |
| 97 | 97 | make_generic_handler |
| 98 | 98 | ( |
| 99 | - Int32 timeout, | |
| 99 | + Int timeout, | |
| 100 | 100 | Message msg_to_send, |
| 101 | 101 | (Message) -> Maybe($T) handler, |
| 102 | 102 | (String) -> One logger |
| ... | ... | @@ -108,8 +108,8 @@ define Maybe($T) |
| 108 | 108 | generic_request_for_service |
| 109 | 109 | ( |
| 110 | 110 | MessageQueue queue, |
| 111 | - Int32 service_id, | |
| 112 | - Int32 service_version, | |
| 111 | + Word32 service_id, | |
| 112 | + Word32 service_version, | |
| 113 | 113 | (MessageQueue, String) -> Maybe($T) handler, |
| 114 | 114 | (String) -> One logger |
| 115 | 115 | )= |
| ... | ... | @@ -147,10 +147,10 @@ public define Maybe($T) |
| 147 | 147 | generic_connect_to_net_service |
| 148 | 148 | ( |
| 149 | 149 | String queue_name, |
| 150 | - Int32 server, | |
| 151 | - Int32 port, | |
| 152 | - Int32 service_id, | |
| 153 | - Int32 service_version, | |
| 150 | + Word32 server, | |
| 151 | + Word32 port, | |
| 152 | + Word32 service_id, | |
| 153 | + Word32 service_version, | |
| 154 | 154 | (MessageQueue, String) -> Maybe($T) handler, |
| 155 | 155 | (String) -> One logger |
| 156 | 156 | ) | ... | ... |
calexium_lib/net_services/CXM_generic_protocol.anubis
| ... | ... | @@ -14,10 +14,10 @@ read tools/basis.anubis |
| 14 | 14 | read system/message_queue.anubis |
| 15 | 15 | read calexium_lib/CXM_message_constants.anubis |
| 16 | 16 | |
| 17 | -public define Int32 _CXM_OK = 0. | |
| 18 | -public define Int32 _CXM_ERROR = 1. | |
| 19 | -public define Int32 _CXM_UNKNOW_CMD = 2. | |
| 20 | -public define Int32 _CXM_UNKNOW_SERVICE = 3. | |
| 17 | +public define Word32 _CXM_OK = 0. | |
| 18 | +public define Word32 _CXM_ERROR = 1. | |
| 19 | +public define Word32 _CXM_UNKNOW_CMD = 2. | |
| 20 | +public define Word32 _CXM_UNKNOW_SERVICE = 3. | |
| 21 | 21 | |
| 22 | 22 | public type ProtocolResult: |
| 23 | 23 | failure, |
| ... | ... | @@ -31,8 +31,8 @@ public define One |
| 31 | 31 | send_ACK_error |
| 32 | 32 | ( |
| 33 | 33 | MessageQueue queue, |
| 34 | - Int32 cmd_id, | |
| 35 | - Int32 error_code, | |
| 34 | + Word32 cmd_id, | |
| 35 | + Word32 error_code, | |
| 36 | 36 | String error_string, |
| 37 | 37 | )= |
| 38 | 38 | with err_msg = message(_CXM_ACK), |
| ... | ... | @@ -46,7 +46,7 @@ public define One |
| 46 | 46 | send_ACK_error |
| 47 | 47 | ( |
| 48 | 48 | MessageQueue queue, |
| 49 | - Int32 cmd_id | |
| 49 | + Word32 cmd_id | |
| 50 | 50 | )= |
| 51 | 51 | send_ACK_error(queue, cmd_id, _CXM_ERROR, ""). |
| 52 | 52 | |
| ... | ... | @@ -54,7 +54,7 @@ public define One |
| 54 | 54 | send_ACK_ok |
| 55 | 55 | ( |
| 56 | 56 | MessageQueue queue, |
| 57 | - Int32 cmd_id | |
| 57 | + Word32 cmd_id | |
| 58 | 58 | )= |
| 59 | 59 | with ok_msg = message(_CXM_ACK), |
| 60 | 60 | forget(add_int32(ok_msg, "CMD", cmd_id)); |
| ... | ... | @@ -66,7 +66,7 @@ public define One |
| 66 | 66 | send_ACK_ok |
| 67 | 67 | ( |
| 68 | 68 | MessageQueue queue, |
| 69 | - Int32 cmd_id, | |
| 69 | + Word32 cmd_id, | |
| 70 | 70 | Message result |
| 71 | 71 | )= |
| 72 | 72 | with ok_msg = message(_CXM_ACK), |
| ... | ... | @@ -80,7 +80,7 @@ public define One |
| 80 | 80 | send_result |
| 81 | 81 | ( |
| 82 | 82 | MessageQueue queue, |
| 83 | - Int32 cmd_id, | |
| 83 | + Word32 cmd_id, | |
| 84 | 84 | Maybe(Message) mb_msg |
| 85 | 85 | )= |
| 86 | 86 | if mb_msg is |
| ... | ... | @@ -93,7 +93,7 @@ public define One |
| 93 | 93 | send_result |
| 94 | 94 | ( |
| 95 | 95 | MessageQueue queue, |
| 96 | - Int32 cmd_id, | |
| 96 | + Word32 cmd_id, | |
| 97 | 97 | Bool result |
| 98 | 98 | )= |
| 99 | 99 | if result then |
| ... | ... | @@ -105,8 +105,8 @@ public define ProtocolResult |
| 105 | 105 | wait_for_reply |
| 106 | 106 | ( |
| 107 | 107 | MessageQueue mQ, |
| 108 | - Int32 wait_cmd, | |
| 109 | - Int32 t_out | |
| 108 | + Word32 wait_cmd, | |
| 109 | + Int t_out | |
| 110 | 110 | ) = |
| 111 | 111 | if mQ.get_next_received_Message(t_out) is |
| 112 | 112 | { | ... | ... |
calexium_lib/net_services/CXM_net_services.anubis
| ... | ... | @@ -18,8 +18,8 @@ read calexium_lib/CXM_message_constants.anubis |
| 18 | 18 | |
| 19 | 19 | public type NetService: |
| 20 | 20 | net_service( |
| 21 | - Int32 version, | |
| 22 | - Int32 id, | |
| 21 | + Word32 version, | |
| 22 | + Word32 id, | |
| 23 | 23 | String name, |
| 24 | 24 | (MessageQueue, String, String) -> One handler // Parameters are MessageQueue, peer IP and timestamp string |
| 25 | 25 | ). |
| ... | ... | @@ -43,14 +43,14 @@ define Maybe(NetService) |
| 43 | 43 | find_service |
| 44 | 44 | ( |
| 45 | 45 | List(NetService) services_list, |
| 46 | - Int32 service_id, | |
| 47 | - Int32 service_version | |
| 46 | + Word32 service_id, | |
| 47 | + Word32 service_version | |
| 48 | 48 | )= |
| 49 | 49 | if services_list is |
| 50 | 50 | { |
| 51 | 51 | [] then failure, |
| 52 | 52 | [h.t] then |
| 53 | - if h.id = service_id & h.version >= service_version then | |
| 53 | + if h.id = service_id & h.version >=+ service_version then | |
| 54 | 54 | success(h) |
| 55 | 55 | else |
| 56 | 56 | find_service(t, service_id, service_version) |
| ... | ... | @@ -93,7 +93,7 @@ define Maybe(NetService) |
| 93 | 93 | define String |
| 94 | 94 | get_time_stamp |
| 95 | 95 | = |
| 96 | - with time = (UTime) now, | |
| 96 | + with time = (UTime) unow, | |
| 97 | 97 | "<"+virtual_machine_id+"@"+time.seconds+">". |
| 98 | 98 | |
| 99 | 99 | /** This message_received function just handle the negociation process the available net_services. |
| ... | ... | @@ -173,7 +173,7 @@ public define Maybe(Server) |
| 173 | 173 | start_net_services |
| 174 | 174 | ( |
| 175 | 175 | List(NetService) net_services, |
| 176 | - Int32 network_port, | |
| 176 | + Word32 network_port, | |
| 177 | 177 | Var(Bool) shutdown_required |
| 178 | 178 | )= |
| 179 | 179 | if start_server(0, | ... | ... |
calexium_lib/net_services_protocols/ftp_client.anubis
| ... | ... | @@ -21,8 +21,8 @@ define Maybe(One) |
| 21 | 21 | ( |
| 22 | 22 | MessageQueue mQ, |
| 23 | 23 | WStream fd, |
| 24 | - Int32 so_far, | |
| 25 | - Int32 left_read | |
| 24 | + Int so_far, | |
| 25 | + Int left_read | |
| 26 | 26 | )= |
| 27 | 27 | //println("receive_data "); |
| 28 | 28 | if mQ.get_next_received_Message(30) is |
| ... | ... | @@ -58,7 +58,7 @@ define Maybe(One) |
| 58 | 58 | ( |
| 59 | 59 | MessageQueue mQ, |
| 60 | 60 | String local_file, |
| 61 | - Int32 size | |
| 61 | + Int size | |
| 62 | 62 | )= |
| 63 | 63 | make_directories(local_file); |
| 64 | 64 | if file(local_file, new) is |
| ... | ... | @@ -96,7 +96,7 @@ define Maybe(One) |
| 96 | 96 | { |
| 97 | 97 | failure then println("file size not found"); failure, |
| 98 | 98 | success(size) then println("file size "+size); |
| 99 | - start_get_file_transtert(mQ, local_file, size) | |
| 99 | + start_get_file_transtert(mQ, local_file, to_Int(size)) | |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | }. |
| ... | ... | @@ -131,7 +131,7 @@ public define Maybe(One) |
| 131 | 131 | ftp_get_file |
| 132 | 132 | ( |
| 133 | 133 | String server, |
| 134 | - Int32 ip_port, | |
| 134 | + Word32 ip_port, | |
| 135 | 135 | String remote_file, |
| 136 | 136 | String local_file |
| 137 | 137 | )= | ... | ... |
calexium_lib/net_services_protocols/logger_service.anubis
| ... | ... | @@ -23,12 +23,12 @@ read calexium_lib/net_services/CXM_generic_protocol.anubis |
| 23 | 23 | // Special non-existing file. This is a work arround for a impossibility to define global configuration in anubis. |
| 24 | 24 | // So this file allows you to specify on which UDP port the logger server is listening. |
| 25 | 25 | // You have to provide this file in your base source directory (or any other folder which is scanned by the compilater, |
| 26 | -// and you define a function named 'logger_port' which simply return the port number as an Int32. | |
| 26 | +// and you define a function named 'logger_port' which simply return the port number as an Word32. | |
| 27 | 27 | // Example: |
| 28 | -// public define Int32 logger_port = 33610. | |
| 28 | +// public define Word32 logger_port = 33610. | |
| 29 | 29 | read logger_config.anubis |
| 30 | 30 | |
| 31 | -public define Int32 logger_srv_version = 1. | |
| 31 | +public define Word32 logger_srv_version = 1. | |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * has_update scan the given message for finding corresponding available update |
| ... | ... | @@ -75,7 +75,7 @@ define Bool |
| 75 | 75 | { |
| 76 | 76 | failure then logError(log, "process_log can't find Level");false, |
| 77 | 77 | success(thread_id) then |
| 78 | - with level = get_LogLevel_from_value(int_level), | |
| 78 | + with level = get_LogLevel_from_value(to_Int(int_level)), | |
| 79 | 79 | if level is logTrace then |
| 80 | 80 | if find_string(msg, "LogMask") is |
| 81 | 81 | { |
| ... | ... | @@ -174,14 +174,14 @@ public define String |
| 174 | 174 | data_preview |
| 175 | 175 | ( |
| 176 | 176 | ByteArray data, |
| 177 | - Int32 max | |
| 177 | + Int max | |
| 178 | 178 | ) = |
| 179 | 179 | with l = length(data), |
| 180 | 180 | firsts_bytes = extract(data, 0, max), |
| 181 | 181 | "Length=" + l + "; String='"+to_string(firsts_bytes)+"' Buffer=[" + to_ascii(firsts_bytes) + (if l > max then "...]" else "]"). |
| 182 | 182 | |
| 183 | 183 | |
| 184 | -define (UDP_Socket, ByteArray, Truncation, Int32, Int32) -> One | |
| 184 | +define (UDP_Socket, ByteArray, Truncation, Word32, Word32) -> One | |
| 185 | 185 | make_udp_handler |
| 186 | 186 | ( |
| 187 | 187 | List(Logger) logs, |
| ... | ... | @@ -191,8 +191,8 @@ define (UDP_Socket, ByteArray, Truncation, Int32, Int32) -> One |
| 191 | 191 | UDP_Socket socket, |
| 192 | 192 | ByteArray data, |
| 193 | 193 | Truncation truncation, |
| 194 | - Int32 ip_address, | |
| 195 | - Int32 ip_port | |
| 194 | + Word32 ip_address, | |
| 195 | + Word32 ip_port | |
| 196 | 196 | ) |-> |
| 197 | 197 | with ip = ip_addr_to_string(ip_address), |
| 198 | 198 | logTrace(debug_logger, logMask("Logger"), "LoggerServer: data received (" + length(data) + " bytes) from IP " + ip + "... "); |
| ... | ... | @@ -292,14 +292,14 @@ define Message |
| 292 | 292 | ( |
| 293 | 293 | String logger_name, |
| 294 | 294 | String log_string, |
| 295 | - Int32 level | |
| 295 | + Int level | |
| 296 | 296 | )= |
| 297 | 297 | with string = if length(log_string) > 1024 then (if sub_string(log_string, 0, 1024) is success(s) then s else "?") + "..." |
| 298 | 298 | else log_string, |
| 299 | 299 | with log_msg = message(_CXM_LOGGER_LOG), |
| 300 | 300 | forget(add_string(log_msg, "LogName", logger_name)); |
| 301 | 301 | forget(add_string(log_msg, "LogString", string)); |
| 302 | - forget(add_int32(log_msg, "Level", level)); | |
| 302 | + forget(add_int32(log_msg, "Level", truncate_to_Word32(level))); | |
| 303 | 303 | forget(add_int32(log_msg, "Thread", virtual_machine_id)); |
| 304 | 304 | log_msg |
| 305 | 305 | . | ... | ... |
calexium_lib/net_services_protocols/pkg_updater_protocol.anubis
calexium_lib/web/CXM_cookies.anubis
| ... | ... | @@ -12,9 +12,10 @@ |
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | read tools/basis.anubis |
| 15 | -read web/CXM_common.anubis | |
| 16 | -read web/CXM_html.anubis | |
| 17 | -read web/CXM_http_get_common.anubis | |
| 15 | +read system/string.anubis | |
| 16 | +read CXM_common.anubis | |
| 17 | +read CXM_html.anubis | |
| 18 | +read CXM_http_get_common.anubis | |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | *Overview* |
| ... | ... | @@ -30,10 +31,10 @@ public type Cookie: |
| 30 | 31 | // attributes: |
| 31 | 32 | Maybe(String) comment, // cookies may have human readable comments |
| 32 | 33 | Maybe(String) domain, // domain name as sent by the server |
| 33 | - Int32 validity, // cookie still valid if this is > now | |
| 34 | + Int validity, // cookie still valid if this is > now | |
| 34 | 35 | Maybe(String) path, // server path for which the cookie is valid |
| 35 | 36 | Bool secure, // if true, do not send this cookie over an insecure link |
| 36 | - Int32 version). // Cookie version (normally 1: rfc 2109) | |
| 37 | + Int version). // Cookie version (normally 1: rfc 2109) | |
| 37 | 38 | |
| 38 | 39 | |
| 39 | 40 | Cookies are sent by servers through 'Set-Cookie' HTTP headers. The function |
| ... | ... | @@ -123,24 +124,23 @@ define Bool |
| 123 | 124 | ( |
| 124 | 125 | Word8 c |
| 125 | 126 | ) = |
| 126 | - with n = word8_to_int32(c), | |
| 127 | - if n < 33 then false else | |
| 128 | - if n < 34 then true else | |
| 129 | - if n < 35 then false else | |
| 130 | - if n < 40 then true else | |
| 131 | - if n < 42 then false else | |
| 132 | - if n < 44 then true else | |
| 133 | - if n < 45 then false else | |
| 134 | - if n < 47 then true else | |
| 135 | - if n < 48 then false else | |
| 136 | - if n < 58 then true else | |
| 137 | - if n < 65 then false else | |
| 138 | - if n < 91 then true else | |
| 139 | - if n < 94 then false else | |
| 140 | - if n < 123 then true else | |
| 141 | - if n < 124 then false else | |
| 142 | - if n = 124 then true else | |
| 143 | - n = 126. | |
| 127 | + if c +< 33 then false else | |
| 128 | + if c +< 34 then true else | |
| 129 | + if c +< 35 then false else | |
| 130 | + if c +< 40 then true else | |
| 131 | + if c +< 42 then false else | |
| 132 | + if c +< 44 then true else | |
| 133 | + if c +< 45 then false else | |
| 134 | + if c +< 47 then true else | |
| 135 | + if c +< 48 then false else | |
| 136 | + if c +< 58 then true else | |
| 137 | + if c +< 65 then false else | |
| 138 | + if c +< 91 then true else | |
| 139 | + if c +< 94 then false else | |
| 140 | + if c +< 123 then true else | |
| 141 | + if c +< 124 then false else | |
| 142 | + if c = 124 then true else | |
| 143 | + c = 126. | |
| 144 | 144 | |
| 145 | 145 | |
| 146 | 146 | From the grammar, it is clear that atomic entities (called 'tokens' by YACC) are: |
| ... | ... | @@ -194,7 +194,7 @@ define Atom |
| 194 | 194 | |
| 195 | 195 | |
| 196 | 196 | variable String input = "". From which cookies will be read. |
| 197 | -variable Int32 index = 0. Current position within 'input'. | |
| 197 | +variable Int index = 0. Current position within 'input'. | |
| 198 | 198 | |
| 199 | 199 | define Maybe(Word8) |
| 200 | 200 | next_char |
| ... | ... | @@ -245,8 +245,7 @@ define Bool |
| 245 | 245 | ( |
| 246 | 246 | Word8 c |
| 247 | 247 | ) = |
| 248 | - with n = word8_to_int32(c), | |
| 249 | - n =< ' '. | |
| 248 | + c +=< ' '. | |
| 250 | 249 | |
| 251 | 250 | Reading an atom from the input: |
| 252 | 251 | |
| ... | ... | @@ -349,7 +348,7 @@ define Maybe(String) |
| 349 | 348 | else get_domain(t) |
| 350 | 349 | }. |
| 351 | 350 | |
| 352 | -define Int32 | |
| 351 | +define Int | |
| 353 | 352 | get_validity |
| 354 | 353 | ( |
| 355 | 354 | List(AttrVal) l |
| ... | ... | @@ -358,7 +357,7 @@ define Int32 |
| 358 | 357 | { |
| 359 | 358 | [ ] then 0, |
| 360 | 359 | [h . t] then if h is max_age(a) |
| 361 | - then if string_to_integer(a) is | |
| 360 | + then if decimal_scan(a) is | |
| 362 | 361 | { |
| 363 | 362 | failure then 0, |
| 364 | 363 | success(n) then n+now |
| ... | ... | @@ -392,7 +391,7 @@ define Bool |
| 392 | 391 | else get_secure(t) |
| 393 | 392 | }. |
| 394 | 393 | |
| 395 | -define Int32 | |
| 394 | +define Int | |
| 396 | 395 | get_version |
| 397 | 396 | ( |
| 398 | 397 | List(AttrVal) l |
| ... | ... | @@ -401,7 +400,7 @@ define Int32 |
| 401 | 400 | { |
| 402 | 401 | [ ] then 0, |
| 403 | 402 | [h . t] then if h is version(v) |
| 404 | - then if string_to_integer(v) is | |
| 403 | + then if decimal_scan(v) is | |
| 405 | 404 | { |
| 406 | 405 | failure then 0, |
| 407 | 406 | success(n) then n |
| ... | ... | @@ -562,7 +561,7 @@ define HTTP_header |
| 562 | 561 | ) = |
| 563 | 562 | if c is cookie(sn,n,v,mbc,mbd,vld,mbp,sec,ver) then |
| 564 | 563 | http_header("Cookie", |
| 565 | - "$Version=" + integer_to_string(ver) + | |
| 564 | + "$Version=" + to_decimal(ver) + | |
| 566 | 565 | ";" + n + "=\"" + v + "\"" + |
| 567 | 566 | if mbp is |
| 568 | 567 | { | ... | ... |
calexium_lib/web/CXM_generic_form.anubis
| ... | ... | @@ -28,11 +28,11 @@ public type Width: |
| 28 | 28 | small, |
| 29 | 29 | narrow, |
| 30 | 30 | wide, |
| 31 | - custom(Int32). | |
| 31 | + custom(Int). | |
| 32 | 32 | |
| 33 | 33 | public type FormFieldWidth: |
| 34 | 34 | auto, |
| 35 | - custom(Int32). | |
| 35 | + custom(Int). | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| ... | ... | @@ -42,7 +42,7 @@ public type FormField: |
| 42 | 42 | |
| 43 | 43 | //--- title field --------------------------------------------------------------------- |
| 44 | 44 | title (String text), |
| 45 | - title (Int32 text_size, | |
| 45 | + title (Int text_size, | |
| 46 | 46 | String text), |
| 47 | 47 | title_f (List(Text_Option) -> HTML_In_Form), |
| 48 | 48 | |
| ... | ... | @@ -135,8 +135,8 @@ public type FormField: |
| 135 | 135 | text_area (WebArgName web_arg_name, |
| 136 | 136 | String tag, |
| 137 | 137 | InitialValue initial_text, |
| 138 | - Int32 width, | |
| 139 | - Int32 height), | |
| 138 | + Int width, | |
| 139 | + Int height), | |
| 140 | 140 | |
| 141 | 141 | //--- fields table -------------------------------------------------------------------- |
| 142 | 142 | fields_table (String tag, |
| ... | ... | @@ -192,7 +192,7 @@ public define HTML_Off_Form |
| 192 | 192 | ( |
| 193 | 193 | String form_name, |
| 194 | 194 | RGB background_color, |
| 195 | - Int32 width, | |
| 195 | + Int width, | |
| 196 | 196 | List(FormField) fields |
| 197 | 197 | ). |
| 198 | 198 | |
| ... | ... | @@ -414,7 +414,7 @@ define HTML_Row(HTML_In_Form) |
| 414 | 414 | [ |
| 415 | 415 | cell([right,top], text([size(10)],tag)), |
| 416 | 416 | cell([width(7)], text([],"")), |
| 417 | - cell([left,top], table([],map((FormField ff) |-> format_form_field(ff),fields))) | |
| 417 | + cell([left,top], table([],map((FormField ff2) |-> format_form_field(ff2),fields))) | |
| 418 | 418 | ], |
| 419 | 419 | |
| 420 | 420 | fields_line(tag,fields) then (List(HTML_Cell(HTML_In_Form))) |
| ... | ... | @@ -422,13 +422,13 @@ define HTML_Row(HTML_In_Form) |
| 422 | 422 | cell([right,top], text([size(10)],tag)), |
| 423 | 423 | cell([width(7)], text([],"")), |
| 424 | 424 | cell([left,top], table([nude],[row([], //border(0,0,3,rgb(0,0,0)) |
| 425 | - map((FormField ff) |-> cell([top],table([nude],[format_form_field(ff)])),fields))])) | |
| 425 | + map((FormField ff2) |-> cell([top],table([nude],[format_form_field(ff2)])),fields))])) | |
| 426 | 426 | ], |
| 427 | 427 | |
| 428 | 428 | fields_line(fields) then (List(HTML_Cell(HTML_In_Form))) |
| 429 | 429 | [ |
| 430 | 430 | cell([left,top,columns(3)], table([nude],[row([], |
| 431 | - map((FormField ff) |-> cell([top],table([nude],[format_form_field(ff)])),fields))])) | |
| 431 | + map((FormField ff2) |-> cell([top],table([nude],[format_form_field(ff2)])),fields))])) | |
| 432 | 432 | ], |
| 433 | 433 | |
| 434 | 434 | preview(html_text) then (List(HTML_Cell(HTML_In_Form))) |
| ... | ... | @@ -460,7 +460,7 @@ public define HTML_Off_Form |
| 460 | 460 | ( |
| 461 | 461 | String form_name, |
| 462 | 462 | RGB bg_color, |
| 463 | - Int32 w, | |
| 463 | + Int w, | |
| 464 | 464 | List(FormField) fields |
| 465 | 465 | ) = |
| 466 | 466 | table([border(0,0,5,bg_color),percentage_width(100), | ... | ... |
calexium_lib/web/CXM_generic_table.anubis
| ... | ... | @@ -48,7 +48,7 @@ read CXM_making_a_web_site.anubis |
| 48 | 48 | +-----+----------+--------+-----------+-----------+ ............... |
| 49 | 49 | |
| 50 | 50 | For the total-line, assuming that datax1 to dataxn and datax32 to datan32 are numbers |
| 51 | - (Int32, Float or Maybe(Float)). | |
| 51 | + (Int, Float or Maybe(Float)). | |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | The columns name are just a List(Item_Row). |
| ... | ... | @@ -56,18 +56,18 @@ read CXM_making_a_web_site.anubis |
| 56 | 56 | The column 'num' is in the case you want to enumerate your data. The existence of this |
| 57 | 57 | column depends on the line function. |
| 58 | 58 | |
| 59 | - Lines are given by the function : (RGB color,Int32 num,$Data d) -> Item_Row | |
| 59 | + Lines are given by the function : (RGB color,Int num,$Data d) -> Item_Row | |
| 60 | 60 | |
| 61 | 61 | where : - (RGB)color is the color of the background of the row (the 'a color' or 'b |
| 62 | 62 | color'); |
| 63 | - - (Int32)num the number of the data (to enumerate). | |
| 63 | + - (Int)num the number of the data (to enumerate). | |
| 64 | 64 | |
| 65 | 65 | So, this function must be written something like : |
| 66 | 66 | |
| 67 | - (RGB color, Int32 num,$Data d) |-> | |
| 67 | + (RGB color, Int num,$Data d) |-> | |
| 68 | 68 | row([background_color(color)], // and of course possibly other row-options |
| 69 | 69 | [ |
| 70 | - cell([], (Int32 -> $HTML)(num) ) | |
| 70 | + cell([], (Int -> $HTML)(num) ) | |
| 71 | 71 | . ($Data -> List(Cell))d // how data is printed in cells |
| 72 | 72 | ]). |
| 73 | 73 | |
| ... | ... | @@ -125,7 +125,7 @@ public type Total_Line($Data,$Upplet,$Row): |
| 125 | 125 | scheme as a column), you must specify the number of columns. You will obtain : |
| 126 | 126 | |
| 127 | 127 | Here is a List($Data) : l = [a,b,c,d,e,f,g,h,i,j,k,l,m]; |
| 128 | - and f : (RGB,Int32,$Data) -> Item_Row | |
| 128 | + and f : (RGB,Int,$Data) -> Item_Row | |
| 129 | 129 | You want to print this list on 3 columns. |
| 130 | 130 | The result will be : |
| 131 | 131 | |
| ... | ... | @@ -151,8 +151,8 @@ public type Total_Line($Data,$Upplet,$Row): |
| 151 | 151 | |
| 152 | 152 | public type HowManyColumns: |
| 153 | 153 | _1, |
| 154 | - several (Int32 col_nb, | |
| 155 | - Int32 spacer). | |
| 154 | + several (Int col_nb, | |
| 155 | + Int spacer). | |
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | |
| ... | ... | @@ -169,7 +169,7 @@ public define HTML_Off_Form |
| 169 | 169 | List(Table_Option) lto, |
| 170 | 170 | List(HTML_Row(HTML_Off_Form)) columns_name, |
| 171 | 171 | HowManyColumns number_of_columns, |
| 172 | - (RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 172 | + (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 173 | 173 | RGB a_color, |
| 174 | 174 | RGB b_color, |
| 175 | 175 | Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line |
| ... | ... | @@ -182,7 +182,7 @@ public define HTML_In_Form |
| 182 | 182 | List(Table_Option) lto, |
| 183 | 183 | List(HTML_Row(HTML_In_Form)) columns_name, |
| 184 | 184 | HowManyColumns number_of_columns, |
| 185 | - (RGB,Int32,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 185 | + (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 186 | 186 | RGB a_color, |
| 187 | 187 | RGB b_color, |
| 188 | 188 | Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line |
| ... | ... | @@ -263,7 +263,7 @@ public define HTML_Off_Form |
| 263 | 263 | List(Table_Option) lto, |
| 264 | 264 | List(HTML_Row(HTML_Off_Form)) columns_name, |
| 265 | 265 | HowManyColumns number_of_columns, |
| 266 | - (RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 266 | + (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 267 | 267 | RGB a_color, |
| 268 | 268 | RGB b_color |
| 269 | 269 | ). |
| ... | ... | @@ -275,7 +275,7 @@ public define HTML_In_Form |
| 275 | 275 | List(Table_Option) lto, |
| 276 | 276 | List(HTML_Row(HTML_In_Form)) columns_name, |
| 277 | 277 | HowManyColumns number_of_columns, |
| 278 | - (RGB,Int32,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 278 | + (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 279 | 279 | RGB a_color, |
| 280 | 280 | RGB b_color |
| 281 | 281 | ). |
| ... | ... | @@ -319,7 +319,7 @@ type Print_Table($Data): |
| 319 | 319 | print_table |
| 320 | 320 | ( |
| 321 | 321 | $Data data, |
| 322 | - Int32 num | |
| 322 | + Int num | |
| 323 | 323 | ). |
| 324 | 324 | |
| 325 | 325 | |
| ... | ... | @@ -331,9 +331,9 @@ define (List(Print_Table($Data)),List($Data)) |
| 331 | 331 | ( |
| 332 | 332 | List($Data) l, |
| 333 | 333 | List(Print_Table($Data)) result, |
| 334 | - Int32 n, | |
| 335 | - Int32 ct, // counter | |
| 336 | - Int32 num | |
| 334 | + Int n, | |
| 335 | + Int ct, // counter | |
| 336 | + Int num | |
| 337 | 337 | ) = |
| 338 | 338 | if l is |
| 339 | 339 | { |
| ... | ... | @@ -349,8 +349,8 @@ define List(List(Print_Table($Data))) |
| 349 | 349 | short_lists |
| 350 | 350 | ( |
| 351 | 351 | List($Data) l, |
| 352 | - Int32 nb, // number of element of short list | |
| 353 | - Int32 ct // counter for numbering data (initialized at 0) | |
| 352 | + Int nb, // number of element of short list | |
| 353 | + Int ct // counter for numbering data (initialized at 0) | |
| 354 | 354 | ) = |
| 355 | 355 | if get_n_elements(l,[],nb,1,ct) is (result,unused) |
| 356 | 356 | then if unused is |
| ... | ... | @@ -367,7 +367,7 @@ define (List(HTML_Row($HTML)),$Upplet) |
| 367 | 367 | generic_rows |
| 368 | 368 | ( |
| 369 | 369 | List(Print_Table($Data)) lpt, |
| 370 | - (RGB,Int32,$Data) -> HTML_Row($HTML) line_format, | |
| 370 | + (RGB,Int,$Data) -> HTML_Row($HTML) line_format, | |
| 371 | 371 | RGB a_color, |
| 372 | 372 | RGB b_color, |
| 373 | 373 | ($Upplet,$Data) -> $Upplet do_sum, |
| ... | ... | @@ -393,13 +393,13 @@ define List(HTML_Cell(HTML_In_Form)) |
| 393 | 393 | List(List(Print_Table($Data))) print_data, |
| 394 | 394 | List(Table_Option) lto, |
| 395 | 395 | List(HTML_Row(HTML_In_Form)) names, |
| 396 | - (RGB,Int32,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 396 | + (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 397 | 397 | RGB a_color, |
| 398 | 398 | RGB b_color, |
| 399 | 399 | ($Upplet,$Data) -> $Upplet do_sum, |
| 400 | 400 | $Upplet -> HTML_Row(HTML_In_Form) total_line, |
| 401 | 401 | $Upplet value, |
| 402 | - Int32 spacer | |
| 402 | + Int spacer | |
| 403 | 403 | ) = |
| 404 | 404 | if print_data is |
| 405 | 405 | { |
| ... | ... | @@ -427,7 +427,7 @@ public define HTML_In_Form |
| 427 | 427 | List(Table_Option) lto, |
| 428 | 428 | List(HTML_Row(HTML_In_Form)) names, |
| 429 | 429 | HowManyColumns hm_col, |
| 430 | - (RGB,Int32,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 430 | + (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 431 | 431 | RGB a_color, |
| 432 | 432 | RGB b_color, |
| 433 | 433 | Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line |
| ... | ... | @@ -486,13 +486,13 @@ define List(HTML_Cell(HTML_Off_Form)) |
| 486 | 486 | List(List(Print_Table($Data))) print_data, |
| 487 | 487 | List(Table_Option) lto, |
| 488 | 488 | List(HTML_Row(HTML_Off_Form)) names, |
| 489 | - (RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 489 | + (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 490 | 490 | RGB a_color, |
| 491 | 491 | RGB b_color, |
| 492 | 492 | ($Upplet,$Data) -> $Upplet do_sum, |
| 493 | 493 | $Upplet -> HTML_Row(HTML_Off_Form) total_line, |
| 494 | 494 | $Upplet value, |
| 495 | - Int32 spacer | |
| 495 | + Int spacer | |
| 496 | 496 | ) = |
| 497 | 497 | if print_data is |
| 498 | 498 | { |
| ... | ... | @@ -520,7 +520,7 @@ public define HTML_Off_Form |
| 520 | 520 | List(Table_Option) lto, |
| 521 | 521 | List(HTML_Row(HTML_Off_Form)) names, |
| 522 | 522 | HowManyColumns hm_col, |
| 523 | - (RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 523 | + (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 524 | 524 | RGB a_color, |
| 525 | 525 | RGB b_color, |
| 526 | 526 | Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line |
| ... | ... | @@ -588,7 +588,7 @@ public define HTML_Off_Form |
| 588 | 588 | (List(Table_Option)) lto, |
| 589 | 589 | (List(HTML_Row(HTML_Off_Form))) columns_name, |
| 590 | 590 | (HowManyColumns) _1, |
| 591 | - ((RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int32 n,$Data d) |-> line_format(r,d), | |
| 591 | + ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 592 | 592 | (RGB) a_color, |
| 593 | 593 | (RGB) b_color, |
| 594 | 594 | (Total_Line($Data,$Data,HTML_Row(HTML_Off_Form))) no_total |
| ... | ... | @@ -610,7 +610,7 @@ public define HTML_In_Form |
| 610 | 610 | (List(Table_Option)) lto, |
| 611 | 611 | (List(HTML_Row(HTML_In_Form))) columns_name, |
| 612 | 612 | (HowManyColumns) _1, |
| 613 | - ((RGB,Int32,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int32 n,$Data d) |-> line_format(r,d), | |
| 613 | + ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 614 | 614 | (RGB) a_color, |
| 615 | 615 | (RGB) b_color, |
| 616 | 616 | (Total_Line($Data,$Data,HTML_Row(HTML_In_Form))) no_total |
| ... | ... | @@ -637,7 +637,7 @@ public define HTML_Off_Form |
| 637 | 637 | (List(Table_Option)) lto, |
| 638 | 638 | (List(HTML_Row(HTML_Off_Form))) columns_name, |
| 639 | 639 | (HowManyColumns) _1, |
| 640 | - ((RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int32 n,$Data d) |-> line_format(r,d), | |
| 640 | + ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 641 | 641 | (RGB) a_color, |
| 642 | 642 | (RGB) b_color, |
| 643 | 643 | (Total_Line($Data,$Upplet,(HTML_Row(HTML_Off_Form)))) total_line |
| ... | ... | @@ -660,7 +660,7 @@ public define HTML_In_Form |
| 660 | 660 | (List(Table_Option)) lto, |
| 661 | 661 | (List(HTML_Row(HTML_In_Form))) columns_name, |
| 662 | 662 | (HowManyColumns) _1, |
| 663 | - ((RGB,Int32,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int32 n,$Data d) |-> line_format(r,d), | |
| 663 | + ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 664 | 664 | (RGB) a_color, |
| 665 | 665 | (RGB) b_color, |
| 666 | 666 | (Total_Line($Data,$Upplet,(HTML_Row(HTML_In_Form)))) total_line |
| ... | ... | @@ -678,7 +678,7 @@ public define HTML_Off_Form |
| 678 | 678 | List(Table_Option) lto, |
| 679 | 679 | List(HTML_Row(HTML_Off_Form)) columns_name, |
| 680 | 680 | HowManyColumns number_of_columns, |
| 681 | - (RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 681 | + (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 682 | 682 | RGB a_color, |
| 683 | 683 | RGB b_color |
| 684 | 684 | ) = |
| ... | ... | @@ -688,7 +688,7 @@ public define HTML_Off_Form |
| 688 | 688 | (List(Table_Option)) lto, |
| 689 | 689 | (List(HTML_Row(HTML_Off_Form))) columns_name, |
| 690 | 690 | (HowManyColumns) number_of_columns, |
| 691 | - ((RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int32 n,$Data d) |-> line_format(r,n,d), | |
| 691 | + ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,n,d), | |
| 692 | 692 | (RGB) a_color, |
| 693 | 693 | (RGB) b_color, |
| 694 | 694 | (Total_Line($Data,$Data,(HTML_Row(HTML_Off_Form)))) no_total |
| ... | ... | @@ -702,7 +702,7 @@ public define HTML_In_Form |
| 702 | 702 | List(Table_Option) lto, |
| 703 | 703 | List(HTML_Row(HTML_In_Form)) columns_name, |
| 704 | 704 | HowManyColumns number_of_columns, |
| 705 | - (RGB,Int32,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 705 | + (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 706 | 706 | RGB a_color, |
| 707 | 707 | RGB b_color |
| 708 | 708 | ) = |
| ... | ... | @@ -712,7 +712,7 @@ public define HTML_In_Form |
| 712 | 712 | (List(Table_Option)) lto, |
| 713 | 713 | (List(HTML_Row(HTML_In_Form))) columns_name, |
| 714 | 714 | (HowManyColumns) number_of_columns, |
| 715 | - ((RGB,Int32,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int32 n,$Data d) |-> line_format(r,n,d), | |
| 715 | + ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,n,d), | |
| 716 | 716 | (RGB) a_color, |
| 717 | 717 | (RGB) b_color, |
| 718 | 718 | (Total_Line($Data,$Data,(HTML_Row(HTML_In_Form)))) no_total |
| ... | ... | @@ -739,7 +739,7 @@ public define HTML_Off_Form |
| 739 | 739 | (List(Table_Option)) lto, |
| 740 | 740 | (List(HTML_Row(HTML_Off_Form))) columns_name, |
| 741 | 741 | (HowManyColumns) number_of_columns, |
| 742 | - ((RGB,Int32,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int32 n,$Data d) |-> line_format(r,d), | |
| 742 | + ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 743 | 743 | (RGB) a_color, |
| 744 | 744 | (RGB) b_color, |
| 745 | 745 | (Total_Line($Data,$Data,(HTML_Row(HTML_Off_Form)))) no_total |
| ... | ... | @@ -763,7 +763,7 @@ public define HTML_In_Form |
| 763 | 763 | (List(Table_Option)) lto, |
| 764 | 764 | (List(HTML_Row(HTML_In_Form))) columns_name, |
| 765 | 765 | (HowManyColumns) number_of_columns, |
| 766 | - ((RGB,Int32,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int32 n,$Data d) |-> line_format(r,d), | |
| 766 | + ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 767 | 767 | (RGB) a_color, |
| 768 | 768 | (RGB) b_color, |
| 769 | 769 | (Total_Line($Data,$Data,(HTML_Row(HTML_In_Form)))) no_total | ... | ... |
calexium_lib/web/CXM_html.anubis
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | *Copyright* Copyright (c) Alain Prouté 2001. |
| 6 | 6 | |
| 7 | 7 | read tools/basis.anubis |
| 8 | - | |
| 8 | +read system/string.anubis | |
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | |
| ... | ... | @@ -24,7 +24,7 @@ read tools/basis.anubis |
| 24 | 24 | String value, |
| 25 | 25 | String temp_file_path). |
| 26 | 26 | |
| 27 | -read web/CXM_common.anubis | |
| 27 | +read CXM_common.anubis | |
| 28 | 28 | |
| 29 | 29 | In other words, a 'web argument' is just a pair made of the name of the argument, and |
| 30 | 30 | the value of the argument, and both are character strings. 'upload' will be explained |
| ... | ... | @@ -33,9 +33,9 @@ read web/CXM_common.anubis |
| 33 | 33 | |
| 34 | 34 | The next variable is a multipurpose counter (used to generate unique names). |
| 35 | 35 | |
| 36 | -variable Int32 web_count = 0. | |
| 36 | +variable Int web_count = 0. | |
| 37 | 37 | |
| 38 | -define Int32 | |
| 38 | +define Int | |
| 39 | 39 | new_web_count |
| 40 | 40 | = |
| 41 | 41 | web_count <- *web_count+1; |
| ... | ... | @@ -68,7 +68,7 @@ public type Web_color_name: |
| 68 | 68 | Web colors. |
| 69 | 69 | |
| 70 | 70 | public type Web_color: |
| 71 | - rgb(Int32,Int32,Int32), /* give the color by its components */ | |
| 71 | + rgb(Word8,Word8,Word8), /* give the color by its components */ | |
| 72 | 72 | _(Web_color_name). /* or by its name */ |
| 73 | 73 | |
| 74 | 74 | |
| ... | ... | @@ -78,7 +78,7 @@ public type Web_color: |
| 78 | 78 | |
| 79 | 79 | public type WebMeta: |
| 80 | 80 | keywords(List(String)), |
| 81 | - refresh(String url, Int32 delay), // in seconds | |
| 81 | + refresh(String url, Int delay), // in seconds | |
| 82 | 82 | meta(String name, String content), |
| 83 | 83 | http_equiv(String name, String content). |
| 84 | 84 | |
| ... | ... | @@ -106,10 +106,10 @@ public type LayerDisposition: |
| 106 | 106 | vertical. |
| 107 | 107 | |
| 108 | 108 | public type FollowPathCommand: // this type is used by the Web_body_option 'follow_path'. |
| 109 | - pos(Int32 x, // x coordinate of position | |
| 110 | - Int32 y, // y coordinate of position | |
| 111 | - Int32 image_number, // the image to display at that position | |
| 112 | - Int32 delay). // wait that milliseconds before leaving this position | |
| 109 | + pos(Int x, // x coordinate of position | |
| 110 | + Int y, // y coordinate of position | |
| 111 | + Int image_number, // the image to display at that position | |
| 112 | + Int delay). // wait that milliseconds before leaving this position | |
| 113 | 113 | |
| 114 | 114 | public type Web_body_option: |
| 115 | 115 | background_color(Web_color), /* color for the background */ |
| ... | ... | @@ -121,35 +121,35 @@ public type Web_body_option: |
| 121 | 121 | // produces a background whose color changes very slowly (this is not tiring) among rather |
| 122 | 122 | // light pastel colors. |
| 123 | 123 | // |
| 124 | - psychedelic_background(Int32 average, /* average light (0 to 255) */ | |
| 125 | - Int32 amplitude, /* amplitude of variation of light */ | |
| 126 | - Int32 delay), /* in milliseconds */ | |
| 124 | + psychedelic_background(Int average, /* average light (0 to 255) */ | |
| 125 | + Int amplitude, /* amplitude of variation of light */ | |
| 126 | + Int delay), /* in milliseconds */ | |
| 127 | 127 | background_image(String file_name), /* name of image file for the background */ |
| 128 | 128 | // |
| 129 | 129 | // 'scrolling_layer' produces a layer above the page which is scrolling continuously either |
| 130 | 130 | // vertically or horizontally. The 'content' is indefinitly repeated. |
| 131 | 131 | // |
| 132 | 132 | scrolling_layer(LayerDisposition, |
| 133 | - Int32 steps, /* number of pixels of each move */ | |
| 134 | - Int32 margin, /* measured from left or top in pixels */ | |
| 135 | - Int32 delay, /* milliseconds for one move */ | |
| 133 | + Int steps, /* number of pixels of each move */ | |
| 134 | + Int margin, /* measured from left or top in pixels */ | |
| 135 | + Int delay, /* milliseconds for one move */ | |
| 136 | 136 | Web_item content, /* content of layer (will be repeated) */ |
| 137 | - Int32 period), /* number of pixels between two instances of 'content' */ | |
| 137 | + Int period), /* number of pixels between two instances of 'content' */ | |
| 138 | 138 | // |
| 139 | 139 | // 'bounce' shows its content above the page and let it move and bounce on the edges of a rectangle. |
| 140 | 140 | // The rectangle is determined by the last 4 arguments. |
| 141 | 141 | // |
| 142 | 142 | bounce(Web_item content, |
| 143 | - Int32 left, | |
| 144 | - Int32 right, | |
| 145 | - Int32 top, | |
| 146 | - Int32 bottom), | |
| 143 | + Int left, | |
| 144 | + Int right, | |
| 145 | + Int top, | |
| 146 | + Int bottom), | |
| 147 | 147 | // |
| 148 | 148 | // put something over the page in any position you want: |
| 149 | 149 | // |
| 150 | 150 | over(Web_item content, |
| 151 | - Int32 left, | |
| 152 | - Int32 top), | |
| 151 | + Int left, | |
| 152 | + Int top), | |
| 153 | 153 | // |
| 154 | 154 | // follow_path: let a changing image follow a path on the screen. This gadget shows |
| 155 | 155 | // an image following a polygonal path on the screen. The image may change at regular |
| ... | ... | @@ -171,18 +171,18 @@ public type Web_body_option: |
| 171 | 171 | // rank 0). 'd' is the delay in milliseconds to wait before leaving that position. |
| 172 | 172 | // |
| 173 | 173 | follow_path(List(String) filenames, /* the changing images which follows the path */ |
| 174 | - Int32 change_every, /* number of steps betwen two changes */ | |
| 174 | + Int change_every, /* number of steps betwen two changes */ | |
| 175 | 175 | List(FollowPathCommand) path, /* the polygonal path and commands */ |
| 176 | 176 | Bool loop, /* if true do it repeatedly, otherwise only once */ |
| 177 | - Int32 steps, /* approximative distance (in pixels) between two | |
| 177 | + Int steps, /* approximative distance (in pixels) between two | |
| 178 | 178 | successive positions */ |
| 179 | - Int32 delay), /* milliseconds between two successive positions */ | |
| 179 | + Int delay), /* milliseconds between two successive positions */ | |
| 180 | 180 | |
| 181 | 181 | load_image(String name), /* load an image (for next page), which is not displayed */ |
| 182 | - left_margin(Int32), /* left margin for document */ | |
| 183 | - top_margin(Int32), /* top margin for document */ | |
| 184 | - margin_width(Int32), | |
| 185 | - margin_height(Int32), | |
| 182 | + left_margin(Int), /* left margin for document */ | |
| 183 | + top_margin(Int), /* top margin for document */ | |
| 184 | + margin_width(Int), | |
| 185 | + margin_height(Int), | |
| 186 | 186 | reload_frame(String name, /* name of target frame */ |
| 187 | 187 | String url), /* url to load in this frame */ |
| 188 | 188 | onload(String function_name). /* nom de la fonction javascript (sans les '()') */ |
| ... | ... | @@ -230,7 +230,7 @@ public type Page_body: |
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | public type VFrame: |
| 233 | - frame(Int32 height, | |
| 233 | + frame(Int height, | |
| 234 | 234 | Printable_tree url, |
| 235 | 235 | String name). |
| 236 | 236 | |
| ... | ... | @@ -242,8 +242,8 @@ public type Web_page: |
| 242 | 242 | Page_body body), /* body of page */ |
| 243 | 243 | standard_frameset(String title, |
| 244 | 244 | List(WebMeta) meta_tags, |
| 245 | - Int32 height, /* height of 'top menu' (pixels) */ | |
| 246 | - Int32 width, /* width of 'left menu' (pixels) */ | |
| 245 | + Int height, /* height of 'top menu' (pixels) */ | |
| 246 | + Int width, /* width of 'left menu' (pixels) */ | |
| 247 | 247 | Printable_tree main). /* url for main */ |
| 248 | 248 | |
| 249 | 249 | +---------+--------------------------+ |
| ... | ... | @@ -293,8 +293,8 @@ public define Web_page |
| 293 | 293 | standard_frameset |
| 294 | 294 | ( |
| 295 | 295 | String title, |
| 296 | - Int32 height, | |
| 297 | - Int32 width, | |
| 296 | + Int height, | |
| 297 | + Int width, | |
| 298 | 298 | Printable_tree main |
| 299 | 299 | ) = |
| 300 | 300 | |
| ... | ... | @@ -331,8 +331,8 @@ public type Web_item: |
| 331 | 331 | text_nowrap_pt(Printable_tree), |
| 332 | 332 | par(String), |
| 333 | 333 | preformated_text(String text), |
| 334 | - integer(Int32), | |
| 335 | - float(Float,Int32),... | |
| 334 | + integer(Int), | |
| 335 | + float(Float,Int),... | |
| 336 | 336 | |
| 337 | 337 | |
| 338 | 338 | You may want to center a web item in a page. Just enclose it into |
| ... | ... | @@ -345,8 +345,8 @@ public type Web_item: |
| 345 | 345 | You may want to write characters of a given item with a big font: |
| 346 | 346 | |
| 347 | 347 | public type Web_item: |
| 348 | - bigger(Int32,Web_item), | |
| 349 | - smaller(Int32,Web_item), | |
| 348 | + bigger(Int,Web_item), | |
| 349 | + smaller(Int,Web_item), | |
| 350 | 350 | bold(Web_item), |
| 351 | 351 | italic(Web_item), |
| 352 | 352 | big(Web_item), |
| ... | ... | @@ -366,14 +366,14 @@ public type WebStyle: |
| 366 | 366 | float_to_left, // the web item will float to the left and text will wrap around |
| 367 | 367 | float_to_right, |
| 368 | 368 | font_family(String font_name), // "verdana" "helvetica" "times" etc... |
| 369 | - font_size(Int32 size), | |
| 369 | + font_size(Int size), | |
| 370 | 370 | italic, |
| 371 | 371 | oblique, |
| 372 | 372 | small_capitals, |
| 373 | 373 | bold, |
| 374 | 374 | bolder, |
| 375 | 375 | lighter, |
| 376 | - line_height(Int32 height), | |
| 376 | + line_height(Int height), | |
| 377 | 377 | text_center, |
| 378 | 378 | text_left, |
| 379 | 379 | text_right, |
| ... | ... | @@ -381,7 +381,7 @@ public type WebStyle: |
| 381 | 381 | text_underline, |
| 382 | 382 | text_blink, |
| 383 | 383 | text_line_through, |
| 384 | - width(Int32 n). | |
| 384 | + width(Int n). | |
| 385 | 385 | |
| 386 | 386 | |
| 387 | 387 | |
| ... | ... | @@ -390,12 +390,12 @@ public type Web_item: |
| 390 | 390 | |
| 391 | 391 | |
| 392 | 392 | public type Web_item: |
| 393 | - spacer(Int32 width, Int32 height), | |
| 393 | + spacer(Int width, Int height), | |
| 394 | 394 | image(String file_name), /* image */ |
| 395 | 395 | image_d(String file_name, String description), |
| 396 | 396 | image_pt(Printable_tree file_name), |
| 397 | 397 | on_image(String file_name, Web_item content), |
| 398 | - turning_images(NonEmptyList(String) filenames, Int32 millisecs),... | |
| 398 | + turning_images(NonEmptyList(String) filenames, Int millisecs),... | |
| 399 | 399 | |
| 400 | 400 | |
| 401 | 401 | |
| ... | ... | @@ -418,8 +418,8 @@ public type Web_item: |
| 418 | 418 | String target, |
| 419 | 419 | String image_on, |
| 420 | 420 | String image_off, |
| 421 | - Int32 width, | |
| 422 | - Int32 height, | |
| 421 | + Int width, | |
| 422 | + Int height, | |
| 423 | 423 | String description), ... |
| 424 | 424 | |
| 425 | 425 | |
| ... | ... | @@ -428,7 +428,7 @@ public type Web_item: |
| 428 | 428 | zones overlap, the first one (in the order they are defined) is selected. |
| 429 | 429 | |
| 430 | 430 | Zones are of 3 sorts: rectangles, circles and polygons. Point's coordinates are |
| 431 | - specified as pairs of integers (of anonymous agglomeration type (Int32,Int32)). The | |
| 431 | + specified as pairs of integers (of anonymous agglomeration type (Int,Int)). The | |
| 432 | 432 | first coordinate counts pixels from the left of the image. The second coordinate counts |
| 433 | 433 | pixels from the top of the image. With polygons, you can construct zones which are |
| 434 | 434 | almost as complicated as you want. You may also construct a zone as the overlapping of |
| ... | ... | @@ -437,19 +437,19 @@ public type Web_item: |
| 437 | 437 | public type Mouse_Sensitive_Zone: |
| 438 | 438 | rectangle |
| 439 | 439 | ( |
| 440 | - (Int32,Int32) left_top, | |
| 441 | - (Int32,Int32) right_bottom, | |
| 440 | + (Int,Int) left_top, | |
| 441 | + (Int,Int) right_bottom, | |
| 442 | 442 | String url |
| 443 | 443 | ), |
| 444 | 444 | circle |
| 445 | 445 | ( |
| 446 | - (Int32,Int32) center, | |
| 447 | - Int32 radius, | |
| 446 | + (Int,Int) center, | |
| 447 | + Int radius, | |
| 448 | 448 | String url |
| 449 | 449 | ), |
| 450 | 450 | polygon |
| 451 | 451 | ( |
| 452 | - List((Int32,Int32)) vertices, | |
| 452 | + List((Int,Int)) vertices, | |
| 453 | 453 | String url |
| 454 | 454 | ). |
| 455 | 455 | |
| ... | ... | @@ -518,14 +518,14 @@ form |
| 518 | 518 | |
| 519 | 519 | public type Web_item: |
| 520 | 520 | text_input(String name, /* text field to be documented by user */ |
| 521 | - Int32 size, | |
| 521 | + Int size, | |
| 522 | 522 | String initial_value),... |
| 523 | 523 | |
| 524 | 524 | public define Web_item |
| 525 | 525 | text_input |
| 526 | 526 | ( |
| 527 | 527 | String name, |
| 528 | - Int32 size, | |
| 528 | + Int size, | |
| 529 | 529 | String initial_value |
| 530 | 530 | ) = |
| 531 | 531 | |
| ... | ... | @@ -535,12 +535,12 @@ public type Web_item: |
| 535 | 535 | |
| 536 | 536 | public type Web_item: |
| 537 | 537 | password_input(String name, |
| 538 | - Int32 size), | |
| 538 | + Int size), | |
| 539 | 539 | text_area(String name, |
| 540 | - Int32 columns, | |
| 541 | - Int32 rows, | |
| 540 | + Int columns, | |
| 541 | + Int rows, | |
| 542 | 542 | String initial_text), |
| 543 | - upload(String name, Int32 size),... | |
| 543 | + upload(String name, Int size),... | |
| 544 | 544 | |
| 545 | 545 | |
| 546 | 546 | |
| ... | ... | @@ -560,7 +560,7 @@ public type Web_item: |
| 560 | 560 | String hl_image_file), |
| 561 | 561 | text_submit(String name, String value, String text), |
| 562 | 562 | web_submit(String web_args, Web_item content), |
| 563 | - button(String name, String text, String on_click_fonction, Int32 width, Int32 height),... | |
| 563 | + button(String name, String text, String on_click_fonction, Int width, Int height),... | |
| 564 | 564 | |
| 565 | 565 | |
| 566 | 566 | public type Web_item: /* mark the form with an information */ |
| ... | ... | @@ -625,11 +625,11 @@ public type Table_option: |
| 625 | 625 | more or less wide. You may also specify a color for the border. */ |
| 626 | 626 | border, |
| 627 | 627 | nude, /* equivalent to 'border(0,0,0)' (below) */ |
| 628 | - border(Int32, /* width of exterior (pixels) */ | |
| 629 | - Int32, /* width of top */ | |
| 630 | - Int32), /* width of interior */ | |
| 628 | + border(Int, /* width of exterior (pixels) */ | |
| 629 | + Int, /* width of top */ | |
| 630 | + Int), /* width of interior */ | |
| 631 | 631 | border_color(Web_color), |
| 632 | - absolute_width(Int32). | |
| 632 | + absolute_width(Int). | |
| 633 | 633 | |
| 634 | 634 | |
| 635 | 635 | |
| ... | ... | @@ -649,7 +649,7 @@ public type Row_option: |
| 649 | 649 | top, |
| 650 | 650 | v_center, |
| 651 | 651 | bottom, |
| 652 | - absolute_height(Int32), | |
| 652 | + absolute_height(Int), | |
| 653 | 653 | base_line, |
| 654 | 654 | /* set the background color of all cells in the row */ |
| 655 | 655 | background_color(Web_color). |
| ... | ... | @@ -670,13 +670,13 @@ public type Cell_option: |
| 670 | 670 | /* you can set the width of the cell either absolutely (in pixels) |
| 671 | 671 | or as a percentage of the width of the table. */ |
| 672 | 672 | background_image(String file_name), |
| 673 | - absolute_width(Int32), | |
| 674 | - relative_width(Int32), | |
| 675 | - absolute_height(Int32), | |
| 676 | - relative_height(Int32), | |
| 673 | + absolute_width(Int), | |
| 674 | + relative_width(Int), | |
| 675 | + absolute_height(Int), | |
| 676 | + relative_height(Int), | |
| 677 | 677 | /* a cell may span over several columns or rows in the table */ |
| 678 | - columns(Int32), | |
| 679 | - rows(Int32), | |
| 678 | + columns(Int), | |
| 679 | + rows(Int), | |
| 680 | 680 | nowrap. |
| 681 | 681 | |
| 682 | 682 | |
| ... | ... | @@ -713,14 +713,14 @@ public type Web_item: |
| 713 | 713 | |
| 714 | 714 | public type Web_item: |
| 715 | 715 | select(String name, |
| 716 | - Int32 size, | |
| 716 | + Int size, | |
| 717 | 717 | List(String) choices), |
| 718 | 718 | select(String name, |
| 719 | - Int32 size, | |
| 719 | + Int size, | |
| 720 | 720 | List(String) choices, |
| 721 | 721 | String selected), |
| 722 | 722 | immediate_select(String name, // selection will immediately submit the form |
| 723 | - Int32 size, | |
| 723 | + Int size, | |
| 724 | 724 | List(String) choices),... |
| 725 | 725 | |
| 726 | 726 | |
| ... | ... | @@ -738,23 +738,23 @@ public type Web_item: |
| 738 | 738 | String web_args, |
| 739 | 739 | String window_name, |
| 740 | 740 | Web_item content, |
| 741 | - Int32 width, | |
| 742 | - Int32 height), | |
| 741 | + Int width, | |
| 742 | + Int height), | |
| 743 | 743 | link_to_window_with_ticket_and_scroll |
| 744 | 744 | (String name, |
| 745 | 745 | String web_args, |
| 746 | 746 | String window_name, |
| 747 | 747 | Web_item content, |
| 748 | - Int32 width, | |
| 749 | - Int32 height), | |
| 748 | + Int width, | |
| 749 | + Int height), | |
| 750 | 750 | link_to_window_with_ticket_and_scroll |
| 751 | 751 | (String name, |
| 752 | 752 | String label_name, |
| 753 | 753 | String web_args, |
| 754 | 754 | String window_name, |
| 755 | 755 | Web_item content, |
| 756 | - Int32 width, | |
| 757 | - Int32 height), | |
| 756 | + Int width, | |
| 757 | + Int height), | |
| 758 | 758 | link_to_frame (Printable_tree name, String frame_name, Web_item). |
| 759 | 759 | |
| 760 | 760 | |
| ... | ... | @@ -798,7 +798,7 @@ public define String |
| 798 | 798 | ) = |
| 799 | 799 | if wc is |
| 800 | 800 | { |
| 801 | - rgb(r,g,b) then "\"#" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "\"", | |
| 801 | + rgb(r,g,b) then "\"#" + to_hexa(r) + to_hexa(g) + to_hexa(b) + "\"", | |
| 802 | 802 | _(c) then format(c) |
| 803 | 803 | }. |
| 804 | 804 | |
| ... | ... | @@ -809,7 +809,7 @@ public define String |
| 809 | 809 | ) = |
| 810 | 810 | if wc is |
| 811 | 811 | { |
| 812 | - rgb(r,g,b) then "#" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "", | |
| 812 | + rgb(r,g,b) then "#" + to_hexa(r) + to_hexa(g) + to_hexa(b) + "", | |
| 813 | 813 | _(c) then format(c) |
| 814 | 814 | }. |
| 815 | 815 | |
| ... | ... | @@ -826,7 +826,7 @@ public define String |
| 826 | 826 | ) = |
| 827 | 827 | if wc is |
| 828 | 828 | { |
| 829 | - rgb(r,g,b) then "" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "", | |
| 829 | + rgb(r,g,b) then "" + to_hexa(r) + to_hexa(g) + to_hexa(b) + "", | |
| 830 | 830 | _(c) then format(c) |
| 831 | 831 | }. |
| 832 | 832 | |
| ... | ... | @@ -837,13 +837,17 @@ define Printable_tree |
| 837 | 837 | ) = [(String)format_without_sharp(c)]. |
| 838 | 838 | |
| 839 | 839 | |
| 840 | +define Printable_tree | |
| 841 | + [Word32 x . Printable_tree t] | |
| 842 | + = | |
| 843 | + [to_Int(x) . t]. | |
| 840 | 844 | |
| 841 | 845 | define Printable_tree |
| 842 | 846 | psychedelic_bg |
| 843 | 847 | ( |
| 844 | - Int32 average, | |
| 845 | - Int32 amplitude, | |
| 846 | - Int32 delay | |
| 848 | + Int average, | |
| 849 | + Int amplitude, | |
| 850 | + Int delay | |
| 847 | 851 | ) = |
| 848 | 852 | with ampl = if amplitude >= 120 then 120 else |
| 849 | 853 | if amplitude =< 1 then 1 else amplitude, |
| ... | ... | @@ -865,23 +869,23 @@ define List(Web_body_option) |
| 865 | 869 | replace_background_init |
| 866 | 870 | ( |
| 867 | 871 | List(Web_body_option) l, |
| 868 | - Int32 average, | |
| 869 | - Int32 amplitude, | |
| 870 | - Int32 delay | |
| 872 | + Int average, | |
| 873 | + Int amplitude, | |
| 874 | + Int delay | |
| 871 | 875 | ) = |
| 872 | 876 | if l is |
| 873 | 877 | { |
| 874 | 878 | [ ] then [ ], |
| 875 | 879 | [h . t] then |
| 876 | 880 | if h is background_color(_) |
| 877 | - then [background_color(rgb(average+amplitude, | |
| 878 | - average, | |
| 879 | - average-amplitude)) | |
| 881 | + then [background_color(rgb(truncate_to_Word8(average+amplitude), | |
| 882 | + truncate_to_Word8(average), | |
| 883 | + truncate_to_Word8(average-amplitude))) | |
| 880 | 884 | . replace_background_init(t,average,amplitude,delay)] |
| 881 | 885 | else [h . replace_background_init(t,average,amplitude,delay)] |
| 882 | 886 | }. |
| 883 | 887 | |
| 884 | -define Maybe((Int32,Int32,Int32)) | |
| 888 | +define Maybe((Int,Int,Int)) | |
| 885 | 889 | get_psy |
| 886 | 890 | ( |
| 887 | 891 | List(Web_body_option) l |
| ... | ... | @@ -920,10 +924,10 @@ define Printable_tree |
| 920 | 924 | move_layer_command |
| 921 | 925 | ( |
| 922 | 926 | String property, |
| 923 | - Int32 n, | |
| 924 | - Int32 num, | |
| 925 | - Int32 i, | |
| 926 | - Int32 period | |
| 927 | + Int n, | |
| 928 | + Int num, | |
| 929 | + Int i, | |
| 930 | + Int period | |
| 927 | 931 | ) = |
| 928 | 932 | if i >= num then [ ] else |
| 929 | 933 | [" if (document.layers)", |
| ... | ... | @@ -936,12 +940,12 @@ define Printable_tree |
| 936 | 940 | format_layers |
| 937 | 941 | ( |
| 938 | 942 | LayerDisposition disp, |
| 939 | - Int32 margin, | |
| 943 | + Int margin, | |
| 940 | 944 | Web_item content, |
| 941 | - Int32 n, | |
| 942 | - Int32 num, | |
| 943 | - Int32 i, | |
| 944 | - Int32 period | |
| 945 | + Int n, | |
| 946 | + Int num, | |
| 947 | + Int i, | |
| 948 | + Int period | |
| 945 | 949 | ) = |
| 946 | 950 | if i >= num then [ ] else |
| 947 | 951 | ["<layer name=\"nslay",n,"_",i,"\" top=0", |
| ... | ... | @@ -958,12 +962,12 @@ define Printable_tree |
| 958 | 962 | s_layer |
| 959 | 963 | ( |
| 960 | 964 | LayerDisposition disp, |
| 961 | - Int32 steps, | |
| 962 | - Int32 margin, | |
| 963 | - Int32 delay, | |
| 965 | + Int steps, | |
| 966 | + Int margin, | |
| 967 | + Int delay, | |
| 964 | 968 | Web_item content, |
| 965 | - Int32 period, | |
| 966 | - Int32 num | |
| 969 | + Int period, | |
| 970 | + Int num | |
| 967 | 971 | ) = |
| 968 | 972 | with n = new_web_count, |
| 969 | 973 | [ "<script>", |
| ... | ... | @@ -985,8 +989,8 @@ define Printable_tree |
| 985 | 989 | over |
| 986 | 990 | ( |
| 987 | 991 | Web_item i, |
| 988 | - Int32 left, | |
| 989 | - Int32 top | |
| 992 | + Int left, | |
| 993 | + Int top | |
| 990 | 994 | ) = |
| 991 | 995 | with n = new_web_count, |
| 992 | 996 | [ "<layer name=\"nslay",n,"\" top=",top," left=",left,">", |
| ... | ... | @@ -999,10 +1003,10 @@ define Printable_tree |
| 999 | 1003 | bnce |
| 1000 | 1004 | ( |
| 1001 | 1005 | Web_item i, |
| 1002 | - Int32 left, | |
| 1003 | - Int32 right, | |
| 1004 | - Int32 top, | |
| 1005 | - Int32 bottom | |
| 1006 | + Int left, | |
| 1007 | + Int right, | |
| 1008 | + Int top, | |
| 1009 | + Int bottom | |
| 1006 | 1010 | ) = |
| 1007 | 1011 | with n = new_web_count, |
| 1008 | 1012 | [ "<script>", |
| ... | ... | @@ -1027,11 +1031,11 @@ define Printable_tree |
| 1027 | 1031 | define Printable_tree |
| 1028 | 1032 | folp_switch |
| 1029 | 1033 | ( |
| 1030 | - Int32 n, | |
| 1031 | - Int32 i, | |
| 1034 | + Int n, | |
| 1035 | + Int i, | |
| 1032 | 1036 | List(FollowPathCommand) path, |
| 1033 | 1037 | Bool loop, |
| 1034 | - Int32 steps | |
| 1038 | + Int steps | |
| 1035 | 1039 | ) = |
| 1036 | 1040 | if path is |
| 1037 | 1041 | { |
| ... | ... | @@ -1073,9 +1077,9 @@ define Printable_tree |
| 1073 | 1077 | define Printable_tree |
| 1074 | 1078 | set_folpimages |
| 1075 | 1079 | ( |
| 1076 | - Int32 n, | |
| 1080 | + Int n, | |
| 1077 | 1081 | List(String) filenames, |
| 1078 | - Int32 i, | |
| 1082 | + Int i, | |
| 1079 | 1083 | ) = |
| 1080 | 1084 | if filenames is |
| 1081 | 1085 | { |
| ... | ... | @@ -1089,11 +1093,11 @@ define Printable_tree |
| 1089 | 1093 | follow_path |
| 1090 | 1094 | ( |
| 1091 | 1095 | List(String) filenames, |
| 1092 | - Int32 change_every, | |
| 1096 | + Int change_every, | |
| 1093 | 1097 | List(FollowPathCommand) path, |
| 1094 | 1098 | Bool loop, |
| 1095 | - Int32 steps, | |
| 1096 | - Int32 delay | |
| 1099 | + Int steps, | |
| 1100 | + Int delay | |
| 1097 | 1101 | ) = |
| 1098 | 1102 | if filenames is |
| 1099 | 1103 | { |
| ... | ... | @@ -1182,7 +1186,7 @@ public define Printable_tree |
| 1182 | 1186 | background_color(c) then [" bgcolor=" , (String)format(c)], |
| 1183 | 1187 | psychedelic_background(a,f,d) then add_script(psychedelic_bg(a,f,d)); [ ], |
| 1184 | 1188 | background_image(n) then [" background=", n], |
| 1185 | - scrolling_layer(disp,st,m,t,c,p) then add_script(s_layer(disp,st,m,t,c,p,2000/p)); [ ], | |
| 1189 | + scrolling_layer(disp,st,m,t,c,p) then add_script(s_layer(disp,st,m,t,c,p,2000\p)); [ ], | |
| 1186 | 1190 | bounce(i,l,r,t,b) then add_script(bnce(i,l,r,t,b)); [ ], |
| 1187 | 1191 | over(i,l,t) then add_script(over(i,l,t)); [ ], |
| 1188 | 1192 | follow_path(li,ns,p,l,s,d) then add_script(follow_path(li,ns,p,l,s,d)); [ ], |
| ... | ... | @@ -1199,7 +1203,7 @@ define Printable_tree |
| 1199 | 1203 | preload_list |
| 1200 | 1204 | ( |
| 1201 | 1205 | List(ImageToLoad) images, |
| 1202 | - Int32 n, | |
| 1206 | + Int n, | |
| 1203 | 1207 | ) = |
| 1204 | 1208 | if images is |
| 1205 | 1209 | { |
| ... | ... | @@ -1284,13 +1288,13 @@ public define Printable_tree |
| 1284 | 1288 | |
| 1285 | 1289 | |
| 1286 | 1290 | |
| 1287 | -public define Int32 | |
| 1288 | - percentage(Int32 n) = | |
| 1291 | +public define Int | |
| 1292 | + percentage(Int n) = | |
| 1289 | 1293 | if n < 0 then 0 |
| 1290 | 1294 | else if n > 100 then 100 |
| 1291 | 1295 | else n. |
| 1292 | 1296 | |
| 1293 | - public define Int32 percentage(Int32 n) = n. | |
| 1297 | + public define Int percentage(Int n) = n. | |
| 1294 | 1298 | |
| 1295 | 1299 | |
| 1296 | 1300 | |
| ... | ... | @@ -1441,14 +1445,14 @@ public define String |
| 1441 | 1445 | float_to_left then "float: left", |
| 1442 | 1446 | float_to_right then "float: right", |
| 1443 | 1447 | font_family(n) then "font-family: "+n, |
| 1444 | - font_size(n) then "font-size: "+integer_to_string(n)+"pt", | |
| 1448 | + font_size(n) then "font-size: "+to_decimal(n)+"pt", | |
| 1445 | 1449 | italic then "font-style: italic", |
| 1446 | 1450 | oblique then "font-style: oblique", |
| 1447 | 1451 | small_capitals then "font-variant: small-caps", |
| 1448 | 1452 | bold then "font-weight: bold", |
| 1449 | 1453 | bolder then "font-weight: bolder", |
| 1450 | 1454 | lighter then "font-weight: lighter", |
| 1451 | - line_height(h) then "line-height: "+integer_to_string(h), | |
| 1455 | + line_height(h) then "line-height: "+to_decimal(h), | |
| 1452 | 1456 | text_center then "text-align: center", |
| 1453 | 1457 | text_left then "text-align: left", |
| 1454 | 1458 | text_right then "text-align: right", |
| ... | ... | @@ -1456,7 +1460,7 @@ public define String |
| 1456 | 1460 | text_underline then "text-decoration: underline", |
| 1457 | 1461 | text_blink then "text-decoration: blink", |
| 1458 | 1462 | text_line_through then "text-decoration: line-through", |
| 1459 | - width(n) then "width: "+integer_to_string(n), | |
| 1463 | + width(n) then "width: "+to_decimal(n), | |
| 1460 | 1464 | }. |
| 1461 | 1465 | |
| 1462 | 1466 | |
| ... | ... | @@ -1480,7 +1484,7 @@ public define Printable_tree |
| 1480 | 1484 | define Printable_tree |
| 1481 | 1485 | format_polygon_coordinates |
| 1482 | 1486 | ( |
| 1483 | - List((Int32,Int32)) vertices | |
| 1487 | + List((Int,Int)) vertices | |
| 1484 | 1488 | ) = |
| 1485 | 1489 | if vertices is |
| 1486 | 1490 | { |
| ... | ... | @@ -1550,7 +1554,7 @@ define Printable_tree |
| 1550 | 1554 | . format(t, c_ticket, s_ticket)] |
| 1551 | 1555 | }. |
| 1552 | 1556 | |
| 1553 | -variable Int32 map_number = 0. | |
| 1557 | +variable Int map_number = 0. | |
| 1554 | 1558 | |
| 1555 | 1559 | define Printable_tree |
| 1556 | 1560 | format_mouse_sensitive_image |
| ... | ... | @@ -1727,7 +1731,7 @@ define String |
| 1727 | 1731 | define Printable_tree |
| 1728 | 1732 | set_turning_images_sources |
| 1729 | 1733 | ( |
| 1730 | - Int32 i, | |
| 1734 | + Int i, | |
| 1731 | 1735 | String name, |
| 1732 | 1736 | List(String) filenames |
| 1733 | 1737 | ) = |
| ... | ... | @@ -1738,6 +1742,21 @@ define Printable_tree |
| 1738 | 1742 | [" i",name,"[",i,"].src=\"",h,"\";" |
| 1739 | 1743 | . set_turning_images_sources(i+1,name,t)] |
| 1740 | 1744 | }. |
| 1745 | + | |
| 1746 | +define Bool | |
| 1747 | + member | |
| 1748 | + ( | |
| 1749 | + Word8 x, | |
| 1750 | + Printable_tree t | |
| 1751 | + ) = | |
| 1752 | + if t is | |
| 1753 | + { | |
| 1754 | + [] then false, | |
| 1755 | + str_pt(String _0,Printable_tree _1) then (member(x,_0) | member(x,_1)), | |
| 1756 | + ba_pt(ByteArray _0,Printable_tree _1) then (member(x,to_string(_0)) | member(x,_1)), | |
| 1757 | + int_pt(Int _0,Printable_tree _1) then (member(x,to_decimal(_0)) | member(x,_1)), | |
| 1758 | + pt_pt(Printable_tree _0,Printable_tree _1) then (member(x,_0) | member(x,_1)) | |
| 1759 | + }. | |
| 1741 | 1760 | |
| 1742 | 1761 | public define Printable_tree |
| 1743 | 1762 | format |
| ... | ... | @@ -1803,7 +1822,7 @@ public define Printable_tree |
| 1803 | 1822 | ["<span style=\"background: url(",fn,")\">",format(c_ticket,s_ticket,x),"</span>"], |
| 1804 | 1823 | |
| 1805 | 1824 | turning_images(fns,msec) then if fns is [im0 . imo] then |
| 1806 | - with name = "trni"+integer_to_string(new_web_count), n = 1+length(imo), (Printable_tree) | |
| 1825 | + with name = "trni"+to_decimal(new_web_count), n = 1+length(imo), (Printable_tree) | |
| 1807 | 1826 | ["<script>", |
| 1808 | 1827 | "var i",name,"=new Array(",n,");", |
| 1809 | 1828 | "var n",name,"=0;", |
| ... | ... | @@ -1823,7 +1842,7 @@ public define Printable_tree |
| 1823 | 1842 | |
| 1824 | 1843 | rollover(prlim,url,target,ion,ioff,descr) then (Printable_tree) |
| 1825 | 1844 | (images_to_load <- [simple(ion) . *images_to_load]; |
| 1826 | - with name = "ron_"+integer_to_string(new_web_count), | |
| 1845 | + with name = "ron_"+to_decimal(new_web_count), | |
| 1827 | 1846 | ["<a target=\"",target,"\" href=\"",url, |
| 1828 | 1847 | (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',url) then "&" else "?")), |
| 1829 | 1848 | (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), |
| ... | ... | @@ -1834,7 +1853,7 @@ public define Printable_tree |
| 1834 | 1853 | |
| 1835 | 1854 | rollover(prlim,url,target,ion,ioff,w,h,descr) then (Printable_tree) |
| 1836 | 1855 | (images_to_load <- [simple(ion) . *images_to_load]; |
| 1837 | - with name = "ron_"+integer_to_string(new_web_count), | |
| 1856 | + with name = "ron_"+to_decimal(new_web_count), | |
| 1838 | 1857 | ["<a target=\"",target,"\" href=\"",url, |
| 1839 | 1858 | (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',url) then "&" else "?")), |
| 1840 | 1859 | (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), |
| ... | ... | @@ -1927,7 +1946,7 @@ public define Printable_tree |
| 1927 | 1946 | ["<a href=\"javascript:document.forms[0].action='", |
| 1928 | 1947 | wa,"'; document.forms[0].submit();\">",format(c_ticket,s_ticket,i),"</a>"], |
| 1929 | 1948 | |
| 1930 | - button(n, String t, String o, Int32 w, Int32 h) then (Printable_tree) | |
| 1949 | + button(n, String t, String o, Int w, Int h) then (Printable_tree) | |
| 1931 | 1950 | ["<input type=button name=",n," value=\"",t, |
| 1932 | 1951 | "\"style=\"width=",w, ";height=", h, "\" ", "\" onclick=\"", o, "\";\" />"], |
| 1933 | 1952 | |
| ... | ... | @@ -2089,9 +2108,9 @@ define Printable_tree |
| 2089 | 2108 | define String |
| 2090 | 2109 | frame_size |
| 2091 | 2110 | ( |
| 2092 | - Int32 s | |
| 2111 | + Int s | |
| 2093 | 2112 | ) = |
| 2094 | - if s =< 0 then "*" else integer_to_string(s). | |
| 2113 | + if s =< 0 then "*" else to_decimal(s). | |
| 2095 | 2114 | |
| 2096 | 2115 | define String |
| 2097 | 2116 | frame_stack_rows |
| ... | ... | @@ -2119,13 +2138,13 @@ define String |
| 2119 | 2138 | define Printable_tree |
| 2120 | 2139 | standard_headers |
| 2121 | 2140 | ( |
| 2122 | - Int32 size | |
| 2141 | + Int size | |
| 2123 | 2142 | ) = |
| 2124 | 2143 | [ |
| 2125 | 2144 | "HTTP/1.0 200 OK" + crlf + |
| 2126 | 2145 | "Server: Anubis" + crlf + |
| 2127 | 2146 | "Content-Type: text/html" + crlf + |
| 2128 | - "Content-Length: "+integer_to_string(size)+crlf+ | |
| 2147 | + "Content-Length: "+to_decimal(size)+crlf+ | |
| 2129 | 2148 | crlf |
| 2130 | 2149 | ]. |
| 2131 | 2150 | |
| ... | ... | @@ -2211,7 +2230,7 @@ public define Printable_tree |
| 2211 | 2230 | if p is |
| 2212 | 2231 | { |
| 2213 | 2232 | web_page(title,metas,head_scripts,body) then |
| 2214 | - with body = | |
| 2233 | + with fullpage = | |
| 2215 | 2234 | [ |
| 2216 | 2235 | "<html>", |
| 2217 | 2236 | "<head>", |
| ... | ... | @@ -2240,10 +2259,10 @@ public define Printable_tree |
| 2240 | 2259 | if hs is |
| 2241 | 2260 | { |
| 2242 | 2261 | empty then [ ], |
| 2243 | - anubis then standard_headers(length(body)), | |
| 2262 | + anubis then standard_headers(length(fullpage)), | |
| 2244 | 2263 | apache then apache_headers |
| 2245 | 2264 | } |
| 2246 | - . body | |
| 2265 | + . fullpage | |
| 2247 | 2266 | ], |
| 2248 | 2267 | standard_frameset(title,metas,height,width,main) then |
| 2249 | 2268 | with body = |
| ... | ... | @@ -2319,19 +2338,19 @@ public define Bool |
| 2319 | 2338 | public define Cell |
| 2320 | 2339 | h_spacer |
| 2321 | 2340 | ( |
| 2322 | - Int32 n | |
| 2341 | + Int n | |
| 2323 | 2342 | ) = |
| 2324 | - cell([absolute_width(n)],literal(" ")). | |
| 2343 | + cell([absolute_width(n)],text(" ")). | |
| 2325 | 2344 | |
| 2326 | 2345 | public define Cell |
| 2327 | 2346 | v_spacer |
| 2328 | 2347 | ( |
| 2329 | - Int32 n | |
| 2348 | + Int n | |
| 2330 | 2349 | ) = |
| 2331 | - cell([absolute_height(n)],literal(" ")). | |
| 2350 | + cell([absolute_height(n)],text(" ")). | |
| 2332 | 2351 | |
| 2333 | 2352 | public define Cell |
| 2334 | - empty = cell([],literal(" ")). | |
| 2353 | + empty = cell([],text(" ")). | |
| 2335 | 2354 | |
| 2336 | 2355 | |
| 2337 | 2356 | |
| ... | ... | @@ -2339,19 +2358,19 @@ public define Cell |
| 2339 | 2358 | at each call. The argument is the name of the file (relative to the directory of the |
| 2340 | 2359 | server), and the file is created automatically. It returns the number of the visitor. |
| 2341 | 2360 | |
| 2342 | -public define Int32 | |
| 2361 | +public define Int | |
| 2343 | 2362 | get_visitor_number |
| 2344 | 2363 | ( |
| 2345 | 2364 | String counter_file_name, |
| 2346 | 2365 | ) = |
| 2347 | 2366 | protect |
| 2348 | - if (RetrieveResult(Int32))retrieve(counter_file_name) is | |
| 2367 | + if (RetrieveResult(Int))retrieve(counter_file_name) is | |
| 2349 | 2368 | { |
| 2350 | 2369 | cannot_find_file then |
| 2351 | 2370 | // |
| 2352 | 2371 | // It's time to create the file. |
| 2353 | 2372 | // |
| 2354 | - if save((Int32)1,counter_file_name) is | |
| 2373 | + if save((Int)1,counter_file_name) is | |
| 2355 | 2374 | { |
| 2356 | 2375 | cannot_open_file then 0, |
| 2357 | 2376 | write_error then 0, | ... | ... |
calexium_lib/web/CXM_http_get_common.anubis
| ... | ... | @@ -32,7 +32,7 @@ public type HTTP_argument: |
| 32 | 32 | |
| 33 | 33 | 'crlf' and 'crlfcrlf' are defined in 'basis.anubis'. |
| 34 | 34 | |
| 35 | -public define Maybe(Int32) | |
| 35 | +public define Maybe(Int) | |
| 36 | 36 | has_double_crlf |
| 37 | 37 | ( |
| 38 | 38 | String s, |
| ... | ... | @@ -159,21 +159,21 @@ public define Bool |
| 159 | 159 | |
| 160 | 160 | Separating the server name from the port. |
| 161 | 161 | |
| 162 | -public define (String,Int32) | |
| 162 | +public define (String,Word32) | |
| 163 | 163 | separate_name_port |
| 164 | 164 | ( |
| 165 | 165 | String server_name, |
| 166 | - Int32 default_port | |
| 166 | + Word32 default_port | |
| 167 | 167 | ) = |
| 168 | 168 | if find(":",server_name,0) is |
| 169 | 169 | { |
| 170 | 170 | failure then (server_name,default_port), |
| 171 | 171 | success(n) then |
| 172 | 172 | (substr(server_name,0,n), |
| 173 | - if string_to_integer(substr(server_name,n+1,length(server_name)-n-1)) is | |
| 173 | + if decimal_scan(substr(server_name,n+1,length(server_name)-n-1)) is | |
| 174 | 174 | { |
| 175 | 175 | failure then default_port, |
| 176 | - success(p) then p | |
| 176 | + success(p) then truncate_to_Word32(p) | |
| 177 | 177 | }) |
| 178 | 178 | }. |
| 179 | 179 | |
| ... | ... | @@ -192,7 +192,7 @@ define HTTP_header |
| 192 | 192 | separate_header |
| 193 | 193 | ( |
| 194 | 194 | String header, |
| 195 | - Int32 i | |
| 195 | + Int i | |
| 196 | 196 | ) = |
| 197 | 197 | if nth(i,header) is |
| 198 | 198 | { |
| ... | ... | @@ -210,7 +210,7 @@ define List(HTTP_header) |
| 210 | 210 | separate_headers |
| 211 | 211 | ( |
| 212 | 212 | String headers, |
| 213 | - Int32 start, | |
| 213 | + Int start, | |
| 214 | 214 | ) = |
| 215 | 215 | if find("\r\n",headers,start) is |
| 216 | 216 | { |
| ... | ... | @@ -244,7 +244,7 @@ public define One |
| 244 | 244 | public define Word8 |
| 245 | 245 | force_nth |
| 246 | 246 | ( |
| 247 | - Int32 n, | |
| 247 | + Int n, | |
| 248 | 248 | String s |
| 249 | 249 | ) = |
| 250 | 250 | if nth(n,s) is | ... | ... |
calexium_lib/web/CXM_making_a_web_site.anubis
| ... | ... | @@ -439,7 +439,7 @@ public define Web_Site |
| 439 | 439 | Bool is_https) -> (Maybe($SessionTicket), Maybe($State), List(HTTP_header)) ticket_lost_state, |
| 440 | 440 | List(Web_Action($SessionTicket, $State)) actions, |
| 441 | 441 | (Maybe($SessionTicket), Maybe($State), List(Web_arg) lwa) -> HTML_Page compute_page, |
| 442 | - Int32 timeout, // seconds (todo: minutes) | |
| 442 | + Int timeout, // seconds (todo: minutes) | |
| 443 | 443 | List(Redirection) redirections, |
| 444 | 444 | String charset, |
| 445 | 445 | List(String) journal_extensions, |
| ... | ... | @@ -559,8 +559,8 @@ public define Web_Site |
| 559 | 559 | 'start_web_sites' below. This function returns a result of the following type: |
| 560 | 560 | |
| 561 | 561 | public type Start_Web_Sites_Result: |
| 562 | - cannot_bind_to_port(Int32), | |
| 563 | - cannot_bind_to_port(Int32,Int32), | |
| 562 | + cannot_bind_to_port(Word32), | |
| 563 | + cannot_bind_to_port(Word32,Word32), | |
| 564 | 564 | ok(Server http_server, |
| 565 | 565 | Server https_server). |
| 566 | 566 | |
| ... | ... | @@ -582,9 +582,9 @@ public type Start_Web_Sites_Result: |
| 582 | 582 | public define Start_Web_Sites_Result |
| 583 | 583 | start_web_sites |
| 584 | 584 | ( |
| 585 | - Int32 ip_address, // the IP address shared by the web sites | |
| 586 | - Int32 http_port, // usually: 80 | |
| 587 | - Int32 https_port, // usually: 443 | |
| 585 | + Word32 ip_address, // the IP address shared by the web sites | |
| 586 | + Word32 http_port, // usually: 80 | |
| 587 | + Word32 https_port, // usually: 443 | |
| 588 | 588 | String ssl_certificate_common_name, |
| 589 | 589 | List(Web_Site) web_sites, // web sites to be started |
| 590 | 590 | Var(Bool) shutdown_required |
| ... | ... | @@ -627,12 +627,12 @@ public define Start_Web_Sites_Result |
| 627 | 627 | |
| 628 | 628 | |
| 629 | 629 | public type HTML_Size: |
| 630 | - absolute(Int32), // in pixels | |
| 631 | - percentage(Int32). | |
| 630 | + absolute(Int), // in pixels | |
| 631 | + percentage(Int). | |
| 632 | 632 | |
| 633 | 633 | |
| 634 | 634 | public type Text_Option: |
| 635 | - size(Int32), // size of character font to use | |
| 635 | + size(Int), // size of character font to use | |
| 636 | 636 | font(String), // name of character font to use (such as "helvetica",...) |
| 637 | 637 | color(RGB), // color to be used for characters |
| 638 | 638 | italic, |
| ... | ... | @@ -726,7 +726,7 @@ public type CoreAttrs: |
| 726 | 726 | lang (String), |
| 727 | 727 | dir (Reading_Way), |
| 728 | 728 | accesskey (Word8), |
| 729 | - tabindex (Int32), | |
| 729 | + tabindex (Int), | |
| 730 | 730 | attr (String, String), |
| 731 | 731 | event (HtmlEvents, String). |
| 732 | 732 | |
| ... | ... | @@ -737,7 +737,7 @@ public type InputAttrs: |
| 737 | 737 | lang (String), |
| 738 | 738 | dir (Reading_Way), |
| 739 | 739 | accesskey (Word8), |
| 740 | - tabindex (Int32), | |
| 740 | + tabindex (Int), | |
| 741 | 741 | attr (String, String), |
| 742 | 742 | event (HtmlEvents, String). |
| 743 | 743 | |
| ... | ... | @@ -788,12 +788,12 @@ define String event_name |
| 788 | 788 | public type Table_Option: |
| 789 | 789 | background_color(RGB), // applied to all cells in the table |
| 790 | 790 | background_image(String url), |
| 791 | - border(Int32 width_of_outer_edge, // if not present, all values are 0 | |
| 792 | - Int32 width_of_top_of_relief, | |
| 793 | - Int32 width_of_inner_edge, | |
| 791 | + border(Int width_of_outer_edge, // if not present, all values are 0 | |
| 792 | + Int width_of_top_of_relief, | |
| 793 | + Int width_of_inner_edge, | |
| 794 | 794 | RGB border_color), |
| 795 | - width(Int32), // sets a minimal width for the table | |
| 796 | - percentage_width(Int32). | |
| 795 | + width(Int), // sets a minimal width for the table | |
| 796 | + percentage_width(Int). | |
| 797 | 797 | |
| 798 | 798 | |
| 799 | 799 | public define Table_Option nude = border(0,0,0,rgb(0,0,0)). |
| ... | ... | @@ -821,11 +821,11 @@ public type Cell_Option: |
| 821 | 821 | base_line, // align the content vertically according to base lines |
| 822 | 822 | background_color(RGB), |
| 823 | 823 | background_image(String url, BackgroundOption), |
| 824 | - width(Int32), // sets a minimal width for the cell | |
| 825 | - percentage_width(Int32), | |
| 826 | - height(Int32), // sets a minimal height for the cell | |
| 827 | - columns(Int32), // lets the cell span over several columns | |
| 828 | - rows(Int32), // lets the cell span over several rows | |
| 824 | + width(Int), // sets a minimal width for the cell | |
| 825 | + percentage_width(Int), | |
| 826 | + height(Int), // sets a minimal height for the cell | |
| 827 | + columns(Int), // lets the cell span over several columns | |
| 828 | + rows(Int), // lets the cell span over several rows | |
| 829 | 829 | nowrap. // do not allow text wrapping within the cell |
| 830 | 830 | |
| 831 | 831 | A list of 'Cell_Option' must be given with each cell and each row in a table. Options |
| ... | ... | @@ -907,8 +907,8 @@ public type Actioner_Connection: |
| 907 | 907 | public type Other_Window_Option: |
| 908 | 908 | resizable, // the new window may be resized by the client |
| 909 | 909 | scrollbars, // the new window has scrollbars |
| 910 | - width(Int32), // the new window has the specified width | |
| 911 | - height(Int32). // the new window has the specified height | |
| 910 | + width(Int), // the new window has the specified width | |
| 911 | + height(Int). // the new window has the specified height | |
| 912 | 912 | |
| 913 | 913 | public type Actioner_Target: |
| 914 | 914 | same, |
| ... | ... | @@ -920,10 +920,10 @@ public type Actioner_Aspect: |
| 920 | 920 | img_link (String img_url, String alt_text), |
| 921 | 921 | push_button (List(CoreAttrs),String text), |
| 922 | 922 | button (String url_off, String url_on), // rollover button |
| 923 | - button (String url_off, String url_on, Int32 w, Int32 h), // idem with size | |
| 923 | + button (String url_off, String url_on, Int w, Int h), // idem with size | |
| 924 | 924 | submit (List(CoreAttrs),String text), |
| 925 | - immediate_selector (List(CoreAttrs),WebArgName name, Int32 size, List((WebArgValue,String)) choices), | |
| 926 | - immediate_selector (List(CoreAttrs),WebArgName name, Int32 size, List((WebArgValue,String)) choices, InitialValue selected). | |
| 925 | + immediate_selector (List(CoreAttrs),WebArgName name, Int size, List((WebArgValue,String)) choices), | |
| 926 | + immediate_selector (List(CoreAttrs),WebArgName name, Int size, List((WebArgValue,String)) choices, InitialValue selected). | |
| 927 | 927 | |
| 928 | 928 | |
| 929 | 929 | |
| ... | ... | @@ -951,14 +951,14 @@ public define Actioner_Aspect |
| 951 | 951 | link |
| 952 | 952 | ( |
| 953 | 953 | List(Text_Option) options, |
| 954 | - Int32 i | |
| 954 | + Int i | |
| 955 | 955 | ) = |
| 956 | - link(options,integer_to_string(i), failure). | |
| 956 | + link(options,to_decimal(i), failure). | |
| 957 | 957 | |
| 958 | 958 | public define Actioner_Aspect |
| 959 | 959 | link |
| 960 | 960 | ( |
| 961 | - Int32 i | |
| 961 | + Int i | |
| 962 | 962 | ) = |
| 963 | 963 | link([], i). |
| 964 | 964 | |
| ... | ... | @@ -986,12 +986,12 @@ public type HTML_In_Form: |
| 986 | 986 | preformated (List(Text_Option), String), |
| 987 | 987 | paragraph (List(Text_Option), HTML_In_Form content), |
| 988 | 988 | image (List(CoreAttrs), String url, String alternate), |
| 989 | - image (List(CoreAttrs), String url, String alternate, Int32 width, Int32 height), | |
| 989 | + image (List(CoreAttrs), String url, String alternate, Int width, Int height), | |
| 990 | 990 | table (List(Table_Option), HTML_Header_Row(HTML_In_Form), List(HTML_Row(HTML_In_Form)), HTML_Footer_Row(HTML_In_Form)), |
| 991 | 991 | center (HTML_In_Form), |
| 992 | 992 | mail_to (String email, HTML_In_Form element), |
| 993 | - scroller (Int32 width, Int32 height, | |
| 994 | - Int32 content_width, Int32 content_height, | |
| 993 | + scroller (Int width, Int height, | |
| 994 | + Int content_width, Int content_height, | |
| 995 | 995 | HTML_In_Form content), |
| 996 | 996 | actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, |
| 997 | 997 | String action_name, List((String,String)) extra_ops, |
| ... | ... | @@ -1001,18 +1001,18 @@ public type HTML_In_Form: |
| 1001 | 1001 | foreign_link (List(Text_Option), String url, String name), |
| 1002 | 1002 | private_download (String abs_path, String name, String extra_ext, |
| 1003 | 1003 | Maybe((String,List((String,String)))) action), |
| 1004 | - text_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), | |
| 1005 | - text_input_ro (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), | |
| 1006 | - password_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), | |
| 1007 | - text_area (List(TextAreaOption), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width, Int32 height), | |
| 1008 | - file_upload (List(InputAttrs), String label, HtmlId id, WebArgName name, Int32 width), | |
| 1009 | - selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List(String) choices), | |
| 1010 | - selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List(String) choices, InitialValue selected), | |
| 1004 | + text_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int width), | |
| 1005 | + text_input_ro (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int width), | |
| 1006 | + password_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int width), | |
| 1007 | + text_area (List(TextAreaOption), String label_text, HtmlId id, WebArgName name, InitialValue init, Int width, Int height), | |
| 1008 | + file_upload (List(InputAttrs), String label, HtmlId id, WebArgName name, Int width), | |
| 1009 | + selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int size, List(String) choices), | |
| 1010 | + selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int size, List(String) choices, InitialValue selected), | |
| 1011 | 1011 | // List((String,String)) = List((code,name)) where : |
| 1012 | 1012 | // code is the web-arg value |
| 1013 | 1013 | // name appears in selector |
| 1014 | - selector_c (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List((WebArgValue,String)) choices), | |
| 1015 | - selector_c (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List((WebArgValue,String)) choices, InitialValue selected), | |
| 1014 | + selector_c (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int size, List((WebArgValue,String)) choices), | |
| 1015 | + selector_c (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int size, List((WebArgValue,String)) choices, InitialValue selected), | |
| 1016 | 1016 | radio_button (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), |
| 1017 | 1017 | radio_button_r (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), |
| 1018 | 1018 | check_box (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), |
| ... | ... | @@ -1029,12 +1029,12 @@ public define HTML_In_Form literal(Printable_tree t) = literal_pt(t). |
| 1029 | 1029 | |
| 1030 | 1030 | public define HTML_In_Form image(String url) = image([], url, url). |
| 1031 | 1031 | |
| 1032 | -public define HTML_In_Form image(String url, Int32 width, Int32 height) = image([], url, url, width, height). | |
| 1032 | +public define HTML_In_Form image(String url, Int width, Int height) = image([], url, url, width, height). | |
| 1033 | 1033 | |
| 1034 | 1034 | public define HTML_In_Form |
| 1035 | 1035 | foreign_link |
| 1036 | 1036 | ( |
| 1037 | - Int32 tsize, | |
| 1037 | + Int tsize, | |
| 1038 | 1038 | String url, |
| 1039 | 1039 | String name |
| 1040 | 1040 | ) = |
| ... | ... | @@ -1066,8 +1066,8 @@ public define HTML_In_Form |
| 1066 | 1066 | ( |
| 1067 | 1067 | WebArgName name, |
| 1068 | 1068 | InitialValue init, |
| 1069 | - Int32 width, | |
| 1070 | - Int32 height | |
| 1069 | + Int width, | |
| 1070 | + Int height | |
| 1071 | 1071 | ) = |
| 1072 | 1072 | text_area([], "", htmlId(""), name,init,width,height). |
| 1073 | 1073 | |
| ... | ... | @@ -1077,8 +1077,8 @@ public define HTML_In_Form |
| 1077 | 1077 | List(TextAreaOption) options, |
| 1078 | 1078 | WebArgName name, |
| 1079 | 1079 | InitialValue init, |
| 1080 | - Int32 width, | |
| 1081 | - Int32 height | |
| 1080 | + Int width, | |
| 1081 | + Int height | |
| 1082 | 1082 | ) = |
| 1083 | 1083 | text_area(options, "", htmlId(""), name,init,width,height). |
| 1084 | 1084 | |
| ... | ... | @@ -1158,7 +1158,7 @@ public define HTML_In_Form |
| 1158 | 1158 | = check_box_r (options, label_text, htmlId(n.name), n, value, checked). |
| 1159 | 1159 | |
| 1160 | 1160 | public define HTML_In_Form |
| 1161 | - file_upload (WebArgName name, Int32 width) | |
| 1161 | + file_upload (WebArgName name, Int width) | |
| 1162 | 1162 | = file_upload([], "", htmlId(""), name, width). |
| 1163 | 1163 | |
| 1164 | 1164 | |
| ... | ... | @@ -1170,12 +1170,12 @@ public type HTML_Off_Form: |
| 1170 | 1170 | preformated (List(Text_Option), String), |
| 1171 | 1171 | paragraph (List(Text_Option), HTML_Off_Form content), |
| 1172 | 1172 | image (List(CoreAttrs), String url, String alternate), |
| 1173 | - image (List(CoreAttrs), String url, String alternate, Int32 width, Int32 height), | |
| 1173 | + image (List(CoreAttrs), String url, String alternate, Int width, Int height), | |
| 1174 | 1174 | table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)), |
| 1175 | 1175 | center (HTML_Off_Form), |
| 1176 | 1176 | mail_to (String email, HTML_Off_Form element), |
| 1177 | - scroller (Int32 width, Int32 height, | |
| 1178 | - Int32 content_width, Int32 content_height, | |
| 1177 | + scroller (Int width, Int height, | |
| 1178 | + Int content_width, Int content_height, | |
| 1179 | 1179 | HTML_Off_Form content), |
| 1180 | 1180 | fixed_size (HTML_Size width, HTML_Size height, HTML_Off_Form content), |
| 1181 | 1181 | fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), |
| ... | ... | @@ -1203,7 +1203,7 @@ public type HTML_Off_Form: |
| 1203 | 1203 | |
| 1204 | 1204 | public define HTML_Off_Form image(String url) = image([], url, url). |
| 1205 | 1205 | |
| 1206 | -public define HTML_Off_Form image(String url, Int32 width, Int32 height) = image([], url, url, width, height). | |
| 1206 | +public define HTML_Off_Form image(String url, Int width, Int height) = image([], url, url, width, height). | |
| 1207 | 1207 | |
| 1208 | 1208 | public define HTML_Off_Form |
| 1209 | 1209 | form |
| ... | ... | @@ -1234,7 +1234,7 @@ public define HTML_Off_Form fixed_size(HTML_Size width, HTML_Size height, String |
| 1234 | 1234 | public define HTML_Off_Form |
| 1235 | 1235 | foreign_link |
| 1236 | 1236 | ( |
| 1237 | - Int32 tsize, | |
| 1237 | + Int tsize, | |
| 1238 | 1238 | String url, |
| 1239 | 1239 | String name |
| 1240 | 1240 | ) = |
| ... | ... | @@ -1329,15 +1329,15 @@ public define HTML_Off_Form |
| 1329 | 1329 | text |
| 1330 | 1330 | ( |
| 1331 | 1331 | List(Text_Option) lto, |
| 1332 | - Int32 i | |
| 1332 | + Int i | |
| 1333 | 1333 | ) = |
| 1334 | - text(lto,integer_to_string(i)). | |
| 1334 | + text(lto,to_decimal(i)). | |
| 1335 | 1335 | |
| 1336 | 1336 | |
| 1337 | 1337 | public define HTML_Off_Form |
| 1338 | 1338 | text |
| 1339 | 1339 | ( |
| 1340 | - Int32 i | |
| 1340 | + Int i | |
| 1341 | 1341 | ) = |
| 1342 | 1342 | text([],i). |
| 1343 | 1343 | |
| ... | ... | @@ -1353,14 +1353,14 @@ public define HTML_Off_Form |
| 1353 | 1353 | public define HTML_Cell(HTML_Off_Form) |
| 1354 | 1354 | width_gap |
| 1355 | 1355 | ( |
| 1356 | - Int32 w | |
| 1356 | + Int w | |
| 1357 | 1357 | ) = |
| 1358 | 1358 | cell([width(w)],text([],"")). |
| 1359 | 1359 | |
| 1360 | 1360 | public define HTML_Cell(HTML_In_Form) |
| 1361 | 1361 | width_gap |
| 1362 | 1362 | ( |
| 1363 | - Int32 w | |
| 1363 | + Int w | |
| 1364 | 1364 | ) = |
| 1365 | 1365 | cell([width(w)],text([],"")). |
| 1366 | 1366 | |
| ... | ... | @@ -1370,14 +1370,14 @@ public define HTML_Cell(HTML_In_Form) |
| 1370 | 1370 | public define HTML_Row(HTML_Off_Form) |
| 1371 | 1371 | height_gap |
| 1372 | 1372 | ( |
| 1373 | - Int32 h | |
| 1373 | + Int h | |
| 1374 | 1374 | ) = |
| 1375 | 1375 | row([],[cell([height(h)],text([],""))]). |
| 1376 | 1376 | |
| 1377 | 1377 | public define HTML_Row(HTML_In_Form) |
| 1378 | 1378 | height_gap |
| 1379 | 1379 | ( |
| 1380 | - Int32 h | |
| 1380 | + Int h | |
| 1381 | 1381 | ) = |
| 1382 | 1382 | row([],[cell([height(h)],text([],""))]). |
| 1383 | 1383 | |
| ... | ... | @@ -1430,8 +1430,8 @@ public type HTML_Meta: |
| 1430 | 1430 | refresh (Actioner_Connection connection, |
| 1431 | 1431 | Actioner_Target target, |
| 1432 | 1432 | String action_name, |
| 1433 | - Int32 delay), // in seconds | |
| 1434 | - refresh (String url, Int32 delay), // in seconds | |
| 1433 | + Int delay), // in seconds | |
| 1434 | + refresh (String url, Int delay), // in seconds | |
| 1435 | 1435 | meta (String name, String content), |
| 1436 | 1436 | http_equiv (String name, String content), |
| 1437 | 1437 | generic_meta (List((String,String))), |
| ... | ... | @@ -1707,7 +1707,7 @@ read CXM_web_arg_encode.anubis |
| 1707 | 1707 | define (Maybe($State) s) -> String // the function constructed returns the name of the state |
| 1708 | 1708 | make_save_state_function |
| 1709 | 1709 | ( |
| 1710 | - Int32 timeout, | |
| 1710 | + Int timeout, | |
| 1711 | 1711 | String state_directory |
| 1712 | 1712 | ) = |
| 1713 | 1713 | (Maybe($State) mbs) |-> |
| ... | ... | @@ -1740,7 +1740,7 @@ define (String state_name) -> PreviousState($State) |
| 1740 | 1740 | ) = |
| 1741 | 1741 | (String state_name) |-> |
| 1742 | 1742 | with file_path = state_directory+"/s"+state_name, |
| 1743 | - if (RetrieveResult((Int32,$State)))retrieve(file_path) is ok(d) | |
| 1743 | + if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d) | |
| 1744 | 1744 | then ( |
| 1745 | 1745 | if d is (time_stamp,s) then |
| 1746 | 1746 | if time_stamp < now |
| ... | ... | @@ -1772,7 +1772,7 @@ define (List(String) file_names) -> One |
| 1772 | 1772 | [ ] then unique, |
| 1773 | 1773 | [h . t] then |
| 1774 | 1774 | with file_path = state_directory+"/"+h, |
| 1775 | - if (RetrieveResult((Int32,$State)))retrieve(file_path) is ok(d) | |
| 1775 | + if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d) | |
| 1776 | 1776 | then ( |
| 1777 | 1777 | if d is (time_stamp,data) then |
| 1778 | 1778 | if time_stamp < now |
| ... | ... | @@ -1830,8 +1830,8 @@ define One |
| 1830 | 1830 | delete_states_loop |
| 1831 | 1831 | ( |
| 1832 | 1832 | List((String,List(String) -> One)) directories_and_functions, |
| 1833 | - Int32 timeout, | |
| 1834 | - Int32 next_time, | |
| 1833 | + Int timeout, | |
| 1834 | + Int next_time, | |
| 1835 | 1835 | Server http_server, |
| 1836 | 1836 | Server https_server, |
| 1837 | 1837 | Var(Bool) shutdown_required |
| ... | ... | @@ -1932,10 +1932,10 @@ define String |
| 1932 | 1932 | |
| 1933 | 1933 | In order to uniquely name object for JavaScript we generate unique ids from a counter. |
| 1934 | 1934 | |
| 1935 | -define Int32 | |
| 1935 | +define Int | |
| 1936 | 1936 | new_idnum |
| 1937 | 1937 | ( |
| 1938 | - Var(Int32) ic_v // 'idnum' counter variable | |
| 1938 | + Var(Int) ic_v // 'idnum' counter variable | |
| 1939 | 1939 | ) = |
| 1940 | 1940 | protect |
| 1941 | 1941 | with result = *ic_v+1, |
| ... | ... | @@ -2031,7 +2031,7 @@ define (List(Web_arg) lwa) -> Separated_Web_Args($State) |
| 2031 | 2031 | { |
| 2032 | 2032 | web_arg(n,v) then |
| 2033 | 2033 | with prefix = if substr(n,0,4) = "amp;" then substr(n,4,1) else substr(n,0,1), |
| 2034 | - name_start = (Int32)(if substr(n,0,4) = "amp;" then 5 else 1), | |
| 2034 | + name_start = (Int)(if substr(n,0,4) = "amp;" then 5 else 1), | |
| 2035 | 2035 | if prefix = "s" then |
| 2036 | 2036 | swa(success(retrieve_state(v)),an1,op1) else |
| 2037 | 2037 | if prefix = "a" then |
| ... | ... | @@ -2070,7 +2070,7 @@ define (Maybe($State) previous, |
| 2070 | 2070 | Bool is_https) -> (Maybe($SessionTicket), Maybe($State), List(HTTP_header)) |
| 2071 | 2071 | make_apply_action_function |
| 2072 | 2072 | ( |
| 2073 | - List(Web_Action($SessionTicket, $State)) actions | |
| 2073 | + List(Web_Action($SessionTicket, $State)) actions_list | |
| 2074 | 2074 | ) = |
| 2075 | 2075 | with f = |
| 2076 | 2076 | (Maybe($State) previous, |
| ... | ... | @@ -2121,7 +2121,7 @@ define (Maybe($State) previous, |
| 2121 | 2121 | HTTP_Info http_info, |
| 2122 | 2122 | List(Web_arg) lwa, |
| 2123 | 2123 | Bool is_https) |-> |
| 2124 | - f(previous,action_name,http_info,lwa,is_https,actions). | |
| 2124 | + f(previous, action_name, http_info, lwa, is_https, actions_list). | |
| 2125 | 2125 | |
| 2126 | 2126 | |
| 2127 | 2127 | |
| ... | ... | @@ -2138,7 +2138,7 @@ define (Maybe($State) previous, |
| 2138 | 2138 | need another one, because, we have some extra informations to record for each site. |
| 2139 | 2139 | |
| 2140 | 2140 | public type Web_Site: |
| 2141 | - web_site((Int32,Int32) -> Web_Site_Description description, | |
| 2141 | + web_site((Word32,Word32) -> Web_Site_Description description, | |
| 2142 | 2142 | List(String) -> One delete_out_of_date). |
| 2143 | 2143 | |
| 2144 | 2144 | |
| ... | ... | @@ -2154,8 +2154,8 @@ public type Web_Site: |
| 2154 | 2154 | |
| 2155 | 2155 | type CommonInfo: |
| 2156 | 2156 | info(String common_name, |
| 2157 | - Int32 http_port, | |
| 2158 | - Int32 https_port, | |
| 2157 | + Word32 http_port, | |
| 2158 | + Word32 https_port, | |
| 2159 | 2159 | String site_directory, |
| 2160 | 2160 | String authorization_secret |
| 2161 | 2161 | ). |
| ... | ... | @@ -2205,7 +2205,7 @@ public define Web_Site |
| 2205 | 2205 | Bool is_https) -> (Maybe($SessionTicket), Maybe($State), List(HTTP_header)) ticket_lost_state, |
| 2206 | 2206 | List(Web_Action($SessionTicket, $State)) actions, |
| 2207 | 2207 | (Maybe($SessionTicket), Maybe($State), List(Web_arg) lwa) -> HTML_Page compute_page, |
| 2208 | - Int32 timeout, | |
| 2208 | + Int timeout, | |
| 2209 | 2209 | Redirections redirections, |
| 2210 | 2210 | String charset, |
| 2211 | 2211 | List(String) journal_extensions, |
| ... | ... | @@ -2235,7 +2235,7 @@ public define Web_Site |
| 2235 | 2235 | // |
| 2236 | 2236 | // construct the site handler |
| 2237 | 2237 | // |
| 2238 | - site_handler = (Int32 http_port, Int32 https_port) |-> | |
| 2238 | + site_handler = (Word32 http_port, Word32 https_port) |-> | |
| 2239 | 2239 | ((String host_name, |
| 2240 | 2240 | HTTP_Info http_info, |
| 2241 | 2241 | List(Web_arg) lwa, |
| ... | ... | @@ -2293,7 +2293,7 @@ public define Web_Site |
| 2293 | 2293 | // |
| 2294 | 2294 | // construct the web site description |
| 2295 | 2295 | // |
| 2296 | - web_site((Int32 http_port, Int32 https_port) |-> | |
| 2296 | + web_site((Word32 http_port, Word32 https_port) |-> | |
| 2297 | 2297 | web_site_description(common_names, |
| 2298 | 2298 | site_directory, |
| 2299 | 2299 | redirections, |
| ... | ... | @@ -2320,9 +2320,9 @@ public define Web_Site |
| 2320 | 2320 | public define Start_Web_Sites_Result |
| 2321 | 2321 | start_web_sites |
| 2322 | 2322 | ( |
| 2323 | - Int32 ip_address, // the IP address shared by the web sites | |
| 2324 | - Int32 http_port, // usually: 80 | |
| 2325 | - Int32 https_port, // usually: 443 | |
| 2323 | + Word32 ip_address, // the IP address shared by the web sites | |
| 2324 | + Word32 http_port, // usually: 80 | |
| 2325 | + Word32 https_port, // usually: 443 | |
| 2326 | 2326 | String ssl_certificate_common_name, |
| 2327 | 2327 | List(Web_Site) web_sites, // web sites to be started |
| 2328 | 2328 | Var(Bool) shutdown_required |
| ... | ... | @@ -2372,9 +2372,9 @@ public define Start_Web_Sites_Result |
| 2372 | 2372 | public define One |
| 2373 | 2373 | start_web_sites |
| 2374 | 2374 | ( |
| 2375 | - Int32 ip_address, // the IP address shared by the web sites | |
| 2376 | - Int32 http_port, // usually: 80 | |
| 2377 | - Int32 https_port, // usually: 443 | |
| 2375 | + Word32 ip_address, // the IP address shared by the web sites | |
| 2376 | + Word32 http_port, // usually: 80 | |
| 2377 | + Word32 https_port, // usually: 443 | |
| 2378 | 2378 | String ssl_certificate_common_name, |
| 2379 | 2379 | List(Web_Site) web_sites, // web sites to be started |
| 2380 | 2380 | Var(Bool) shutdown_required, |
| ... | ... | @@ -2426,12 +2426,12 @@ type HTML_Any($T): |
| 2426 | 2426 | any_preformated (List(Text_Option), String), |
| 2427 | 2427 | any_paragraph (List(Text_Option), $T content), |
| 2428 | 2428 | any_image (List(CoreAttrs), String url, String alternate), |
| 2429 | - any_image (List(CoreAttrs), String url, String alternate, Int32 width, Int32 height), | |
| 2429 | + any_image (List(CoreAttrs), String url, String alternate, Int width, Int height), | |
| 2430 | 2430 | any_table (List(Table_Option), HTML_Header_Row($T), List(HTML_Row($T)), HTML_Footer_Row($T)), |
| 2431 | 2431 | any_center ($T), |
| 2432 | 2432 | any_mail_to (String email, $T element), |
| 2433 | - any_scroller (Int32 width, Int32 height, | |
| 2434 | - Int32 content_width, Int32 content_height, | |
| 2433 | + any_scroller (Int width, Int height, | |
| 2434 | + Int content_width, Int content_height, | |
| 2435 | 2435 | $T content), |
| 2436 | 2436 | any_fixed_size (HTML_Size width, HTML_Size height, $T content), |
| 2437 | 2437 | any_fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), |
| ... | ... | @@ -2464,9 +2464,9 @@ define String |
| 2464 | 2464 | RGB color |
| 2465 | 2465 | ) = |
| 2466 | 2466 | if color is rgb(r,g,b) then |
| 2467 | - "#" + hexadecimal(word8_to_int32(r),2) | |
| 2468 | - + hexadecimal(word8_to_int32(g),2) | |
| 2469 | - + hexadecimal(word8_to_int32(b),2). | |
| 2467 | + "#" + to_hexa(r) | |
| 2468 | + + to_hexa(g) | |
| 2469 | + + to_hexa(b). | |
| 2470 | 2470 | |
| 2471 | 2471 | |
| 2472 | 2472 | The following is a very arbitrary definition of the opposite color. The thing which is |
| ... | ... | @@ -2479,12 +2479,9 @@ define RGB |
| 2479 | 2479 | RGB color |
| 2480 | 2480 | ) = |
| 2481 | 2481 | if color is rgb(r,g,b) then |
| 2482 | - with r1 = word8_to_int32(r), | |
| 2483 | - with g1 = word8_to_int32(g), | |
| 2484 | - with b1 = word8_to_int32(b), | |
| 2485 | - rgb(truncate_to_word8(255-r1), | |
| 2486 | - truncate_to_word8(255-g1), | |
| 2487 | - truncate_to_word8(255-b1)). | |
| 2482 | + rgb(255-r, | |
| 2483 | + 255-g, | |
| 2484 | + 255-b). | |
| 2488 | 2485 | |
| 2489 | 2486 | |
| 2490 | 2487 | |
| ... | ... | @@ -2498,19 +2495,19 @@ define RGB |
| 2498 | 2495 | |
| 2499 | 2496 | Computing printed text length. |
| 2500 | 2497 | |
| 2501 | - define Int32 | |
| 2498 | + define Int | |
| 2502 | 2499 | printed_text_width |
| 2503 | 2500 | ( |
| 2504 | - Word8 -> Int32 char_size, | |
| 2501 | + Word8 -> Int char_size, | |
| 2505 | 2502 | List(Word8) l |
| 2506 | 2503 | ) = |
| 2507 | 2504 | if l is |
| 2508 | 2505 | { |
| 2509 | - [] then (Int32) 0, | |
| 2506 | + [] then (Int) 0, | |
| 2510 | 2507 | [h . t] then char_size(h) + 1+ printed_text_width(char_size,t) |
| 2511 | 2508 | }. |
| 2512 | 2509 | |
| 2513 | - define Int32 | |
| 2510 | + define Int | |
| 2514 | 2511 | printed_text_width |
| 2515 | 2512 | ( |
| 2516 | 2513 | SystemFont font, |
| ... | ... | @@ -2538,11 +2535,11 @@ define RGBA |
| 2538 | 2535 | ( |
| 2539 | 2536 | RGBAImage dest, |
| 2540 | 2537 | RGBA color, |
| 2541 | - Int32 contrast, | |
| 2542 | - Int32 x, | |
| 2543 | - Int32 y, | |
| 2544 | - Int32 width, | |
| 2545 | - Int32 height | |
| 2538 | + Int contrast, | |
| 2539 | + Int x, | |
| 2540 | + Int y, | |
| 2541 | + Int width, | |
| 2542 | + Int height | |
| 2546 | 2543 | ) = |
| 2547 | 2544 | with l = lighten(color,contrast), |
| 2548 | 2545 | d = darken(color,contrast), |
| ... | ... | @@ -2558,8 +2555,8 @@ define RGBA |
| 2558 | 2555 | create_button_background |
| 2559 | 2556 | ( |
| 2560 | 2557 | RGBA color, |
| 2561 | - Int32 width, | |
| 2562 | - Int32 height | |
| 2558 | + Int width, | |
| 2559 | + Int height | |
| 2563 | 2560 | ) = |
| 2564 | 2561 | with result = create_rgba_image(width,height,color), |
| 2565 | 2562 | draw_relief(result,color,100,0,0,width,height); |
| ... | ... | @@ -2579,9 +2576,9 @@ define RGBA |
| 2579 | 2576 | ( |
| 2580 | 2577 | RGBAImage image, |
| 2581 | 2578 | String text, |
| 2582 | - Int32 text_index, | |
| 2583 | - Int32 pixel_x, | |
| 2584 | - Int32 y, | |
| 2579 | + Int text_index, | |
| 2580 | + Int pixel_x, | |
| 2581 | + Int y, | |
| 2585 | 2582 | Rectangle clip, |
| 2586 | 2583 | RGBA color, |
| 2587 | 2584 | SystemFont font, |
| ... | ... | @@ -2599,7 +2596,7 @@ define RGBA |
| 2599 | 2596 | ( |
| 2600 | 2597 | RGBAImage image, |
| 2601 | 2598 | String text, |
| 2602 | - Int32 text_width, | |
| 2599 | + Int text_width, | |
| 2603 | 2600 | RGBA light_color, |
| 2604 | 2601 | RGBA dark_color, |
| 2605 | 2602 | SystemFont font |
| ... | ... | @@ -2637,7 +2634,7 @@ define RGBA |
| 2637 | 2634 | String site_directory, |
| 2638 | 2635 | RGBA color, |
| 2639 | 2636 | String text, |
| 2640 | - Int32 width, | |
| 2637 | + Int width, | |
| 2641 | 2638 | SystemFont font |
| 2642 | 2639 | ) = |
| 2643 | 2640 | with xxxx = web_arg_encode(sha1((color,text,width))), |
| ... | ... | @@ -2649,7 +2646,7 @@ define RGBA |
| 2649 | 2646 | else with |
| 2650 | 2647 | text_width = printed_text_width(font,text), |
| 2651 | 2648 | button_width = max(width,text_width+12), |
| 2652 | - button_height = (Int32)20, | |
| 2649 | + button_height = (Int)20, | |
| 2653 | 2650 | light_color = lighten(color,60), |
| 2654 | 2651 | very_light_color = lighten(light_color,30), |
| 2655 | 2652 | dark_color = darken(color,40), |
| ... | ... | @@ -2721,7 +2718,7 @@ define String |
| 2721 | 2718 | resizable then "resizable", |
| 2722 | 2719 | scrollbars then "scrollbars", |
| 2723 | 2720 | width(w) then "width="+w, |
| 2724 | - height(h) then "height="+h | |
| 2721 | + height(h2) then "height="+h2 | |
| 2725 | 2722 | } + if t is [ ] then "" else (","+format(t)) |
| 2726 | 2723 | }. |
| 2727 | 2724 | |
| ... | ... | @@ -2787,12 +2784,12 @@ public define Printable_tree |
| 2787 | 2784 | |
| 2788 | 2785 | |
| 2789 | 2786 | |
| 2790 | -variable Int32 count = 0. | |
| 2787 | +variable Int count = 0. | |
| 2791 | 2788 | |
| 2792 | 2789 | Note: this counter is private to the virtual machine, hence there is one counter by |
| 2793 | 2790 | client and by page : it seems that a new VM (simply a delegate) is started for each request. |
| 2794 | 2791 | |
| 2795 | -define Int32 | |
| 2792 | +define Int | |
| 2796 | 2793 | new_count |
| 2797 | 2794 | = |
| 2798 | 2795 | count <- *count+1; |
| ... | ... | @@ -3168,25 +3165,25 @@ define Printable_tree |
| 3168 | 3165 | Bool is_https, |
| 3169 | 3166 | ) = |
| 3170 | 3167 | //if cinfo is info(common_name,http_port,https_port,site_dir,secret) then |
| 3171 | - with url = make_foreign_link_url(target,url), | |
| 3172 | -// with action = format_action(url, aspect, extract_id(aspect), mb_form_name), | |
| 3168 | + with full_url = make_foreign_link_url(target,url), | |
| 3169 | +// with action = format_action(full_url, aspect, extract_id(aspect), mb_form_name), | |
| 3173 | 3170 | if aspect is |
| 3174 | 3171 | { |
| 3175 | 3172 | |
| 3176 | 3173 | link(opt, text, mb_name) then |
| 3177 | 3174 | with name_tag = if mb_name is success(n) then " name=\"" + n + "\"" else "", |
| 3178 | 3175 | [ |
| 3179 | - "<a href=\"", url, "\"", format_text_options(opt), name_tag, ">", | |
| 3176 | + "<a href=\"", full_url, "\"", format_text_options(opt), name_tag, ">", | |
| 3180 | 3177 | text, |
| 3181 | 3178 | "</a>" |
| 3182 | 3179 | ], |
| 3183 | 3180 | img_link(img,alt_text) then |
| 3184 | 3181 | [ |
| 3185 | - "<a href=\"", url ,"\"><img src=\"", img, | |
| 3182 | + "<a href=\"", full_url ,"\"><img src=\"", img, | |
| 3186 | 3183 | "\" alt=\"" + alt_text + "\" border=\"0\"></a>" |
| 3187 | 3184 | ], |
| 3188 | 3185 | push_button(options, text) then |
| 3189 | - ["<a href=\"",url,"\"", format_attrs(options), ">", | |
| 3186 | + ["<a href=\"",full_url,"\"", format_attrs(options), ">", | |
| 3190 | 3187 | text, "</a>" |
| 3191 | 3188 | ], |
| 3192 | 3189 | button(url_off,url_on) then |
| ... | ... | @@ -3268,7 +3265,7 @@ define Printable_tree |
| 3268 | 3265 | [ if action is |
| 3269 | 3266 | { |
| 3270 | 3267 | url(u) then ["<a href=\"",u], |
| 3271 | - javascript(s,h) then [s,"<a onMouseDown=\"",h] | |
| 3268 | + javascript(s,h2) then [s,"<a onMouseDown=\"",h2] | |
| 3272 | 3269 | }, |
| 3273 | 3270 | "\" style=\"text-decoration:none\">", |
| 3274 | 3271 | "<img width=",w," height=",h," alt=\"",url_off,"\" src=\"",url_off,"\" border=0", |
| ... | ... | @@ -3358,10 +3355,10 @@ define Printable_tree |
| 3358 | 3355 | |
| 3359 | 3356 | *** [5.6] Formating rows and cells in a table. |
| 3360 | 3357 | |
| 3361 | -define Int32 | |
| 3358 | +define Int | |
| 3362 | 3359 | percent |
| 3363 | 3360 | ( |
| 3364 | - Int32 p | |
| 3361 | + Int p | |
| 3365 | 3362 | ) = |
| 3366 | 3363 | if p < 0 then 0 else if p > 100 then 100 else p. |
| 3367 | 3364 | |
| ... | ... | @@ -3421,7 +3418,7 @@ define String |
| 3421 | 3418 | background_image(n,o) then " style=\"background: url("+n+")"+format(o)+"\"", |
| 3422 | 3419 | width(w) then " width=\""+w+"\"", |
| 3423 | 3420 | percentage_width(n) then " width=\""+percent(n)+"%\"", |
| 3424 | - height(h) then " height=\""+h+"\"", | |
| 3421 | + height(h2) then " height=\""+h2+"\"", | |
| 3425 | 3422 | columns(n) then " colspan=\""+n+"\"", |
| 3426 | 3423 | rows(n) then " rowspan=\""+n+"\"", |
| 3427 | 3424 | nowrap then " nowrap" |
| ... | ... | @@ -3587,7 +3584,7 @@ define String |
| 3587 | 3584 | size(n) then "font-size:"+n+"pt", |
| 3588 | 3585 | font(fn) then "font-family:"+fn, |
| 3589 | 3586 | color(c) then if c is rgb(r,g,b) then |
| 3590 | - "color:rgb("+word8_to_int32(r)+","+word8_to_int32(g)+","+word8_to_int32(b)+")", | |
| 3587 | + "color:rgb("+to_decimal(r)+","+to_decimal(g)+","+to_decimal(b)+")", | |
| 3591 | 3588 | italic then "font-style:italic", |
| 3592 | 3589 | oblique then "font-style:oblique", |
| 3593 | 3590 | small_capitals then "font-variant:small-caps", |
| ... | ... | @@ -3638,11 +3635,11 @@ define Printable_tree |
| 3638 | 3635 | format_scroller |
| 3639 | 3636 | ( |
| 3640 | 3637 | String sn, |
| 3641 | - Int32 width, | |
| 3642 | - Int32 height, | |
| 3643 | - Int32 content_width, | |
| 3644 | - Int32 content_height, | |
| 3645 | - Int32 idnum, // identifying the scroller | |
| 3638 | + Int width, | |
| 3639 | + Int height, | |
| 3640 | + Int content_width, | |
| 3641 | + Int content_height, | |
| 3642 | + Int idnum, // identifying the scroller | |
| 3646 | 3643 | $T content, |
| 3647 | 3644 | $T -> Printable_tree format_element |
| 3648 | 3645 | ) = |
| ... | ... | @@ -3714,7 +3711,7 @@ define Printable_tree |
| 3714 | 3711 | ( |
| 3715 | 3712 | CommonInfo cinfo, |
| 3716 | 3713 | String sn, // state_name |
| 3717 | - Var(Int32) ic_v, | |
| 3714 | + Var(Int) ic_v, | |
| 3718 | 3715 | HTML_Any($T) element, |
| 3719 | 3716 | $T -> Printable_tree format_element, // able to format a datum of type $T |
| 3720 | 3717 | Bool is_https, |
| ... | ... | @@ -3798,7 +3795,7 @@ define Printable_tree |
| 3798 | 3795 | CommonInfo cinfo, |
| 3799 | 3796 | String fn, // form_name |
| 3800 | 3797 | String sn, // state_name |
| 3801 | - Var(Int32) ic_v, // idnum counter variable | |
| 3798 | + Var(Int) ic_v, // idnum counter variable | |
| 3802 | 3799 | HTML_In_Form element, |
| 3803 | 3800 | Bool is_https, |
| 3804 | 3801 | ) = |
| ... | ... | @@ -3983,7 +3980,7 @@ define Printable_tree |
| 3983 | 3980 | ( |
| 3984 | 3981 | CommonInfo cinfo, |
| 3985 | 3982 | String sn, // state_name |
| 3986 | - Var(Int32) ic_v, // 'idnum' counter variable | |
| 3983 | + Var(Int) ic_v, // 'idnum' counter variable | |
| 3987 | 3984 | HTML_Off_Form element, |
| 3988 | 3985 | Bool is_https, |
| 3989 | 3986 | ) = |
| ... | ... | @@ -4037,7 +4034,7 @@ define Printable_tree |
| 4037 | 4034 | enctype(c), |
| 4038 | 4035 | " action=\"http", |
| 4039 | 4036 | if is_https then "s" else "", |
| 4040 | - "://",common_name,":",http_port,"/\">", | |
| 4037 | + "://",common_name,":",to_decimal(http_port),"/\">", | |
| 4041 | 4038 | // action is set dynamically by |
| 4042 | 4039 | // the actioner using JavaScript |
| 4043 | 4040 | if fn is htmlId(id) then |
| ... | ... | @@ -4141,7 +4138,7 @@ define Printable_tree |
| 4141 | 4138 | { |
| 4142 | 4139 | background_color(c) then [" bgcolor=\"" , (String)html_format(c), "\""], |
| 4143 | 4140 | background_image(n) then [" background=", n], |
| 4144 | - background_image(n,o) then [" style=\"background: url(",n,")",format(o),"\""] | |
| 4141 | + background_image(n,o2) then [" style=\"background: url(",n,")",format(o2),"\""] | |
| 4145 | 4142 | |
| 4146 | 4143 | }. |
| 4147 | 4144 | |
| ... | ... | @@ -4209,7 +4206,7 @@ define Printable_tree |
| 4209 | 4206 | String charset |
| 4210 | 4207 | ) = |
| 4211 | 4208 | if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
| 4212 | - with ic_v = var((Int32)0), | |
| 4209 | + with ic_v = var((Int)0), | |
| 4213 | 4210 | if page is |
| 4214 | 4211 | { |
| 4215 | 4212 | html_page(title,metas,css_styles, css_files, js_files, body) then | ... | ... |
calexium_lib/web/CXM_mime.anubis
| ... | ... | @@ -68,5 +68,5 @@ public define String |
| 68 | 68 | String charset, |
| 69 | 69 | String text |
| 70 | 70 | )= |
| 71 | - with text = "=?"+charset+"?B?"+to_string(base64_encode(to_byte_array(text)))+"?=", | |
| 72 | - find_and_replace(text, implode([13,10]), implode([13,10,32])). | |
| 71 | + with text2 = "=?"+charset+"?B?"+to_string(base64_encode(to_byte_array(text)))+"?=", | |
| 72 | + find_and_replace(text2, implode([13,10]), implode([13,10,32])). | ... | ... |
calexium_lib/web/CXM_multihost_http_server.anubis
| ... | ... | @@ -179,7 +179,7 @@ read CXM_mime.anubis |
| 179 | 179 | public type HTTP_Info: |
| 180 | 180 | http_info |
| 181 | 181 | ( |
| 182 | - Int32 ip_address, // IP address of the client | |
| 182 | + Word32 ip_address, // IP address of the client | |
| 183 | 183 | String uri, // URI requested by the client |
| 184 | 184 | List(HTTP_header) http_headers, // HTTP headers sent by the client |
| 185 | 185 | One -> String generate_trust_ticket // may be used against denial of |
| ... | ... | @@ -283,17 +283,17 @@ public type Web_Site_Description: |
| 283 | 283 | Each dubious IP address is recorded together with its last activity time. |
| 284 | 284 | |
| 285 | 285 | public type DubiousIP: |
| 286 | - dubious_ip (Int32 address, | |
| 287 | - Int32 last_activity). | |
| 286 | + dubious_ip (Word32 address, | |
| 287 | + Int last_activity). | |
| 288 | 288 | |
| 289 | 289 | |
| 290 | 290 | public type DenialOfService: |
| 291 | - denial_of_service(Var(Int32) max_connections, | |
| 292 | - Var(Int32) request_line_delay, // seconds | |
| 293 | - Var(Int32) headers_delay, | |
| 294 | - Var(Int32) answer_delay, | |
| 291 | + denial_of_service(Var(Int) max_connections, | |
| 292 | + Var(Int) request_line_delay, // seconds | |
| 293 | + Var(Int) headers_delay, | |
| 294 | + Var(Int) answer_delay, | |
| 295 | 295 | Var(List(DubiousIP)) list_of_dubious, |
| 296 | - Var(List(Int32)) reliable_addresses). | |
| 296 | + Var(List(Word32)) reliable_addresses). | |
| 297 | 297 | |
| 298 | 298 | The informations in this set of variables are stored serialized into the file |
| 299 | 299 | 'my_anubis/web_sites/dos_info'. If this file does not exist a set if variables with |
| ... | ... | @@ -315,8 +315,8 @@ public define DenialOfService load_denial_of_service_info. |
| 315 | 315 | public define StartServerResult |
| 316 | 316 | start_http_server |
| 317 | 317 | ( |
| 318 | - Int32 ip_address, | |
| 319 | - Int32 http_port, | |
| 318 | + Word32 ip_address, | |
| 319 | + Word32 http_port, | |
| 320 | 320 | List(Web_Site_Description) web_sites, |
| 321 | 321 | DenialOfService dos |
| 322 | 322 | ). |
| ... | ... | @@ -324,8 +324,8 @@ public define StartServerResult |
| 324 | 324 | public define StartServerResult |
| 325 | 325 | start_https_server |
| 326 | 326 | ( |
| 327 | - Int32 ip_address, | |
| 328 | - Int32 https_port, | |
| 327 | + Word32 ip_address, | |
| 328 | + Word32 https_port, | |
| 329 | 329 | String certificate_common_name, |
| 330 | 330 | List(Web_Site_Description) web_sites, |
| 331 | 331 | DenialOfService dos |
| ... | ... | @@ -452,7 +452,7 @@ public define String |
| 452 | 452 | |
| 453 | 453 | public type DispatcherInfo: |
| 454 | 454 | site(String common_name, |
| 455 | - Int32 http_port). | |
| 455 | + Word32 http_port). | |
| 456 | 456 | |
| 457 | 457 | The dispatcher does not write into this file. It reads it when it starts, and rereads |
| 458 | 458 | it each time the date of last modification of the file changes, so that the dispatcher |
| ... | ... | @@ -468,8 +468,8 @@ public type DispatcherInfo: |
| 468 | 468 | public define One |
| 469 | 469 | start_web_dispatcher |
| 470 | 470 | ( |
| 471 | - Int32 ip_address, // address for listening (typically 0) | |
| 472 | - Int32 port, // typically 80 | |
| 471 | + Word32 ip_address, // address for listening (typically 0) | |
| 472 | + Word32 port, // typically 80 | |
| 473 | 473 | DenialOfService dos |
| 474 | 474 | ). |
| 475 | 475 | |
| ... | ... | @@ -497,7 +497,7 @@ define String |
| 497 | 497 | ( |
| 498 | 498 | UTime t |
| 499 | 499 | ) = |
| 500 | - integer_to_string(t.seconds) + "." + zero_pad_n(6, t.microseconds ) + "s". | |
| 500 | + to_decimal(t.seconds) + "." + zero_pad_n(6, t.microseconds ) + "s". | |
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | variable UTime t0 = utime(0,0). |
| ... | ... | @@ -508,7 +508,7 @@ define One |
| 508 | 508 | ( |
| 509 | 509 | UTime start |
| 510 | 510 | ) = |
| 511 | - with delta = (UTime)now - start, | |
| 511 | + with delta = (UTime)unow - start, | |
| 512 | 512 | t1 <- delta + *t1; |
| 513 | 513 | unique. |
| 514 | 514 | |
| ... | ... | @@ -519,7 +519,7 @@ define One |
| 519 | 519 | ( |
| 520 | 520 | UTime start |
| 521 | 521 | ) = |
| 522 | - with delta = (UTime)now - start, | |
| 522 | + with delta = (UTime)unow - start, | |
| 523 | 523 | t2 <- delta + *t2; |
| 524 | 524 | unique. |
| 525 | 525 | |
| ... | ... | @@ -529,7 +529,7 @@ public define One |
| 529 | 529 | ( |
| 530 | 530 | String txt |
| 531 | 531 | ) = |
| 532 | - println(utime_to_string((UTime)now - *t0) + " : " + txt). | |
| 532 | + println(utime_to_string((UTime)unow - *t0) + " : " + txt). | |
| 533 | 533 | |
| 534 | 534 | |
| 535 | 535 | ----------------------------------- Table of Contents --------------------------------- |
| ... | ... | @@ -614,7 +614,7 @@ type Error: |
| 614 | 614 | end_of_line_expected, |
| 615 | 615 | incorrect_content_length_value, |
| 616 | 616 | colon_expected, |
| 617 | - timeout(Int32). | |
| 617 | + timeout(Int). | |
| 618 | 618 | |
| 619 | 619 | type HTTP_RequestType: |
| 620 | 620 | get, |
| ... | ... | @@ -632,7 +632,7 @@ type EncodingType: |
| 632 | 632 | type BufferedConnection: |
| 633 | 633 | buffered_connection(Connection conn, |
| 634 | 634 | Var(ByteArray) buffer, |
| 635 | - Var(Int32) read_pos). | |
| 635 | + Var(Int) read_pos). | |
| 636 | 636 | |
| 637 | 637 | |
| 638 | 638 | |
| ... | ... | @@ -674,8 +674,8 @@ define String |
| 674 | 674 | |
| 675 | 675 | We need two conversion functions for IP addresses: |
| 676 | 676 | |
| 677 | - (Word8,Word8,Word8,Word8) --> Int32 ip_address | |
| 678 | - Int32 --> String ip_addr_to_string | |
| 677 | + (Word8,Word8,Word8,Word8) --> Word32 ip_address | |
| 678 | + Word32 --> String ip_addr_to_string | |
| 679 | 679 | |
| 680 | 680 | These conversions are defined in 'tools/basis.anubis'. |
| 681 | 681 | |
| ... | ... | @@ -710,15 +710,15 @@ define One |
| 710 | 710 | |
| 711 | 711 | |
| 712 | 712 | |
| 713 | -define One record_dubious_IP(Int32 addr,DenialOfService dos). | |
| 713 | +define One record_dubious_IP(Word32 addr,DenialOfService dos). | |
| 714 | 714 | |
| 715 | -variable Int32 sttm = 0. // contains the start time for this connection. | |
| 715 | +variable Int sttm = 0. // contains the start time for this connection. | |
| 716 | 716 | |
| 717 | 717 | define Result(Error,Word8) |
| 718 | 718 | record_dubious_connection |
| 719 | 719 | ( |
| 720 | 720 | Connection conn, |
| 721 | - Int32 dead_line, | |
| 721 | + Int dead_line, | |
| 722 | 722 | DenialOfService dos, |
| 723 | 723 | ) = |
| 724 | 724 | if remote_IP_address_and_port(conn) is (addr,port) then |
| ... | ... | @@ -739,8 +739,8 @@ define One |
| 739 | 739 | ( |
| 740 | 740 | ByteArray source, |
| 741 | 741 | ByteArray dest, |
| 742 | - Int32 position, | |
| 743 | - Int32 i | |
| 742 | + Int position, | |
| 743 | + Int i | |
| 744 | 744 | ) = |
| 745 | 745 | if nth(i,source) is |
| 746 | 746 | { |
| ... | ... | @@ -756,16 +756,16 @@ define ReadResult |
| 756 | 756 | read_from_connexion |
| 757 | 757 | ( |
| 758 | 758 | BufferedConnection connection, |
| 759 | - Int32 size, | |
| 760 | - Int32 time_out, | |
| 759 | + Int size, | |
| 760 | + Int time_out, | |
| 761 | 761 | ByteArray result_buffer, |
| 762 | - Int32 position | |
| 762 | + Int position | |
| 763 | 763 | ) = |
| 764 | 764 | //println(pid + "read_from_connexion(" + size + ")"); |
| 765 | 765 | |
| 766 | 766 | if *connection.read_pos < length(*connection.buffer) then |
| 767 | 767 | //println(pid + " reading from buffer (size = " + length(*connection.buffer) + ", pos = " + *connection.read_pos); |
| 768 | - //with t1_tmp = (UTime) now, | |
| 768 | + //with t1_tmp = (UTime) unow, | |
| 769 | 769 | with result = extract(*connection.buffer, *connection.read_pos, *connection.read_pos + size), |
| 770 | 770 | size_read = length(result), |
| 771 | 771 | put(result,result_buffer,position,0); |
| ... | ... | @@ -783,7 +783,7 @@ define ReadResult |
| 783 | 783 | else |
| 784 | 784 | ok(result_buffer) |
| 785 | 785 | else |
| 786 | - //if now > dead_line then record_dubious_connection(connection,dead_line,dos) else | |
| 786 | + //if unow > dead_line then record_dubious_connection(connection,dead_line,dos) else | |
| 787 | 787 | if read(connection.conn, 16384, time_out) is // the connection is closed after 10 minutes of inactivity |
| 788 | 788 | { |
| 789 | 789 | error then println(pid + "read failed)"); error, |
| ... | ... | @@ -802,7 +802,7 @@ define Result(Error,Word8) |
| 802 | 802 | // only when the list is empty). |
| 803 | 803 | ( |
| 804 | 804 | BufferedConnection connection, |
| 805 | - Int32 dead_line, | |
| 805 | + Int dead_line, | |
| 806 | 806 | DenialOfService dos |
| 807 | 807 | ) = |
| 808 | 808 | //with t2_tmp = (UTime) now, |
| ... | ... | @@ -811,7 +811,7 @@ define Result(Error,Word8) |
| 811 | 811 | [ ] then |
| 812 | 812 | // /////////////////// |
| 813 | 813 | // Buffered reading |
| 814 | - //if now > dead_line then record_dubious_connection(connection,dead_line,dos) else | |
| 814 | + //if unow > dead_line then record_dubious_connection(connection,dead_line,dos) else | |
| 815 | 815 | if nth(*connection.read_pos, *connection.buffer) is |
| 816 | 816 | { |
| 817 | 817 | failure then |
| ... | ... | @@ -869,8 +869,8 @@ define Result(Error,One) |
| 869 | 869 | read_and_ignore |
| 870 | 870 | ( |
| 871 | 871 | BufferedConnection connection, // to client |
| 872 | - Int32 dead_line, | |
| 873 | - Int32 number_of_characters, // number of characters to read and ignore | |
| 872 | + Int dead_line, | |
| 873 | + Int number_of_characters, // number of characters to read and ignore | |
| 874 | 874 | DenialOfService dos |
| 875 | 875 | ) = |
| 876 | 876 | if number_of_characters =< 0 then ok(unique) else |
| ... | ... | @@ -897,7 +897,7 @@ define Result(Error,String) |
| 897 | 897 | read_string |
| 898 | 898 | ( |
| 899 | 899 | BufferedConnection connection, // connection with the client |
| 900 | - Int32 dead_line, | |
| 900 | + Int dead_line, | |
| 901 | 901 | List(Word8) so_far, // characters read so far (in reverse order) |
| 902 | 902 | DenialOfService dos |
| 903 | 903 | ) = |
| ... | ... | @@ -948,12 +948,9 @@ define Word8 |
| 948 | 948 | Word8 x1, |
| 949 | 949 | Word8 x2 |
| 950 | 950 | ) = |
| 951 | - with z1 = word8_to_int32(x1), | |
| 952 | - n1 = if z1 =< '9' then (z1 - '0') else (z1 - 'A' + 10), | |
| 953 | - z2 = word8_to_int32(x2), | |
| 954 | - n2 = if z2 =< '9' then (z2 - '0') else (z2 - 'A' + 10), | |
| 955 | - n = (n1 << 4) + n2, | |
| 956 | - truncate_to_word8(n). | |
| 951 | + with n1 = if x1 +=< '9' then (x1 - '0') else (x1 - 'A' + 10), | |
| 952 | + n2 = if x2 +=< '9' then (x2 - '0') else (x2 - 'A' + 10), | |
| 953 | + (n1 << 4) + n2. | |
| 957 | 954 | |
| 958 | 955 | |
| 959 | 956 | |
| ... | ... | @@ -961,7 +958,7 @@ define String |
| 961 | 958 | web_to_ascii |
| 962 | 959 | ( |
| 963 | 960 | String web_string, |
| 964 | - Int32 n, // current position in web_string | |
| 961 | + Int n, // current position in web_string | |
| 965 | 962 | List(Word8) so_far |
| 966 | 963 | ) = |
| 967 | 964 | if nth(n,web_string) is |
| ... | ... | @@ -1011,7 +1008,7 @@ define String |
| 1011 | 1008 | make_current_journal_file_name |
| 1012 | 1009 | = |
| 1013 | 1010 | if convert_time(now) is date_and_time(y,m,d,h,_,_,_,_,_) then |
| 1014 | - integer_to_string(y)+"_"+ | |
| 1011 | + to_decimal(y)+"_"+ | |
| 1015 | 1012 | zero_pad_n(2,m)+"_"+ |
| 1016 | 1013 | zero_pad_n(2,d)+"_"+ |
| 1017 | 1014 | zero_pad_n(2,h). |
| ... | ... | @@ -1081,7 +1078,7 @@ define String |
| 1081 | 1078 | define String |
| 1082 | 1079 | format_month |
| 1083 | 1080 | ( |
| 1084 | - Int32 m | |
| 1081 | + Int m | |
| 1085 | 1082 | ) = |
| 1086 | 1083 | if m = 1 then "jan" else |
| 1087 | 1084 | if m = 2 then "feb" else |
| ... | ... | @@ -1119,7 +1116,7 @@ define String |
| 1119 | 1116 | ) = |
| 1120 | 1117 | with dt = convert_time(now), |
| 1121 | 1118 | if remote_IP_address_and_port(client_connection) is (addr,port) then |
| 1122 | - integer_to_string(year(dt))+"/"+format_month(month(dt))+"/"+zero_pad_n(2,day(dt))+" "+ | |
| 1119 | + to_decimal(year(dt))+"/"+format_month(month(dt))+"/"+zero_pad_n(2,day(dt))+" "+ | |
| 1123 | 1120 | zero_pad_n(2,hour(dt))+":"+zero_pad_n(2,minute(dt))+":"+zero_pad_n(2,second(dt))+ |
| 1124 | 1121 | " from "+ip_addr_to_string(addr)+ |
| 1125 | 1122 | ": "+uri(request_line)+"\n"+ |
| ... | ... | @@ -1143,16 +1140,16 @@ define One |
| 1143 | 1140 | Web_Site_Description desc, |
| 1144 | 1141 | String msg, |
| 1145 | 1142 | ) = |
| 1146 | - with msg = to_byte_array("["+virtual_machine_id+"] "+msg+"\n"), | |
| 1143 | + with ba_msg = to_byte_array("["+virtual_machine_id+"] "+msg+"\n"), | |
| 1147 | 1144 | protect |
| 1148 | 1145 | ( |
| 1149 | 1146 | if file(site_directory(desc)+"/journal/"+make_current_journal_file_name,append) is |
| 1150 | 1147 | { |
| 1151 | 1148 | failure then unique, |
| 1152 | 1149 | success(journal_file) then |
| 1153 | - forget(reliable_write(file(journal_file),msg)) | |
| 1150 | + forget(reliable_write(file(journal_file),ba_msg)) | |
| 1154 | 1151 | }; |
| 1155 | - forget(reliable_write(file(stdout),msg)) | |
| 1152 | + forget(reliable_write(file(stdout),ba_msg)) | |
| 1156 | 1153 | ). |
| 1157 | 1154 | |
| 1158 | 1155 | |
| ... | ... | @@ -1202,7 +1199,7 @@ define Result(Error,One) |
| 1202 | 1199 | skip_http_blanks |
| 1203 | 1200 | ( |
| 1204 | 1201 | BufferedConnection connection, |
| 1205 | - Int32 dead_line, | |
| 1202 | + Int dead_line, | |
| 1206 | 1203 | DenialOfService dos |
| 1207 | 1204 | ) = |
| 1208 | 1205 | if next_char(connection,dead_line,dos) is |
| ... | ... | @@ -1258,7 +1255,7 @@ define Result(Error,One) |
| 1258 | 1255 | read_new_line |
| 1259 | 1256 | ( |
| 1260 | 1257 | BufferedConnection connection, |
| 1261 | - Int32 dead_line, | |
| 1258 | + Int dead_line, | |
| 1262 | 1259 | DenialOfService dos |
| 1263 | 1260 | ) = |
| 1264 | 1261 | if skip_http_blanks(connection,dead_line,dos) is |
| ... | ... | @@ -1307,7 +1304,7 @@ define Result(Error,String) |
| 1307 | 1304 | read_word_aux |
| 1308 | 1305 | ( |
| 1309 | 1306 | BufferedConnection connection, |
| 1310 | - Int32 dead_line, | |
| 1307 | + Int dead_line, | |
| 1311 | 1308 | List(Word8) so_far, |
| 1312 | 1309 | DenialOfService dos |
| 1313 | 1310 | ) = |
| ... | ... | @@ -1325,7 +1322,7 @@ define Result(Error,String) |
| 1325 | 1322 | read_word |
| 1326 | 1323 | ( |
| 1327 | 1324 | BufferedConnection connection, |
| 1328 | - Int32 dead_line, | |
| 1325 | + Int dead_line, | |
| 1329 | 1326 | DenialOfService dos |
| 1330 | 1327 | ) = |
| 1331 | 1328 | if skip_http_blanks(connection,dead_line,dos) is |
| ... | ... | @@ -1366,7 +1363,7 @@ define (String,String) |
| 1366 | 1363 | separate_uri_from_query_string |
| 1367 | 1364 | ( |
| 1368 | 1365 | String uri_and_query_string, |
| 1369 | - Int32 n | |
| 1366 | + Int n | |
| 1370 | 1367 | ) = |
| 1371 | 1368 | if nth(n,uri_and_query_string) is |
| 1372 | 1369 | { |
| ... | ... | @@ -1435,8 +1432,8 @@ define String |
| 1435 | 1432 | read_name_or_value |
| 1436 | 1433 | ( |
| 1437 | 1434 | String s, |
| 1438 | - Int32 start, | |
| 1439 | - Int32 i | |
| 1435 | + Int start, | |
| 1436 | + Int i | |
| 1440 | 1437 | ) = |
| 1441 | 1438 | if nth(i,s) is |
| 1442 | 1439 | { |
| ... | ... | @@ -1452,7 +1449,7 @@ define List(Web_arg) |
| 1452 | 1449 | read_www_url_encoded_web_args |
| 1453 | 1450 | ( |
| 1454 | 1451 | String s, |
| 1455 | - Int32 start, | |
| 1452 | + Int start, | |
| 1456 | 1453 | ) = |
| 1457 | 1454 | with first = read_name_or_value(s,start,start), |
| 1458 | 1455 | if first = "" |
| ... | ... | @@ -1490,16 +1487,16 @@ define Result(Error,HTTP_RequestType) |
| 1490 | 1487 | ( |
| 1491 | 1488 | String s |
| 1492 | 1489 | ) = |
| 1493 | - with s = to_lower(s), | |
| 1494 | - if s = "get" then ok(get) else | |
| 1495 | - if s = "post" then ok(post) else | |
| 1496 | - error(not_get_or_post_request(s)). | |
| 1490 | + with ls = to_lower(s), | |
| 1491 | + if ls = "get" then ok(get) else | |
| 1492 | + if ls = "post" then ok(post) else | |
| 1493 | + error(not_get_or_post_request(ls)). | |
| 1497 | 1494 | |
| 1498 | 1495 | define Result(Error,HTTP_RequestLine) |
| 1499 | 1496 | read_request_line |
| 1500 | 1497 | ( |
| 1501 | 1498 | BufferedConnection connection, |
| 1502 | - Int32 dead_line, | |
| 1499 | + Int dead_line, | |
| 1503 | 1500 | DenialOfService dos |
| 1504 | 1501 | ) = |
| 1505 | 1502 | if read_word(connection,dead_line,dos) is |
| ... | ... | @@ -1545,10 +1542,9 @@ define Bool |
| 1545 | 1542 | ( |
| 1546 | 1543 | Word8 c |
| 1547 | 1544 | ) = |
| 1548 | - with n = word8_to_int32(c), | |
| 1549 | - if ('a' =< n & n =< 'z') then true else | |
| 1550 | - if ('A' =< n & n =< 'Z') then true else | |
| 1551 | - if ('0' =< n & n =< '9') then true else | |
| 1545 | + if ('a' +=< c & c +=< 'z') then true else | |
| 1546 | + if ('A' +=< c & c +=< 'Z') then true else | |
| 1547 | + if ('0' +=< c & c +=< '9') then true else | |
| 1552 | 1548 | if c = '-' then true else |
| 1553 | 1549 | c = '_'. |
| 1554 | 1550 | |
| ... | ... | @@ -1556,7 +1552,7 @@ define Result(Error,String) |
| 1556 | 1552 | read_header_name |
| 1557 | 1553 | ( |
| 1558 | 1554 | BufferedConnection connection, |
| 1559 | - Int32 dead_line, | |
| 1555 | + Int dead_line, | |
| 1560 | 1556 | List(Word8) so_far, |
| 1561 | 1557 | DenialOfService dos |
| 1562 | 1558 | ) = |
| ... | ... | @@ -1573,7 +1569,7 @@ define Result(Error,One) |
| 1573 | 1569 | skip_colon |
| 1574 | 1570 | ( |
| 1575 | 1571 | BufferedConnection connection, |
| 1576 | - Int32 dead_line, | |
| 1572 | + Int dead_line, | |
| 1577 | 1573 | DenialOfService dos |
| 1578 | 1574 | ) = |
| 1579 | 1575 | if skip_http_blanks(connection,dead_line,dos) is |
| ... | ... | @@ -1594,7 +1590,7 @@ define Result(Error,String) |
| 1594 | 1590 | read_header_value |
| 1595 | 1591 | ( |
| 1596 | 1592 | BufferedConnection connection, |
| 1597 | - Int32 dead_line, | |
| 1593 | + Int dead_line, | |
| 1598 | 1594 | List(Word8) so_far, |
| 1599 | 1595 | DenialOfService dos |
| 1600 | 1596 | ) = |
| ... | ... | @@ -1628,7 +1624,7 @@ define Result(Error,Maybe(HTTP_header)) |
| 1628 | 1624 | read_header |
| 1629 | 1625 | ( |
| 1630 | 1626 | BufferedConnection connection, |
| 1631 | - Int32 dead_line, | |
| 1627 | + Int dead_line, | |
| 1632 | 1628 | DenialOfService dos |
| 1633 | 1629 | ) = |
| 1634 | 1630 | if read_header_name(connection,dead_line,[],dos) is |
| ... | ... | @@ -1666,7 +1662,7 @@ define Result(Error,List(HTTP_header)) |
| 1666 | 1662 | read_http_headers |
| 1667 | 1663 | ( |
| 1668 | 1664 | BufferedConnection connection, |
| 1669 | - Int32 dead_line, | |
| 1665 | + Int dead_line, | |
| 1670 | 1666 | DenialOfService dos |
| 1671 | 1667 | ) = |
| 1672 | 1668 | if read_header(connection,dead_line,dos) is |
| ... | ... | @@ -1695,7 +1691,7 @@ define Result(Error,List(HTTP_header)) |
| 1695 | 1691 | The size of the body of the request is given under the 'Content-Length' header. If this |
| 1696 | 1692 | header is not present, the size is assumed to be zero. |
| 1697 | 1693 | |
| 1698 | -define Result(Error,Int32) | |
| 1694 | +define Result(Error,Int) | |
| 1699 | 1695 | get_body_size |
| 1700 | 1696 | ( |
| 1701 | 1697 | List(HTTP_header) headers |
| ... | ... | @@ -1705,7 +1701,7 @@ define Result(Error,Int32) |
| 1705 | 1701 | [ ] then ok(0), |
| 1706 | 1702 | [h . t] then if h is http_header(name,value) then |
| 1707 | 1703 | if name = "content-length" |
| 1708 | - then if string_to_integer(value) is | |
| 1704 | + then if decimal_scan(value) is | |
| 1709 | 1705 | { |
| 1710 | 1706 | failure then error(incorrect_content_length_value), |
| 1711 | 1707 | success(n) then ok(n) |
| ... | ... | @@ -1737,9 +1733,9 @@ define Result(Error,ByteArray) |
| 1737 | 1733 | read_http_body |
| 1738 | 1734 | ( |
| 1739 | 1735 | BufferedConnection connection, |
| 1740 | - Int32 body_size, | |
| 1736 | + Int body_size, | |
| 1741 | 1737 | ByteArray so_far, // when calling this function, 'so_far' is the empty byte array |
| 1742 | - Int32 retries // this function is called with retries = 10 | |
| 1738 | + Int retries // this function is called with retries = 10 | |
| 1743 | 1739 | ) = |
| 1744 | 1740 | if body_size = 0 then ok(constant_byte_array(0,0)) else |
| 1745 | 1741 | if retries =< 0 then error(cannot_read_from_connection) else |
| ... | ... | @@ -1803,10 +1799,9 @@ define Bool |
| 1803 | 1799 | ( |
| 1804 | 1800 | Word8 c |
| 1805 | 1801 | ) = |
| 1806 | - with n = word8_to_int32(c), | |
| 1807 | - if ('a' =< n & n =< 'z') then true else // accept 'a' to 'z' | |
| 1808 | - if ('A' =< n & n =< 'Z') then true else // accept 'A' to 'Z' | |
| 1809 | - if ('0' =< n & n =< '9') then true else // accept '0' to '9' | |
| 1802 | + if ('a' +=< c & c +=< 'z') then true else // accept 'a' to 'z' | |
| 1803 | + if ('A' +=< c & c +=< 'Z') then true else // accept 'A' to 'Z' | |
| 1804 | + if ('0' +=< c & c +=< '9') then true else // accept '0' to '9' | |
| 1810 | 1805 | if c = '.' then true else // accept '.' '-' '/' and '_' |
| 1811 | 1806 | if c = '-' then true else |
| 1812 | 1807 | if c = '/' then true else |
| ... | ... | @@ -1820,7 +1815,7 @@ define Bool |
| 1820 | 1815 | is_illegal_uri |
| 1821 | 1816 | ( |
| 1822 | 1817 | String uri, |
| 1823 | - Int32 n | |
| 1818 | + Int n | |
| 1824 | 1819 | ) = |
| 1825 | 1820 | if nth(n,uri) is |
| 1826 | 1821 | { |
| ... | ... | @@ -1891,7 +1886,7 @@ define String |
| 1891 | 1886 | get_uri_extension_aux |
| 1892 | 1887 | ( |
| 1893 | 1888 | String uri, |
| 1894 | - Int32 n // used for searching backwards | |
| 1889 | + Int n // used for searching backwards | |
| 1895 | 1890 | ) = |
| 1896 | 1891 | if nth(n,uri) is |
| 1897 | 1892 | { |
| ... | ... | @@ -2017,7 +2012,7 @@ public define String |
| 2017 | 2012 | public define String |
| 2018 | 2013 | format_http_date |
| 2019 | 2014 | ( |
| 2020 | - Int32 date | |
| 2015 | + Int date | |
| 2021 | 2016 | ) = |
| 2022 | 2017 | format_http_date(convert_time(date)). |
| 2023 | 2018 | |
| ... | ... | @@ -2030,7 +2025,7 @@ define List(HTTP_header) |
| 2030 | 2025 | headers_for_send_file |
| 2031 | 2026 | ( |
| 2032 | 2027 | String mime_type, |
| 2033 | - Int32 size, | |
| 2028 | + Int size, | |
| 2034 | 2029 | String etag, |
| 2035 | 2030 | Maybe(FileTimes) mb_ftimes, |
| 2036 | 2031 | ) = |
| ... | ... | @@ -2038,12 +2033,12 @@ define List(HTTP_header) |
| 2038 | 2033 | [ |
| 2039 | 2034 | http_header("Content-Type",mime_type), |
| 2040 | 2035 | http_header("Etag", etag), |
| 2041 | - http_header("Content-Length",integer_to_string(size)), | |
| 2036 | + http_header("Content-Length",to_decimal(size)), | |
| 2042 | 2037 | ], |
| 2043 | 2038 | if mb_ftimes is |
| 2044 | 2039 | { |
| 2045 | 2040 | failure then headers, |
| 2046 | - success(ftimes) then [http_header("Last-Modified", format_http_date(ftimes.last_modified)) . headers] | |
| 2041 | + success(ftimes) then [http_header("Last-Modified", format_http_date(to_Int(ftimes.last_modified))) . headers] | |
| 2047 | 2042 | } |
| 2048 | 2043 | . |
| 2049 | 2044 | |
| ... | ... | @@ -2057,8 +2052,8 @@ define One |
| 2057 | 2052 | Web_Site_Description desc, |
| 2058 | 2053 | Connection connection, // connection with the client |
| 2059 | 2054 | Connection file, // file to be sent already opened |
| 2060 | - Int32 size, // size of file | |
| 2061 | - Int32 sent, // bytes already sent | |
| 2055 | + Int size, // size of file | |
| 2056 | + Int sent, // bytes already sent | |
| 2062 | 2057 | String filename // name of file |
| 2063 | 2058 | ) = |
| 2064 | 2059 | if sent >= size then unique else |
| ... | ... | @@ -2082,7 +2077,7 @@ define String |
| 2082 | 2077 | ( |
| 2083 | 2078 | String filename, |
| 2084 | 2079 | Maybe(FileTimes) mb_ftimes, |
| 2085 | - Int32 size, | |
| 2080 | + Int size, | |
| 2086 | 2081 | ) = |
| 2087 | 2082 | if mb_ftimes is |
| 2088 | 2083 | { |
| ... | ... | @@ -2111,7 +2106,7 @@ define One |
| 2111 | 2106 | Connection connection, |
| 2112 | 2107 | List(HTTP_header) input_headers, |
| 2113 | 2108 | List(HTTP_header) headers, |
| 2114 | - Int32 size, | |
| 2109 | + Int size, | |
| 2115 | 2110 | Connection file, |
| 2116 | 2111 | String filename, |
| 2117 | 2112 | String full_path, |
| ... | ... | @@ -2248,13 +2243,13 @@ define List(HTTP_header) |
| 2248 | 2243 | define List(HTTP_header) |
| 2249 | 2244 | standard_headers_for_html |
| 2250 | 2245 | ( |
| 2251 | - Int32 answer_body_size, | |
| 2246 | + Int answer_body_size, | |
| 2252 | 2247 | String charset |
| 2253 | 2248 | ) = |
| 2254 | 2249 | [ |
| 2255 | 2250 | //http_header("Content-Type","text/html"), |
| 2256 | 2251 | http_header("Content-Type","text/html; charset="+charset), |
| 2257 | - http_header("Content-length",integer_to_string(answer_body_size)) | |
| 2252 | + http_header("Content-length",to_decimal(answer_body_size)) | |
| 2258 | 2253 | ]. |
| 2259 | 2254 | |
| 2260 | 2255 | |
| ... | ... | @@ -2264,7 +2259,7 @@ define One |
| 2264 | 2259 | String host_name, |
| 2265 | 2260 | Web_Site_Description desc, |
| 2266 | 2261 | Connection connection, // with the client |
| 2267 | - Int32 ip_addr, // of the client | |
| 2262 | + Word32 ip_addr, // of the client | |
| 2268 | 2263 | HTTP_RequestLine request_line, |
| 2269 | 2264 | List(HTTP_header) headers, |
| 2270 | 2265 | ByteArray body, |
| ... | ... | @@ -2350,7 +2345,7 @@ define Maybe(String) |
| 2350 | 2345 | get_boundary_value_3 |
| 2351 | 2346 | ( |
| 2352 | 2347 | String s, |
| 2353 | - Int32 i, | |
| 2348 | + Int i, | |
| 2354 | 2349 | List(Word8) so_far |
| 2355 | 2350 | ) = |
| 2356 | 2351 | if nth(i,s) is |
| ... | ... | @@ -2368,7 +2363,7 @@ define Maybe(String) |
| 2368 | 2363 | get_boundary_value_2 |
| 2369 | 2364 | ( |
| 2370 | 2365 | String s, |
| 2371 | - Int32 i, | |
| 2366 | + Int i, | |
| 2372 | 2367 | ) = |
| 2373 | 2368 | if nth(i,s) is |
| 2374 | 2369 | { |
| ... | ... | @@ -2383,7 +2378,7 @@ define Maybe(String) |
| 2383 | 2378 | get_boundary_value_1 |
| 2384 | 2379 | ( |
| 2385 | 2380 | String s, // string into which we must find '= ...' |
| 2386 | - Int32 i // position of start of search | |
| 2381 | + Int i // position of start of search | |
| 2387 | 2382 | ) = |
| 2388 | 2383 | if nth(i,s) is |
| 2389 | 2384 | { |
| ... | ... | @@ -2468,13 +2463,13 @@ define Maybe(String) |
| 2468 | 2463 | Below is a variant of 'find' (see 'tools/findstring.anubis'), with an extra 'end' |
| 2469 | 2464 | argument. |
| 2470 | 2465 | |
| 2471 | -define Maybe(Int32) | |
| 2466 | +define Maybe(Int) | |
| 2472 | 2467 | find |
| 2473 | 2468 | ( |
| 2474 | 2469 | String what, |
| 2475 | 2470 | ByteArray where, |
| 2476 | - Int32 start, | |
| 2477 | - Int32 end | |
| 2471 | + Int start, | |
| 2472 | + Int end | |
| 2478 | 2473 | ) = |
| 2479 | 2474 | if find(to_byte_array(what),where,start) is |
| 2480 | 2475 | { |
| ... | ... | @@ -2490,8 +2485,8 @@ define String |
| 2490 | 2485 | read_attribute_value |
| 2491 | 2486 | ( |
| 2492 | 2487 | ByteArray where, |
| 2493 | - Int32 start, | |
| 2494 | - Int32 end, | |
| 2488 | + Int start, | |
| 2489 | + Int end, | |
| 2495 | 2490 | List(Word8) so_far |
| 2496 | 2491 | ) = |
| 2497 | 2492 | if start >= end then implode(reverse(so_far)) else |
| ... | ... | @@ -2509,17 +2504,17 @@ define Maybe(String) |
| 2509 | 2504 | ( |
| 2510 | 2505 | String name, |
| 2511 | 2506 | ByteArray where, |
| 2512 | - Int32 start, | |
| 2513 | - Int32 end | |
| 2507 | + Int start, | |
| 2508 | + Int end | |
| 2514 | 2509 | ) = |
| 2515 | - with name = name+"=\"", | |
| 2516 | - if find(to_byte_array(name),where,start) is | |
| 2510 | + with prefix = name+"=\"", | |
| 2511 | + if find(to_byte_array(prefix),where,start) is | |
| 2517 | 2512 | { |
| 2518 | 2513 | failure then failure, |
| 2519 | 2514 | success(n) then |
| 2520 | - if n+length(name) >= end | |
| 2515 | + if n+length(prefix) >= end | |
| 2521 | 2516 | then failure |
| 2522 | - else success(read_attribute_value(where,n+length(name),end,[])) | |
| 2517 | + else success(read_attribute_value(where,n+length(prefix),end,[])) | |
| 2523 | 2518 | }. |
| 2524 | 2519 | |
| 2525 | 2520 | |
| ... | ... | @@ -2528,8 +2523,8 @@ define Maybe((String,Maybe(String))) |
| 2528 | 2523 | find_name_and_filename |
| 2529 | 2524 | ( |
| 2530 | 2525 | ByteArray body, |
| 2531 | - Int32 start, | |
| 2532 | - Int32 end | |
| 2526 | + Int start, | |
| 2527 | + Int end | |
| 2533 | 2528 | ) = |
| 2534 | 2529 | if find(to_byte_array("Content-Disposition"),body,start) is |
| 2535 | 2530 | { |
| ... | ... | @@ -2557,7 +2552,7 @@ define Maybe((String,Maybe(String))) |
| 2557 | 2552 | |
| 2558 | 2553 | *** [5.7.3] Creating a temporary filename for an uploaded file. |
| 2559 | 2554 | |
| 2560 | -variable Int32 uploaded_file_count = 0. | |
| 2555 | +variable Int uploaded_file_count = 0. | |
| 2561 | 2556 | |
| 2562 | 2557 | This variable is local to the virtual machine. Hence, its value is 0 each time a new |
| 2563 | 2558 | requests arrives. Temporary uploaded files are stored in the directory represented by |
| ... | ... | @@ -2582,11 +2577,11 @@ define Maybe(String) // returns the temporary file name |
| 2582 | 2577 | ( |
| 2583 | 2578 | Web_Site_Description desc, |
| 2584 | 2579 | ByteArray body, |
| 2585 | - Int32 start, | |
| 2586 | - Int32 end | |
| 2580 | + Int start, | |
| 2581 | + Int end | |
| 2587 | 2582 | ) = |
| 2588 | 2583 | uploaded_file_count <- 1 + *uploaded_file_count; |
| 2589 | - with tfn = "_"+integer_to_string(virtual_machine_id)+"_"+integer_to_string(*uploaded_file_count), | |
| 2584 | + with tfn = "_"+to_decimal(virtual_machine_id)+"_"+to_decimal(*uploaded_file_count), | |
| 2590 | 2585 | if (Maybe(WStream))connect to file site_directory(desc)+"/upload_temporary/"+tfn is |
| 2591 | 2586 | { |
| 2592 | 2587 | failure then failure, |
| ... | ... | @@ -2614,11 +2609,11 @@ define Maybe(String) // returns the temporary file name |
| 2614 | 2609 | machine as the file name. Actually, this is not quite normal. Nevertheless, we need to |
| 2615 | 2610 | remove the path, and keep only the file name. This is achieved by 'remove_path' below. |
| 2616 | 2611 | |
| 2617 | -define Int32 | |
| 2612 | +define Int | |
| 2618 | 2613 | file_name_begin |
| 2619 | 2614 | ( |
| 2620 | 2615 | String full_name, |
| 2621 | - Int32 i | |
| 2616 | + Int i | |
| 2622 | 2617 | ) = |
| 2623 | 2618 | if nth(i,full_name) is |
| 2624 | 2619 | { |
| ... | ... | @@ -2649,8 +2644,8 @@ define Maybe(Web_arg) |
| 2649 | 2644 | ( |
| 2650 | 2645 | Web_Site_Description desc, |
| 2651 | 2646 | ByteArray body, |
| 2652 | - Int32 start, | |
| 2653 | - Int32 end | |
| 2647 | + Int start, | |
| 2648 | + Int end | |
| 2654 | 2649 | ) = |
| 2655 | 2650 | if find(to_byte_array(crlf+crlf),body,start) is |
| 2656 | 2651 | { |
| ... | ... | @@ -2689,7 +2684,7 @@ define List(Web_arg) |
| 2689 | 2684 | Web_Site_Description desc, |
| 2690 | 2685 | ByteArray body, |
| 2691 | 2686 | ByteArray __boundary, |
| 2692 | - Int32 i, | |
| 2687 | + Int i, | |
| 2693 | 2688 | ) = |
| 2694 | 2689 | if find(__boundary,body,i) is |
| 2695 | 2690 | { |
| ... | ... | @@ -2716,7 +2711,7 @@ define One |
| 2716 | 2711 | String host_name, |
| 2717 | 2712 | Web_Site_Description desc, |
| 2718 | 2713 | Connection connection, |
| 2719 | - Int32 ip_addr, | |
| 2714 | + Word32 ip_addr, | |
| 2720 | 2715 | HTTP_RequestLine request_line, |
| 2721 | 2716 | List(HTTP_header) headers, |
| 2722 | 2717 | ByteArray body, |
| ... | ... | @@ -2805,7 +2800,7 @@ define String |
| 2805 | 2800 | strip_port |
| 2806 | 2801 | ( |
| 2807 | 2802 | String name, |
| 2808 | - Int32 i | |
| 2803 | + Int i | |
| 2809 | 2804 | ) = |
| 2810 | 2805 | if nth(i,name) is |
| 2811 | 2806 | { |
| ... | ... | @@ -2882,14 +2877,14 @@ define One |
| 2882 | 2877 | One -> String generate_tt |
| 2883 | 2878 | ) = |
| 2884 | 2879 | if rqline is request_line(type,uri,qstring) then |
| 2885 | - with rqline = request_line(type,handle_redirection(redirections(desc),uri,headers),qstring), | |
| 2880 | + with rqline2 = request_line(type,handle_redirection(redirections(desc),uri,headers),qstring), | |
| 2886 | 2881 | if remote_IP_address_and_port(connection) is (ip_addr,_) then |
| 2887 | 2882 | if get_encoding_type(headers) is |
| 2888 | 2883 | { |
| 2889 | 2884 | www_url then |
| 2890 | - www_url_answer(host_name,desc,connection,ip_addr,rqline,headers,body,generate_tt), | |
| 2885 | + www_url_answer(host_name,desc,connection,ip_addr,rqline2,headers,body,generate_tt), | |
| 2891 | 2886 | multipart_form_data then |
| 2892 | - multipart_form_data_answer(host_name,desc,connection,ip_addr,rqline,headers,body,generate_tt) | |
| 2887 | + multipart_form_data_answer(host_name,desc,connection,ip_addr,rqline2,headers,body,generate_tt) | |
| 2893 | 2888 | }. |
| 2894 | 2889 | |
| 2895 | 2890 | |
| ... | ... | @@ -2991,8 +2986,8 @@ define One |
| 2991 | 2986 | Bool is_https, |
| 2992 | 2987 | DenialOfService dos |
| 2993 | 2988 | ) = |
| 2994 | - //t0 <- (UTime)now; | |
| 2995 | - with start_time = (Int32)now, | |
| 2989 | + //t0 <- (UTime)unow; | |
| 2990 | + with start_time = (Int)now, | |
| 2996 | 2991 | sttm <- start_time; |
| 2997 | 2992 | //println("Request time: " + format_http_date(start_time)); |
| 2998 | 2993 | if dos is denial_of_service(mc_v,rld_v,hd_v,ad_v,ld_v,ra_v) then |
| ... | ... | @@ -3023,7 +3018,7 @@ define One |
| 3023 | 3018 | //print_delta("before send_answer"); |
| 3024 | 3019 | send_answer(host_name, desc,connection.conn, request_line, headers, body, |
| 3025 | 3020 | make_generate_trust_ticket(dos)) |
| 3026 | - //with duration = (UTime) now - *t0, | |
| 3021 | + //with duration = (UTime) unow - *t0, | |
| 3027 | 3022 | //println("Request duration: " + utime_to_string(duration)) |
| 3028 | 3023 | //println("BufferRead duration: " + utime_to_string(*t1)); |
| 3029 | 3024 | //println("next_char duration: " + utime_to_string(*t2)) |
| ... | ... | @@ -3037,7 +3032,7 @@ define One |
| 3037 | 3032 | Below are the two tools for constructing the handlers required by 'start_server' and |
| 3038 | 3033 | 'start_ssl_server' (see 'predefined.anubis'). |
| 3039 | 3034 | |
| 3040 | -define Bool is_dubious_IP(Int32 ip, DenialOfService dos). | |
| 3035 | +define Bool is_dubious_IP(Word32 ip, DenialOfService dos). | |
| 3041 | 3036 | |
| 3042 | 3037 | define Server -> ((RWStream) -> One) |
| 3043 | 3038 | make_http_handler |
| ... | ... | @@ -3082,8 +3077,8 @@ define One |
| 3082 | 3077 | forget(map((FileDescription fd) |-> if fd is |
| 3083 | 3078 | { |
| 3084 | 3079 | no_info(name) then forget(remove(dir+name)), |
| 3085 | - file(name,_,_,d) then if d+600 < now then forget(remove(dir+name)) else unique, | |
| 3086 | - link(name,_,_,d) then if d+600 < now then forget(remove(dir+name)) else unique, | |
| 3080 | + file(name,_,_,d) then if to_Int(d)+600 < now then forget(remove(dir+name)) else unique, | |
| 3081 | + link(name,_,_,d) then if to_Int(d)+600 < now then forget(remove(dir+name)) else unique, | |
| 3087 | 3082 | directory(name,_,_) then cleanup_directory_10mn(dir+name+"/"), |
| 3088 | 3083 | }, |
| 3089 | 3084 | directory_full_list(dir,"*","*","*"))). |
| ... | ... | @@ -3094,8 +3089,8 @@ define One |
| 3094 | 3089 | ( |
| 3095 | 3090 | List(Web_Site_Description) sites, |
| 3096 | 3091 | List(Server) servers, |
| 3097 | - Int32 period, | |
| 3098 | - Int32 next_time, | |
| 3092 | + Int period, | |
| 3093 | + Int next_time, | |
| 3099 | 3094 | ) = |
| 3100 | 3095 | if mapand(is_down,servers) |
| 3101 | 3096 | then unique |
| ... | ... | @@ -3121,7 +3116,7 @@ public define One |
| 3121 | 3116 | ( |
| 3122 | 3117 | List(Web_Site_Description) sites, |
| 3123 | 3118 | List(Server) servers, |
| 3124 | - Int32 period | |
| 3119 | + Int period | |
| 3125 | 3120 | ) = |
| 3126 | 3121 | delegate http_servers_tasks(sites,servers,period,now), |
| 3127 | 3122 | unique. |
| ... | ... | @@ -3137,7 +3132,7 @@ public define One |
| 3137 | 3132 | define Bool // returns false if the counter cannot be incremented (too many connections) |
| 3138 | 3133 | increment_connections_counter |
| 3139 | 3134 | ( |
| 3140 | - Var(Int32) counter | |
| 3135 | + Var(Int) counter | |
| 3141 | 3136 | ) = |
| 3142 | 3137 | protect with n = *counter, |
| 3143 | 3138 | if n >= 100 |
| ... | ... | @@ -3147,7 +3142,7 @@ define Bool // returns false if the counter cannot be incremented (too many conn |
| 3147 | 3142 | define One |
| 3148 | 3143 | decrement_connections_counter |
| 3149 | 3144 | ( |
| 3150 | - Var(Int32) counter | |
| 3145 | + Var(Int) counter | |
| 3151 | 3146 | ) = |
| 3152 | 3147 | protect counter <- (*counter)-1. |
| 3153 | 3148 | |
| ... | ... | @@ -3161,7 +3156,7 @@ define One |
| 3161 | 3156 | define List(DubiousIP) |
| 3162 | 3157 | record_dubious_IP |
| 3163 | 3158 | ( |
| 3164 | - Int32 ip, | |
| 3159 | + Word32 ip, | |
| 3165 | 3160 | List(DubiousIP) l |
| 3166 | 3161 | ) = |
| 3167 | 3162 | if l is |
| ... | ... | @@ -3177,7 +3172,7 @@ define List(DubiousIP) |
| 3177 | 3172 | define One |
| 3178 | 3173 | record_dubious_IP |
| 3179 | 3174 | ( |
| 3180 | - Int32 dubious_IP, | |
| 3175 | + Word32 dubious_IP, | |
| 3181 | 3176 | Var(List(DubiousIP)) v |
| 3182 | 3177 | ) = |
| 3183 | 3178 | protect v <- record_dubious_IP(dubious_IP,*v). |
| ... | ... | @@ -3186,7 +3181,7 @@ define One |
| 3186 | 3181 | define One |
| 3187 | 3182 | record_dubious_IP |
| 3188 | 3183 | ( |
| 3189 | - Int32 addr, | |
| 3184 | + Word32 addr, | |
| 3190 | 3185 | DenialOfService dos |
| 3191 | 3186 | ) = |
| 3192 | 3187 | record_dubious_IP(addr,list_of_dubious(dos)). |
| ... | ... | @@ -3212,7 +3207,7 @@ public define DenialOfService |
| 3212 | 3207 | define Bool |
| 3213 | 3208 | is_dubious_IP |
| 3214 | 3209 | ( |
| 3215 | - Int32 ip, | |
| 3210 | + Word32 ip, | |
| 3216 | 3211 | List(DubiousIP) l |
| 3217 | 3212 | ) = |
| 3218 | 3213 | if l is |
| ... | ... | @@ -3228,7 +3223,7 @@ define Bool |
| 3228 | 3223 | define Bool |
| 3229 | 3224 | is_dubious_IP |
| 3230 | 3225 | ( |
| 3231 | - Int32 ip, | |
| 3226 | + Word32 ip, | |
| 3232 | 3227 | DenialOfService dos |
| 3233 | 3228 | ) = |
| 3234 | 3229 | if dos is |
| ... | ... | @@ -3247,7 +3242,7 @@ define List(DubiousIP) |
| 3247 | 3242 | remove_inactive_dubious_IP |
| 3248 | 3243 | ( |
| 3249 | 3244 | List(DubiousIP) l, |
| 3250 | - Int32 ref_time, | |
| 3245 | + Int ref_time, | |
| 3251 | 3246 | ) = |
| 3252 | 3247 | if l is |
| 3253 | 3248 | { |
| ... | ... | @@ -3265,7 +3260,7 @@ define One |
| 3265 | 3260 | Var(List(DubiousIP)) v |
| 3266 | 3261 | ) = |
| 3267 | 3262 | protect |
| 3268 | - with ref_time = now - 600, // 10 minutes | |
| 3263 | + with ref_time = (Int)now - 600, // 10 minutes | |
| 3269 | 3264 | v <- remove_inactive_dubious_IP(*v,ref_time). |
| 3270 | 3265 | |
| 3271 | 3266 | |
| ... | ... | @@ -3320,10 +3315,10 @@ define One |
| 3320 | 3315 | define StartServerResult |
| 3321 | 3316 | start_http_server |
| 3322 | 3317 | ( |
| 3323 | - Int32 ip_address, | |
| 3324 | - Int32 port, | |
| 3325 | - Server -> ((RWStream) -> One) handler, | |
| 3326 | - Int32 retries, | |
| 3318 | + Word32 ip_address, | |
| 3319 | + Word32 port, | |
| 3320 | + Server -> ((RWStream) -> One) handler, | |
| 3321 | + Int retries, | |
| 3327 | 3322 | DenialOfService dos |
| 3328 | 3323 | ) = |
| 3329 | 3324 | if start_server(ip_address, |
| ... | ... | @@ -3339,8 +3334,8 @@ define StartServerResult |
| 3339 | 3334 | public define StartServerResult |
| 3340 | 3335 | start_http_server |
| 3341 | 3336 | ( |
| 3342 | - Int32 ip_address, | |
| 3343 | - Int32 port, | |
| 3337 | + Word32 ip_address, | |
| 3338 | + Word32 port, | |
| 3344 | 3339 | List(Web_Site_Description) sites, |
| 3345 | 3340 | DenialOfService dos |
| 3346 | 3341 | ) = |
| ... | ... | @@ -3361,11 +3356,11 @@ public define StartServerResult |
| 3361 | 3356 | define StartServerResult |
| 3362 | 3357 | start_https_server |
| 3363 | 3358 | ( |
| 3364 | - Int32 ip_address, | |
| 3365 | - Int32 port, | |
| 3359 | + Word32 ip_address, | |
| 3360 | + Word32 port, | |
| 3366 | 3361 | String certificate_common_name, |
| 3367 | 3362 | Server -> (SSL_Connection -> One) handler, |
| 3368 | - Int32 retries, | |
| 3363 | + Int retries, | |
| 3369 | 3364 | DenialOfService dos |
| 3370 | 3365 | ) = |
| 3371 | 3366 | if start_ssl_server(ip_address, |
| ... | ... | @@ -3386,8 +3381,8 @@ define StartServerResult |
| 3386 | 3381 | public define StartServerResult |
| 3387 | 3382 | start_https_server |
| 3388 | 3383 | ( |
| 3389 | - Int32 ip_address, | |
| 3390 | - Int32 port, | |
| 3384 | + Word32 ip_address, | |
| 3385 | + Word32 port, | |
| 3391 | 3386 | String certificate_common_name, // of SSL server certificate |
| 3392 | 3387 | List(Web_Site_Description) sites, |
| 3393 | 3388 | DenialOfService dos |
| ... | ... | @@ -3415,7 +3410,7 @@ define One |
| 3415 | 3410 | ( |
| 3416 | 3411 | RWStream conn, |
| 3417 | 3412 | String common_name, |
| 3418 | - Int32 port | |
| 3413 | + Word32 port | |
| 3419 | 3414 | ) = |
| 3420 | 3415 | print("Dispatching '"+common_name+"' to port "+port+"\n"); |
| 3421 | 3416 | forget(reliable_write(conn,to_byte_array( |
| ... | ... | @@ -3450,7 +3445,7 @@ define Server -> ((RWStream) -> One) |
| 3450 | 3445 | DenialOfService dos |
| 3451 | 3446 | ) = |
| 3452 | 3447 | (Server server) |-> (RWStream conn) |-> |
| 3453 | - with start_time = (Int32)now, | |
| 3448 | + with start_time = (Int)now, | |
| 3454 | 3449 | connection = buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0)), |
| 3455 | 3450 | if read_request_line(connection, start_time+*request_line_delay(dos), dos) is |
| 3456 | 3451 | { |
| ... | ... | @@ -3487,7 +3482,7 @@ define Bool |
| 3487 | 3482 | ( |
| 3488 | 3483 | String info_file_path, |
| 3489 | 3484 | Var(List(DispatcherInfo)) info_v, |
| 3490 | - Var(Int32) info_date_v | |
| 3485 | + Var(Int) info_date_v | |
| 3491 | 3486 | ) = |
| 3492 | 3487 | if directory_full_list(my_anubis_directory+"/web_sites","dispatcher.info","","") is |
| 3493 | 3488 | { |
| ... | ... | @@ -3496,7 +3491,7 @@ define Bool |
| 3496 | 3491 | { |
| 3497 | 3492 | no_info(n) then false, |
| 3498 | 3493 | file(n,_,_,d) then if n = "dispatcher.info" |
| 3499 | - then (info_date_v <- d; | |
| 3494 | + then (info_date_v <- to_Int(d); | |
| 3500 | 3495 | if (RetrieveResult(List(DispatcherInfo)))retrieve(info_file_path) is |
| 3501 | 3496 | { |
| 3502 | 3497 | cannot_find_file then false, |
| ... | ... | @@ -3519,7 +3514,7 @@ define One |
| 3519 | 3514 | ( |
| 3520 | 3515 | String info_file_path, |
| 3521 | 3516 | Var(List(DispatcherInfo)) info_v, |
| 3522 | - Var(Int32) info_date_v | |
| 3517 | + Var(Int) info_date_v | |
| 3523 | 3518 | ) = |
| 3524 | 3519 | sleep(3000); |
| 3525 | 3520 | (if dispatcher_update_data(info_file_path,info_v,info_date_v) |
| ... | ... | @@ -3531,13 +3526,13 @@ define One |
| 3531 | 3526 | public define One |
| 3532 | 3527 | start_web_dispatcher |
| 3533 | 3528 | ( |
| 3534 | - Int32 ip_address, // address for listening (typically 0: listen on all interfaces) | |
| 3535 | - Int32 http_port, // typically 80 | |
| 3529 | + Word32 ip_address, // address for listening (typically 0: listen on all interfaces) | |
| 3530 | + Word32 http_port, // typically 80 | |
| 3536 | 3531 | DenialOfService dos |
| 3537 | 3532 | ) = |
| 3538 | 3533 | with info_file_path = my_anubis_directory+"/web_sites/dispatcher.info", |
| 3539 | 3534 | info_v = var((List(DispatcherInfo))[]), |
| 3540 | - info_date_v = var((Int32)0), | |
| 3535 | + info_date_v = var((Int)0), | |
| 3541 | 3536 | if dispatcher_update_data(info_file_path,info_v,info_date_v) |
| 3542 | 3537 | then if start_server(ip_address, |
| 3543 | 3538 | http_port, |
| ... | ... | @@ -3573,7 +3568,7 @@ public define One |
| 3573 | 3568 | |
| 3574 | 3569 | *** [7.3] Managing the info file. |
| 3575 | 3570 | |
| 3576 | -define Int32 | |
| 3571 | +define Word32 | |
| 3577 | 3572 | register_ip_address |
| 3578 | 3573 | = |
| 3579 | 3574 | if ip_address(prompt(" numerical IP address (for HTTP): ")) is |
| ... | ... | @@ -3584,15 +3579,15 @@ define Int32 |
| 3584 | 3579 | }. |
| 3585 | 3580 | |
| 3586 | 3581 | |
| 3587 | -define Int32 | |
| 3582 | +define Word32 | |
| 3588 | 3583 | register_ip_port |
| 3589 | 3584 | = |
| 3590 | - if string_to_integer(prompt(" IP port (for HTTP): ")) is | |
| 3585 | + if decimal_scan(prompt(" IP port (for HTTP): ")) is | |
| 3591 | 3586 | { |
| 3592 | 3587 | failure then print(" *** Error: incorrect IP port.\n"); |
| 3593 | 3588 | register_ip_port, |
| 3594 | 3589 | success(p) then if (0 =< p & p =< 65535) |
| 3595 | - then p | |
| 3590 | + then truncate_to_Word32(p) | |
| 3596 | 3591 | else print(" *** Error: IP port out of bounds.\n"); |
| 3597 | 3592 | register_ip_port |
| 3598 | 3593 | }. |
| ... | ... | @@ -3634,7 +3629,7 @@ define String |
| 3634 | 3629 | pad |
| 3635 | 3630 | ( |
| 3636 | 3631 | String s, |
| 3637 | - Int32 l | |
| 3632 | + Int l | |
| 3638 | 3633 | ) = |
| 3639 | 3634 | if length(s) >= l |
| 3640 | 3635 | then s |
| ... | ... | @@ -3646,7 +3641,7 @@ define One |
| 3646 | 3641 | show_sites_1 |
| 3647 | 3642 | ( |
| 3648 | 3643 | List(DispatcherInfo) l, |
| 3649 | - Int32 i | |
| 3644 | + Int i | |
| 3650 | 3645 | ) = |
| 3651 | 3646 | if l is |
| 3652 | 3647 | { |
| ... | ... | @@ -3661,7 +3656,7 @@ define One |
| 3661 | 3656 | show_sites |
| 3662 | 3657 | ( |
| 3663 | 3658 | List(DispatcherInfo) l, |
| 3664 | - Int32 i | |
| 3659 | + Int i | |
| 3665 | 3660 | ) = |
| 3666 | 3661 | print(" Name Port\n"); |
| 3667 | 3662 | print(" --------------------------------------------------------\n"); |
| ... | ... | @@ -3672,7 +3667,7 @@ define List(DispatcherInfo) |
| 3672 | 3667 | ( |
| 3673 | 3668 | List(DispatcherInfo) l, |
| 3674 | 3669 | String site_name, |
| 3675 | - Int32 new_port | |
| 3670 | + Word32 new_port | |
| 3676 | 3671 | ) = |
| 3677 | 3672 | if l is |
| 3678 | 3673 | { |
| ... | ... | @@ -3704,7 +3699,7 @@ define One |
| 3704 | 3699 | ( |
| 3705 | 3700 | Var(List(DispatcherInfo)) info_v, |
| 3706 | 3701 | String site_name, |
| 3707 | - Int32 old_port | |
| 3702 | + Word32 old_port | |
| 3708 | 3703 | ) = |
| 3709 | 3704 | print("\n"); |
| 3710 | 3705 | print(" Updating site '"+site_name+"': (currently: "+old_port+")\n"); |
| ... | ... | @@ -3742,7 +3737,7 @@ define One |
| 3742 | 3737 | [h . t] then |
| 3743 | 3738 | show_sites(qsort([h . t],compare),1); |
| 3744 | 3739 | with i1 = prompt(" Choose a site to update [1/.../"+(length(t)+1)+"]: "), |
| 3745 | - if string_to_integer(i1) is | |
| 3740 | + if decimal_scan(i1) is | |
| 3746 | 3741 | { |
| 3747 | 3742 | failure then print(" *** Error: site number not recognized.\n"); |
| 3748 | 3743 | update_site(info_v), |
| ... | ... | @@ -3762,7 +3757,7 @@ define One |
| 3762 | 3757 | ( |
| 3763 | 3758 | Var(List(DispatcherInfo)) info_v, |
| 3764 | 3759 | String site_name, |
| 3765 | - Int32 old_port | |
| 3760 | + Word32 old_port | |
| 3766 | 3761 | ) = |
| 3767 | 3762 | print("\n"); |
| 3768 | 3763 | print(" Deleting site '"+site_name+"': (currently: "+old_port+")\n"); |
| ... | ... | @@ -3786,7 +3781,7 @@ define One |
| 3786 | 3781 | [h . t] then |
| 3787 | 3782 | show_sites(qsort([h . t],compare),1); |
| 3788 | 3783 | with i1 = prompt(" Choose a site to delete [1/.../"+(length(t)+1)+"]: "), |
| 3789 | - if string_to_integer(i1) is | |
| 3784 | + if decimal_scan(i1) is | |
| 3790 | 3785 | { |
| 3791 | 3786 | failure then print(" *** Error: site number not recognized.\n"); |
| 3792 | 3787 | delete_site(info_v), | ... | ... |
calexium_lib/web/CXM_web_arg_encode.anubis
| ... | ... | @@ -45,6 +45,7 @@ public define Maybe($T) |
| 45 | 45 | --- That's all for the public part. --------------------------------------------------- |
| 46 | 46 | |
| 47 | 47 | read tools/basis.anubis |
| 48 | +read system/convert.anubis | |
| 48 | 49 | |
| 49 | 50 | Our algorithms are copy-pasted from 'base64.anubis' and slightly modified. The point is |
| 50 | 51 | twofold: |
| ... | ... | @@ -68,12 +69,12 @@ read tools/basis.anubis |
| 68 | 69 | define Word8 |
| 69 | 70 | wa64_alphabet |
| 70 | 71 | ( |
| 71 | - Int32 index // the index is assumed to be >= 0 and < 64 | |
| 72 | + Word32 index // the index is assumed to be >= 0 and < 64 | |
| 72 | 73 | ) = |
| 73 | - if index < 0 then print("Bad index [" + index + "] in wa64_alphabet()\n"); '_' else | |
| 74 | - if index < 26 then truncate_to_word8(index+'A') else | |
| 75 | - if index < 52 then truncate_to_word8(index-26+'a') else | |
| 76 | - if index < 62 then truncate_to_word8(index-52+'0') else | |
| 74 | + if index -< 0 then print("Bad index [" + index + "] in wa64_alphabet()\n"); '_' else | |
| 75 | + if index -< 26 then truncate_to_Word8(index+'A') else | |
| 76 | + if index -< 52 then truncate_to_Word8(index-26+'a') else | |
| 77 | + if index -< 62 then truncate_to_Word8(index-52+'0') else | |
| 77 | 78 | if index = 62 then '-' else |
| 78 | 79 | if index = 63 then '_' else |
| 79 | 80 | print("Bad index [" + index + "] in wa64_alphabet()\n"); '_'. |
| ... | ... | @@ -82,6 +83,14 @@ define Word8 |
| 82 | 83 | |
| 83 | 84 | Transform a group of 3 bytes into a group of 4 wa64 letters. |
| 84 | 85 | |
| 86 | + | |
| 87 | +define Word32 | |
| 88 | + to_word32 | |
| 89 | + ( | |
| 90 | + Word8 x | |
| 91 | + ) = | |
| 92 | + word32(word16(x,0),0). | |
| 93 | + | |
| 85 | 94 | define (Word8,Word8,Word8,Word8) |
| 86 | 95 | transform_group |
| 87 | 96 | ( |
| ... | ... | @@ -89,9 +98,9 @@ define (Word8,Word8,Word8,Word8) |
| 89 | 98 | Word8 byte2, |
| 90 | 99 | Word8 byte3 |
| 91 | 100 | ) = |
| 92 | - with n1 = word8_to_int32(byte1), | |
| 93 | - n2 = word8_to_int32(byte2), | |
| 94 | - n3 = word8_to_int32(byte3), | |
| 101 | + with n1 = to_word32(byte1), | |
| 102 | + n2 = to_word32(byte2), | |
| 103 | + n3 = to_word32(byte3), | |
| 95 | 104 | ( |
| 96 | 105 | wa64_alphabet(n1>>2), |
| 97 | 106 | wa64_alphabet(((n1&3)<<4)|(n2>>4)), |
| ... | ... | @@ -106,12 +115,12 @@ define ByteArray |
| 106 | 115 | two_mod_three |
| 107 | 116 | ( |
| 108 | 117 | ByteArray result, |
| 109 | - Int32 result_index, | |
| 118 | + Int result_index, | |
| 110 | 119 | Word8 byte1, |
| 111 | 120 | Word8 byte2 |
| 112 | 121 | ) = |
| 113 | - with n1 = word8_to_int32(byte1), | |
| 114 | - n2 = word8_to_int32(byte2), | |
| 122 | + with n1 = to_word32(byte1), | |
| 123 | + n2 = to_word32(byte2), | |
| 115 | 124 | forget(put(result,result_index ,wa64_alphabet(n1>>2))); |
| 116 | 125 | forget(put(result,result_index+1,wa64_alphabet(((n1&3)<<4)|(n2>>4)))); |
| 117 | 126 | forget(put(result,result_index+2,wa64_alphabet((n2&15)<<2))); |
| ... | ... | @@ -126,10 +135,10 @@ define ByteArray |
| 126 | 135 | one_mod_three |
| 127 | 136 | ( |
| 128 | 137 | ByteArray result, |
| 129 | - Int32 result_index, | |
| 138 | + Int result_index, | |
| 130 | 139 | Word8 byte1 |
| 131 | 140 | ) = |
| 132 | - with n1 = word8_to_int32(byte1), | |
| 141 | + with n1 = to_word32(byte1), | |
| 133 | 142 | forget(put(result,result_index ,wa64_alphabet(n1>>2))); |
| 134 | 143 | forget(put(result,result_index+1,wa64_alphabet((n1&3)<<4))); |
| 135 | 144 | forget(put(result,result_index+4,0)); |
| ... | ... | @@ -141,9 +150,9 @@ define ByteArray |
| 141 | 150 | wa64_encode |
| 142 | 151 | ( |
| 143 | 152 | ByteArray ba, |
| 144 | - Int32 ba_index, // index into byte array | |
| 153 | + Int ba_index, // index into byte array | |
| 145 | 154 | ByteArray result, |
| 146 | - Int32 result_index | |
| 155 | + Int result_index | |
| 147 | 156 | ) = |
| 148 | 157 | if nth(ba_index,ba) is |
| 149 | 158 | { |
| ... | ... | @@ -181,7 +190,7 @@ define ByteArray |
| 181 | 190 | ) = |
| 182 | 191 | with l = length(ba), |
| 183 | 192 | wa64_encode(ba,0, |
| 184 | - constant_byte_array((((l/57)+1)*76)+10,0),0). | |
| 193 | + constant_byte_array((((l\57)+1)*76)+10,0),0). | |
| 185 | 194 | |
| 186 | 195 | |
| 187 | 196 | public define String |
| ... | ... | @@ -202,15 +211,15 @@ public define String |
| 202 | 211 | Checking if a character belongs to the wa64 alphabet. If true, the function returns the |
| 203 | 212 | index of the character in the alphabet. |
| 204 | 213 | |
| 205 | -define Maybe(Int32) | |
| 214 | +define Maybe(Word32) | |
| 206 | 215 | is_wa64_char |
| 207 | 216 | ( |
| 208 | 217 | Word8 c |
| 209 | 218 | ) = |
| 210 | - with n = word8_to_int32(c), | |
| 211 | - if ('A' =< n & n =< 'Z') then success(n - 'A') else | |
| 212 | - if ('a' =< n & n =< 'z') then success(n - 'a' + 26) else | |
| 213 | - if ('0' =< n & n =< '9') then success(n - '0' + 52) else | |
| 219 | + with n = to_word32(c), | |
| 220 | + if ('A' +=< n & n +=< 'Z') then success(n - 'A') else | |
| 221 | + if ('a' +=< n & n +=< 'z') then success(n - 'a' + 26) else | |
| 222 | + if ('0' +=< n & n +=< '9') then success(n - '0' + 52) else | |
| 214 | 223 | if n = '-' then success(62) else |
| 215 | 224 | if n = '_' then success(63) else |
| 216 | 225 | failure. |
| ... | ... | @@ -221,12 +230,12 @@ define Maybe(Int32) |
| 221 | 230 | for reading. The function does not return the character itself, but its index in the |
| 222 | 231 | alphabet. |
| 223 | 232 | |
| 224 | -define Maybe((Int32, // next position for reading | |
| 225 | - Int32)) // index of character in wa64 alphabet | |
| 233 | +define Maybe((Int, // next position for reading | |
| 234 | + Word32)) // index of character in wa64 alphabet | |
| 226 | 235 | get_next_character |
| 227 | 236 | ( |
| 228 | 237 | ByteArray ba, |
| 229 | - Int32 n | |
| 238 | + Int n | |
| 230 | 239 | ) = |
| 231 | 240 | if nth(n,ba) is |
| 232 | 241 | { |
| ... | ... | @@ -243,7 +252,7 @@ define Maybe((Int32, // next position for reading |
| 243 | 252 | Translating a group of characters into a group of bytes. |
| 244 | 253 | |
| 245 | 254 | type TranslateGroupResult: |
| 246 | - three_bytes (Int32 new_pos, Word8 b1, Word8 b2, Word8 b3), | |
| 255 | + three_bytes (Int new_pos, Word8 b1, Word8 b2, Word8 b3), | |
| 247 | 256 | two_bytes ( Word8 b1, Word8 b2 ), |
| 248 | 257 | one_byte ( Word8 b1 ), |
| 249 | 258 | zero_bytes, |
| ... | ... | @@ -254,7 +263,7 @@ define TranslateGroupResult |
| 254 | 263 | translate_group |
| 255 | 264 | ( |
| 256 | 265 | ByteArray ba, |
| 257 | - Int32 n | |
| 266 | + Int n | |
| 258 | 267 | ) = |
| 259 | 268 | if get_next_character(ba,n) is |
| 260 | 269 | { |
| ... | ... | @@ -267,30 +276,30 @@ define TranslateGroupResult |
| 267 | 276 | if get_next_character(ba,n2) is |
| 268 | 277 | { |
| 269 | 278 | failure then // we don't check the padding characters |
| 270 | - one_byte(truncate_to_word8((i1<<2)|(i2>>4))), | |
| 279 | + one_byte(truncate_to_Word8((i1<<2)|(i2>>4))), | |
| 271 | 280 | success(p3) then if p3 is (n3,i3) then |
| 272 | 281 | if get_next_character(ba,n3) is |
| 273 | 282 | { |
| 274 | 283 | failure then |
| 275 | - two_bytes(truncate_to_word8((i1<<2)|(i2>>4)), | |
| 276 | - truncate_to_word8(((i2&15)<<4)|(i3>>2))), | |
| 284 | + two_bytes(truncate_to_Word8((i1<<2)|(i2>>4)), | |
| 285 | + truncate_to_Word8(((i2&15)<<4)|(i3>>2))), | |
| 277 | 286 | success(p4) then if p4 is (n4,i4) then |
| 278 | - three_bytes(n4,truncate_to_word8((i1<<2)|(i2>>4)), | |
| 279 | - truncate_to_word8(((i2&15)<<4)|(i3>>2)), | |
| 280 | - truncate_to_word8(((i3&3)<<6)|i4)) | |
| 287 | + three_bytes(n4,truncate_to_Word8((i1<<2)|(i2>>4)), | |
| 288 | + truncate_to_Word8(((i2&15)<<4)|(i3>>2)), | |
| 289 | + truncate_to_Word8(((i3&3)<<6)|i4)) | |
| 281 | 290 | } |
| 282 | 291 | } |
| 283 | 292 | } |
| 284 | 293 | }. |
| 285 | 294 | |
| 286 | 295 | |
| 287 | -define Int32 // returns the size of the decoded array of bytes | |
| 296 | +define Int // returns the size of the decoded array of bytes | |
| 288 | 297 | translate_groups |
| 289 | 298 | ( |
| 290 | 299 | ByteArray source, |
| 291 | - Int32 n, // position in source | |
| 300 | + Int n, // position in source | |
| 292 | 301 | ByteArray target, |
| 293 | - Int32 m // position in target | |
| 302 | + Int m // position in target | |
| 294 | 303 | ) = |
| 295 | 304 | if translate_group(source,n) is |
| 296 | 305 | { | ... | ... |
calexium_lib/web/counter.anubis
| ... | ... | @@ -22,7 +22,7 @@ public define HTML_Off_Form |
| 22 | 22 | ( |
| 23 | 23 | String directory, // where the counter file will be located |
| 24 | 24 | String name, // name of counter |
| 25 | - Int32 text_size // size of characters of counter | |
| 25 | + Int text_size // size of characters of counter | |
| 26 | 26 | ). |
| 27 | 27 | |
| 28 | 28 | |
| ... | ... | @@ -50,9 +50,9 @@ define List(Word8) |
| 50 | 50 | zero_pad |
| 51 | 51 | ( |
| 52 | 52 | List(Word8) l, |
| 53 | - Int32 n | |
| 53 | + Int n | |
| 54 | 54 | ) = |
| 55 | - if length(l) < n | |
| 55 | + if length(l) < to_Int(n) | |
| 56 | 56 | then zero_pad(['0' . l],n) |
| 57 | 57 | else l. |
| 58 | 58 | |
| ... | ... | @@ -60,8 +60,8 @@ define List(Word8) |
| 60 | 60 | define HTML_Off_Form |
| 61 | 61 | web_counter |
| 62 | 62 | ( |
| 63 | - Int32 n, // value of counter | |
| 64 | - Int32 text_size // size of text | |
| 63 | + Int n, // value of counter | |
| 64 | + Int text_size // size of text | |
| 65 | 65 | ) = |
| 66 | 66 | with black = rgb(0,0,0), |
| 67 | 67 | white = rgb(255,255,255), |
| ... | ... | @@ -69,8 +69,8 @@ define HTML_Off_Form |
| 69 | 69 | table([border(0,1,0,black),background_color(black)],[row( |
| 70 | 70 | [cell([background_color(black),width(2)],text([],"")) . |
| 71 | 71 | map((Word8 c) |-> cell([background_color(black),width(8),h_center], |
| 72 | - text([size(text_size),color(white),bold],""+(word8_to_int32(c)-'0'))), | |
| 73 | - zero_pad(explode(integer_to_string(n)),8))] | |
| 72 | + text([size(text_size),color(white),bold],""+(to_Word32(c)-'0'))), | |
| 73 | + zero_pad(explode(to_decimal(n)),8))] | |
| 74 | 74 | )]) |
| 75 | 75 | )]). |
| 76 | 76 | |
| ... | ... | @@ -81,9 +81,9 @@ public define HTML_Off_Form |
| 81 | 81 | ( |
| 82 | 82 | String directory, // where the counter file will be located |
| 83 | 83 | String name, // name of counter |
| 84 | - Int32 text_size // size of characters of counter | |
| 84 | + Int text_size // size of characters of counter | |
| 85 | 85 | ) = |
| 86 | - if (RetrieveResult(Int32))retrieve(directory+"/"+name+".counter") is | |
| 86 | + if (RetrieveResult(Int))retrieve(directory+"/"+name+".counter") is | |
| 87 | 87 | { |
| 88 | 88 | cannot_find_file then web_counter(0,text_size), |
| 89 | 89 | read_error then web_counter(0,text_size), |
| ... | ... | @@ -101,12 +101,12 @@ public define One |
| 101 | 101 | ) = |
| 102 | 102 | with path = directory+"/"+name+".counter", |
| 103 | 103 | protect |
| 104 | - if (RetrieveResult(Int32))retrieve(path) is | |
| 104 | + if (RetrieveResult(Int))retrieve(path) is | |
| 105 | 105 | { |
| 106 | - cannot_find_file then forget(save((Int32)1,path)), | |
| 106 | + cannot_find_file then forget(save((Int)1,path)), | |
| 107 | 107 | read_error then unique, |
| 108 | 108 | type_error then unique, |
| 109 | - ok(n) then forget(save((Int32)(n+1),path)) | |
| 109 | + ok(n) then forget(save((Int)(n+1),path)) | |
| 110 | 110 | }. |
| 111 | 111 | |
| 112 | 112 | ... | ... |