lbkit 0.5.5__tar.gz → 0.5.7__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.
Files changed (51) hide show
  1. {lbkit-0.5.5/lbkit.egg-info → lbkit-0.5.7}/PKG-INFO +1 -1
  2. lbkit-0.5.7/lbkit/__init__.py +2 -0
  3. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/cli.py +1 -1
  4. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/codegen.py +8 -0
  5. lbkit-0.5.7/lbkit/codegen/ctype_defination.py +644 -0
  6. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/idf_interface.py +253 -2
  7. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/template/public.c.mako +352 -5
  8. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/template/public.h.mako +18 -1
  9. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/template/server.c.mako +5 -1
  10. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/template/server.h.mako +0 -1
  11. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/component/build.py +66 -13
  12. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/errors.py +8 -0
  13. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/misc.py +17 -9
  14. {lbkit-0.5.5 → lbkit-0.5.7/lbkit.egg-info}/PKG-INFO +1 -1
  15. lbkit-0.5.5/lbkit/__init__.py +0 -2
  16. lbkit-0.5.5/lbkit/codegen/ctype_defination.py +0 -199
  17. {lbkit-0.5.5 → lbkit-0.5.7}/AUTHORS +0 -0
  18. {lbkit-0.5.5 → lbkit-0.5.7}/LICENSE +0 -0
  19. {lbkit-0.5.5 → lbkit-0.5.7}/MANIFEST.in +0 -0
  20. {lbkit-0.5.5 → lbkit-0.5.7}/README.md +0 -0
  21. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/ci_robot/__init__.py +0 -0
  22. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/ci_robot/gitee.py +0 -0
  23. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/__init__.py +0 -0
  24. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/renderer.py +0 -0
  25. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/template/client.c.mako +0 -0
  26. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/template/client.h.mako +0 -0
  27. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/template/interface.c.mako +0 -0
  28. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
  29. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/component/__init__.py +0 -0
  30. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/component/arg_parser.py +0 -0
  31. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/component/template/conanbase.mako +0 -0
  32. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/component/template/deploy.mako +0 -0
  33. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/component/test.py +0 -0
  34. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/helper.py +0 -0
  35. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/integration/__init__.py +0 -0
  36. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/integration/build_manifest.py +0 -0
  37. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/integration/build_prepare.py +0 -0
  38. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/integration/build_rootfs.py +0 -0
  39. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/integration/config.py +0 -0
  40. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/integration/task.py +0 -0
  41. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/integration/template/conanfile.py.mako +0 -0
  42. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/lbkit.py +0 -0
  43. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/log.py +0 -0
  44. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit/tools.py +0 -0
  45. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit.egg-info/SOURCES.txt +0 -0
  46. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit.egg-info/dependency_links.txt +0 -0
  47. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit.egg-info/entry_points.txt +0 -0
  48. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit.egg-info/requires.txt +0 -0
  49. {lbkit-0.5.5 → lbkit-0.5.7}/lbkit.egg-info/top_level.txt +0 -0
  50. {lbkit-0.5.5 → lbkit-0.5.7}/setup.cfg +0 -0
  51. {lbkit-0.5.5 → lbkit-0.5.7}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.5.5
