lbkit 0.5.5__tar.gz → 0.5.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lbkit-0.5.5/lbkit.egg-info → lbkit-0.5.6}/PKG-INFO +1 -1
- lbkit-0.5.6/lbkit/__init__.py +2 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/cli.py +1 -1
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/codegen.py +8 -0
- lbkit-0.5.6/lbkit/codegen/ctype_defination.py +511 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/idf_interface.py +190 -1
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/component/build.py +66 -13
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/errors.py +8 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/misc.py +18 -10
- {lbkit-0.5.5 → lbkit-0.5.6/lbkit.egg-info}/PKG-INFO +1 -1
- lbkit-0.5.5/lbkit/__init__.py +0 -2
- lbkit-0.5.5/lbkit/codegen/ctype_defination.py +0 -199
- {lbkit-0.5.5 → lbkit-0.5.6}/AUTHORS +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/LICENSE +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/MANIFEST.in +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/README.md +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/ci_robot/__init__.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/ci_robot/gitee.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/__init__.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/renderer.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/template/client.c.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/template/client.h.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/template/interface.c.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/template/public.c.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/template/public.h.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/template/server.c.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/codegen/template/server.h.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/component/__init__.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/component/arg_parser.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/component/template/conanbase.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/component/template/deploy.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/component/test.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/helper.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/integration/__init__.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/integration/build_manifest.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/integration/build_prepare.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/integration/build_rootfs.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/integration/config.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/integration/task.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/integration/template/conanfile.py.mako +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/lbkit.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/log.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit/tools.py +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit.egg-info/SOURCES.txt +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit.egg-info/dependency_links.txt +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit.egg-info/entry_points.txt +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit.egg-info/requires.txt +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/lbkit.egg-info/top_level.txt +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/setup.cfg +0 -0
- {lbkit-0.5.5 → lbkit-0.5.6}/setup.py +0 -0
|
@@ -223,7 +223,7 @@ class Command(object):
|
|
|
223
223
|
if exc.code != 0:
|
|
224
224
|
log.error("Exiting with code: %d" % exc.code)
|
|
225
225
|
ret_code = exc.code
|
|
226
|
-
except (errors.LiteBmcException, errors.RunCommandException, errors.ArgException, errors.PackageConfigException, Exception) as exc:
|
|
226
|
+
except (errors.LiteBmcException, errors.RunCommandException, errors.ArgException, errors.PackageConfigException, Exception, errors.OdfValidateException) as exc:
|
|
227
227
|
if os.environ.get("LOG"):
|
|
228
228
|
print(traceback.format_exc())
|
|
229
229
|
ret_code = -1
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"""
|
|
4
4
|
import os
|
|
5
5
|
import sys
|
|
6
|
+
import json
|
|
6
7
|
import yaml
|
|
7
8
|
import argparse
|
|
8
9
|
from lbkit.codegen.idf_interface import IdfInterface
|
|
@@ -45,6 +46,13 @@ class CodeGen(object):
|
|
|
45
46
|
with open(json_file, "w", encoding="utf-8") as fp:
|
|
46
47
|
yaml.dump(data, fp, encoding='utf-8', allow_unicode=True)
|
|
47
48
|
|
|
49
|
+
# 生成接口schema文件
|
|
50
|
+
odf_file = os.path.join(directory, "server", "schema", f"{interface.name}.json")
|
|
51
|
+
os.makedirs(os.path.dirname(odf_file), exist_ok=True)
|
|
52
|
+
odf_data = interface.odf_schema
|
|
53
|
+
with open(odf_file, "w", encoding="utf-8") as fp:
|
|
54
|
+
json.dump(odf_data, fp, sort_keys=False, indent=4)
|
|
55
|
+
|
|
48
56
|
|
|
49
57
|
def run(self, package_yml=None):
|
|
50
58
|
"""
|
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
"""语言相关类型定义"""
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IdfValidator():
|
|
6
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
7
|
+
return None
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BoolValidator(IdfValidator):
|
|
11
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
12
|
+
if allow_ref:
|
|
13
|
+
return {
|
|
14
|
+
"anyOf": [
|
|
15
|
+
{
|
|
16
|
+
"type": "boolean"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"$ref": "#/$defs/ref_value"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
else:
|
|
24
|
+
return {
|
|
25
|
+
"type": "boolean"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class BoolArrayValidator(BoolValidator):
|
|
30
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
31
|
+
parent_schema = super().odf_schema(False, idf_validator)
|
|
32
|
+
if allow_ref:
|
|
33
|
+
schema = {
|
|
34
|
+
"anyOf": [
|
|
35
|
+
{
|
|
36
|
+
"type": "array",
|
|
37
|
+
"item": parent_schema
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"$ref": "#/$defs/ref_value"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
else:
|
|
45
|
+
schema = {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"item": parent_schema
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return schema
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class IntegerValidator(IdfValidator):
|
|
54
|
+
maximum = sys.maxsize * 2
|
|
55
|
+
minimum = -(sys.maxsize + 1) * 2
|
|
56
|
+
|
|
57
|
+
def __init__(self, max, min):
|
|
58
|
+
self.maximum = max
|
|
59
|
+
self.minimum = min
|
|
60
|
+
super().__init__()
|
|
61
|
+
|
|
62
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
63
|
+
"""
|
|
64
|
+
返回整数类型成员的ODF schema
|
|
65
|
+
idf_validator为IDF模型中加载的数据验证器的对象
|
|
66
|
+
"""
|
|
67
|
+
max = idf_validator.get("max", self.maximum)
|
|
68
|
+
if max > self.maximum:
|
|
69
|
+
max = self.maximum
|
|
70
|
+
min = idf_validator.get("min", self.minimum)
|
|
71
|
+
if min < self.minimum:
|
|
72
|
+
min = self.minimum
|
|
73
|
+
if allow_ref:
|
|
74
|
+
return {
|
|
75
|
+
"anyOf": [
|
|
76
|
+
{
|
|
77
|
+
"type": "integer",
|
|
78
|
+
"maximum": max,
|
|
79
|
+
"minimum": min
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"$ref": "#/$defs/ref_value"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
else:
|
|
87
|
+
return {
|
|
88
|
+
"type": "integer",
|
|
89
|
+
"maximum": max,
|
|
90
|
+
"minimum": min
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class IntegerArrayValidator(IntegerValidator):
|
|
95
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
96
|
+
parent_schema = super().odf_schema(False, idf_validator)
|
|
97
|
+
if allow_ref:
|
|
98
|
+
schema = {
|
|
99
|
+
"anyOf": [
|
|
100
|
+
{
|
|
101
|
+
"type": "array",
|
|
102
|
+
"item": parent_schema
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"$ref": "#/$defs/ref_value"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
else:
|
|
110
|
+
schema = {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"item": parent_schema
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return schema
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class FloatValidator(IdfValidator):
|
|
119
|
+
maximum = sys.float_info.max
|
|
120
|
+
minimum = -sys.float_info.max
|
|
121
|
+
|
|
122
|
+
def __init__(self):
|
|
123
|
+
super().__init__()
|
|
124
|
+
|
|
125
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
126
|
+
"""
|
|
127
|
+
返回整数类型成员的ODF schema
|
|
128
|
+
idf_validator为IDF模型中加载的数据验证器的对象
|
|
129
|
+
"""
|
|
130
|
+
max = idf_validator.get("max", self.maximum)
|
|
131
|
+
min = idf_validator.get("min", self.minimum)
|
|
132
|
+
exclusive_max = idf_validator.get("exclusive_max", None)
|
|
133
|
+
exclusive_min = idf_validator.get("exclusive_min", None)
|
|
134
|
+
max_key = "maximum"
|
|
135
|
+
max_val = max
|
|
136
|
+
min_key = "minimum"
|
|
137
|
+
min_val = min
|
|
138
|
+
if exclusive_max is not None:
|
|
139
|
+
max_key = "exclusiveMaximum"
|
|
140
|
+
max_val = exclusive_max
|
|
141
|
+
if exclusive_min is not None:
|
|
142
|
+
max_key = "exclusiveMinimum"
|
|
143
|
+
min_val = exclusive_min
|
|
144
|
+
if allow_ref:
|
|
145
|
+
return {
|
|
146
|
+
"anyOf": [
|
|
147
|
+
{
|
|
148
|
+
"type": "number",
|
|
149
|
+
max_key: max_val,
|
|
150
|
+
min_key: min_val
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"$ref": "#/$defs/ref_value"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
else:
|
|
158
|
+
return {
|
|
159
|
+
"type": "number",
|
|
160
|
+
max_key: max_val,
|
|
161
|
+
min_key: min_val
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
class FloatArrayValidator(FloatValidator):
|
|
166
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
167
|
+
parent_schema = super().odf_schema(False, idf_validator)
|
|
168
|
+
if allow_ref:
|
|
169
|
+
schema = {
|
|
170
|
+
"anyOf": [
|
|
171
|
+
{
|
|
172
|
+
"type": "array",
|
|
173
|
+
"item": parent_schema
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"$ref": "#/$defs/ref_value"
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
else:
|
|
181
|
+
schema = {
|
|
182
|
+
"type": "array",
|
|
183
|
+
"item": parent_schema
|
|
184
|
+
}
|
|
185
|
+
return schema
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class StringValidator(IdfValidator):
|
|
189
|
+
pattern = None
|
|
190
|
+
def __init__(self, pattern):
|
|
191
|
+
self.pattern = pattern
|
|
192
|
+
super().__init__()
|
|
193
|
+
|
|
194
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
195
|
+
pattern = idf_validator.get("pattern", self.pattern)
|
|
196
|
+
if allow_ref:
|
|
197
|
+
schema = {
|
|
198
|
+
"anyOf": [
|
|
199
|
+
{
|
|
200
|
+
"type": "string"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"$ref": "#/$defs/ref_value"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
if pattern is not None:
|
|
208
|
+
schema["anyOf"][0]["pattern"] = pattern
|
|
209
|
+
else:
|
|
210
|
+
schema = {
|
|
211
|
+
"type": "string",
|
|
212
|
+
"pattern": pattern
|
|
213
|
+
}
|
|
214
|
+
return schema
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class StringArrayValidator(StringValidator):
|
|
218
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
219
|
+
parent_schema = super().odf_schema(False, idf_validator)
|
|
220
|
+
if allow_ref:
|
|
221
|
+
schema = {
|
|
222
|
+
"anyOf": [
|
|
223
|
+
{
|
|
224
|
+
"type": "array",
|
|
225
|
+
"item": parent_schema
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"$ref": "#/$defs/ref_value"
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
else:
|
|
233
|
+
schema = {
|
|
234
|
+
"type": "array",
|
|
235
|
+
"item": parent_schema
|
|
236
|
+
}
|
|
237
|
+
return schema
|
|
238
|
+
|
|
239
|
+
class RefObjValidator(IdfValidator):
|
|
240
|
+
def __init__(self):
|
|
241
|
+
super().__init__()
|
|
242
|
+
|
|
243
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
244
|
+
if allow_ref:
|
|
245
|
+
schema = {
|
|
246
|
+
"anyOf": [
|
|
247
|
+
{
|
|
248
|
+
"$ref": "#/$defs/ref_obj"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"$ref": "#/$defs/ref_value"
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
else:
|
|
256
|
+
schema = {
|
|
257
|
+
"$ref": "#/$defs/ref_obj"
|
|
258
|
+
}
|
|
259
|
+
return schema
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class RefObjArrayValidator(RefObjValidator):
|
|
263
|
+
def odf_schema(self, allow_ref, idf_validator):
|
|
264
|
+
if allow_ref:
|
|
265
|
+
schema = {
|
|
266
|
+
"anyOf": [
|
|
267
|
+
{
|
|
268
|
+
"$ref": "#/$defs/ref_obj_array"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"$ref": "#/$defs/ref_value"
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
else:
|
|
276
|
+
schema = {
|
|
277
|
+
"$ref": "#/$defs/ref_obj_array"
|
|
278
|
+
}
|
|
279
|
+
return schema
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class CTypeBase(object):
|
|
283
|
+
"""C语言相关的操作函数&类型定义"""
|
|
284
|
+
def __init__(self, declare, free_func, encode_func, decode_func, validator: IdfValidator = None):
|
|
285
|
+
self.declare = declare
|
|
286
|
+
self.free_func = free_func
|
|
287
|
+
self.encode_func = encode_func
|
|
288
|
+
self.decode_func = decode_func
|
|
289
|
+
self.validator = validator
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
"""定义支持的C语言类型"""
|
|
293
|
+
CTYPE_OBJS = {
|
|
294
|
+
"boolean": CTypeBase(
|
|
295
|
+
["gboolean <arg_name>"],
|
|
296
|
+
[],
|
|
297
|
+
["<arg_out> = g_variant_new_boolean(<arg_name>)"],
|
|
298
|
+
["<arg_in> = g_variant_get_boolean(<arg_name>)"],
|
|
299
|
+
BoolValidator()
|
|
300
|
+
),
|
|
301
|
+
"byte": CTypeBase(
|
|
302
|
+
["guint8 <arg_name>"],
|
|
303
|
+
[],
|
|
304
|
+
["<arg_out> = g_variant_new_byte(<arg_name>)"],
|
|
305
|
+
["<arg_in> = g_variant_get_byte(<arg_name>)"],
|
|
306
|
+
IntegerValidator(0xff, 0)
|
|
307
|
+
),
|
|
308
|
+
"int16": CTypeBase(
|
|
309
|
+
["gint16 <arg_name>"],
|
|
310
|
+
[],
|
|
311
|
+
["<arg_out> = g_variant_new_int16(<arg_name>)"],
|
|
312
|
+
["<arg_in> = g_variant_get_int16(<arg_name>)"],
|
|
313
|
+
IntegerValidator(0x7fff, -(0x8000))
|
|
314
|
+
),
|
|
315
|
+
"uint16": CTypeBase(
|
|
316
|
+
["guint16 <arg_name>"],
|
|
317
|
+
[],
|
|
318
|
+
["<arg_out> = g_variant_new_uint16(<arg_name>)"],
|
|
319
|
+
["<arg_in> = g_variant_get_uint16(<arg_name>)"],
|
|
320
|
+
IntegerValidator(0xffff, 0)
|
|
321
|
+
),
|
|
322
|
+
"int32": CTypeBase(
|
|
323
|
+
["gint32 <arg_name>"],
|
|
324
|
+
[],
|
|
325
|
+
["<arg_out> = g_variant_new_int32(<arg_name>)"],
|
|
326
|
+
["<arg_in> = g_variant_get_int32(<arg_name>)"],
|
|
327
|
+
IntegerValidator(0x7fff_ffff, -(0x8000_0000))
|
|
328
|
+
),
|
|
329
|
+
"uint32": CTypeBase(
|
|
330
|
+
["guint32 <arg_name>"],
|
|
331
|
+
[],
|
|
332
|
+
["<arg_out> = g_variant_new_uint32(<arg_name>)"],
|
|
333
|
+
["<arg_in> = g_variant_get_uint32(<arg_name>)"],
|
|
334
|
+
IntegerValidator(0xffff_ffff, 0)
|
|
335
|
+
),
|
|
336
|
+
"int64": CTypeBase(
|
|
337
|
+
["gint64 <arg_name>"],
|
|
338
|
+
[],
|
|
339
|
+
["<arg_out> = g_variant_new_int64(<arg_name>)"],
|
|
340
|
+
["<arg_in> = g_variant_get_int64(<arg_name>)"],
|
|
341
|
+
IntegerValidator(0x7fff_ffff_ffff_ffff, -(0x8000_0000_0000_0000))
|
|
342
|
+
),
|
|
343
|
+
"uint64": CTypeBase(
|
|
344
|
+
["guint64 <arg_name>"],
|
|
345
|
+
[],
|
|
346
|
+
["<arg_out> = g_variant_new_uint64(<arg_name>)"],
|
|
347
|
+
["<arg_in> = g_variant_get_uint64(<arg_name>)"],
|
|
348
|
+
IntegerValidator(0xffff_ffff_ffff_ffff, 0)
|
|
349
|
+
),
|
|
350
|
+
"size": CTypeBase(
|
|
351
|
+
["gsize <arg_name>"],
|
|
352
|
+
[],
|
|
353
|
+
["<arg_out> = g_variant_new_uint64(<arg_name>)"],
|
|
354
|
+
["<arg_in> = g_variant_get_uint64(<arg_name>)"],
|
|
355
|
+
IntegerValidator(0xffff_ffff_ffff_ffff, 0)
|
|
356
|
+
),
|
|
357
|
+
"ssize": CTypeBase(
|
|
358
|
+
["gssize <arg_name>"],
|
|
359
|
+
[],
|
|
360
|
+
["<arg_out> = g_variant_new_int64(<arg_name>)"],
|
|
361
|
+
["<arg_in> = g_variant_get_int64(<arg_name>)"],
|
|
362
|
+
IntegerValidator(0x7fff_ffff_ffff_ffff, -(0x8000_0000_0000_0000))
|
|
363
|
+
),
|
|
364
|
+
"double": CTypeBase(
|
|
365
|
+
["gdouble <arg_name>"],
|
|
366
|
+
[],
|
|
367
|
+
["<arg_out> = g_variant_new_double(<arg_name>)"],
|
|
368
|
+
["<arg_in> = g_variant_get_double(<arg_name>)"],
|
|
369
|
+
FloatValidator()
|
|
370
|
+
),
|
|
371
|
+
"unixfd": CTypeBase(
|
|
372
|
+
["gint32 <arg_name>"],
|
|
373
|
+
[],
|
|
374
|
+
["<arg_out> = g_variant_new_handle(<arg_name>)"],
|
|
375
|
+
["<arg_in> = g_variant_get_handle(<arg_name>)"],
|
|
376
|
+
IntegerValidator(0x7fff_ffff_ffff_ffff, 0)
|
|
377
|
+
),
|
|
378
|
+
"string": CTypeBase(
|
|
379
|
+
["<const>gchar *<arg_name>"],
|
|
380
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
381
|
+
["<arg_out> = gcl_string_encode(<arg_name>)"],
|
|
382
|
+
["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
|
|
383
|
+
StringValidator("^.*$")
|
|
384
|
+
),
|
|
385
|
+
"object_path": CTypeBase(
|
|
386
|
+
["<const>gchar *<arg_name>"],
|
|
387
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
388
|
+
["<arg_out> = gcl_object_path_encode(<arg_name>)"],
|
|
389
|
+
["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
|
|
390
|
+
StringValidator("^(/[A-Z0-9a-z_]+)*$")
|
|
391
|
+
),
|
|
392
|
+
"signature": CTypeBase(
|
|
393
|
+
["<const>gchar *<arg_name>"],
|
|
394
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
395
|
+
["<arg_out> = gcl_signature_encode(<arg_name>)"],
|
|
396
|
+
["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
|
|
397
|
+
StringValidator("^([abynqiuxtdsogv\\{\\}\\(\\)])+$")
|
|
398
|
+
),
|
|
399
|
+
"variant": CTypeBase(
|
|
400
|
+
["GVariant *<arg_name>"],
|
|
401
|
+
["gcl_unref_p((GVariant **)&<arg_name>)"],
|
|
402
|
+
["g_variant_take_ref(<arg_name>)", "<arg_out> = g_variant_new_variant(<arg_name>)"],
|
|
403
|
+
["<arg_in> = g_variant_get_variant(<arg_name>)"],
|
|
404
|
+
IdfValidator()
|
|
405
|
+
),
|
|
406
|
+
"array[boolean]": CTypeBase(
|
|
407
|
+
["gsize n_<arg_name>" ,"<const>gboolean *<arg_name>"],
|
|
408
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
409
|
+
["<arg_out> = gcl_array_boolean_encode(<arg_name>, n_<arg_name>)"],
|
|
410
|
+
["<arg_in> = gcl_array_boolean_decode(<arg_name>, &n_<arg_in>)"],
|
|
411
|
+
BoolArrayValidator()
|
|
412
|
+
),
|
|
413
|
+
"array[byte]": CTypeBase(
|
|
414
|
+
["gsize n_<arg_name>" ,"<const>guint8 *<arg_name>"],
|
|
415
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
416
|
+
["<arg_out> = gcl_array_byte_encode(<arg_name>, n_<arg_name>)"],
|
|
417
|
+
["<arg_in> = gcl_array_byte_decode(<arg_name>, &n_<arg_in>)"],
|
|
418
|
+
IntegerArrayValidator(0xff, 0)
|
|
419
|
+
),
|
|
420
|
+
"array[int16]": CTypeBase(
|
|
421
|
+
["gsize n_<arg_name>" ,"<const>gint16 *<arg_name>"],
|
|
422
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
423
|
+
["<arg_out> = gcl_array_int16_encode(<arg_name>, n_<arg_name>)"],
|
|
424
|
+
["<arg_in> = gcl_array_int16_decode(<arg_name>, &n_<arg_in>)"],
|
|
425
|
+
IntegerArrayValidator(0x7fff, -(0x8000))
|
|
426
|
+
),
|
|
427
|
+
"array[uint16]": CTypeBase(
|
|
428
|
+
["gsize n_<arg_name>" ,"<const>guint16 *<arg_name>"],
|
|
429
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
430
|
+
["<arg_out> = gcl_array_uint16_encode(<arg_name>, n_<arg_name>)"],
|
|
431
|
+
["<arg_in> = gcl_array_uint16_decode(<arg_name>, &n_<arg_in>)"],
|
|
432
|
+
IntegerArrayValidator(0xffff, 0)
|
|
433
|
+
),
|
|
434
|
+
"array[int32]": CTypeBase(
|
|
435
|
+
["gsize n_<arg_name>" ,"<const>gint32 *<arg_name>"],
|
|
436
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
437
|
+
["<arg_out> = gcl_array_int32_encode(<arg_name>, n_<arg_name>)"],
|
|
438
|
+
["<arg_in> = gcl_array_int32_decode(<arg_name>, &n_<arg_in>)"],
|
|
439
|
+
IntegerArrayValidator(0x7fff_ffff, -(0x80000000))
|
|
440
|
+
),
|
|
441
|
+
"array[uint32]": CTypeBase(
|
|
442
|
+
["gsize n_<arg_name>" ,"<const>guint32 *<arg_name>"],
|
|
443
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
444
|
+
["<arg_out> = gcl_array_uint32_encode(<arg_name>, n_<arg_name>)"],
|
|
445
|
+
["<arg_in> = gcl_array_uint32_decode(<arg_name>, &n_<arg_in>)"],
|
|
446
|
+
IntegerArrayValidator(0xffff_ffff, 0)
|
|
447
|
+
),
|
|
448
|
+
"array[int64]": CTypeBase(
|
|
449
|
+
["gsize n_<arg_name>" ,"<const>gint64 *<arg_name>"],
|
|
450
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
451
|
+
["<arg_out> = gcl_array_int64_encode(<arg_name>, n_<arg_name>)"],
|
|
452
|
+
["<arg_in> = gcl_array_int64_decode(<arg_name>, &n_<arg_in>)"],
|
|
453
|
+
IntegerArrayValidator(0x7fff_ffff_ffff_ffff, -(0x8000_0000_0000_0000))
|
|
454
|
+
),
|
|
455
|
+
"array[uint64]": CTypeBase(
|
|
456
|
+
["gsize n_<arg_name>" ,"<const>guint64 *<arg_name>"],
|
|
457
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
458
|
+
["<arg_out> = gcl_array_uint64_encode(<arg_name>, n_<arg_name>)"],
|
|
459
|
+
["<arg_in> = gcl_array_uint64_decode(<arg_name>, &n_<arg_in>)"],
|
|
460
|
+
IntegerArrayValidator(0xffff_ffff_ffff_ffff, 0)
|
|
461
|
+
),
|
|
462
|
+
"array[ssize]": CTypeBase(
|
|
463
|
+
["gsize n_<arg_name>" ,"<const>gssize *<arg_name>"],
|
|
464
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
465
|
+
["<arg_out> = gcl_array_int64_encode(<arg_name>, n_<arg_name>)"],
|
|
466
|
+
["<arg_in> = gcl_array_int64_decode(<arg_name>, &n_<arg_in>)"],
|
|
467
|
+
IntegerArrayValidator(0xffff_ffff_ffff_ffff, 0)
|
|
468
|
+
),
|
|
469
|
+
"array[size]": CTypeBase(
|
|
470
|
+
["gsize n_<arg_name>" ,"<const>gsize *<arg_name>"],
|
|
471
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
472
|
+
["<arg_out> = gcl_array_uint64_encode(<arg_name>, n_<arg_name>)"],
|
|
473
|
+
["<arg_in> = gcl_array_uint64_decode(<arg_name>, &n_<arg_in>)"],
|
|
474
|
+
IntegerArrayValidator(0x7fff_ffff_ffff_ffff, -(0x8000_0000_0000_0000))
|
|
475
|
+
),
|
|
476
|
+
"array[double]": CTypeBase(
|
|
477
|
+
["gsize n_<arg_name>" ,"<const>gdouble *<arg_name>"],
|
|
478
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
479
|
+
["<arg_out> = gcl_array_double_encode(<arg_name>, n_<arg_name>)"],
|
|
480
|
+
["<arg_in> = gcl_array_double_decode(<arg_name>, &n_<arg_in>)"],
|
|
481
|
+
FloatArrayValidator()
|
|
482
|
+
),
|
|
483
|
+
"array[unixfd]": CTypeBase(
|
|
484
|
+
["gsize n_<arg_name>" ,"<const>gint32 *<arg_name>"],
|
|
485
|
+
["gcl_free_p((void **)&<arg_name>)"],
|
|
486
|
+
["<arg_out> = gcl_array_handle_encode(<arg_name>, n_<arg_name>)"],
|
|
487
|
+
["<arg_in> = gcl_array_handle_decode(<arg_name>, &n_<arg_in>)"],
|
|
488
|
+
IntegerArrayValidator(0x7fff_ffff_ffff_ffff, 0)
|
|
489
|
+
),
|
|
490
|
+
"array[string]": CTypeBase(
|
|
491
|
+
["gchar * <const>*<arg_name>"],
|
|
492
|
+
["gcl_strfreev_p(&<arg_name>)"],
|
|
493
|
+
["<arg_out> = gcl_array_string_encode(<arg_name>)"],
|
|
494
|
+
["<arg_in> = gcl_array_string_decode(<arg_name>)"],
|
|
495
|
+
StringArrayValidator("^.*$")
|
|
496
|
+
),
|
|
497
|
+
"array[object_path]": CTypeBase(
|
|
498
|
+
["gchar * <const>*<arg_name>"],
|
|
499
|
+
["gcl_strfreev_p(&<arg_name>)"],
|
|
500
|
+
["<arg_out> = gcl_array_object_path_encode(<arg_name>)"],
|
|
501
|
+
["<arg_in> = gcl_array_object_path_decode(<arg_name>)"],
|
|
502
|
+
StringArrayValidator("^(/[A-Z0-9a-z_]+)*$")
|
|
503
|
+
),
|
|
504
|
+
"array[signature]": CTypeBase(
|
|
505
|
+
["gchar * <const>*<arg_name>"],
|
|
506
|
+
["gcl_strfreev_p(&<arg_name>)"],
|
|
507
|
+
["<arg_out> = gcl_array_signature_encode(<arg_name>)"],
|
|
508
|
+
["<arg_in> = gcl_array_signature_decode(<arg_name>)"],
|
|
509
|
+
StringArrayValidator("^([abynqiuxtdsogv\\{\\}\\(\\)])+$")
|
|
510
|
+
)
|
|
511
|
+
}
|