diff --git a/web/CXM_xml_rpc.anubis b/web/CXM_xml_rpc.anubis index e8b6475..340fb2d 100644 --- a/web/CXM_xml_rpc.anubis +++ b/web/CXM_xml_rpc.anubis @@ -70,12 +70,12 @@ define String define String format_struct(XML_RPC_struct structure, Int position). define String format_array(XML_RPC_array array, Int position). -define String format_int_value ( Word32 value) = ""+to_String(value)+"" + crlf. -define String format_boolean_value ( Bool value) = ""+to_String_value(value)+"" + crlf. -define String format_string_value ( String value) = ""+value+"" + crlf. -define String format_double_value ( Float value) = ""+float_to_string(value, 10)+"" + crlf. +define String format_int_value ( Word32 value) = ""+to_String(value)+"" + crlf. +define String format_boolean_value ( Bool value) = ""+to_String_value(value)+"" + crlf. +define String format_string_value ( String value) = ""+value+"" + crlf. +define String format_double_value ( Float value) = ""+float_to_string(value, 10)+"" + crlf. define String format_datetime_value ( String value) = ""+value+"" + crlf. -define String format_base64_value ( String value) = ""+value+"" + crlf. +define String format_base64_value ( String value) = ""+value+"" + crlf. define String format_value diff --git a/web/CXM_xml_rpc_types.anubis b/web/CXM_xml_rpc_types.anubis index 44a7dd9..b135e66 100644 --- a/web/CXM_xml_rpc_types.anubis +++ b/web/CXM_xml_rpc_types.anubis @@ -1,41 +1,99 @@ -/* - * Created by PyramIDE. - * User: Totoro - * Date: 06/07/2013 - * Time: 15:27 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -public type XML_RPC_struct:... -public type XML_RPC_array:... - -public type XML_RPC_value: - int(Word32), - bool(Bool), - string(String), - double(Float), - datetime(String), - base64(String), - struct(XML_RPC_struct), - array(XML_RPC_array). - -public type XML_RPC_array: - array(List(XML_RPC_value)). - -public type XML_RPC_struct_member: - member(String name, XML_RPC_value value). - -public type XML_RPC_struct: - members(List(XML_RPC_struct_member)). - -public type XML_RPC_parameter: - parameter(List(XML_RPC_value)). - -public type XML_RPC_parameters: - parameters(List(XML_RPC_parameter)). - -public type XML_RPC_response: - ok(XML_RPC_parameters params), - fault(XML_RPC_value fault). - +/* + * Created by PyramIDE. + * User: Totoro + * Date: 06/07/2013 + * Time: 15:27 + */ + +public type XML_RPC_struct:... +public type XML_RPC_array:... + +public type XML_RPC_value: + int(Word32), + bool(Bool), + string(String), + double(Float), + datetime(String), + base64(String), + struct(XML_RPC_struct), + array(XML_RPC_array). + +public type XML_RPC_array: + array(List(XML_RPC_value)). + +public type XML_RPC_struct_member: + member(String name, XML_RPC_value value). + +public type XML_RPC_struct: + members(List(XML_RPC_struct_member)). + +public type XML_RPC_parameter: + parameter(List(XML_RPC_value)). + +public type XML_RPC_parameters: + parameters(List(XML_RPC_parameter)). + +public type XML_RPC_response: + ok(XML_RPC_parameters params), + fault(XML_RPC_value fault). + +public define XML_RPC_value +/* convert a list of String to XML_RPC_array +*/ + to_XML_RPC_array + ( + List(String) l_strings + )= + array(array(map((String _str) |-> string(_str), l_strings))). + + +public define Maybe(XML_RPC_parameter) + get_first_parameter + ( + XML_RPC_parameters params + )= + since params is parameters(param_list), + if param_list is + { + [] then failure, + [h . t] then success(h) + }. + +public define Maybe(XML_RPC_struct) + get_first_struct + ( + List(XML_RPC_parameter) params + )= + if params is + { + [] then failure, + [h . t] then + since h is parameter(values), + if values is + { + [] then get_first_struct(t), + [val . _ ] then + if val is struct(content) then + success(content) + else + get_first_struct(t) + } + }. + +public define Maybe(XML_RPC_value) + get_member + ( + List(XML_RPC_struct_member) struct, + String member_name + )= + if struct is + { + [] then failure, + [h . t] then + since h is member(name, value), + if name = member_name then + success(value) + else + get_member(t, member_name) + }. + -- libgit2 0.21.4