3
+ Version: 0.5.7
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.5.7'
@@ -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,644 @@
1
+ """语言相关类型定义"""
2
+ import sys
3
+ from lbkit.errors import OdfValidateException
4
+
5
+
6
+ class IdfValidator():
7
+ validator = {}
8
+
9
+ def set_validator(self, value):
10
+ self.validator = value
11
+
12
+ def odf_validate(self):
13
+ idf_validator = idf_validator
14
+ return []
15
+
16
+ def odf_schema(self, allow_ref):
17
+ allow_ref = allow_ref
18
+ idf_validator = idf_validator
19
+ return None
20
+
21
+
22
+ class BoolValidator(IdfValidator):
23
+ def odf_validate(self):
24
+ func = ["validate_odf_as_boolean(doc, node, prop, error_list)"]
25
+ return func
26
+
27
+ def odf_schema(self, allow_ref):
28
+ if allow_ref:
29
+ return {
30
+ "anyOf": [
31
+ {
32
+ "type": "boolean"
33
+ },
34
+ {
35
+ "$ref": "#/$defs/ref_value"
36
+ }
37
+ ]
38
+ }
39
+ else:
40
+ return {
41
+ "type": "boolean"
42
+ }
43
+
44
+
45
+ class BoolArrayValidator(BoolValidator):
46
+ def odf_validate(self):
47
+ func = ["validate_odf_as_boolean_v(doc, node, prop, error_list)"]
48
+ return func
49
+
50
+ def odf_schema(self, allow_ref):
51
+ parent_schema = super().odf_schema(False)
52
+ if allow_ref:
53
+ schema = {
54
+ "anyOf": [
55
+ {
56
+ "type": "array",
57
+ "item": parent_schema
58
+ },
59
+ {
60
+ "$ref": "#/$defs/ref_value"
61
+ }
62
+ ]
63
+ }
64
+ else:
65
+ schema = {
66
+ "type": "array",
67
+ "item": parent_schema
68
+ }
69
+
70
+ return schema
71
+
72
+
73
+ class IntegerValidator(IdfValidator):
74
+ maximum = sys.maxsize * 2
75
+ minimum = -(sys.maxsize + 1) * 2
76
+
77
+ def __init__(self, max, min, signed=False):
78
+ self.maximum = max
79
+ self.minimum = min
80
+ self.signed = signed
81
+ if not self.signed and self.minimum < 0:
82
+ self.minimum = 0
83
+ if self.maximum < self.minimum:
84
+ raise OdfValidateException(f"The max value {self.maximum} less than or equal to {self.minimum}")
85
+ super().__init__()
86
+
87
+ def set_validator(self, value):
88
+ super().set_validator(value)
89
+ max = self.validator.get("max", self.maximum)
90
+ if max > self.maximum:
91
+ max = self.maximum
92
+ min = self.validator.get("min", self.minimum)
93
+ if min < self.minimum:
94
+ min = self.minimum
95
+ self.maximum = max
96
+ self.minimum = min
97
+ if not self.signed and self.minimum < 0:
98
+ self.minimum = 0
99
+ if self.maximum < self.minimum:
100
+ raise OdfValidateException(f"The max value {self.maximum} less than or equal to {self.minimum}")
101
+
102
+ def odf_validate(self):
103
+ func = []
104
+ if self.signed:
105
+ if self.minimum == -9223372036854775808:
106
+ func.append(f"validate_odf_as_signed(doc, node, prop, {self.maximum}, G_MININT64, error_list)")
107
+ else:
108
+ func.append(f"validate_odf_as_signed(doc, node, prop, {self.maximum}, {self.minimum}, error_list)")
109
+ else:
110
+ if self.maximum == 18446744073709551615:
111
+ func.append(f"validate_odf_as_unsigned(doc, node, prop, G_MAXUINT64, {self.minimum}, error_list)")
112
+ else:
113
+ func.append(f"validate_odf_as_unsigned(doc, node, prop, {self.maximum}, {self.minimum}, error_list)")
114
+ return func
115
+
116
+ def odf_schema(self, allow_ref):
117
+ """
118
+ 返回整数类型成员的ODF schema
119
+ idf_validator为IDF模型中加载的数据验证器的对象
120
+ """
121
+ if allow_ref:
122
+ return {
123
+ "anyOf": [
124
+ {
125
+ "type": "integer",
126
+ "maximum": self.maximum,
127
+ "minimum": self.minimum
128
+ },
129
+ {
130
+ "$ref": "#/$defs/ref_value"
131
+ }
132
+ ]
133
+ }
134
+ else:
135
+ return {
136
+ "type": "integer",
137
+ "maximum": self.maximum,
138
+ "minimum": self.minimum
139
+ }
140
+
141
+
142
+ class IntegerArrayValidator(IntegerValidator):
143
+ def odf_validate(self):
144
+ func = []
145
+ min = self.minimum
146
+ max = self.maximum
147
+ if self.signed:
148
+ if self.minimum <= -0x8000_0000_0000_0000:
149
+ min = "G_MININT64"
150
+ if self.maximum >= 0x7fff_ffff_ffff_ffff:
151
+ max = "G_MAXINT64"
152
+ else:
153
+ if self.maximum >= 0xffff_ffff_ffff_ffff:
154
+ max = "G_MAXUINT64"
155
+
156
+ if self.signed:
157
+ func.append(f"validate_odf_as_signed_v(doc, node, prop, {max}, {min}, error_list)")
158
+ else:
159
+ func.append(f"validate_odf_as_unsigned_v(doc, node, prop, {max}, {min}, error_list)")
160
+ return func
161
+
162
+ def odf_schema(self, allow_ref):
163
+ parent_schema = super().odf_schema(False)
164
+ if allow_ref:
165
+ schema = {
166
+ "anyOf": [
167
+ {
168
+ "type": "array",
169
+ "item": parent_schema
170
+ },
171
+ {
172
+ "$ref": "#/$defs/ref_value"
173
+ }
174
+ ]
175
+ }
176
+ else:
177
+ schema = {
178
+ "type": "array",
179
+ "item": parent_schema
180
+ }
181
+
182
+ return schema
183
+
184
+
185
+ class FloatValidator(IdfValidator):
186
+ maximum = sys.float_info.max
187
+ minimum = -sys.float_info.max
188
+
189
+ exclusive_max = None
190
+ exclusive_min = None
191
+
192
+ def __init__(self):
193
+ self.max_key = "maximum"
194
+ self.max_val = self.maximum
195
+ self.min_key = "minimum"
196
+ self.min_val = self.minimum
197
+ super().__init__()
198
+
199
+ def odf_validate(self):
200
+ func = ["validate_odf_as_double(doc, node, prop, error_list)"]
201
+ if self.exclusive_max is not None:
202
+ func.append(f"validate_odf_as_float_exclusive_max(doc, node, prop, {self.exclusive_max}, error_list)")
203
+ elif self.maximum != sys.float_info.max:
204
+ func.append(f"validate_odf_as_float_max(doc, node, prop, {self.maximum}, error_list)")
205
+
206
+ if self.exclusive_min is not None:
207
+ func.append(f"validate_odf_as_float_exclusive_min(doc, node, prop, {self.exclusive_min}, error_list)")
208
+ elif self.minimum != (-sys.float_info.max):
209
+ func.append(f"validate_odf_as_float_min(doc, node, prop, {self.minimum}, error_list)")
210
+ return func
211
+
212
+ def set_validator(self, value):
213
+ super().set_validator(value)
214
+ self.maximum = self.validator.get("max", self.maximum)
215
+ self.minimum = self.validator.get("min", self.minimum)
216
+ self.exclusive_max = self.validator.get("exclusive_max", None)
217
+ self.exclusive_min = self.validator.get("exclusive_min", None)
218
+ self.max_key = "maximum"
219
+ self.min_key = "minimum"
220
+ self.max_val = self.maximum
221
+ self.min_val = self.minimum
222
+ if self.exclusive_max is not None:
223
+ self.max_key = "exclusiveMaximum"
224
+ self.max_val = self.exclusive_max
225
+ if self.exclusive_min is not None:
226
+ self.max_key = "exclusiveMinimum"
227
+ self.min_val = self.exclusive_min
228
+
229
+ def odf_schema(self, allow_ref):
230
+ """
231
+ 返回整数类型成员的ODF schema
232
+ idf_validator为IDF模型中加载的数据验证器的对象
233
+ """
234
+ if allow_ref:
235
+ return {
236
+ "anyOf": [
237
+ {
238
+ "type": "number",
239
+ self.max_key: self.max_val,
240
+ self.min_key: self.min_val
241
+ },
242
+ {
243
+ "$ref": "#/$defs/ref_value"
244
+ }
245
+ ]
246
+ }
247
+ else:
248
+ return {
249
+ "type": "number",
250
+ self.max_key: self.max_val,
251
+ self.min_key: self.min_val
252
+ }
253
+
254
+
255
+ class FloatArrayValidator(FloatValidator):
256
+ def odf_validate(self):
257
+ func = ["validate_odf_as_double_v(doc, node, prop, error_list)"]
258
+ if self.exclusive_max is not None:
259
+ func.append(f"validate_odf_as_float_exclusive_max_v(doc, node, prop, {self.exclusive_max}, error_list)")
260
+ elif self.maximum != sys.float_info.max:
261
+ func.append(f"validate_odf_as_float_max_v(doc, node, prop, {self.maximum}, error_list)")
262
+
263
+ if self.exclusive_min is not None:
264
+ func.append(f"validate_odf_as_float_exclusive_min_v(doc, node, prop, {self.exclusive_min}, error_list)")
265
+ elif self.minimum != (-sys.float_info.max):
266
+ func.append(f"validate_odf_as_float_min_v(doc, node, prop, {self.minimum}, error_list)")
267
+ return func
268
+
269
+ def odf_schema(self, allow_ref):
270
+ parent_schema = super().odf_schema(False)
271
+ if allow_ref:
272
+ schema = {
273
+ "anyOf": [
274
+ {
275
+ "type": "array",
276
+ "item": parent_schema
277
+ },
278
+ {
279
+ "$ref": "#/$defs/ref_value"
280
+ }
281
+ ]
282
+ }
283
+ else:
284
+ schema = {
285
+ "type": "array",
286
+ "item": parent_schema
287
+ }
288
+ return schema
289
+
290
+
291
+ class StringValidator(IdfValidator):
292
+ pattern = None
293
+ def __init__(self, pattern):
294
+ self.pattern = pattern
295
+ super().__init__()
296
+
297
+ def set_validator(self, value):
298
+ self.pattern = self.validator.get("pattern", self.pattern)
299
+ super().set_validator(value)
300
+
301
+ def odf_validate(self):
302
+ func = []
303
+ if self.pattern is not None:
304
+ func.append(f"validate_odf_as_string(doc, node, prop, \"{self.pattern}\", error_list)")
305
+ else:
306
+ pattern = "^()|(((\\\\$)|[^$]).*)$"
307
+ func.append(f"validate_odf_as_string(doc, node, prop, \"{pattern}\", error_list)")
308
+ return func
309
+
310
+ def odf_schema(self, allow_ref):
311
+ if allow_ref:
312
+ schema = {
313
+ "anyOf": [
314
+ {
315
+ "type": "string",
316
+ "pattern": "^()|(((\\\\$)|[^$]).*)$"
317
+ },
318
+ {
319
+ "$ref": "#/$defs/ref_value"
320
+ }
321
+ ]
322
+ }
323
+ if self.pattern is not None:
324
+ schema["anyOf"][0]["pattern"] = self.pattern
325
+ else:
326
+ schema = {
327
+ "type": "string",
328
+ "pattern": self.pattern
329
+ }
330
+ return schema
331
+
332
+
333
+ class StringArrayValidator(StringValidator):
334
+ def odf_validate(self):
335
+ func = []
336
+ if self.pattern is not None:
337
+ func.append(f"validate_odf_as_string_v(doc, node, prop, \"{self.pattern}\", error_list)")
338
+ else:
339
+ pattern = "^()|(((\\\\$)|[^$]).*)$"
340
+ func.append(f"validate_odf_as_string_v(doc, node, prop, \"{pattern}\", error_list)")
341
+ return func
342
+
343
+ def odf_schema(self, allow_ref):
344
+ parent_schema = super().odf_schema(False)
345
+ if allow_ref:
346
+ schema = {
347
+ "anyOf": [
348
+ {
349
+ "type": "array",
350
+ "item": parent_schema
351
+ },
352
+ {
353
+ "$ref": "#/$defs/ref_value"
354
+ }
355
+ ]
356
+ }
357
+ else:
358
+ schema = {
359
+ "type": "array",
360
+ "item": parent_schema
361
+ }
362
+ return schema
363
+
364
+ class RefObjValidator(IdfValidator):
365
+ def __init__(self):
366
+ super().__init__()
367
+
368
+ def odf_validate(self):
369
+ func = ["validate_odf_as_ref_obj(doc, node, prop, error_list)"]
370
+ return func
371
+
372
+ def odf_schema(self, allow_ref):
373
+ if allow_ref:
374
+ schema = {
375
+ "anyOf": [
376
+ {
377
+ "$ref": "#/$defs/ref_obj"
378
+ },
379
+ {
380
+ "$ref": "#/$defs/ref_value"
381
+ }
382
+ ]
383
+ }
384
+ else:
385
+ schema = {
386
+ "$ref": "#/$defs/ref_obj"
387
+ }
388
+ return schema
389
+
390
+
391
+ class RefObjArrayValidator(RefObjValidator):
392
+ def odf_validate(self):
393
+ func = ["validate_odf_as_ref_obj_v(doc, node, prop, error_list)"]
394
+ return func
395
+
396
+ def odf_schema(self, allow_ref):
397
+ if allow_ref:
398
+ schema = {
399
+ "anyOf": [
400
+ {
401
+ "$ref": "#/$defs/ref_obj_array"
402
+ },
403
+ {
404
+ "$ref": "#/$defs/ref_value"
405
+ }
406
+ ]
407
+ }
408
+ else:
409
+ schema = {
410
+ "$ref": "#/$defs/ref_obj_array"
411
+ }
412
+ return schema
413
+
414
+
415
+ class CTypeBase(object):
416
+ """C语言相关的操作函数&类型定义"""
417
+ def __init__(self, declare, free_func, encode_func, decode_func, validator: IdfValidator = None):
418
+ self.declare = declare
419
+ self.free_func = free_func
420
+ self.encode_func = encode_func
421
+ self.decode_func = decode_func
422
+ self.validator = validator
423
+
424
+
425
+ """定义支持的C语言类型"""
426
+ CTYPE_OBJS = {
427
+ "boolean": CTypeBase(
428
+ ["gboolean <arg_name>"],
429
+ [],
430
+ ["<arg_out> = g_variant_new_boolean(<arg_name>)"],
431
+ ["<arg_in> = g_variant_get_boolean(<arg_name>)"],
432
+ BoolValidator()
433
+ ),
434
+ "byte": CTypeBase(
435
+ ["guint8 <arg_name>"],
436
+ [],
437
+ ["<arg_out> = g_variant_new_byte(<arg_name>)"],
438
+ ["<arg_in> = g_variant_get_byte(<arg_name>)"],
439
+ IntegerValidator(0xff, 0)
440
+ ),
441
+ "int16": CTypeBase(
442
+ ["gint16 <arg_name>"],
443
+ [],
444
+ ["<arg_out> = g_variant_new_int16(<arg_name>)"],
445
+ ["<arg_in> = g_variant_get_int16(<arg_name>)"],
446
+ IntegerValidator(0x7fff, -(0x8000), True)
447
+ ),
448
+ "uint16": CTypeBase(
449
+ ["guint16 <arg_name>"],
450
+ [],
451
+ ["<arg_out> = g_variant_new_uint16(<arg_name>)"],
452
+ ["<arg_in> = g_variant_get_uint16(<arg_name>)"],
453
+ IntegerValidator(0xffff, 0)
454
+ ),
455
+ "int32": CTypeBase(
456
+ ["gint32 <arg_name>"],
457
+ [],
458
+ ["<arg_out> = g_variant_new_int32(<arg_name>)"],
459
+ ["<arg_in> = g_variant_get_int32(<arg_name>)"],
460
+ IntegerValidator(0x7fff_ffff, -(0x8000_0000), True)
461
+ ),
462
+ "uint32": CTypeBase(
463
+ ["guint32 <arg_name>"],
464
+ [],
465
+ ["<arg_out> = g_variant_new_uint32(<arg_name>)"],
466
+ ["<arg_in> = g_variant_get_uint32(<arg_name>)"],
467
+ IntegerValidator(0xffff_ffff, 0)
468
+ ),
469
+ "int64": CTypeBase(
470
+ ["gint64 <arg_name>"],
471
+ [],
472
+ ["<arg_out> = g_variant_new_int64(<arg_name>)"],
473
+ ["<arg_in> = g_variant_get_int64(<arg_name>)"],
474
+ IntegerValidator(0x7fff_ffff_ffff_ffff, -(0x8000_0000_0000_0000), True)
475
+ ),
476
+ "uint64": CTypeBase(
477
+ ["guint64 <arg_name>"],
478
+ [],
479
+ ["<arg_out> = g_variant_new_uint64(<arg_name>)"],
480
+ ["<arg_in> = g_variant_get_uint64(<arg_name>)"],
481
+ IntegerValidator(0xffff_ffff_ffff_ffff, 0)
482
+ ),
483
+ "size": CTypeBase(
484
+ ["gsize <arg_name>"],
485
+ [],
486
+ ["<arg_out> = g_variant_new_uint64(<arg_name>)"],
487
+ ["<arg_in> = g_variant_get_uint64(<arg_name>)"],
488
+ IntegerValidator(0xffff_ffff_ffff_ffff, 0)
489
+ ),
490
+ "ssize": CTypeBase(
491
+ ["gssize <arg_name>"],
492
+ [],
493
+ ["<arg_out> = g_variant_new_int64(<arg_name>)"],
494
+ ["<arg_in> = g_variant_get_int64(<arg_name>)"],
495
+ IntegerValidator(0x7fff_ffff_ffff_ffff, -(0x8000_0000_0000_0000), True)
496
+ ),
497
+ "double": CTypeBase(
498
+ ["gdouble <arg_name>"],
499
+ [],
500
+ ["<arg_out> = g_variant_new_double(<arg_name>)"],
501
+ ["<arg_in> = g_variant_get_double(<arg_name>)"],
502
+ FloatValidator()
503
+ ),
504
+ "unixfd": CTypeBase(
505
+ ["gint32 <arg_name>"],
506
+ [],
507
+ ["<arg_out> = g_variant_new_handle(<arg_name>)"],
508
+ ["<arg_in> = g_variant_get_handle(<arg_name>)"],
509
+ IntegerValidator(0x7fff_ffff_ffff_ffff, 0, True)
510
+ ),
511
+ "string": CTypeBase(
512
+ ["<const>gchar *<arg_name>"],
513
+ ["gcl_free_p((void **)&<arg_name>)"],
514
+ ["<arg_out> = gcl_string_encode(<arg_name>)"],
515
+ ["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
516
+ StringValidator("^.*$")
517
+ ),
518
+ "object_path": CTypeBase(
519
+ ["<const>gchar *<arg_name>"],
520
+ ["gcl_free_p((void **)&<arg_name>)"],
521
+ ["<arg_out> = gcl_object_path_encode(<arg_name>)"],
522
+ ["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
523
+ StringValidator("^(/[A-Z0-9a-z_]+)*$")
524
+ ),
525
+ "signature": CTypeBase(
526
+ ["<const>gchar *<arg_name>"],
527
+ ["gcl_free_p((void **)&<arg_name>)"],
528
+ ["<arg_out> = gcl_signature_encode(<arg_name>)"],
529
+ ["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
530
+ StringValidator("^([abynqiuxtdsogv\\\\{\\\\}\\\\(\\\\)])+$")
531
+ ),
532
+ "variant": CTypeBase(
533
+ ["GVariant *<arg_name>"],
534
+ ["gcl_unref_p((GVariant **)&<arg_name>)"],
535
+ ["g_variant_take_ref(<arg_name>)", "<arg_out> = g_variant_new_variant(<arg_name>)"],
536
+ ["<arg_in> = g_variant_get_variant(<arg_name>)"],
537
+ IdfValidator()
538
+ ),
539
+ "array[boolean]": CTypeBase(
540
+ ["gsize n_<arg_name>" ,"<const>gboolean *<arg_name>"],
541
+ ["gcl_free_p((void **)&<arg_name>)"],
542
+ ["<arg_out> = gcl_array_boolean_encode(<arg_name>, n_<arg_name>)"],
543
+ ["<arg_in> = gcl_array_boolean_decode(<arg_name>, &n_<arg_in>)"],
544
+ BoolArrayValidator()
545
+ ),
546
+ "array[byte]": CTypeBase(
547
+ ["gsize n_<arg_name>" ,"<const>guint8 *<arg_name>"],
548
+ ["gcl_free_p((void **)&<arg_name>)"],
549
+ ["<arg_out> = gcl_array_byte_encode(<arg_name>, n_<arg_name>)"],
550
+ ["<arg_in> = gcl_array_byte_decode(<arg_name>, &n_<arg_in>)"],
551
+ IntegerArrayValidator(0xff, 0)
552
+ ),
553
+ "array[int16]": CTypeBase(
554
+ ["gsize n_<arg_name>" ,"<const>gint16 *<arg_name>"],
555
+ ["gcl_free_p((void **)&<arg_name>)"],
556
+ ["<arg_out> = gcl_array_int16_encode(<arg_name>, n_<arg_name>)"],
557
+ ["<arg_in> = gcl_array_int16_decode(<arg_name>, &n_<arg_in>)"],
558
+ IntegerArrayValidator(0x7fff, -(0x8000), True)
559
+ ),
560
+ "array[uint16]": CTypeBase(
561
+ ["gsize n_<arg_name>" ,"<const>guint16 *<arg_name>"],
562
+ ["gcl_free_p((void **)&<arg_name>)"],
563
+ ["<arg_out> = gcl_array_uint16_encode(<arg_name>, n_<arg_name>)"],
564
+ ["<arg_in> = gcl_array_uint16_decode(<arg_name>, &n_<arg_in>)"],
565
+ IntegerArrayValidator(0xffff, 0)
566
+ ),
567
+ "array[int32]": CTypeBase(
568
+ ["gsize n_<arg_name>" ,"<const>gint32 *<arg_name>"],
569
+ ["gcl_free_p((void **)&<arg_name>)"],
570
+ ["<arg_out> = gcl_array_int32_encode(<arg_name>, n_<arg_name>)"],
571
+ ["<arg_in> = gcl_array_int32_decode(<arg_name>, &n_<arg_in>)"],
572
+ IntegerArrayValidator(0x7fff_ffff, -(0x80000000), True)
573
+ ),
574
+ "array[uint32]": CTypeBase(
575
+ ["gsize n_<arg_name>" ,"<const>guint32 *<arg_name>"],
576
+ ["gcl_free_p((void **)&<arg_name>)"],
577
+ ["<arg_out> = gcl_array_uint32_encode(<arg_name>, n_<arg_name>)"],
578
+ ["<arg_in> = gcl_array_uint32_decode(<arg_name>, &n_<arg_in>)"],
579
+ IntegerArrayValidator(0xffff_ffff, 0)
580
+ ),
581
+ "array[int64]": CTypeBase(
582
+ ["gsize n_<arg_name>" ,"<const>gint64 *<arg_name>"],
583
+ ["gcl_free_p((void **)&<arg_name>)"],
584
+ ["<arg_out> = gcl_array_int64_encode(<arg_name>, n_<arg_name>)"],
585
+ ["<arg_in> = gcl_array_int64_decode(<arg_name>, &n_<arg_in>)"],
586
+ IntegerArrayValidator(0x7fff_ffff_ffff_ffff, -(0x8000_0000_0000_0000), True)
587
+ ),
588
+ "array[uint64]": CTypeBase(
589
+ ["gsize n_<arg_name>" ,"<const>guint64 *<arg_name>"],
590
+ ["gcl_free_p((void **)&<arg_name>)"],
591
+ ["<arg_out> = gcl_array_uint64_encode(<arg_name>, n_<arg_name>)"],
592
+ ["<arg_in> = gcl_array_uint64_decode(<arg_name>, &n_<arg_in>)"],
593
+ IntegerArrayValidator(0xffff_ffff_ffff_ffff, 0)
594
+ ),
595
+ "array[ssize]": CTypeBase(
596
+ ["gsize n_<arg_name>" ,"<const>gssize *<arg_name>"],
597
+ ["gcl_free_p((void **)&<arg_name>)"],
598
+ ["<arg_out> = gcl_array_int64_encode(<arg_name>, n_<arg_name>)"],
599
+ ["<arg_in> = gcl_array_int64_decode(<arg_name>, &n_<arg_in>)"],
600
+ IntegerArrayValidator(0x7fff_ffff_ffff_ffff, -(0x8000_0000_0000_0000), True)
601
+ ),
602
+ "array[size]": CTypeBase(
603
+ ["gsize n_<arg_name>" ,"<const>gsize *<arg_name>"],
604
+ ["gcl_free_p((void **)&<arg_name>)"],
605
+ ["<arg_out> = gcl_array_uint64_encode(<arg_name>, n_<arg_name>)"],
606
+ ["<arg_in> = gcl_array_uint64_decode(<arg_name>, &n_<arg_in>)"],
607
+ IntegerArrayValidator(0xffff_ffff_ffff_ffff, 0)
608
+ ),
609
+ "array[double]": CTypeBase(
610
+ ["gsize n_<arg_name>" ,"<const>gdouble *<arg_name>"],
611
+ ["gcl_free_p((void **)&<arg_name>)"],
612
+ ["<arg_out> = gcl_array_double_encode(<arg_name>, n_<arg_name>)"],
613
+ ["<arg_in> = gcl_array_double_decode(<arg_name>, &n_<arg_in>)"],
614
+ FloatArrayValidator()
615
+ ),
616
+ "array[unixfd]": CTypeBase(
617
+ ["gsize n_<arg_name>" ,"<const>gint32 *<arg_name>"],
618
+ ["gcl_free_p((void **)&<arg_name>)"],
619
+ ["<arg_out> = gcl_array_handle_encode(<arg_name>, n_<arg_name>)"],
620
+ ["<arg_in> = gcl_array_handle_decode(<arg_name>, &n_<arg_in>)"],
621
+ IntegerArrayValidator(0x7fff_ffff_ffff_ffff, 0, True)
622
+ ),
623
+ "array[string]": CTypeBase(
624
+ ["gchar *<const>*<arg_name>"],
625
+ ["gcl_strfreev_p(&<arg_name>)"],
626
+ ["<arg_out> = gcl_array_string_encode(<arg_name>)"],
627
+ ["<arg_in> = gcl_array_string_decode(<arg_name>)"],
628
+ StringArrayValidator("^.*$")
629
+ ),
630
+ "array[object_path]": CTypeBase(
631
+ ["gchar *<const>*<arg_name>"],
632
+ ["gcl_strfreev_p(&<arg_name>)"],
633
+ ["<arg_out> = gcl_array_object_path_encode(<arg_name>)"],
634
+ ["<arg_in> = gcl_array_object_path_decode(<arg_name>)"],
635
+ StringArrayValidator("^(/[A-Z0-9a-z_]+)*$")
636
+ ),
637
+ "array[signature]": CTypeBase(
638
+ ["gchar *<const>*<arg_name>"],
639
+ ["gcl_strfreev_p(&<arg_name>)"],
640
+ ["<arg_out> = gcl_array_signature_encode(<arg_name>)"],
641
+ ["<arg_in> = gcl_array_signature_decode(<arg_name>)"],
642
+ StringArrayValidator("^([abynqiuxtdsogv\\\\{\\\\}\\\\(\\\\)])+$")
643
+ )
644
+ }