xml_rpc_types.anubis
2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* Created by PyramIDE.
* User: Totoro
* Date: 06/07/2013
* Time: 15:27
*/
transmit tools/basis.anubis
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),
nil.
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)
}.
public define XML_RPC_struct
struct_add_member
(
XML_RPC_struct rpc_struc,
String name,
XML_RPC_value value
)=
since rpc_struc is members(members_list),
members([member(name, value) . members_list])
.