* All tools:
- Bug: target_link_libraries() must be put back for OSX Snow Leopard (doesn't seems to affect Leopard). As I do not have an OSX under my hand it's untested and is likely to fail at that point. * ./hurricane: - Bug: In Instance, correct support for Instance::PlacementStatus::Code. - New: NetExternalComponents python object wrapper, moves getExternalComponents() from Hurricane module into that new object. - New: Breakpoint python object wrapper, to allow stratus1 to stop each times it calls the viewer. - Change: In PyHurricane, UpdateSession is now a true object with static methods. - Change: In BreakpointWidget uses a local event loop mechanism that no longer consumes 100% of a CPU while doing nothing... (copied from Qt's sources of QDialog).
This commit is contained in:
parent
76215da79c
commit
62b8477fee
|
@ -54,15 +54,18 @@ IF(NOT BUILD_SHARED_LIBS)
|
|||
NO_DEFAULT_PATH
|
||||
)
|
||||
MESSAGE(STATUS "Building static libraries.")
|
||||
IF(Boost_FOUND)
|
||||
ENDIF(Boost_FOUND)
|
||||
ELSE(NOT BUILD_SHARED_LIBS)
|
||||
MESSAGE(STATUS "Building dynamic libraries.")
|
||||
ENDIF(NOT BUILD_SHARED_LIBS)
|
||||
|
||||
SET(Boost_USE_STATIC_LIBS ON)
|
||||
MESSAGE(STATUS "Always uses Boost static libraries.")
|
||||
FIND_PACKAGE(Boost 1.33.1 COMPONENTS regex REQUIRED)
|
||||
FIND_PACKAGE(Boost 1.35.0 COMPONENTS regex)
|
||||
IF(NOT Boost_FOUND)
|
||||
FIND_PACKAGE(Boost 1.33.1 COMPONENTS regex REQUIRED)
|
||||
ENDIF(NOT Boost_FOUND)
|
||||
MESSAGE(STATUS "Found Boost libraries ${Boost_LIB_VERSION} in ${Boost_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS " ${Boost_LIBRARIES}")
|
||||
|
||||
ADD_SUBDIRECTORY(src)
|
||||
ADD_SUBDIRECTORY(cmake_modules)
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace Hurricane {
|
|||
|
||||
bool Breakpoint::_stop ( unsigned int level, const string& message )
|
||||
{
|
||||
if ( _stopCb && ( level <= _stopLevel ) )
|
||||
if ( _stopCb && ( level >= _stopLevel ) )
|
||||
return _stopCb ( message );
|
||||
|
||||
return false;
|
||||
|
|
|
@ -304,7 +304,6 @@ void Instance::materialize()
|
|||
// *************************
|
||||
{
|
||||
if (not isMaterialized()) {
|
||||
cerr << "materialize: " << this << endl;
|
||||
Box boundingBox = getBoundingBox();
|
||||
if (!boundingBox.isEmpty()) {
|
||||
QuadTree* quadTree = _cell->_getQuadTree();
|
||||
|
@ -376,18 +375,15 @@ void Instance::setTransformation(const Transformation& transformation)
|
|||
void Instance::setPlacementStatus(const PlacementStatus& placementstatus)
|
||||
// **********************************************************************
|
||||
{
|
||||
cerr << "setPlacementStatus of " << this << " to " << placementstatus << endl;
|
||||
if (placementstatus != _placementStatus) {
|
||||
invalidate(true);
|
||||
|
||||
if (_placementStatus == PlacementStatus::UNPLACED) {
|
||||
cerr << "setPlacementStatus: PLACED/FIXED " << this << endl;
|
||||
materialize ();
|
||||
} else if (placementstatus == PlacementStatus::UNPLACED)
|
||||
unmaterialize ();
|
||||
|
||||
_placementStatus = placementstatus;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,12 +456,9 @@ void Instance::_postCreate()
|
|||
end_for;
|
||||
}
|
||||
|
||||
cerr << "Initial placement status " << this << " " << _placementStatus << endl;
|
||||
|
||||
bool autoMaterialization = not autoMaterializationIsDisabled();
|
||||
if ( _placementStatus == PlacementStatus::UNPLACED ) {
|
||||
disableAutoMaterialization();
|
||||
cerr << "do not materialize: " << this << endl;
|
||||
}
|
||||
|
||||
Inherit::_postCreate();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
${PYTHON_INCLUDE_PATH}
|
||||
)
|
||||
set ( sources ProxyProperty.cpp
|
||||
PyBreakpoint.cpp
|
||||
PyBox.cpp
|
||||
PyCell.cpp
|
||||
PyCellCollection.cpp
|
||||
|
@ -25,6 +26,7 @@
|
|||
PyLibrary.cpp
|
||||
PyNet.cpp
|
||||
PyNetCollection.cpp
|
||||
PyNetExternalComponents.cpp
|
||||
PyOccurrence.cpp
|
||||
PyOccurrenceCollection.cpp
|
||||
PyPad.cpp
|
||||
|
@ -45,6 +47,7 @@
|
|||
PyVertical.cpp
|
||||
)
|
||||
set ( includes hurricane/isobar/ProxyProperty.h
|
||||
hurricane/isobar/PyBreakpoint.h
|
||||
hurricane/isobar/PyBox.h
|
||||
hurricane/isobar/PyCell.h
|
||||
hurricane/isobar/PyCellCollection.h
|
||||
|
@ -63,6 +66,7 @@
|
|||
hurricane/isobar/PyLibrary.h
|
||||
hurricane/isobar/PyNet.h
|
||||
hurricane/isobar/PyNetCollection.h
|
||||
hurricane/isobar/PyNetExternalComponents.h
|
||||
hurricane/isobar/PyOccurrence.h
|
||||
hurricane/isobar/PyOccurrenceCollection.h
|
||||
hurricane/isobar/PyPad.h
|
||||
|
@ -91,7 +95,9 @@
|
|||
install ( FILES ${includes}
|
||||
${includes2} DESTINATION include/coriolis2/hurricane/isobar )
|
||||
add_library ( isobar ${sources} ${sources2} )
|
||||
target_link_libraries ( isobar viewer )
|
||||
add_library ( Hurricane MODULE ${sources} )
|
||||
target_link_libraries ( Hurricane viewer )
|
||||
set_target_properties ( Hurricane PROPERTIES
|
||||
COMPILE_FLAGS "${COMPILE_FLAGS} -D__PYTHON_MODULE__=1"
|
||||
PREFIX ""
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyBreakpoint.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyNet.h"
|
||||
#include "hurricane/isobar/PyComponent.h"
|
||||
#include "hurricane/isobar/PyComponentCollection.h"
|
||||
#include "hurricane/isobar/PyBreakpoint.h"
|
||||
|
||||
|
||||
namespace Isobar {
|
||||
|
||||
using namespace Hurricane;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Breakpoint,bp,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyBreakpoint" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
static void PyBreakpoint_DeAlloc ( PyBreakpoint* self )
|
||||
{
|
||||
trace << "PySingletonObject_DeAlloc(" << hex << self << ")" << endl;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyBreakpoint_stop ( PyObject*, PyObject *args )
|
||||
{
|
||||
trace << "PyBreakpoint_stop()" << endl;
|
||||
|
||||
bool result = false;
|
||||
|
||||
HTRY
|
||||
PyObject* arg0;
|
||||
PyObject* arg1;
|
||||
if ( not ParseTwoArg ( "Breakpoint::stop()", args, ":int:string", &arg0, &arg1) ) return NULL;
|
||||
|
||||
result = Breakpoint::stop( (unsigned int)PyInt_AsLong (arg0)
|
||||
, PyString_AsString(arg1)
|
||||
);
|
||||
HCATCH
|
||||
|
||||
if ( result ) Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyBreakpoint_setStopLevel ( PyObject*, PyObject* args )
|
||||
{
|
||||
trace << "PyBreakpoint_setStopLevel()" << endl;
|
||||
|
||||
|
||||
HTRY
|
||||
|
||||
PyObject* arg0;
|
||||
if ( not ParseOneArg ( "Breakpoint::setStopLevel()", args, ":int", &arg0) ) return NULL;
|
||||
|
||||
Breakpoint::setStopLevel ( (unsigned int)PyInt_AsLong(arg0) );
|
||||
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyBreakpoint_getStopLevel ( PyObject* )
|
||||
{
|
||||
trace << "PyBreakpoint_getStopLevel()" << endl;
|
||||
|
||||
return Py_BuildValue ( "i", Breakpoint::getStopLevel() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
PyMethodDef PyBreakpoint_Methods[] =
|
||||
{ { "stop" , (PyCFunction)PyBreakpoint_stop, METH_VARARGS|METH_CLASS
|
||||
, "Sets a breakpoint of the given level." }
|
||||
, { "setStopLevel", (PyCFunction)PyBreakpoint_setStopLevel, METH_VARARGS|METH_CLASS
|
||||
, "Sets the level below which breakpoints will be ignoreds." }
|
||||
, { "getStopLevel", (PyCFunction)PyBreakpoint_getStopLevel, METH_NOARGS|METH_CLASS
|
||||
, "Returns the level below which breakpoints will be ignoreds." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
PyTypeObjectLinkPyTypeWithoutObject(Breakpoint,Breakpoint)
|
||||
|
||||
|
||||
// extern void PyBreakpoint_LinkPyType()
|
||||
// {
|
||||
// trace << "PyBreakpoint_LinkType()" << endl;
|
||||
|
||||
// PyTypeBreakpoint.tp_new = (newfunc) PyType_GenericNew;
|
||||
// PyTypeBreakpoint.tp_dealloc = (destructor)PyBreakpoint_DeAlloc;
|
||||
// PyTypeBreakpoint.tp_methods = PyBreakpoint_Methods;
|
||||
// }
|
||||
|
||||
|
||||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyBreakpoint" Shared Library Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
|
||||
PyTypeObjectDefinitions(Breakpoint)
|
||||
|
||||
|
||||
# endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyCellViewer.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyCell.h"
|
||||
#include "hurricane/isobar/PyCellViewer.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
namespace Isobar {
|
||||
|
||||
using namespace Hurricane;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(CellViewer,cw,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyCellViewer" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// Standart Destroy (Attribute).
|
||||
DirectDestroyAttribute(PyCellViewer_destroy, PyCellViewer)
|
||||
|
||||
|
||||
static PyObject* PyCellViewer_getCell ( PyCellViewer* self )
|
||||
{
|
||||
trace << "PyCellViewer_getCell ()" << endl;
|
||||
|
||||
Cell* cell = NULL;
|
||||
|
||||
HTRY
|
||||
METHOD_HEAD("CellViewer.getCell()")
|
||||
|
||||
cell = cw->getCell ();
|
||||
HCATCH
|
||||
|
||||
if ( cell == NULL ) Py_RETURN_NONE;
|
||||
|
||||
return PyCell_Link(cell);
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyCellViewer_setCell ( PyCellViewer* self, PyObject* args )
|
||||
{
|
||||
trace << "PyCellViewer_setCell ()" << endl;
|
||||
|
||||
HTRY
|
||||
METHOD_HEAD("CellViewer.setCell()")
|
||||
|
||||
PyCell* cell;
|
||||
if ( not ParseOneArg("CellViewer.setCell()",args,CELL_ARG,(PyObject**)&cell) ) return NULL;
|
||||
|
||||
cw->setCell ( PYCELL_O(cell) );
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyCellViewer_fit ( PyCellViewer* self )
|
||||
{
|
||||
trace << "PyCellViewer_fit()" << endl;
|
||||
|
||||
HTRY
|
||||
METHOD_HEAD("CellViewer.fit()")
|
||||
cw->getCellWidget()->fitToContents();
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyCellViewer Attribute Method table.
|
||||
|
||||
PyMethodDef PyCellViewer_Methods[] =
|
||||
{ { "getCell" , (PyCFunction)PyCellViewer_getCell , METH_NOARGS
|
||||
, "Return the currently edited Cell." }
|
||||
, { "setCell" , (PyCFunction)PyCellViewer_setCell , METH_VARARGS
|
||||
, "Load a Cell into the viewer." }
|
||||
, { "fit" , (PyCFunction)PyCellViewer_fit , METH_NOARGS
|
||||
, "Fit the contents to the viewer's visible area." }
|
||||
, { "destroy" , (PyCFunction)PyCellViewer_destroy , METH_NOARGS
|
||||
, "Destroy the associated hurricane object. The python object remains." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
PythonOnlyDeleteMethod(CellViewer)
|
||||
PyTypeObjectLinkPyType(CellViewer)
|
||||
|
||||
|
||||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyCellViewer" Shared Library Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
|
||||
PyTypeObjectDefinitions(CellViewer)
|
||||
|
||||
|
||||
# endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
|
@ -138,13 +138,16 @@ extern "C" {
|
|||
&PyTypeNet, &pyNet, &PyTypeLayer, &pyLayer,
|
||||
&x, &y, &width, &height)) {
|
||||
contact = Contact::create(PYNET_O(pyNet), PYLAYER_O(pyLayer), x, y, width, height);
|
||||
} else if (PyArg_ParseTuple(args, "O!O!ll|ll:Contact.create",
|
||||
} else {
|
||||
PyErr_Clear ();
|
||||
if (PyArg_ParseTuple(args, "O!O!ll|ll:Contact.create",
|
||||
&PyTypeComponent, &pyComponent, &PyTypeLayer, &pyLayer,
|
||||
&x, &y, &width, &height)) {
|
||||
contact = Contact::create(PYCOMPONENT_O(pyComponent), PYLAYER_O(pyLayer), x, y, width, height);
|
||||
} else {
|
||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Contact constructor." );
|
||||
return ( NULL );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "hurricane/isobar/PyBreakpoint.h"
|
||||
#include "hurricane/isobar/PyUpdateSession.h"
|
||||
#include "hurricane/isobar/PyDbU.h"
|
||||
#include "hurricane/isobar/PyPoint.h"
|
||||
|
@ -73,6 +74,7 @@
|
|||
#include "hurricane/isobar/PyReferenceCollection.h"
|
||||
#include "hurricane/isobar/PyNet.h"
|
||||
#include "hurricane/isobar/PyNetCollection.h"
|
||||
#include "hurricane/isobar/PyNetExternalComponents.h"
|
||||
#include "hurricane/isobar/PyHyperNet.h"
|
||||
#include "hurricane/isobar/PyComponent.h"
|
||||
#include "hurricane/isobar/PyComponentCollection.h"
|
||||
|
@ -470,31 +472,6 @@ extern "C" {
|
|||
|
||||
extern "C" {
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyNetExternalComponents_getNetExternalComponents ()"
|
||||
|
||||
PyObject* PyNetExternalComponents_getExternalComponents ( PyObject* module, PyObject* args )
|
||||
{
|
||||
trace << "PyNetExternalComponents_getExternalComponents()" << endl;
|
||||
|
||||
PyObject* arg0;
|
||||
if ( ! ParseOneArg ( "getExternalComponents", args, ":ent", &arg0) ) return ( NULL );
|
||||
|
||||
PyComponentCollection* pyComponentCollection = NULL;
|
||||
|
||||
HTRY
|
||||
|
||||
Components* components = new Components(NetExternalComponents::get(PYNET_O(arg0)));
|
||||
|
||||
pyComponentCollection = PyObject_NEW(PyComponentCollection, &PyTypeComponentCollection);
|
||||
if (pyComponentCollection == NULL) { return NULL; }
|
||||
|
||||
pyComponentCollection->_object = components;
|
||||
|
||||
HCATCH
|
||||
|
||||
return ((PyObject*)pyComponentCollection);
|
||||
}
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyHurricane" Module Methods |
|
||||
|
@ -512,8 +489,6 @@ extern "C" {
|
|||
, { "Point" , PyPoint_create , METH_VARARGS, "Creates a new Point." }
|
||||
, { "Box" , PyBox_create , METH_VARARGS, "Creates a new Box." }
|
||||
, { "Transformation" , PyTransformation_create , METH_VARARGS, "Creates a new Transformation." }
|
||||
, { "UpdateSession_open" , (PyCFunction)PyUpdateSession_open , METH_NOARGS , "Opens an update session." }
|
||||
, { "UpdateSession_close" , (PyCFunction)PyUpdateSession_close , METH_NOARGS , "Closes an update session." }
|
||||
, { "DataBase" , (PyCFunction)PyDataBase_create , METH_NOARGS , "Creates the DataBase." }
|
||||
, { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Gets the current DataBase." }
|
||||
, { "Library" , (PyCFunction)PyLibrary_create , METH_VARARGS, "Creates a new Library." }
|
||||
|
@ -530,7 +505,6 @@ extern "C" {
|
|||
, { "Pad" , (PyCFunction)PyPad_create , METH_VARARGS, "Creates a new Pad." }
|
||||
, { "Path" , (PyCFunction)PyPath_create , METH_VARARGS, "Creates a new Path." }
|
||||
, { "Occurrence" , (PyCFunction)PyOccurrence_create , METH_VARARGS, "Creates a new Occurrence." }
|
||||
, { "getExternalComponents" , (PyCFunction)PyNetExternalComponents_getExternalComponents, METH_VARARGS, "Returns the components collection of an external net" }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
@ -543,6 +517,7 @@ extern "C" {
|
|||
DL_EXPORT(void) initHurricane () {
|
||||
trace << "initHurricane()" << endl;
|
||||
|
||||
PyUpdateSession_LinkPyType ();
|
||||
PyPoint_LinkPyType ();
|
||||
PyBox_LinkPyType ();
|
||||
PyTransformation_LinkPyType ();
|
||||
|
@ -556,7 +531,7 @@ extern "C" {
|
|||
PyInstanceCollection_LinkPyType ();
|
||||
PyPlugCollection_LinkPyType ();
|
||||
PyNetCollection_LinkPyType ();
|
||||
PyNetCollection_LinkPyType ();
|
||||
PyNetExternalComponents_LinkPyType ();
|
||||
PyCellCollection_LinkPyType ();
|
||||
PyPinCollection_LinkPyType ();
|
||||
PySegmentCollection_LinkPyType ();
|
||||
|
@ -577,7 +552,9 @@ extern "C" {
|
|||
PyPin_LinkPyType ();
|
||||
PyPlug_LinkPyType ();
|
||||
PyCellViewer_LinkPyType ();
|
||||
PyBreakpoint_LinkPyType ();
|
||||
|
||||
PYTYPE_READY ( UpdateSession )
|
||||
PYTYPE_READY ( Point )
|
||||
PYTYPE_READY ( Box )
|
||||
PYTYPE_READY ( Transformation )
|
||||
|
@ -608,6 +585,8 @@ extern "C" {
|
|||
PYTYPE_READY ( ReferenceCollectionLocator )
|
||||
PYTYPE_READY ( HyperNet )
|
||||
PYTYPE_READY ( CellViewer )
|
||||
PYTYPE_READY ( NetExternalComponents )
|
||||
PYTYPE_READY ( Breakpoint )
|
||||
|
||||
PYTYPE_READY_SUB ( Cell , Entity )
|
||||
PYTYPE_READY_SUB ( Instance , Entity )
|
||||
|
@ -674,7 +653,14 @@ extern "C" {
|
|||
<< " Failed to initialize Hurricane module." << endl;
|
||||
return;
|
||||
}
|
||||
//PyModule_AddObject(module, "Box", (PyObject*)&PyTypeBox); // To add Hurricane.Box type in module -> the Hurricane.Box() method must be renamed
|
||||
|
||||
Py_INCREF ( &PyTypeNetExternalComponents );
|
||||
PyModule_AddObject ( module, "NetExternalComponents", (PyObject*)&PyTypeNetExternalComponents );
|
||||
Py_INCREF ( &PyTypeUpdateSession );
|
||||
PyModule_AddObject ( module, "UpdateSession", (PyObject*)&PyTypeUpdateSession );
|
||||
Py_INCREF ( &PyTypeBreakpoint );
|
||||
PyModule_AddObject ( module, "Breakpoint", (PyObject*)&PyTypeBreakpoint );
|
||||
|
||||
|
||||
PyObject* dictionnary = PyModule_GetDict ( module );
|
||||
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyNetExternalComponents.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyNet.h"
|
||||
#include "hurricane/isobar/PyComponent.h"
|
||||
#include "hurricane/isobar/PyComponentCollection.h"
|
||||
#include "hurricane/isobar/PyNetExternalComponents.h"
|
||||
|
||||
|
||||
namespace Isobar {
|
||||
|
||||
using namespace Hurricane;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(NetExternalComponents,property,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyNetExternalComponents" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
static void PyNetExternalComponents_DeAlloc ( PyNetExternalComponents* self )
|
||||
{
|
||||
trace << "PySingletonObject_DeAlloc(" << hex << self << ")" << endl;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyNetExternalComponents_isExternal ( PyObject*, PyObject *args )
|
||||
{
|
||||
trace << "PyNetExternalComponents_isExternal()" << endl;
|
||||
|
||||
bool isExternal = false;
|
||||
|
||||
HTRY
|
||||
PyObject* arg0;
|
||||
if ( not ParseOneArg ( "NetExternalComponents.isExternal()", args, COMP_ARG, &arg0) ) return NULL;
|
||||
|
||||
isExternal = NetExternalComponents::isExternal(PYCOMPONENT_O(arg0));
|
||||
HCATCH
|
||||
|
||||
if ( isExternal ) Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyNetExternalComponents_get ( PyObject*, PyObject* args )
|
||||
{
|
||||
trace << "PyNetExternalComponents_getExternalComponents()" << endl;
|
||||
|
||||
PyObject* arg0;
|
||||
|
||||
PyComponentCollection* pyComponentCollection = NULL;
|
||||
|
||||
HTRY
|
||||
|
||||
if ( not ParseOneArg ( "getExternalComponents", args, ":ent", &arg0) ) return NULL;
|
||||
Components* components = new Components(NetExternalComponents::get(PYNET_O(arg0)));
|
||||
|
||||
pyComponentCollection = PyObject_NEW(PyComponentCollection, &PyTypeComponentCollection);
|
||||
if (pyComponentCollection == NULL) { return NULL; }
|
||||
|
||||
pyComponentCollection->_object = components;
|
||||
|
||||
HCATCH
|
||||
|
||||
return (PyObject*)pyComponentCollection;
|
||||
}
|
||||
|
||||
|
||||
PyMethodDef PyNetExternalComponents_Methods[] =
|
||||
{ { "isExternal", (PyCFunction)PyNetExternalComponents_isExternal, METH_VARARGS|METH_CLASS
|
||||
, "Tells if Component belong to the externals of the Net." }
|
||||
, { "get" , (PyCFunction)PyNetExternalComponents_get , METH_VARARGS|METH_CLASS
|
||||
, "Returns the Collection of external components of the Net." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
PyTypeObjectLinkPyTypeWithoutObject(NetExternalComponents,NetExternalComponents)
|
||||
|
||||
|
||||
// extern void PyNetExternalComponents_LinkPyType()
|
||||
// {
|
||||
// trace << "PyNetExternalComponents_LinkType()" << endl;
|
||||
|
||||
// PyTypeNetExternalComponents.tp_new = (newfunc) PyType_GenericNew;
|
||||
// PyTypeNetExternalComponents.tp_dealloc = (destructor)PyNetExternalComponents_DeAlloc;
|
||||
// PyTypeNetExternalComponents.tp_methods = PyNetExternalComponents_Methods;
|
||||
// }
|
||||
|
||||
|
||||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyNetExternalComponents" Shared Library Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
|
||||
PyTypeObjectDefinitions(NetExternalComponents)
|
||||
|
||||
|
||||
# endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
|
|
@ -1,39 +1,8 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
||||
// Christian Masson <Christian.Masson@lip6.fr>
|
||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
||||
//
|
||||
// The Coriolis Project is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The Coriolis Project is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Coriolis Project; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA
|
||||
//
|
||||
// License-Tag
|
||||
// Authors-Tag
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id: PyUpdateSession.cpp,v 1.12 2006/07/19 14:00:05 xtof Exp $
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
|
@ -49,6 +18,7 @@
|
|||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyUpdateSession.h"
|
||||
|
||||
|
||||
|
@ -59,6 +29,9 @@ using namespace Hurricane;
|
|||
extern "C" {
|
||||
|
||||
|
||||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(UpdateSession,session,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyUpdateSession" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
|
@ -66,15 +39,14 @@ extern "C" {
|
|||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyUpdateSession" General Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
static void PyUpdateSession_DeAlloc ( PyUpdateSession* self )
|
||||
{
|
||||
trace << "PyUpdateSession_DeAlloc(" << hex << self << ")" << endl;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyUpdateSession_open ()"
|
||||
|
||||
extern PyObject* PyUpdateSession_open ( PyObject* module ) {
|
||||
static PyObject* PyUpdateSession_open ( PyObject* )
|
||||
{
|
||||
trace << "PyUpdateSession_open()" << endl;
|
||||
|
||||
HTRY
|
||||
|
@ -85,22 +57,30 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyUpdateSession_close()"
|
||||
|
||||
extern PyObject* PyUpdateSession_close( PyObject* module )
|
||||
static PyObject* PyUpdateSession_close ( PyObject* )
|
||||
{
|
||||
trace << "PyUpdateSession_close()" << endl;
|
||||
|
||||
HTRY
|
||||
UpdateSession::close();
|
||||
UpdateSession::close ();
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
PyMethodDef PyUpdateSession_Methods[] =
|
||||
{ { "open" , (PyCFunction)PyUpdateSession_open, METH_NOARGS|METH_CLASS
|
||||
, "Opens a new Update Session." }
|
||||
, { "close" , (PyCFunction)PyUpdateSession_close, METH_NOARGS|METH_CLASS
|
||||
, "Closes an Update Session." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
PyTypeObjectLinkPyTypeWithoutObject(UpdateSession,UpdateSession)
|
||||
|
||||
|
||||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
|
@ -109,13 +89,14 @@ extern "C" {
|
|||
// x=================================================================x
|
||||
|
||||
|
||||
#endif
|
||||
PyTypeObjectDefinitions(UpdateSession)
|
||||
|
||||
|
||||
# endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./PyBreakpoint.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ifndef __PY_BREAKPOINT__
|
||||
# define __PY_BREAKPOINT__
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "hurricane/Breakpoint.h"
|
||||
|
||||
|
||||
namespace Isobar {
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Python Object : "PyBreakpoint".
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
} PyBreakpoint;
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Functions & Types exported to "PyHurricane.cpp".
|
||||
|
||||
extern PyTypeObject PyTypeBreakpoint;
|
||||
extern PyMethodDef PyBreakpoint_Methods[];
|
||||
|
||||
extern void PyBreakpoint_LinkPyType ();
|
||||
|
||||
|
||||
#define IsPyBreakpoint(v) ( (v)->ob_type == &PyTypeBreakpoint )
|
||||
#define PYBREAKPOINT(v) ( (PyBreakpoint*)(v) )
|
||||
#define PYBREAKPOINT_O(v) ( PY_BREAKPOINT(v)->_object )
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
|
||||
|
||||
|
||||
|
||||
# endif
|
|
@ -0,0 +1,68 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./PyCellViewer.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __ISOBAR_CELL_VIEWER__
|
||||
#define __ISOBAR_CELL_VIEWER__
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "hurricane/viewer/CellViewer.h"
|
||||
|
||||
|
||||
namespace Isobar {
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Python Object : "PyCellViewer".
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
Hurricane::CellViewer* _object;
|
||||
} PyCellViewer;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Functions & Types exported to "PyHurricane.cpp".
|
||||
|
||||
extern PyTypeObject PyTypeCellViewer;
|
||||
extern PyMethodDef PyCellViewer_Methods[];
|
||||
|
||||
extern PyObject* PyCellViewer_create ( PyObject* self, PyObject* args );
|
||||
extern void PyCellViewer_LinkPyType ();
|
||||
|
||||
|
||||
#define IsPyCellViewer(v) ( (v)->ob_type == &PyTypeCellViewer )
|
||||
#define ISOBARCELLVIEWER(v) ( (PyCellViewer*)(v) )
|
||||
#define ISOBARCELLVIEWER_O(v) ( ISOBAR_CELL_VIEWER(v)->_object )
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
|
||||
|
||||
#endif // __ISOBAR_CELL_VIEWER__
|
|
@ -143,6 +143,7 @@ extern "C" {
|
|||
#define NET_LAYER_INTS2_ARG ":ent:layer:int:int"
|
||||
#define NET_LAYER_INTS3_ARG ":ent:layer:int:int:int"
|
||||
#define NET_LAYER_INTS4_ARG ":ent:layer:int:int:int:int"
|
||||
#define COMP_ARG ":comp"
|
||||
#define COMP_LAYER_INTS2_ARG ":comp:layer:int:int"
|
||||
#define COMP_LAYER_INTS3_ARG ":comp:layer:int:int:int"
|
||||
#define COMP_LAYER_INTS4_ARG ":comp:layer:int:int:int:int"
|
||||
|
@ -176,6 +177,11 @@ extern "C" {
|
|||
PyDict_SetItemString ( dictionnary, CONSTANT_NAME, constant ); \
|
||||
Py_DECREF ( constant );
|
||||
|
||||
#define LoadObjectConstant(DICTIONARY,CONSTANT_VALUE,CONSTANT_NAME) \
|
||||
constant = PyInt_FromLong ( (long)CONSTANT_VALUE ); \
|
||||
PyDict_SetItemString ( DICTIONARY, CONSTANT_NAME, constant ); \
|
||||
Py_DECREF ( constant );
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -253,18 +259,18 @@ extern "C" {
|
|||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Booleans.
|
||||
|
||||
#define DirectSetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \
|
||||
#define DirectSetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,STR_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetBoolAttribute()") \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,STR_FUNC_NAME "()") \
|
||||
\
|
||||
HTRY \
|
||||
PyObject* arg0; \
|
||||
if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \
|
||||
return ( NULL ); \
|
||||
if(arg0 == Py_True) \
|
||||
cobject->FUNC_NAME (true); \
|
||||
else \
|
||||
cobject->FUNC_NAME (false); \
|
||||
if ( not PyArg_ParseTuple ( args, "O:" STR_FUNC_NAME, &arg0 ) or PyBool_Check(arg0) ) \
|
||||
return NULL; \
|
||||
\
|
||||
(arg0 == Py_True) ? cobject->FUNC_NAME (true) : cobject->FUNC_NAME (false); \
|
||||
HCATCH \
|
||||
\
|
||||
Py_RETURN_NONE; \
|
||||
}
|
||||
|
@ -278,10 +284,12 @@ extern "C" {
|
|||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetLongAttribute()") \
|
||||
\
|
||||
HTRY \
|
||||
PyObject* arg0; \
|
||||
if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \
|
||||
return ( NULL ); \
|
||||
cobject->FUNC_NAME ( PyInt_AsLong(arg0) ); \
|
||||
HCATCH \
|
||||
\
|
||||
Py_RETURN_NONE; \
|
||||
}
|
||||
|
@ -599,30 +607,16 @@ extern "C" {
|
|||
PyObject_DEL ( self ); \
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method For Singleton Deletion.
|
||||
|
||||
// # define SingletonDeleteMethod(SELF_TYPE)
|
||||
// static void Py##SELF_TYPE##_DeAlloc ( Py##SELF_TYPE *self )
|
||||
// {
|
||||
// trace << "PySingletonObject_DeAlloc(" << hex << self << ") "
|
||||
// << self->ACCESS_OBJECT << endl;
|
||||
//
|
||||
// if ( self->ACCESS_OBJECT != NULL ) {
|
||||
// ostringstream message;
|
||||
// message << "Never delete singleton "#SELF_TYPE".";
|
||||
// PyErr_SetString ( ProxyError, message.str().c_str() );
|
||||
// }
|
||||
// PyObject_DEL ( self );
|
||||
// }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method For Singleton Deletion.
|
||||
// Attribute Method For Python Only Object Deletion.
|
||||
|
||||
# define SingletonDeleteMethod(SELF_TYPE) \
|
||||
# define PythonOnlyDeleteMethod(SELF_TYPE) \
|
||||
static void Py##SELF_TYPE##_DeAlloc ( Py##SELF_TYPE *self ) \
|
||||
{ \
|
||||
trace << "PySingletonObject_DeAlloc(" << hex << self << ") " \
|
||||
trace << "PythonOnlyObject_DeAlloc(" << hex << self << ") " \
|
||||
<< self->ACCESS_OBJECT << endl; \
|
||||
}
|
||||
|
||||
|
@ -632,23 +626,62 @@ extern "C" {
|
|||
// -------------------------------------------------------------------
|
||||
// Initialisation Function for PyTypeObject Runtime Link.
|
||||
|
||||
#define PyTypeObjectLinkPyType(SELF_TYPE) \
|
||||
DirectReprMethod(Py##SELF_TYPE##_Repr, Py##SELF_TYPE, SELF_TYPE) \
|
||||
DirectStrMethod (Py##SELF_TYPE##_Str, Py##SELF_TYPE, SELF_TYPE) \
|
||||
DirectCmpMethod (Py##SELF_TYPE##_Cmp, IsPy##SELF_TYPE, Py##SELF_TYPE) \
|
||||
DirectHashMethod(Py##SELF_TYPE##_Hash, Py##SELF_TYPE) \
|
||||
extern void Py##SELF_TYPE##_LinkPyType() { \
|
||||
trace << "Py" #SELF_TYPE "_LinkType()" << endl; \
|
||||
#define PyTypeObjectLinkPyTypeWithoutObject(PY_SELF_TYPE,SELF_TYPE) \
|
||||
extern void Py##PY_SELF_TYPE##_LinkPyType() { \
|
||||
trace << "Py" #PY_SELF_TYPE "_LinkType()" << endl; \
|
||||
\
|
||||
PyType##SELF_TYPE.tp_dealloc = (destructor)Py##SELF_TYPE##_DeAlloc; \
|
||||
PyType##SELF_TYPE.tp_compare = (cmpfunc) Py##SELF_TYPE##_Cmp; \
|
||||
PyType##SELF_TYPE.tp_repr = (reprfunc) Py##SELF_TYPE##_Repr; \
|
||||
PyType##SELF_TYPE.tp_str = (reprfunc) Py##SELF_TYPE##_Str; \
|
||||
PyType##SELF_TYPE.tp_hash = (hashfunc) Py##SELF_TYPE##_Hash; \
|
||||
PyType##SELF_TYPE.tp_methods = Py##SELF_TYPE##_Methods; \
|
||||
PyType##PY_SELF_TYPE.tp_dealloc = (destructor) Py##PY_SELF_TYPE##_DeAlloc; \
|
||||
PyType##PY_SELF_TYPE.tp_methods = Py##PY_SELF_TYPE##_Methods; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Initialisation Function for PyTypeObject Runtime Link.
|
||||
|
||||
#define PyTypeObjectLinkPyTypeWithClass(PY_SELF_TYPE,SELF_TYPE) \
|
||||
DirectReprMethod(Py##PY_SELF_TYPE##_Repr, Py##PY_SELF_TYPE, SELF_TYPE) \
|
||||
DirectStrMethod (Py##PY_SELF_TYPE##_Str, Py##PY_SELF_TYPE, SELF_TYPE) \
|
||||
DirectCmpMethod (Py##PY_SELF_TYPE##_Cmp, IsPy##PY_SELF_TYPE, Py##PY_SELF_TYPE) \
|
||||
DirectHashMethod(Py##PY_SELF_TYPE##_Hash, Py##SELF_TYPE) \
|
||||
extern void Py##PY_SELF_TYPE##_LinkPyType() { \
|
||||
trace << "Py" #PY_SELF_TYPE "_LinkType()" << endl; \
|
||||
\
|
||||
PyType##PY_SELF_TYPE.tp_dealloc = (destructor) Py##PY_SELF_TYPE##_DeAlloc; \
|
||||
PyType##PY_SELF_TYPE.tp_compare = (cmpfunc) Py##PY_SELF_TYPE##_Cmp; \
|
||||
PyType##PY_SELF_TYPE.tp_repr = (reprfunc) Py##PY_SELF_TYPE##_Repr; \
|
||||
PyType##PY_SELF_TYPE.tp_str = (reprfunc) Py##PY_SELF_TYPE##_Str; \
|
||||
PyType##PY_SELF_TYPE.tp_hash = (hashfunc) Py##PY_SELF_TYPE##_Hash; \
|
||||
PyType##PY_SELF_TYPE.tp_methods = Py##PY_SELF_TYPE##_Methods; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Initialisation Function for PyTypeObject Runtime Link.
|
||||
|
||||
#define PyTypeObjectLinkPyType(SELF_TYPE) \
|
||||
PyTypeObjectLinkPyTypeWithClass(SELF_TYPE,SELF_TYPE)
|
||||
|
||||
// #define PyTypeObjectLinkPyType(SELF_TYPE)
|
||||
// DirectReprMethod(Py##SELF_TYPE##_Repr, Py##SELF_TYPE, SELF_TYPE)
|
||||
// DirectStrMethod (Py##SELF_TYPE##_Str, Py##SELF_TYPE, SELF_TYPE)
|
||||
// DirectCmpMethod (Py##SELF_TYPE##_Cmp, IsPy##SELF_TYPE, Py##SELF_TYPE)
|
||||
// DirectHashMethod(Py##SELF_TYPE##_Hash, Py##SELF_TYPE)
|
||||
// extern void Py##SELF_TYPE##_LinkPyType() {
|
||||
// trace << "Py" #SELF_TYPE "_LinkType()" << endl;
|
||||
//
|
||||
// PyType##SELF_TYPE.tp_dealloc = (destructor) Py##SELF_TYPE##_DeAlloc;
|
||||
// PyType##SELF_TYPE.tp_compare = (cmpfunc) Py##SELF_TYPE##_Cmp;
|
||||
// PyType##SELF_TYPE.tp_repr = (reprfunc) Py##SELF_TYPE##_Repr;
|
||||
// PyType##SELF_TYPE.tp_str = (reprfunc) Py##SELF_TYPE##_Str;
|
||||
// PyType##SELF_TYPE.tp_hash = (hashfunc) Py##SELF_TYPE##_Hash;
|
||||
// PyType##SELF_TYPE.tp_methods = Py##SELF_TYPE##_Methods;
|
||||
// }
|
||||
|
||||
|
||||
// Special Initialisation Function for Locator PyTypeObject Runtime Link.
|
||||
#define LocatorPyTypeObjectLinkPyType(PY_SELF_TYPE, SELF_TYPE) \
|
||||
DirectReprMethod(Py##PY_SELF_TYPE##Locator_Repr, Py##PY_SELF_TYPE##Locator, Locator<SELF_TYPE>) \
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./PyNetExternalComponents.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ifndef __PY_NET_EXTERNAL_COMPONENTS__
|
||||
# define __PY_NET_EXTERNAL_COMPONENTS__
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "hurricane/NetExternalComponents.h"
|
||||
|
||||
|
||||
namespace Isobar {
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Python Object : "PyNetExternalComponents".
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
} PyNetExternalComponents;
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Functions & Types exported to "PyHurricane.cpp".
|
||||
|
||||
extern PyTypeObject PyTypeNetExternalComponents;
|
||||
extern PyMethodDef PyNetExternalComponents_Methods[];
|
||||
|
||||
extern void PyNetExternalComponents_LinkPyType ();
|
||||
|
||||
|
||||
#define IsPyNetExternalComponents(v) ( (v)->ob_type == &PyTypeNetExternalComponents )
|
||||
#define PYNETEXTERNALCOMPONENTS(v) ( (PyNetExternalComponents*)(v) )
|
||||
#define PYNETEXTERNALCOMPONENTS_O(v) ( PY_NET_EXTERNAL_COMPONENTS(v)->_object )
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
|
||||
|
||||
|
||||
|
||||
# endif
|
|
@ -1,39 +1,8 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
||||
// Christian Masson <Christian.Masson@lip6.fr>
|
||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
||||
//
|
||||
// The Coriolis Project is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The Coriolis Project is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Coriolis Project; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA
|
||||
//
|
||||
// License-Tag
|
||||
// Authors-Tag
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id: PyUpdateSession.h,v 1.8 2006/05/03 14:00:05 jpc Exp $
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
|
@ -53,12 +22,11 @@
|
|||
|
||||
|
||||
|
||||
#ifndef __PYUPDATESESSION__
|
||||
#define __PYUPDATESESSION__
|
||||
# ifndef __PY_UPDATE_SESSION__
|
||||
# define __PY_UPDATE_SESSION__
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
|
||||
#include "hurricane/UpdateSession.h"
|
||||
|
||||
|
||||
|
@ -67,28 +35,37 @@ namespace Isobar {
|
|||
|
||||
extern "C" {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Python Object : "PyUpdateSession".
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
} PyUpdateSession;
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Functions & Types exported to "PyHurricane.ccp".
|
||||
// Functions & Types exported to "PyHurricane.cpp".
|
||||
|
||||
extern PyObject* PyUpdateSession_open ( PyObject* module );
|
||||
extern PyObject* PyUpdateSession_close ( PyObject* module );
|
||||
extern PyTypeObject PyTypeUpdateSession;
|
||||
extern PyMethodDef PyUpdateSession_Methods[];
|
||||
|
||||
extern void PyUpdateSession_LinkPyType ();
|
||||
|
||||
|
||||
#define IsPyUpdateSession(v) ( (v)->ob_type == &PyTypeUpdateSession )
|
||||
#define PYUPDATESESSION(v) ( (PyUpdateSession*)(v) )
|
||||
#define PYUPDATESESSION_O(v) ( PY_UPDATE_SESSION(v)->_object )
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
# endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include <QPointer>
|
||||
#include <QApplication>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
@ -42,6 +43,7 @@ namespace Hurricane {
|
|||
, _message (new QLabel())
|
||||
, _stopLevel (new QSpinBox())
|
||||
, _isFinished(false)
|
||||
, _eventLoop (NULL)
|
||||
{
|
||||
setModal ( false );
|
||||
setWindowTitle ( "Breakpoint" );
|
||||
|
@ -83,8 +85,15 @@ namespace Hurricane {
|
|||
|
||||
_isFinished = false;
|
||||
show ();
|
||||
while ( !_isFinished )
|
||||
QApplication::processEvents ();
|
||||
|
||||
// Snipet code from Qt's QDialog.
|
||||
_eventLoop = new QEventLoop ();
|
||||
QPointer<QDialog> guard = this;
|
||||
(void)_eventLoop->exec(QEventLoop::DialogExec);
|
||||
_eventLoop = NULL;
|
||||
|
||||
if (guard.isNull()) return QDialog::Rejected;
|
||||
|
||||
return result();
|
||||
}
|
||||
|
||||
|
@ -92,6 +101,7 @@ namespace Hurricane {
|
|||
void BreakpointWidget::raiseFinished ( int )
|
||||
{
|
||||
_isFinished = true;
|
||||
if ( _eventLoop ) _eventLoop->exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@
|
|||
qt4_wrap_cpp ( MOC_SRCS ${mocincludes} )
|
||||
qt4_add_resources ( RCC_SRCS CellViewer.qrc )
|
||||
|
||||
install ( FILES ${exports} DESTINATION include/coriolis2/hurricane/viewer )
|
||||
add_library ( viewer ${cpps} ${MOC_SRCS} ${RCC_SRCS} )
|
||||
target_link_libraries ( viewer hurricane ${QT_LIBRARIES} ${Boost_LIBRARIES} )
|
||||
|
||||
install ( FILES ${exports} DESTINATION include/coriolis2/hurricane/viewer )
|
||||
install ( TARGETS viewer DESTINATION lib${LIB_SUFFIX} )
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#define __HURRICANE_BREAKPOINT_WIDGET__
|
||||
|
||||
|
||||
#include <QEventLoop>
|
||||
#include <QDialog>
|
||||
class QLabel;
|
||||
class QSpinBox;
|
||||
|
@ -53,6 +54,7 @@ namespace Hurricane {
|
|||
QLabel* _message;
|
||||
QSpinBox* _stopLevel;
|
||||
bool _isFinished;
|
||||
QEventLoop* _eventLoop;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue