-
Notifications
You must be signed in to change notification settings - Fork 5
/
PyFoehn.cpp
121 lines (85 loc) · 3.49 KB
/
PyFoehn.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2022-2022, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | F o e h n - DAG Toolbox |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyFoehn.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyHurricane.h"
#include "hurricane/isobar/PyCell.h"
#include "foehn/PyFoehnEngine.h"
//#include "foehn/PyGraphicFoehnEngine.h"
#include "foehn/PyDagExtension.h"
#include "foehn/PyDag.h"
namespace Foehn {
using std::cerr;
using std::endl;
using Hurricane::tab;
using Isobar::getPyHash;
using Isobar::__cs;
using CRL::PyTypeToolEngine;
//using CRL::PyTypeGraphicTool;
#if !defined(__PYTHON_MODULE__)
// +=================================================================+
// | "PyFoehn" Shared Library Code Part |
// +=================================================================+
# else // End of PyHurricane Shared Library Code Part.
// +=================================================================+
// | "PyFoehn" Python Module Code Part |
// +=================================================================+
extern "C" {
static PyMethodDef PyFoehn_Methods[] =
{ {NULL, NULL, 0, NULL} /* sentinel */
};
static PyModuleDef PyFoehn_ModuleDef =
{ PyModuleDef_HEAD_INIT
, .m_name = "Foehn"
, .m_doc = "A DAG Toolbox."
, .m_size = -1
, .m_methods = PyFoehn_Methods
};
// ---------------------------------------------------------------
// Module Initialization : "PyInit_Foehn()"
PyMODINIT_FUNC PyInit_Foehn ( void )
{
cdebug_log(40,0) << "PyInit_Foehn()" << endl;
// PyFoehnFlags_LinkPyType();
PyFoehnEngine_LinkPyType();
// PyGraphicFoehnEngine_LinkPyType();
PyDagExtension_LinkPyType();
PyDag_LinkPyType();
// PYTYPE_READY ( FoehnFlags );
PYTYPE_READY_SUB( FoehnEngine , ToolEngine );
// PYTYPE_READY_SUB( GraphicFoehnEngine, GraphicTool );
PYTYPE_READY ( DagExtension );
PYTYPE_READY ( Dag );
PyObject* module = PyModule_Create( &PyFoehn_ModuleDef );
if (module == NULL) {
cerr << "[ERROR]\n"
<< " Failed to initialize Foehn module." << endl;
return NULL;
}
Py_INCREF( &PyTypeFoehnEngine );
PyModule_AddObject( module, "FoehnEngine", (PyObject*)&PyTypeFoehnEngine );
// Py_INCREF( &PyTypeGraphicFoehnEngine );
// PyModule_AddObject( module, "GraphicFoehnEngine", (PyObject*)&PyTypeGraphicFoehnEngine );
// Py_INCREF( &PyTypeFoehnFlags );
// PyModule_AddObject( module, "Flags", (PyObject*)&PyTypeFoehnFlags );
Py_INCREF( &PyTypeDagExtension );
PyModule_AddObject( module, "DagExtension", (PyObject*)&PyTypeDagExtension );
Py_INCREF( &PyTypeDag );
PyModule_AddObject( module, "Dag", (PyObject*)&PyTypeDag );
PyFoehnEngine_postModuleInit();
PyDagExtension_postModuleInit();
return module;
}
} // extern "C".
#endif // Python Module Code Part.
} // Foehn namespace.