MCPcopy Create free account
hub / github.com/Nic30/hdlConvertor / ToPy

Method ToPy

hdlConvertor/toPy.cpp:19–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17using namespace hdlAst;
18
19ToPy::ToPy() {
20 hdlAst_module = PyImport_ImportModule("hdlConvertorAst.hdlAst");
21 if (hdlAst_module == nullptr) {
22 // this could happen only if there are missing files in library
23 PyErr_Print();
24 throw std::runtime_error("can not import hdlConvertorAst.hdlAst");
25 }
26 auto import = [this](PyObject *&obj, const std::string &name) {
27 obj = PyObject_GetAttrString(hdlAst_module, name.c_str());
28 assert(obj != NULL && "hdlConvertorAst.hdlAst not as expected from hdlConvertor");
29 };
30 import(ContextCls, "HdlContext");
31 import(CodePositionCls, "CodePosition");
32 import(HdlModuleDefCls, "HdlModuleDef");
33 import(HdlModuleDecCls, "HdlModuleDec");
34 import(HdlIdDefCls, "HdlIdDef");
35 import(HdlOpCls, "HdlOp");
36 import(HdlOpTypeEnum, "HdlOpType");
37 import(HdlValueIntCls, "HdlValueInt");
38 import(HdlExprNotImplementedCls, "HdlExprNotImplemented");
39 import(HdlValueIdCls, "HdlValueId");
40 import(HdlDirectionEnum, "HdlDirection");
41 import(HdlAllCls, "HdlAll");
42 import(HdlOthersCls, "HdlOthers");
43 import(HdlTypeAutoCls, "HdlTypeAuto");
44 import(HdlTypeTypeCls, "HdlTypeType");
45 import(HdlTypeSubtypeCls, "HdlTypeSubtype");
46 import(HdlClassTypeEnum, "HdlClassType");
47 import(HdlClassDefCls, "HdlClassDef");
48 import(HdlPhysicalDefCls, "HdlPhysicalDef");
49 import(HdlEnumDefCls, "HdlEnumDef");
50 import(HdlStmIfCls, "HdlStmIf");
51 import(HdlStmAssignCls, "HdlStmAssign");
52 import(HdlStmProcessTriggerConstrainEnum, "HdlStmProcessTriggerConstrain");
53 import(HdlStmProcessCls, "HdlStmProcess");
54 import(HdlStmCaseUniqConstrainEnum, "HdlStmCaseUniqConstrain");
55 import(HdlStmCaseTypeEnum, "HdlStmCaseType");
56 import(HdlStmCaseCls, "HdlStmCase");
57 import(HdlStmForCls, "HdlStmFor");
58 import(HdlStmForInCls, "HdlStmForIn");
59 import(HdlStmWhileCls, "HdlStmWhile");
60 import(HdlStmNopCls, "HdlStmNop");
61 import(HdlStmRepeatCls, "HdlStmRepeat");
62 import(HdlStmReturnCls, "HdlStmReturn");
63 import(HdlStmBreakCls, "HdlStmBreak");
64 import(HdlStmContinueCls, "HdlStmContinue");
65 import(HdlStmWaitCls, "HdlStmWait");
66 import(HdlStmBlockJoinTypeCls, "HdlStmBlockJoinType");
67 import(HdlStmBlockCls, "HdlStmBlock");
68 import(HdlLibraryCls, "HdlLibrary");
69 import(HdlImportCls, "HdlImport");
70 import(HdlCompInstCls, "HdlCompInst");
71 import(HdlFunctionDefCls, "HdlFunctionDef");
72 import(HdlValueIdspaceCls, "HdlValueIdspace");
73}
74
75std::string ToPy::PyObject_repr(PyObject *o) {
76 PyObject *args = Py_BuildValue("(O)", PyObject_Repr(o));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected