zuspec-dataclasses 0.0.1.6427156566__py2.py3-none-any.whl → 0.0.1.6449650798__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/context.py +25 -3
- zsp_dataclasses/impl/field_reg_c_impl.py +36 -7
- zsp_dataclasses/impl/generators/zsp_data_model_cpp_gen.py +87 -28
- zsp_dataclasses/impl/method_proxy_fn.py +3 -2
- zsp_dataclasses/impl/pyctxt/context.py +18 -15
- zsp_dataclasses/impl/pyctxt/core_lib_factory.py +44 -0
- zsp_dataclasses/impl/pyctxt/data_type_function.py +14 -1
- zsp_dataclasses/impl/pyctxt/type_expr_method_call_context.py +36 -0
- zsp_dataclasses/impl/pyctxt/type_field_reg_group.py +1 -1
- zsp_dataclasses/impl/pyctxt/visitor_base.py +7 -1
- {zuspec_dataclasses-0.0.1.6427156566.dist-info → zuspec_dataclasses-0.0.1.6449650798.dist-info}/METADATA +1 -1
- {zuspec_dataclasses-0.0.1.6427156566.dist-info → zuspec_dataclasses-0.0.1.6449650798.dist-info}/RECORD +15 -13
- {zuspec_dataclasses-0.0.1.6427156566.dist-info → zuspec_dataclasses-0.0.1.6449650798.dist-info}/LICENSE +0 -0
- {zuspec_dataclasses-0.0.1.6427156566.dist-info → zuspec_dataclasses-0.0.1.6449650798.dist-info}/WHEEL +0 -0
- {zuspec_dataclasses-0.0.1.6427156566.dist-info → zuspec_dataclasses-0.0.1.6449650798.dist-info}/top_level.txt +0 -0
zsp_dataclasses/impl/context.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
from enum import IntEnum, auto
|
2
|
+
from enum import IntEnum, IntFlag, auto
|
3
3
|
from tokenize import Intnumber
|
4
4
|
from typing import List
|
5
5
|
import vsc_dataclasses as vsc
|
@@ -117,6 +117,12 @@ class DataTypeFunctionParamDecl(TypeProcStmtVarDecl):
|
|
117
117
|
def getDirection(self) -> ParamDir:
|
118
118
|
raise NotImplementedError("getDirection")
|
119
119
|
|
120
|
+
class DataTypeFunctionFlags(IntFlag):
|
121
|
+
NoFlags = 0
|
122
|
+
Solve = (1 << 0)
|
123
|
+
Target = (1 << 1)
|
124
|
+
Core = (1 << 2)
|
125
|
+
|
120
126
|
class DataTypeFunction(vsc_ctxt.DataType):
|
121
127
|
|
122
128
|
def name(self):
|
@@ -142,6 +148,12 @@ class DataTypeFunction(vsc_ctxt.DataType):
|
|
142
148
|
|
143
149
|
def getImportSpecs(self) -> List['DataTypeFunctionImport']:
|
144
150
|
raise NotImplementedError("getImportSpecs")
|
151
|
+
|
152
|
+
def getFlags(self) -> DataTypeFunctionFlags:
|
153
|
+
raise NotImplementedError("getFlags")
|
154
|
+
|
155
|
+
def hasFlags(self, f) -> bool:
|
156
|
+
raise NotImplementedError("hasFlags")
|
145
157
|
|
146
158
|
class DataTypeFunctionImport(object):
|
147
159
|
|
@@ -198,6 +210,11 @@ class TypeExprMethodCallStatic(vsc_ctxt.TypeExpr):
|
|
198
210
|
|
199
211
|
def getParameters(self) -> List[vsc_ctxt.TypeExpr]:
|
200
212
|
raise NotImplementedError("getParameters")
|
213
|
+
|
214
|
+
class TypeExprMethodCallContext(TypeExprMethodCallStatic):
|
215
|
+
|
216
|
+
def getContext(self):
|
217
|
+
raise NotImplementedError("getContext")
|
201
218
|
|
202
219
|
class TypeFieldActivity(vsc_ctxt.TypeField):
|
203
220
|
|
@@ -280,8 +297,7 @@ class Context(vsc.impl.Context):
|
|
280
297
|
name : str,
|
281
298
|
rtype : vsc_ctxt.DataType,
|
282
299
|
own_rtype : bool,
|
283
|
-
|
284
|
-
is_solve : bool):
|
300
|
+
flags : DataTypeFunctionFlags):
|
285
301
|
raise NotImplementedError("mkDataTypeFunction")
|
286
302
|
|
287
303
|
def addDataTypeFunction(self, f):
|
@@ -311,6 +327,12 @@ class Context(vsc.impl.Context):
|
|
311
327
|
kind,
|
312
328
|
body):
|
313
329
|
raise NotImplementedError("mkTypeExec")
|
330
|
+
|
331
|
+
def mkTypeExprMethodCallContext(self,
|
332
|
+
target : DataTypeFunction,
|
333
|
+
context,
|
334
|
+
params : List[vsc_ctxt.TypeExpr]):
|
335
|
+
raise NotImplementedError("mkTypeExprMethodCallContext")
|
314
336
|
|
315
337
|
def mkTypeExprMethodCallStatic(self,
|
316
338
|
target : DataTypeFunction,
|
@@ -19,6 +19,8 @@
|
|
19
19
|
#* Author:
|
20
20
|
#*
|
21
21
|
#****************************************************************************
|
22
|
+
import vsc_dataclasses.impl.context as vsc_ctxt
|
23
|
+
from .ctor import Ctor
|
22
24
|
|
23
25
|
class FieldRegCImpl(object):
|
24
26
|
|
@@ -29,22 +31,49 @@ class FieldRegCImpl(object):
|
|
29
31
|
pass
|
30
32
|
|
31
33
|
def read(self):
|
34
|
+
ctor = Ctor.inst()
|
35
|
+
reg_read = ctor.ctxt().findDataTypeFunction("pss::core::reg_read")
|
32
36
|
print("READ: %s %d" % (self._name, self._idx))
|
33
|
-
mi = self._modelinfo_p
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
ctor.proc_scope().addStatement(
|
39
|
+
ctor.ctxt().mkTypeProcStmtExpr(
|
40
|
+
ctor.ctxt().mkTypeExprMethodCallContext(
|
41
|
+
reg_read,
|
42
|
+
self.mkRef(),
|
43
|
+
[])))
|
41
44
|
|
42
45
|
def write(self, value):
|
46
|
+
m = Ctor.inst().ctxt().findDataTypeFunction("pss::core::reg_write")
|
43
47
|
pass
|
44
48
|
|
45
49
|
def read_val(self):
|
50
|
+
m = Ctor.inst().ctxt().findDataTypeFunction("pss::core::reg_read_val")
|
46
51
|
pass
|
47
52
|
|
48
53
|
def write_val(self, value):
|
54
|
+
m = Ctor.inst().ctxt().findDataTypeFunction("pss::core::reg_write_val")
|
49
55
|
pass
|
50
56
|
|
57
|
+
def mkRef(self):
|
58
|
+
ctor = Ctor.inst()
|
59
|
+
|
60
|
+
# TODO: must determine whether we're in a top-down or bottom-up scope
|
61
|
+
kind = vsc_ctxt.TypeExprFieldRefKind.TopDownScope
|
62
|
+
root_off = 0
|
63
|
+
|
64
|
+
mi = self._modelinfo_p
|
65
|
+
|
66
|
+
offset_l = [self._idx]
|
67
|
+
while mi is not None and mi._idx != -1:
|
68
|
+
print("MI: %s %d %s" % (str(mi), mi._idx, mi._name))
|
69
|
+
offset_l.insert(0, mi._idx)
|
70
|
+
mi = mi._parent
|
71
|
+
|
72
|
+
|
73
|
+
return ctor.ctxt().mkTypeExprFieldRef(
|
74
|
+
kind,
|
75
|
+
root_off,
|
76
|
+
offset_l
|
77
|
+
)
|
78
|
+
|
79
|
+
|
@@ -23,11 +23,9 @@
|
|
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
|
-
|
27
|
-
from ..context import DataTypeAction, DataTypeComponent, DataTypeFunction, TypeExec, TypeExprMethodCallStatic, TypeFieldReg, TypeFieldRegGroup, TypeProcStmtExpr, TypeProcStmtIfElse, TypeProcStmtScope
|
28
|
-
|
29
|
-
from ..context import DataTypeAction, DataTypeComponent, DataTypeFunction, TypeExec, TypeExprMethodCallStatic, TypeProcStmtExpr, TypeProcStmtScope
|
30
|
-
>>>>>>> refs/remotes/origin/main
|
26
|
+
from .collect_type_deps import CollectTypeDeps
|
27
|
+
from ..context import DataTypeAction, DataTypeComponent, DataTypeFunction, TypeExec, TypeExprMethodCallContext, TypeExprMethodCallStatic, TypeFieldReg, TypeFieldRegGroup, TypeProcStmtExpr, TypeProcStmtIfElse, TypeProcStmtScope
|
28
|
+
from ..context import DataTypeFunctionFlags
|
31
29
|
from ..pyctxt.visitor_base import VisitorBase
|
32
30
|
|
33
31
|
class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
@@ -47,6 +45,9 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
47
45
|
# First, declare all functions
|
48
46
|
self._define_func = False
|
49
47
|
for f in functions:
|
48
|
+
if f.hasFlags(DataTypeFunctionFlags.Core):
|
49
|
+
continue
|
50
|
+
|
50
51
|
self.println("{")
|
51
52
|
self.inc_indent()
|
52
53
|
f.accept(self)
|
@@ -54,6 +55,9 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
54
55
|
self.println("}")
|
55
56
|
self._define_func = True
|
56
57
|
for f in functions:
|
58
|
+
if f.hasFlags(DataTypeFunctionFlags.Core):
|
59
|
+
continue
|
60
|
+
|
57
61
|
self.println("{")
|
58
62
|
self.inc_indent()
|
59
63
|
self.println("zsp::arl::dm::IDataTypeFunction *%s_t = %s->findDataTypeFunction(\"%s\");" % (
|
@@ -87,12 +91,18 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
87
91
|
self.dec_indent()
|
88
92
|
self.println("}")
|
89
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
|
+
|
90
100
|
# Should result in RootComp and RootAction type handles
|
91
|
-
self.println("{")
|
92
|
-
self.inc_indent()
|
93
|
-
root_comp.accept(self)
|
94
|
-
self.dec_indent()
|
95
|
-
self.println("}")
|
101
|
+
# self.println("{")
|
102
|
+
# self.inc_indent()
|
103
|
+
# root_comp.accept(self)
|
104
|
+
# self.dec_indent()
|
105
|
+
# self.println("}")
|
96
106
|
self.println("")
|
97
107
|
self.println("zsp::arl::dm::IDataTypeComponent *%s_t = %s->findDataTypeComponent(\"%s\");" % (
|
98
108
|
self.leaf_name(root_comp.name()),
|
@@ -113,10 +123,15 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
113
123
|
self._ctxt,
|
114
124
|
i.name()))
|
115
125
|
else:
|
126
|
+
self.println("{")
|
127
|
+
self.inc_indent()
|
116
128
|
self.println("zsp::arl::dm::IDataTypeComponent *%s_t = %s->mkDataTypeComponent(\"%s\");" % (
|
117
129
|
self.leaf_name(i.name()),
|
118
130
|
self._ctxt,
|
119
131
|
i.name()))
|
132
|
+
self.println("%s->addDataTypeComponent(%s_t);" % (
|
133
|
+
self._ctxt,
|
134
|
+
self.leaf_name(i.name())))
|
120
135
|
|
121
136
|
self._type_s.append(i)
|
122
137
|
for f in i.getFields():
|
@@ -128,9 +143,8 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
128
143
|
a.accept(self)
|
129
144
|
self._type_s.pop()
|
130
145
|
|
131
|
-
self.
|
132
|
-
|
133
|
-
self.leaf_name(i.name())))
|
146
|
+
self.dec_indent()
|
147
|
+
self.println("}")
|
134
148
|
|
135
149
|
def visitDataTypeFunction(self, i: DataTypeFunction):
|
136
150
|
if self._define_func:
|
@@ -149,11 +163,16 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
149
163
|
self._emit_type_mode += 1
|
150
164
|
i.getReturnType().accept(self)
|
151
165
|
self._emit_type_mode -= 1
|
152
|
-
<<<<<<< HEAD
|
153
166
|
self.write(",\n")
|
154
|
-
|
155
|
-
|
156
|
-
|
167
|
+
self.println("false,") # own_rtype
|
168
|
+
|
169
|
+
# TODO: Flags
|
170
|
+
flags = "zsp::arl::dm::DataTypeFunctionFlags::NoFlags"
|
171
|
+
for f in DataTypeFunctionFlags:
|
172
|
+
if i.hasFlags(f):
|
173
|
+
flags += "|zsp::arl::dm::DataTYpeFunctionFlags::%s" % f.__name__
|
174
|
+
|
175
|
+
self.println("%s" % flags)
|
157
176
|
self.dec_indent()
|
158
177
|
self.println(");")
|
159
178
|
# Add parameter declarations
|
@@ -199,6 +218,26 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
199
218
|
self.dec_indent()
|
200
219
|
self.println("));")
|
201
220
|
|
221
|
+
def visitTypeExprMethodCallContext(self, i: TypeExprMethodCallContext):
|
222
|
+
self.println("%s->mkTypeExprMethodCallContext(" % self._ctxt)
|
223
|
+
self.inc_indent()
|
224
|
+
self.println("%s->findDataTypeFunction(\"%s\")," % (
|
225
|
+
self._ctxt,
|
226
|
+
i.getTarget().name()))
|
227
|
+
self.push_comma(True)
|
228
|
+
i.getContext().accept(self)
|
229
|
+
self.pop_comma()
|
230
|
+
self.println("{")
|
231
|
+
self.inc_indent()
|
232
|
+
for ii,p in enumerate(i.getParameters()):
|
233
|
+
self.push_comma(ii+1 < len(i.getParameters()))
|
234
|
+
p.accept(self)
|
235
|
+
self.pop_comma()
|
236
|
+
self.dec_indent()
|
237
|
+
self.println("}")
|
238
|
+
self.dec_indent()
|
239
|
+
self.println(")%s" % self.comma())
|
240
|
+
|
202
241
|
def visitTypeExprMethodCallStatic(self, i: TypeExprMethodCallStatic):
|
203
242
|
self.println("%s->mkTypeExprMethodCallStatic(" % self._ctxt)
|
204
243
|
self.inc_indent()
|
@@ -220,8 +259,26 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
220
259
|
self.println("TODO: hit generic TypeField (%s)" % str(i))
|
221
260
|
|
222
261
|
def visitTypeFieldRegGroup(self, i: TypeFieldRegGroup):
|
223
|
-
|
224
|
-
|
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("}")
|
225
282
|
|
226
283
|
def visitTypeFieldRef(self, i : 'TypeFieldRef'):
|
227
284
|
if i.name() != "comp":
|
@@ -230,7 +287,7 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
230
287
|
def visitTypeFieldReg(self, i: TypeFieldReg):
|
231
288
|
self.println("{")
|
232
289
|
self.inc_indent()
|
233
|
-
self.println("zsp::arl::dm::
|
290
|
+
self.println("zsp::arl::dm::ITypeFieldReg *%s_f = %s->mkTypeFieldReg(" % (
|
234
291
|
self.leaf_name(i.name()),
|
235
292
|
self._ctxt))
|
236
293
|
self.inc_indent()
|
@@ -273,6 +330,10 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
273
330
|
self.leaf_name(i.name()),
|
274
331
|
self._ctxt,
|
275
332
|
i.name()))
|
333
|
+
self.println("%s->addDataTypeAction(%s_t);" % (
|
334
|
+
self._ctxt,
|
335
|
+
self.leaf_name(i.name())
|
336
|
+
))
|
276
337
|
self._type_s.append(i)
|
277
338
|
for f in i.getFields():
|
278
339
|
if f.name() != "comp":
|
@@ -284,16 +345,14 @@ class ZspDataModelCppGen(VscDataModelCppGen,VisitorBase):
|
|
284
345
|
e.accept(self)
|
285
346
|
pass
|
286
347
|
self._type_s.pop()
|
287
|
-
self.println("%s_t->setComponentType(%
|
348
|
+
self.println("%s_t->setComponentType(%s->findDataTypeComponent(\"%s\"));" % (
|
288
349
|
self.leaf_name(i.name()),
|
289
|
-
self.leaf_name(self._type_s[-1].name())))
|
290
|
-
self.println("%s_t->addActionType(%s_t);" % (
|
291
|
-
self.leaf_name(self._type_s[-1].name()),
|
292
|
-
self.leaf_name(i.name())))
|
293
|
-
self.println("%s->addDataTypeAction(%s_t);" % (
|
294
350
|
self._ctxt,
|
295
|
-
self.leaf_name(i.name())
|
296
|
-
))
|
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())))
|
297
356
|
self.dec_indent()
|
298
357
|
self.println("}")
|
299
358
|
|
@@ -23,6 +23,7 @@ import typeworks
|
|
23
23
|
from .input_output_t import InputOutputT
|
24
24
|
from .typeinfo_proc_scope import TypeInfoProcScope
|
25
25
|
from .type_utils import TypeUtils
|
26
|
+
from .context import DataTypeFunctionFlags
|
26
27
|
import zsp_dataclasses.impl.context as ctxt_api
|
27
28
|
|
28
29
|
|
@@ -46,12 +47,12 @@ class MethodProxyFn(typeworks.MethodProxy):
|
|
46
47
|
if self._rtype is not None:
|
47
48
|
rtype_dt = TypeUtils().val2TypeInfo(self._rtype)._lib_typeobj
|
48
49
|
|
50
|
+
|
49
51
|
self._libobj = ctxt.mkDataTypeFunction(
|
50
52
|
typeworks.localname(self.T),
|
51
53
|
rtype_dt,
|
52
54
|
False,
|
53
|
-
|
54
|
-
False)
|
55
|
+
DataTypeFunctionFlags.NoFlags)
|
55
56
|
ctxt.addDataTypeFunction(self._libobj)
|
56
57
|
|
57
58
|
dir = ctxt_api.ParamDir.In
|
@@ -4,6 +4,7 @@ import zsp_dataclasses.impl.context as ctxt_api
|
|
4
4
|
import vsc_dataclasses.impl.context as vsc_ctxt
|
5
5
|
import vsc_dataclasses.impl.pyctxt as vsc_pyctxt
|
6
6
|
|
7
|
+
from .core_lib_factory import CoreLibFactory
|
7
8
|
from .data_type_action import DataTypeAction
|
8
9
|
from .data_type_component import DataTypeComponent
|
9
10
|
from .data_type_activity_replicate import DataTypeActivityReplicate
|
@@ -13,6 +14,7 @@ from .data_type_function import DataTypeFunction
|
|
13
14
|
from .data_type_function_import import DataTypeFunctionImport
|
14
15
|
from .data_type_function_param_decl import DataTypeFunctionParamDecl
|
15
16
|
from .type_exec import TypeExec
|
17
|
+
from .type_expr_method_call_context import TypeExprMethodCallContext
|
16
18
|
from .type_expr_method_call_static import TypeExprMethodCallStatic
|
17
19
|
from .type_field_activity import TypeFieldActivity
|
18
20
|
from .type_field_reg import TypeFieldReg
|
@@ -31,6 +33,8 @@ class Context(vsc_pyctxt.Context,ctxt_api.Context):
|
|
31
33
|
self._comp_t_m = {}
|
32
34
|
self._data_t_func_m = {}
|
33
35
|
self._data_t_func_l = []
|
36
|
+
CoreLibFactory(self).build()
|
37
|
+
|
34
38
|
|
35
39
|
def findDataTypeAction(self, name) -> 'DataTypeAction':
|
36
40
|
if name in self._action_t_m.keys():
|
@@ -77,15 +81,20 @@ class Context(vsc_pyctxt.Context,ctxt_api.Context):
|
|
77
81
|
name : str,
|
78
82
|
rtype : vsc_ctxt.DataType,
|
79
83
|
own_rtype : bool,
|
80
|
-
|
81
|
-
|
82
|
-
return DataTypeFunction(name, rtype)
|
84
|
+
flags):
|
85
|
+
return DataTypeFunction(name, rtype, flags)
|
83
86
|
|
84
87
|
def addDataTypeFunction(self, f):
|
85
88
|
if f.name() not in self._data_t_func_m.keys():
|
86
89
|
self._data_t_func_m[f.name()] = f
|
87
90
|
self._data_t_func_l.append(f)
|
88
91
|
|
92
|
+
def findDataTypeFunction(self, name):
|
93
|
+
if name in self._data_t_func_m.keys():
|
94
|
+
return self._data_t_func_m[name]
|
95
|
+
else:
|
96
|
+
return None
|
97
|
+
|
89
98
|
def getDataTypeFunctions(self):
|
90
99
|
return self._data_t_func_l
|
91
100
|
|
@@ -112,18 +121,6 @@ class Context(vsc_pyctxt.Context,ctxt_api.Context):
|
|
112
121
|
def mkTypeFieldActivity(self, name, type : 'DataTypeActivity', owned):
|
113
122
|
return TypeFieldActivity(name, type)
|
114
123
|
|
115
|
-
def mkTypeFieldPhy(self,
|
116
|
-
name,
|
117
|
-
dtype : 'DataType',
|
118
|
-
own_dtype : bool,
|
119
|
-
attr,
|
120
|
-
init : 'ModelVal') -> 'TypeFieldPhy':
|
121
|
-
print("mkTypeFieldPhy: %s" % name)
|
122
|
-
if name.endswith(".Entry"):
|
123
|
-
raise Exception("Creating action-named field")
|
124
|
-
else:
|
125
|
-
return super().mkTypeFieldPhy(name, dtype, own_dtype, attr, init)
|
126
|
-
|
127
124
|
def mkTypeFieldRef(self,
|
128
125
|
name,
|
129
126
|
dtype : 'DataType',
|
@@ -146,6 +143,12 @@ class Context(vsc_pyctxt.Context,ctxt_api.Context):
|
|
146
143
|
owned):
|
147
144
|
return TypeFieldRegGroup(name, type, owned)
|
148
145
|
|
146
|
+
def mkTypeExprMethodCallContext(self,
|
147
|
+
target : DataTypeFunction,
|
148
|
+
context,
|
149
|
+
params : List[vsc_ctxt.TypeExpr]):
|
150
|
+
return TypeExprMethodCallContext(target, context, params)
|
151
|
+
|
149
152
|
def mkTypeExprMethodCallStatic(self,
|
150
153
|
target: DataTypeFunction,
|
151
154
|
params: List[vsc_ctxt.TypeExpr]):
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#****************************************************************************
|
2
|
+
#* core_lib_factory.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 ..context import Context
|
23
|
+
from ..context import DataTypeFunctionFlags
|
24
|
+
|
25
|
+
class CoreLibFactory(object):
|
26
|
+
|
27
|
+
def __init__(self, ctxt):
|
28
|
+
self._ctxt = ctxt
|
29
|
+
pass
|
30
|
+
|
31
|
+
def build(self):
|
32
|
+
self._buildRegFuncs()
|
33
|
+
pass
|
34
|
+
|
35
|
+
def _buildRegFuncs(self):
|
36
|
+
reg_read = self._ctxt.mkDataTypeFunction(
|
37
|
+
"pss::core::reg_read",
|
38
|
+
self._ctxt.findDataTypeInt(False, 64),
|
39
|
+
False,
|
40
|
+
DataTypeFunctionFlags.Core)
|
41
|
+
reg_read.addImportSpec(
|
42
|
+
self._ctxt.mkDataTypeFunctionImport("X", False, False))
|
43
|
+
self._ctxt.addDataTypeFunction(reg_read)
|
44
|
+
|
@@ -26,9 +26,11 @@ class DataTypeFunction(object):
|
|
26
26
|
|
27
27
|
def __init__(self,
|
28
28
|
name,
|
29
|
-
rtype
|
29
|
+
rtype,
|
30
|
+
flags):
|
30
31
|
self._name = name
|
31
32
|
self._rtype = rtype
|
33
|
+
self._flags = flags
|
32
34
|
self._params = []
|
33
35
|
self._body = None
|
34
36
|
self._imp_specs = []
|
@@ -56,6 +58,17 @@ class DataTypeFunction(object):
|
|
56
58
|
|
57
59
|
def getImportSpecs(self) -> List['DataTypeFunctionImport']:
|
58
60
|
return self._imp_specs
|
61
|
+
|
62
|
+
def getFlags(self):
|
63
|
+
return self._flags
|
64
|
+
|
65
|
+
def hasFlags(self, f):
|
66
|
+
print("hasFlags: %s %s %d" % (
|
67
|
+
str(self._flags),
|
68
|
+
str(f),
|
69
|
+
(self._flags & f)
|
70
|
+
))
|
71
|
+
return (self._flags & f) != 0
|
59
72
|
|
60
73
|
def accept(self, v):
|
61
74
|
v.visitDataTypeFunction(self)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#****************************************************************************
|
2
|
+
#* type_expr_method_call_context.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
|
+
import zsp_dataclasses.impl.context as ctxt_api
|
23
|
+
from .type_expr_method_call_static import TypeExprMethodCallStatic
|
24
|
+
|
25
|
+
class TypeExprMethodCallContext(ctxt_api.TypeExprMethodCallContext,TypeExprMethodCallStatic):
|
26
|
+
|
27
|
+
def __init__(self, target, context, params):
|
28
|
+
TypeExprMethodCallStatic.__init__(self, target, params)
|
29
|
+
self._context = context
|
30
|
+
|
31
|
+
def getContext(self):
|
32
|
+
return self._context
|
33
|
+
|
34
|
+
def accept(self, v):
|
35
|
+
v.visitTypeExprMethodCallContext(self)
|
36
|
+
|
@@ -24,7 +24,7 @@ from vsc_dataclasses.impl.pyctxt.visitor_base import VisitorBase as VscVisitorBa
|
|
24
24
|
from ..context import DataTypeAction, DataTypeActivity, DataTypeActivityScope
|
25
25
|
from ..context import DataTypeActivityTraverse
|
26
26
|
from ..context import DataTypeComponent, DataTypeArlStruct, DataTypeFunction, DataTypeFunctionParamDecl
|
27
|
-
from ..context import TypeExprMethodCallStatic, TypeProcStmtExpr, TypeProcStmtVarDecl
|
27
|
+
from ..context import TypeExprMethodCallStatic, TypeProcStmtExpr, TypeProcStmtVarDecl, TypeExprMethodCallContext
|
28
28
|
from ..context import TypeExec, TypeProcStmtScope
|
29
29
|
from ..context import TypeFieldReg, TypeFieldRegGroup, TypeProcStmtIfElse
|
30
30
|
|
@@ -71,6 +71,12 @@ class VisitorBase(VscVisitorBase):
|
|
71
71
|
def visitTypeExec(self, i : TypeExec):
|
72
72
|
i.getBody().accept(self)
|
73
73
|
|
74
|
+
def visitTypeExprMethodCallContext(self, i : TypeExprMethodCallContext):
|
75
|
+
i.getTarget().accept(self)
|
76
|
+
i.getContext().accept(self)
|
77
|
+
for p in i.getParameters():
|
78
|
+
p.accept(self)
|
79
|
+
|
74
80
|
def visitTypeExprMethodCallStatic(self, i : TypeExprMethodCallStatic):
|
75
81
|
i.getTarget().accept(self)
|
76
82
|
for p in i.getParameters():
|
@@ -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.6449650798
|
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
|
@@ -29,7 +29,7 @@ zsp_dataclasses/impl/component_base.py,sha256=EMkIv4crlwTDVUo4kNP3oOzQcMJ__Ah1Z1
|
|
29
29
|
zsp_dataclasses/impl/component_decorator_impl.py,sha256=gJuI8QPevGIt9F1HZEgUfY2VAuh2J_IMcosB4W4rCCw,7008
|
30
30
|
zsp_dataclasses/impl/component_impl.py,sha256=_FEaLbmsha1xWySpbMlmf782cX0v2865meFYyx2hSL4,4758
|
31
31
|
zsp_dataclasses/impl/constraint_impl.py,sha256=qEbh7cBRjEOULEEpgX8cqSvNuIDfbKYwG2kZovHdIWQ,190
|
32
|
-
zsp_dataclasses/impl/context.py,sha256=
|
32
|
+
zsp_dataclasses/impl/context.py,sha256=op8k_V2KuoT3QBAMskNc_RJT99L8LJMgNiINyKilhug,11334
|
33
33
|
zsp_dataclasses/impl/ctor.py,sha256=4VOTM07CAXbE39ggi772kBskNka8PuCCFESOZNkLcrg,7586
|
34
34
|
zsp_dataclasses/impl/ctor_scope.py,sha256=HsWpJqE6eQl0--aWPLm11WEzuFF3CKHc7S_P89PeZX4,956
|
35
35
|
zsp_dataclasses/impl/decorator_impl_base.py,sha256=2g9PgX2WKDqdlQW4HhCa_Ayfm9-b9LIbQrJh_T0dOdg,3817
|
@@ -46,7 +46,7 @@ zsp_dataclasses/impl/extend_decorator_impl.py,sha256=hRQa88X2L7-7Id7mtb-4jNt781P
|
|
46
46
|
zsp_dataclasses/impl/extend_kind_e.py,sha256=Ffae7HJ7cFzFO6_gWuHTu0bjk2Xc5ksLhzD2Hx4lbEs,940
|
47
47
|
zsp_dataclasses/impl/field_claim_impl.py,sha256=iaf8IytXDymRduzKhT85UQBlc4jV9AGSl2uTD7QQrT0,340
|
48
48
|
zsp_dataclasses/impl/field_pool_impl.py,sha256=glCQf2DdC9Yqdzy3e2zs4Y9SyRVvrhkV1dXNkL8AN3g,1192
|
49
|
-
zsp_dataclasses/impl/field_reg_c_impl.py,sha256=
|
49
|
+
zsp_dataclasses/impl/field_reg_c_impl.py,sha256=2tgt1_-CkdZNiqx3zv8V8xkOUMvqtvVPlhuaJLM3-9o,2434
|
50
50
|
zsp_dataclasses/impl/flow_obj_kind_e.py,sha256=K_M7kSKyvyU53I6MSu6TVwRFRcG7NJlP-rAckVxfF-Y,138
|
51
51
|
zsp_dataclasses/impl/fn_decorator_impl.py,sha256=-FW8z_r9opfNAm7n1rM7szXVfK7OsP9sMdNpppdP55Q,1728
|
52
52
|
zsp_dataclasses/impl/fn_impl.py,sha256=nrXtG4RiMz10INe3HDmWdwz6CCnq1UB-iNTZWLy5OUc,1062
|
@@ -55,7 +55,7 @@ zsp_dataclasses/impl/input_meta_t.py,sha256=bQeK2CaOlltSleGvwdOkUenxyMKf7AE0LYZj
|
|
55
55
|
zsp_dataclasses/impl/input_output_t.py,sha256=QNWp8aEg_0T-sSDQAlcU5G-TKZJw-sM-UJ8ChplSe_E,440
|
56
56
|
zsp_dataclasses/impl/lock_meta_t.py,sha256=xsAlVUwW5VVj61aTwCSzz0jAtBC6S11gan3nwTT3IuI,502
|
57
57
|
zsp_dataclasses/impl/lock_share_t.py,sha256=ewgVyUwAbc7fSWxasb_52fO70JrBpgmNgEMGL4b2g-E,574
|
58
|
-
zsp_dataclasses/impl/method_proxy_fn.py,sha256=
|
58
|
+
zsp_dataclasses/impl/method_proxy_fn.py,sha256=P6mBu9vXDE8S4syQLpdYqEtipRDv9FtunRgPdN5Hu78,4234
|
59
59
|
zsp_dataclasses/impl/modelinfo_activity.py,sha256=ymJMpoXT8mnG1vq-BZNNcPbrBgYsieEMJMx-mtb8ZZ0,267
|
60
60
|
zsp_dataclasses/impl/modelinfo_component.py,sha256=JFievD4qHH6avu1Mc5ZQ0CGF9gyMSbYigl0bSLmUi0k,353
|
61
61
|
zsp_dataclasses/impl/obj_base.py,sha256=mRGs3UOUBOoxq5yS8Ed_Ug4sShxW3aS2OULjbxqqi9E,935
|
@@ -94,8 +94,9 @@ 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/zsp_data_model_cpp_gen.py,sha256=
|
98
|
-
zsp_dataclasses/impl/pyctxt/context.py,sha256=
|
97
|
+
zsp_dataclasses/impl/generators/zsp_data_model_cpp_gen.py,sha256=0mza3RUPf31RjjIh4KbEgAEW4cAfN0CKZqFs-TWAFuc,14615
|
98
|
+
zsp_dataclasses/impl/pyctxt/context.py,sha256=r3cOmGDzntKjg3ryY1oKWLGlp8O6UgbHHeDwBnt2ZMo,6096
|
99
|
+
zsp_dataclasses/impl/pyctxt/core_lib_factory.py,sha256=9vpcDdlzVIOSixnSJuMFe6_wWpxeRV0nHnANxI1K5C4,1452
|
99
100
|
zsp_dataclasses/impl/pyctxt/data_type_action.py,sha256=v5DR7eFqov0_iPMhLE30meuqMM98YQ0VcMV7_P1FPas,1622
|
100
101
|
zsp_dataclasses/impl/pyctxt/data_type_activity_replicate.py,sha256=RE3uNEAjs-FeeThN-KClneFCXWAfTuefaA0Fhlui_38,1298
|
101
102
|
zsp_dataclasses/impl/pyctxt/data_type_activity_scope.py,sha256=u_Lg2p_bUUydtXq7l0Ah45FvurJ2M68R29Ez0QJBEeg,1404
|
@@ -103,25 +104,26 @@ zsp_dataclasses/impl/pyctxt/data_type_activity_sequence.py,sha256=k97zrkLTEpP9cF
|
|
103
104
|
zsp_dataclasses/impl/pyctxt/data_type_activity_traverse.py,sha256=naSl1YL8zG1PNdtBsdt4cpdiNxbyUsjoo_OP6T7ZyII,1432
|
104
105
|
zsp_dataclasses/impl/pyctxt/data_type_arl_struct.py,sha256=nw-Z2J5NesoNkWxQAp1o52nvg2kRNdYdf0iY8nZruUY,1466
|
105
106
|
zsp_dataclasses/impl/pyctxt/data_type_component.py,sha256=w6S3GUmQ_AKxEz-wLYfhF4Hv7SP-X5Zf_556VQyL7Ok,1122
|
106
|
-
zsp_dataclasses/impl/pyctxt/data_type_function.py,sha256=
|
107
|
+
zsp_dataclasses/impl/pyctxt/data_type_function.py,sha256=XnIeXR37OI2w1snatcremyyX7bj4xs6AVdPsD8-2K28,2148
|
107
108
|
zsp_dataclasses/impl/pyctxt/data_type_function_import.py,sha256=hZmhCukuDiz2jo0Vvc4VtI3IhfmodYbVQP47G-LQDyk,1228
|
108
109
|
zsp_dataclasses/impl/pyctxt/data_type_function_param_decl.py,sha256=rAel2RQX7Zc_NlqH0RP6JLWsny1kF50_dexcUDFE9-M,1277
|
109
110
|
zsp_dataclasses/impl/pyctxt/model_field_component.py,sha256=GP9BjIde7pBamGgMx56dY0dd2CG5kSzQZSIpaoHVoQw,1180
|
110
111
|
zsp_dataclasses/impl/pyctxt/type_exec.py,sha256=Un9cst7m--P65lvNQ7iNssGU1CNimM0N6yBRyfwg0Dk,1225
|
112
|
+
zsp_dataclasses/impl/pyctxt/type_expr_method_call_context.py,sha256=AjXA6-LpEX6wyOIPg6zdn-Ni0ynFaNA9sxlHPiJsU44,1339
|
111
113
|
zsp_dataclasses/impl/pyctxt/type_expr_method_call_static.py,sha256=5c9lMjPEGrb0m_G9OMAK_QZL6AytKE4isPmtO4O5KrQ,1365
|
112
114
|
zsp_dataclasses/impl/pyctxt/type_field_activity.py,sha256=SFpdm_fOQgE1F3qKTM9gU9ocnG4ZxFmtwkdb0Mi3F_A,1286
|
113
115
|
zsp_dataclasses/impl/pyctxt/type_field_reg.py,sha256=miyfFvT_MWdk5P2UCrOeDf7LHo2IUVwj7-84x-XrtEs,1361
|
114
|
-
zsp_dataclasses/impl/pyctxt/type_field_reg_group.py,sha256=
|
116
|
+
zsp_dataclasses/impl/pyctxt/type_field_reg_group.py,sha256=68ngAJ5g6NzyEopDgVu8s6U4Sfc72f-E1M4eeq1NOG8,1384
|
115
117
|
zsp_dataclasses/impl/pyctxt/type_proc_stmt_expr.py,sha256=V2UsVyGI9bExvZ2Eqz3wNJ39LMC_3EXICo6JZsenV0c,1115
|
116
118
|
zsp_dataclasses/impl/pyctxt/type_proc_stmt_if_else.py,sha256=fdf8DEiweRnkFRqkWY6LfOkO4vBuURFbSMNDfqdABbk,1465
|
117
119
|
zsp_dataclasses/impl/pyctxt/type_proc_stmt_scope.py,sha256=TfbqEcHgLOlKn7M99IDnwzTjkhhp0wxcMaca5X57JwY,1355
|
118
120
|
zsp_dataclasses/impl/pyctxt/type_proc_stmt_var_decl.py,sha256=gHmRGhPQDQeN2F4dZ7FBY7-HhF5t1ZDMd16_EakYhHg,1306
|
119
|
-
zsp_dataclasses/impl/pyctxt/visitor_base.py,sha256=
|
121
|
+
zsp_dataclasses/impl/pyctxt/visitor_base.py,sha256=n08-7Y5AOjBeuvZOLiAqvDh78Xsf4I-0VYexPmQ13so,3829
|
120
122
|
zsp_dataclasses/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
121
123
|
zsp_dataclasses/util/extract_cpp_embedded_dsl.py,sha256=SyMMLumZD6fsubj40hyekYzWyrcoUGTijJH3NmK1ihY,5630
|
122
124
|
zsp_dataclasses/util/gen_cpp_dt_defs/__main__.py,sha256=LdfPAEzhMPtW1Ie15A5pmYAlL8DQFj-l7Pbey3EJiJg,3391
|
123
|
-
zuspec_dataclasses-0.0.1.
|
124
|
-
zuspec_dataclasses-0.0.1.
|
125
|
-
zuspec_dataclasses-0.0.1.
|
126
|
-
zuspec_dataclasses-0.0.1.
|
127
|
-
zuspec_dataclasses-0.0.1.
|
125
|
+
zuspec_dataclasses-0.0.1.6449650798.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
126
|
+
zuspec_dataclasses-0.0.1.6449650798.dist-info/METADATA,sha256=aNnPTILn4j7ywVZFZyd8PImgeCVNqhOyh2jeWGTLYz8,499
|
127
|
+
zuspec_dataclasses-0.0.1.6449650798.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
128
|
+
zuspec_dataclasses-0.0.1.6449650798.dist-info/top_level.txt,sha256=BHigRYcGvNv_xCJUUv5OXgSPSoczsH3Tle0gABks4l0,16
|
129
|
+
zuspec_dataclasses-0.0.1.6449650798.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|