zuspec-dataclasses 0.0.1.6433827600__py2.py3-none-any.whl → 0.0.1.6449654181__py2.py3-none-any.whl
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.
- zsp_dataclasses/impl/generators/collect_type_deps.py +65 -0
- zsp_dataclasses/impl/generators/zsp_data_model_cpp_gen.py +51 -20
- zsp_dataclasses/impl/pyctxt/type_field_reg_group.py +1 -1
- {zuspec_dataclasses-0.0.1.6433827600.dist-info → zuspec_dataclasses-0.0.1.6449654181.dist-info}/METADATA +1 -1
- {zuspec_dataclasses-0.0.1.6433827600.dist-info → zuspec_dataclasses-0.0.1.6449654181.dist-info}/RECORD +8 -7
- {zuspec_dataclasses-0.0.1.6433827600.dist-info → zuspec_dataclasses-0.0.1.6449654181.dist-info}/LICENSE +0 -0
- {zuspec_dataclasses-0.0.1.6433827600.dist-info → zuspec_dataclasses-0.0.1.6449654181.dist-info}/WHEEL +0 -0
- {zuspec_dataclasses-0.0.1.6433827600.dist-info → zuspec_dataclasses-0.0.1.6449654181.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
#****************************************************************************
|
2
|
+
#* collect_type_deps.py
|
3
|
+
#*
|
4
|
+
#* Copyright 2022 Matthew Ballance and Contributors
|
5
|
+
#*
|
6
|
+
#* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
7
|
+
#* not use this file except in compliance with the License.
|
8
|
+
#* You may obtain a copy of the License at:
|
9
|
+
#*
|
10
|
+
#* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#*
|
12
|
+
#* Unless required by applicable law or agreed to in writing, software
|
13
|
+
#* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
#* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
#* See the License for the specific language governing permissions and
|
16
|
+
#* limitations under the License.
|
17
|
+
#*
|
18
|
+
#* Created on:
|
19
|
+
#* Author:
|
20
|
+
#*
|
21
|
+
#****************************************************************************
|
22
|
+
from vsc_dataclasses.impl.generators.collect_struct_deps import CollectStructDeps
|
23
|
+
from zsp_dataclasses.impl.context import DataTypeAction, DataTypeComponent
|
24
|
+
from ..pyctxt.visitor_base import VisitorBase
|
25
|
+
|
26
|
+
class CollectTypeDeps(VisitorBase,CollectStructDeps):
|
27
|
+
|
28
|
+
def __init__(self):
|
29
|
+
CollectStructDeps.__init__(self, None)
|
30
|
+
|
31
|
+
def collect(self, root_comp, root_action):
|
32
|
+
self._init()
|
33
|
+
self.addType(root_action)
|
34
|
+
self.push_scope(root_action)
|
35
|
+
self.addRef(root_comp)
|
36
|
+
self.pop_scope()
|
37
|
+
root_comp.accept(self)
|
38
|
+
root_action.accept(self)
|
39
|
+
|
40
|
+
return self._sort_deps()
|
41
|
+
|
42
|
+
def visitDataTypeAction(self, i: DataTypeAction):
|
43
|
+
if self.in_field():
|
44
|
+
self.addRef(i)
|
45
|
+
else:
|
46
|
+
self.addType(i)
|
47
|
+
|
48
|
+
self.push_scope(i)
|
49
|
+
for f in i.getFields():
|
50
|
+
f.accept(self)
|
51
|
+
# TODO: Activities
|
52
|
+
self.pop_scope()
|
53
|
+
|
54
|
+
def visitDataTypeComponent(self, i: DataTypeComponent):
|
55
|
+
if self.in_field():
|
56
|
+
self.addRef(i)
|
57
|
+
else:
|
58
|
+
self.addType(i)
|
59
|
+
|
60
|
+
self.push_scope(i)
|
61
|
+
for f in i.getFields():
|
62
|
+
f.accept(self)
|
63
|
+
self.pop_scope()
|
64
|
+
|
65
|
+
|
@@ -23,6 +23,7 @@
|
|
23
23
|
import zsp_dataclasses.impl.context as ctxt_api
|
24
24
|
from vsc_dataclasses.impl.generators.vsc_data_model_cpp_gen import VscDataModelCppGen
|
25
25
|
from vsc_dataclasses.impl.pyctxt.data_type_struct import DataTypeStruct
|
26
|
+
from .collect_type_deps import CollectTypeDeps
|
26
27
|
from ..context import DataTypeAction, DataTypeComponent, DataTypeFunction, TypeExec, TypeExprMethodCallContext, TypeExprMethodCallStatic, TypeFieldReg, TypeFieldRegGroup, TypeProcStmtExpr, TypeProcStmtIfElse, TypeProcStmtScope
|
27
28
|
from ..context import DataTypeFunctionFlags
|
28
29
|
from ..pyctxt.visitor_base import VisitorBase
|
@@ -90,12 +91,18 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
90
91
|
self.dec_indent()
|
91
92
|
self.println("}")
|
92
93
|
|
94
|
+
types = CollectTypeDeps().collect(root_comp, root_action)
|
95
|
+
|
96
|
+
print("types: %s" % str(types))
|
97
|
+
for t in types:
|
98
|
+
t.accept(self)
|
99
|
+
|
93
100
|
# Should result in RootComp and RootAction type handles
|
94
|
-
self.println("{")
|
95
|
-
self.inc_indent()
|
96
|
-
root_comp.accept(self)
|
97
|
-
self.dec_indent()
|
98
|
-
self.println("}")
|
101
|
+
# self.println("{")
|
102
|
+
# self.inc_indent()
|
103
|
+
# root_comp.accept(self)
|
104
|
+
# self.dec_indent()
|
105
|
+
# self.println("}")
|
99
106
|
self.println("")
|
100
107
|
self.println("zsp::arl::dm::IDataTypeComponent *%s_t = %s->findDataTypeComponent(\"%s\");" % (
|
101
108
|
self.leaf_name(root_comp.name()),
|
@@ -116,10 +123,15 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
116
123
|
self._ctxt,
|
117
124
|
i.name()))
|
118
125
|
else:
|
126
|
+
self.println("{")
|
127
|
+
self.inc_indent()
|
119
128
|
self.println("zsp::arl::dm::IDataTypeComponent *%s_t = %s->mkDataTypeComponent(\"%s\");" % (
|
120
129
|
self.leaf_name(i.name()),
|
121
130
|
self._ctxt,
|
122
131
|
i.name()))
|
132
|
+
self.println("%s->addDataTypeComponent(%s_t);" % (
|
133
|
+
self._ctxt,
|
134
|
+
self.leaf_name(i.name())))
|
123
135
|
|
124
136
|
self._type_s.append(i)
|
125
137
|
for f in i.getFields():
|
@@ -131,9 +143,8 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
131
143
|
a.accept(self)
|
132
144
|
self._type_s.pop()
|
133
145
|
|
134
|
-
self.
|
135
|
-
|
136
|
-
self.leaf_name(i.name())))
|
146
|
+
self.dec_indent()
|
147
|
+
self.println("}")
|
137
148
|
|
138
149
|
def visitDataTypeFunction(self, i: DataTypeFunction):
|
139
150
|
if self._define_func:
|
@@ -153,7 +164,7 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
153
164
|
i.getReturnType().accept(self)
|
154
165
|
self._emit_type_mode -= 1
|
155
166
|
self.write(",\n")
|
156
|
-
self.println("false") # own_rtype
|
167
|
+
self.println("false,") # own_rtype
|
157
168
|
|
158
169
|
# TODO: Flags
|
159
170
|
flags = "zsp::arl::dm::DataTypeFunctionFlags::NoFlags"
|
@@ -248,8 +259,26 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
248
259
|
self.println("TODO: hit generic TypeField (%s)" % str(i))
|
249
260
|
|
250
261
|
def visitTypeFieldRegGroup(self, i: TypeFieldRegGroup):
|
251
|
-
|
252
|
-
|
262
|
+
self.println("{")
|
263
|
+
self.inc_indent()
|
264
|
+
self.println("zsp::arl::dm::ITypeFieldRegGroup *%s_f = %s->mkTypeFieldRegGroup(" % (
|
265
|
+
self.leaf_name(i.name()),
|
266
|
+
self._ctxt))
|
267
|
+
self.inc_indent()
|
268
|
+
self.println("\"%s\"," % i.name())
|
269
|
+
self.write(self.ind())
|
270
|
+
self._emit_type_mode += 1
|
271
|
+
i.getDataType().accept(self)
|
272
|
+
self._emit_type_mode -= 1
|
273
|
+
self.write(",\n")
|
274
|
+
self.println("false);")
|
275
|
+
self.dec_indent()
|
276
|
+
# self.println("%s_f->setOffset(%d);" % (self.leaf_name(i.name()), i.getOffset()))
|
277
|
+
self.println("%s_t->addField(%s_f);" % (
|
278
|
+
self.leaf_name(self._type_s[-1].name()),
|
279
|
+
self.leaf_name(i.name())))
|
280
|
+
self.dec_indent()
|
281
|
+
self.println("}")
|
253
282
|
|
254
283
|
def visitTypeFieldRef(self, i : 'TypeFieldRef'):
|
255
284
|
if i.name() != "comp":
|
@@ -258,7 +287,7 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
258
287
|
def visitTypeFieldReg(self, i: TypeFieldReg):
|
259
288
|
self.println("{")
|
260
289
|
self.inc_indent()
|
261
|
-
self.println("zsp::arl::dm::
|
290
|
+
self.println("zsp::arl::dm::ITypeFieldReg *%s_f = %s->mkTypeFieldReg(" % (
|
262
291
|
self.leaf_name(i.name()),
|
263
292
|
self._ctxt))
|
264
293
|
self.inc_indent()
|
@@ -301,6 +330,10 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
301
330
|
self.leaf_name(i.name()),
|
302
331
|
self._ctxt,
|
303
332
|
i.name()))
|
333
|
+
self.println("%s->addDataTypeAction(%s_t);" % (
|
334
|
+
self._ctxt,
|
335
|
+
self.leaf_name(i.name())
|
336
|
+
))
|
304
337
|
self._type_s.append(i)
|
305
338
|
for f in i.getFields():
|
306
339
|
if f.name() != "comp":
|
@@ -312,16 +345,14 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
312
345
|
e.accept(self)
|
313
346
|
pass
|
314
347
|
self._type_s.pop()
|
315
|
-
self.println("%s_t->setComponentType(%
|
348
|
+
self.println("%s_t->setComponentType(%s->findDataTypeComponent(\"%s\"));" % (
|
316
349
|
self.leaf_name(i.name()),
|
317
|
-
self.leaf_name(self._type_s[-1].name())))
|
318
|
-
self.println("%s_t->addActionType(%s_t);" % (
|
319
|
-
self.leaf_name(self._type_s[-1].name()),
|
320
|
-
self.leaf_name(i.name())))
|
321
|
-
self.println("%s->addDataTypeAction(%s_t);" % (
|
322
350
|
self._ctxt,
|
323
|
-
self.leaf_name(i.name())
|
324
|
-
))
|
351
|
+
self.leaf_name(i.getComponentType().name())))
|
352
|
+
self.println("%s->findDataTypeComponent(\"%s\")->addActionType(%s_t);" % (
|
353
|
+
self._ctxt,
|
354
|
+
self.leaf_name(i.getComponentType().name()),
|
355
|
+
self.leaf_name(i.name())))
|
325
356
|
self.dec_indent()
|
326
357
|
self.println("}")
|
327
358
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: zuspec-dataclasses
|
3
|
-
Version: 0.0.1.
|
3
|
+
Version: 0.0.1.6449654181
|
4
4
|
Summary: Front-end for capturing Action Relation Level models using dataclasses
|
5
5
|
Home-page: https://github.com/zuspec/zuspec-dataclasses
|
6
6
|
Author: Matthew Ballance
|
@@ -94,7 +94,8 @@ zsp_dataclasses/impl/typeinfo_pure_component.py,sha256=5I8OIiL0tgRYkwlb2M8VfnPVg
|
|
94
94
|
zsp_dataclasses/impl/typeinfo_reg_group.py,sha256=2kNSSPaxQnfxoxrHszBqUQ9vl1wtBBFfeOk7Q7hwCN8,1319
|
95
95
|
zsp_dataclasses/impl/typeinfo_struct.py,sha256=JF-1NJGaNxgm6aTEkNHPEx230yMXExnORLlJIHe4KBI,333
|
96
96
|
zsp_dataclasses/impl/generators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
97
|
-
zsp_dataclasses/impl/generators/
|
97
|
+
zsp_dataclasses/impl/generators/collect_type_deps.py,sha256=EainOgsxfmBqOVVVj-XI6rkvRckrs1QMT2np90MNtjc,2035
|
98
|
+
zsp_dataclasses/impl/generators/zsp_data_model_cpp_gen.py,sha256=0mza3RUPf31RjjIh4KbEgAEW4cAfN0CKZqFs-TWAFuc,14615
|
98
99
|
zsp_dataclasses/impl/pyctxt/context.py,sha256=r3cOmGDzntKjg3ryY1oKWLGlp8O6UgbHHeDwBnt2ZMo,6096
|
99
100
|
zsp_dataclasses/impl/pyctxt/core_lib_factory.py,sha256=9vpcDdlzVIOSixnSJuMFe6_wWpxeRV0nHnANxI1K5C4,1452
|
100
101
|
zsp_dataclasses/impl/pyctxt/data_type_action.py,sha256=v5DR7eFqov0_iPMhLE30meuqMM98YQ0VcMV7_P1FPas,1622
|
@@ -113,7 +114,7 @@ zsp_dataclasses/impl/pyctxt/type_expr_method_call_context.py,sha256=AjXA6-LpEX6w
|
|
113
114
|
zsp_dataclasses/impl/pyctxt/type_expr_method_call_static.py,sha256=5c9lMjPEGrb0m_G9OMAK_QZL6AytKE4isPmtO4O5KrQ,1365
|
114
115
|
zsp_dataclasses/impl/pyctxt/type_field_activity.py,sha256=SFpdm_fOQgE1F3qKTM9gU9ocnG4ZxFmtwkdb0Mi3F_A,1286
|
115
116
|
zsp_dataclasses/impl/pyctxt/type_field_reg.py,sha256=miyfFvT_MWdk5P2UCrOeDf7LHo2IUVwj7-84x-XrtEs,1361
|
116
|
-
zsp_dataclasses/impl/pyctxt/type_field_reg_group.py,sha256=
|
117
|
+
zsp_dataclasses/impl/pyctxt/type_field_reg_group.py,sha256=68ngAJ5g6NzyEopDgVu8s6U4Sfc72f-E1M4eeq1NOG8,1384
|
117
118
|
zsp_dataclasses/impl/pyctxt/type_proc_stmt_expr.py,sha256=V2UsVyGI9bExvZ2Eqz3wNJ39LMC_3EXICo6JZsenV0c,1115
|
118
119
|
zsp_dataclasses/impl/pyctxt/type_proc_stmt_if_else.py,sha256=fdf8DEiweRnkFRqkWY6LfOkO4vBuURFbSMNDfqdABbk,1465
|
119
120
|
zsp_dataclasses/impl/pyctxt/type_proc_stmt_scope.py,sha256=TfbqEcHgLOlKn7M99IDnwzTjkhhp0wxcMaca5X57JwY,1355
|
@@ -122,8 +123,8 @@ zsp_dataclasses/impl/pyctxt/visitor_base.py,sha256=n08-7Y5AOjBeuvZOLiAqvDh78Xsf4
|
|
122
123
|
zsp_dataclasses/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
123
124
|
zsp_dataclasses/util/extract_cpp_embedded_dsl.py,sha256=SyMMLumZD6fsubj40hyekYzWyrcoUGTijJH3NmK1ihY,5630
|
124
125
|
zsp_dataclasses/util/gen_cpp_dt_defs/__main__.py,sha256=LdfPAEzhMPtW1Ie15A5pmYAlL8DQFj-l7Pbey3EJiJg,3391
|
125
|
-
zuspec_dataclasses-0.0.1.
|
126
|
-
zuspec_dataclasses-0.0.1.
|
127
|
-
zuspec_dataclasses-0.0.1.
|
128
|
-
zuspec_dataclasses-0.0.1.
|
129
|
-
zuspec_dataclasses-0.0.1.
|
126
|
+
zuspec_dataclasses-0.0.1.6449654181.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
127
|
+
zuspec_dataclasses-0.0.1.6449654181.dist-info/METADATA,sha256=6hr6XDnK3DCYq8EFkSEjju691pWZFMp6Uuh6YDvy5JM,499
|
128
|
+
zuspec_dataclasses-0.0.1.6449654181.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
129
|
+
zuspec_dataclasses-0.0.1.6449654181.dist-info/top_level.txt,sha256=BHigRYcGvNv_xCJUUv5OXgSPSoczsH3Tle0gABks4l0,16
|
130
|
+
zuspec_dataclasses-0.0.1.6449654181.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|