Corrections in C-Python interface required by Analagic (CHAMS).
* Change: In Hurricane, in PyHurricane.h, in all DirectSet*() macros, suppress the third parameter giving the function name. It is now build from stringification of other parameters. The various macros calls are also modificated all througout Isobar. Added PyAny_AsInt() to convert a Python Int or Long into an int. Maybe we should manage only long, because the type difference seems ambiguous in Python itself. * Change: In Hurricane, in PyHurricane.h, in DirectGetBoolAttribute() deduce the function name to display in messages from the arguments. Idem for DirectIsAFromCStringAttribute(), DirectGetIntAttribute(), DirectGetUIntAttribute(), DirectGetDoubleAttribute() and DirectGetStringAttribute(). * New: In Hurricane, in PyHurricane.h, new macro DirectGetNameAttribute() to build accessors for method returning a Name. * New: In Hurricane, in PyHurricane.h, new macro DirectSetIntAttribute() to build modificators taking int arguments. * Bug: In Hurricane, in PyHurricane.h, in macro DirectSetBoolAttribute(), the check for a boolean PyObject was wrong, leading the macro to systematically emit a Python exception. * Bug: In Hurricane, in PyInstance method table, PyLibrary_create() was registered as a NOARGS function, but it *do* have arguments, change to VARARGS.
This commit is contained in:
parent
8fc4056a7a
commit
f2c036ac6d
|
@ -8,7 +8,7 @@
|
|||
# | C o r i o l i s / C h a m s B u i l d e r |
|
||||
# | |
|
||||
# | Author : Jean-Paul Chaput |
|
||||
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
# | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
# | =============================================================== |
|
||||
# | Python : "./crlcore/__init__.py" |
|
||||
# +-----------------------------------------------------------------+
|
||||
|
|
|
@ -129,13 +129,13 @@ extern "C" {
|
|||
DirectGetUIntAttribute (PyBanner_getScreenWidth ,getScreenWidth ,PyBanner,Banner)
|
||||
|
||||
// Standart Mutators (Attributes).
|
||||
DirectSetCStringAttribute(PyBanner_setName ,setName ,"Banner.setName" ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setVersion ,setVersion ,"Banner.setVersion" ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setPurpose ,setPurpose ,"Banner.setPurpose" ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setDate ,setDate ,"Banner.setDate" ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setContributors,setContributors,"Banner.setContributors",PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setAuthors ,setAuthors ,"Banner.setAuthors" ,PyBanner,Banner)
|
||||
DirectSetLongAttribute (PyBanner_setScreenWidth ,setScreenWidth ,"Banner.setScreenWidth" ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setName ,setName ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setVersion ,setVersion ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setPurpose ,setPurpose ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setDate ,setDate ,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setContributors,setContributors,PyBanner,Banner)
|
||||
DirectSetCStringAttribute(PyBanner_setAuthors ,setAuthors ,PyBanner,Banner)
|
||||
DirectSetLongAttribute (PyBanner_setScreenWidth ,setScreenWidth ,PyBanner,Banner)
|
||||
|
||||
|
||||
// Standart Destroy (Attribute).
|
||||
|
|
|
@ -66,12 +66,12 @@ extern "C" {
|
|||
DirectGetBoolAttribute(PyCatalogState_isPhysical ,isPhysical ,PyCatalogState,Catalog::State)
|
||||
DirectGetBoolAttribute(PyCatalogState_isLogical ,isFlattenLeaf,PyCatalogState,Catalog::State)
|
||||
|
||||
DirectSetBoolAttribute(PyCatalogState_setFlattenLeaf,setFlattenLeaf,"Catalog::State::setFlatenLeaf",PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setFeed ,setFeed ,"Catalog::State::setFeed" ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setGds ,setGds ,"Catalog::State::setGds" ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setDelete ,setDelete ,"Catalog::State::setDelete" ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setPhysical ,setPhysical ,"Catalog::State::setPhysical" ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setLogical ,setFlattenLeaf,"Catalog::State::setLogical" ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setFlattenLeaf,setFlattenLeaf,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setFeed ,setFeed ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setGds ,setGds ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setDelete ,setDelete ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setPhysical ,setPhysical ,PyCatalogState,Catalog::State)
|
||||
DirectSetBoolAttribute(PyCatalogState_setLogical ,setFlattenLeaf,PyCatalogState,Catalog::State)
|
||||
|
||||
|
||||
// Standart Destroy (Attribute).
|
||||
|
|
|
@ -166,19 +166,19 @@ extern "C" {
|
|||
DirectIsAFromCStringAttribute(PyEnvironment_isPad ,isPad ,PyEnvironment,Environment)
|
||||
|
||||
// Standart Mutators (Attributes).
|
||||
DirectSetCStringAttribute(PyEnvironment_setDisplayStyle ,setDisplayStyle ,"Environment.setDisplayStyle" ,PyEnvironment,Environment)
|
||||
DirectSetLongAttribute (PyEnvironment_setSCALE_X ,setSCALE_X ,"Environment.setSCALE_X" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setIN_LO ,setIN_LO ,"Environment.setIN_LO" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setIN_PH ,setIN_PH ,"Environment.setIN_PH" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setOUT_LO ,setOUT_LO ,"Environment.setOUT_LO" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setOUT_PH ,setOUT_PH ,"Environment.setOUT_PH" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setPOWER ,setPOWER ,"Environment.setPOWER" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setGROUND ,setGROUND ,"Environment.setGROUND" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setCLOCK ,setCLOCK ,"Environment.setCLOCK" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setBLOCKAGE ,setBLOCKAGE ,"Environment.setBLOCKAGE" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setPad ,setPad ,"Environment.setPad" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setCATALOG ,setCATALOG ,"Environment.setCATALOG" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setWORKING_LIBRARY ,setWORKING_LIBRARY ,"Environment.setWORKING_LIBRARY" ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setDisplayStyle ,setDisplayStyle ,PyEnvironment,Environment)
|
||||
DirectSetLongAttribute (PyEnvironment_setSCALE_X ,setSCALE_X ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setIN_LO ,setIN_LO ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setIN_PH ,setIN_PH ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setOUT_LO ,setOUT_LO ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setOUT_PH ,setOUT_PH ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setPOWER ,setPOWER ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setGROUND ,setGROUND ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setCLOCK ,setCLOCK ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setBLOCKAGE ,setBLOCKAGE ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setPad ,setPad ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setCATALOG ,setCATALOG ,PyEnvironment,Environment)
|
||||
DirectSetCStringAttribute(PyEnvironment_setWORKING_LIBRARY,setWORKING_LIBRARY,PyEnvironment,Environment)
|
||||
|
||||
|
||||
// Standart Destroy (Attribute).
|
||||
|
|
|
@ -110,8 +110,8 @@ extern "C" {
|
|||
|
||||
updatorFromBasicLayer (setBlockageLayer,PyBasicLayer,BasicLayer)
|
||||
accessorLayerFromVoid (getBlockageLayer,PyBasicLayer,BasicLayer)
|
||||
DirectSetLongAttribute (PyBasicLayer_setExtractNumber,setExtractNumber,"BasicLayer.setExtractNumber",PyBasicLayer,BasicLayer)
|
||||
DirectSetCStringAttribute(PyBasicLayer_setRealName ,setRealName ,"BasicLayer.setRealName" ,PyBasicLayer,BasicLayer)
|
||||
DirectSetLongAttribute (PyBasicLayer_setExtractNumber,setExtractNumber,PyBasicLayer,BasicLayer)
|
||||
DirectSetCStringAttribute(PyBasicLayer_setRealName ,setRealName ,PyBasicLayer,BasicLayer)
|
||||
|
||||
|
||||
// Standart destroy (Attribute).
|
||||
|
|
|
@ -52,12 +52,12 @@ extern "C" {
|
|||
DirectGetLongAttribute(PyContact_getDx, getDx, PyContact,Contact)
|
||||
DirectGetLongAttribute(PyContact_getDy, getDy, PyContact,Contact)
|
||||
|
||||
DirectSetLongAttribute(PyContact_setX ,setX ,"Contact.setX" ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setY ,setY ,"Contact.setY" ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setDx ,setDx ,"Contact.setDx" ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setDy ,setDy ,"Contact.setDy" ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setWidth ,setWidth ,"Contact.setWidth" ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setHeight,setHeight,"Contact.setHeight",PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setX ,setX ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setY ,setY ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setDx ,setDx ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setDy ,setDy ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setWidth ,setWidth ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setHeight,setHeight,PyContact,Contact)
|
||||
accessorHook(getAnchorHook,PyContact,Contact)
|
||||
|
||||
|
||||
|
|
|
@ -49,9 +49,9 @@ extern "C" {
|
|||
DirectGetLongAttribute(PyHorizontal_getY ,getY ,PyHorizontal,Horizontal)
|
||||
DirectGetLongAttribute(PyHorizontal_getDxSource,getDxSource,PyHorizontal,Horizontal)
|
||||
DirectGetLongAttribute(PyHorizontal_getDxTarget,getDxTarget,PyHorizontal,Horizontal)
|
||||
DirectSetLongAttribute(PyHorizontal_setY ,setY ,"Horizontal.setY",PyHorizontal,Horizontal)
|
||||
DirectSetLongAttribute(PyHorizontal_setDxSource,setDxSource,"Horizontal.setDxSource",PyHorizontal,Horizontal)
|
||||
DirectSetLongAttribute(PyHorizontal_setDxTarget,setDxTarget,"Horizontal.setDxTarget",PyHorizontal,Horizontal)
|
||||
DirectSetLongAttribute(PyHorizontal_setY ,setY ,PyHorizontal,Horizontal)
|
||||
DirectSetLongAttribute(PyHorizontal_setDxSource,setDxSource,PyHorizontal,Horizontal)
|
||||
DirectSetLongAttribute(PyHorizontal_setDxTarget,setDxTarget,PyHorizontal,Horizontal)
|
||||
|
||||
// Standart destroy (Attribute).
|
||||
DBoDestroyAttribute(PyHorizontal_destroy, PyHorizontal)
|
||||
|
|
|
@ -129,6 +129,16 @@ using namespace Hurricane;
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
int PyAny_AsInt ( PyObject* object )
|
||||
{
|
||||
long value = 0;
|
||||
|
||||
if (PyObject_IsInstance(object,(PyObject*)&PyInt_Type )) value = PyInt_AsLong ( object );
|
||||
else if (PyObject_IsInstance(object,(PyObject*)&PyLong_Type)) value = PyLong_AsLong( object );
|
||||
return (int)value;
|
||||
}
|
||||
|
||||
|
||||
long PyAny_AsLong ( PyObject* object )
|
||||
{
|
||||
long value = 0;
|
||||
|
|
|
@ -73,45 +73,45 @@ extern "C" {
|
|||
|
||||
static PyObject* PyInstance_create ( PyObject*, PyObject *args )
|
||||
{
|
||||
trace << "PyInstance_create ()" << endl;
|
||||
trace << "PyInstance_create()" << endl;
|
||||
|
||||
Instance* instance = NULL;
|
||||
PyObject* arg0;
|
||||
PyObject* arg1;
|
||||
PyObject* arg2;
|
||||
PyObject* arg3;
|
||||
PyObject* arg0 = NULL;
|
||||
PyObject* arg1 = NULL;
|
||||
PyObject* arg2 = NULL;
|
||||
PyObject* arg3 = NULL;
|
||||
|
||||
HTRY
|
||||
__cs.init ("Instance.create");
|
||||
if ( ! PyArg_ParseTuple(args,"O&O&O&|O&:Instance.new"
|
||||
,Converter,&arg0
|
||||
,Converter,&arg1
|
||||
,Converter,&arg2
|
||||
,Converter,&arg3
|
||||
)) {
|
||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Instance constructor." );
|
||||
__cs.init( "Instance.create" );
|
||||
if (not PyArg_ParseTuple(args,"O&O&O&|O&:Instance.create"
|
||||
,Converter,&arg0
|
||||
,Converter,&arg1
|
||||
,Converter,&arg2
|
||||
,Converter,&arg3
|
||||
)) {
|
||||
PyErr_SetString( ConstructorError, "Instance.create(): Invalid number of parameters." );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( __cs.getObjectIds() == ":ent:string:ent") {
|
||||
instance = Instance::create(
|
||||
PYCELL_O(arg0),
|
||||
Name(PyString_AsString(arg1)),
|
||||
PYCELL_O(arg2) );
|
||||
} else if ( __cs.getObjectIds() == ":ent:string:ent:transfo") {
|
||||
instance = Instance::create(
|
||||
PYCELL_O(arg0),
|
||||
Name(PyString_AsString(arg1)),
|
||||
PYCELL_O(arg2),
|
||||
*PYTRANSFORMATION_O(arg3),
|
||||
Instance::PlacementStatus::PLACED);
|
||||
if (__cs.getObjectIds() == ":ent:string:ent") {
|
||||
instance = Instance::create( PYCELL_O(arg0)
|
||||
, Name(PyString_AsString(arg1))
|
||||
, PYCELL_O(arg2)
|
||||
);
|
||||
} else if (__cs.getObjectIds() == ":ent:string:ent:transfo") {
|
||||
instance = Instance::create( PYCELL_O(arg0)
|
||||
, Name(PyString_AsString(arg1))
|
||||
, PYCELL_O(arg2)
|
||||
, *PYTRANSFORMATION_O(arg3)
|
||||
, Instance::PlacementStatus::PLACED
|
||||
);
|
||||
} else {
|
||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Instance constructor." );
|
||||
PyErr_SetString( ConstructorError, "Instance.create(): Bad type of parameter(s)." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
|
||||
return PyInstance_Link ( instance );
|
||||
return PyInstance_Link( instance );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ extern "C" {
|
|||
|
||||
|
||||
PyMethodDef PyLibrary_Methods[] =
|
||||
{ { "create" , (PyCFunction)PyLibrary_create , METH_NOARGS|METH_STATIC
|
||||
{ { "create" , (PyCFunction)PyLibrary_create , METH_VARARGS|METH_STATIC
|
||||
, "Creates a new library." }
|
||||
, { "getName" , (PyCFunction)PyLibrary_getName , METH_NOARGS , "Returns the name of the library." }
|
||||
, { "getLibrary", (PyCFunction)PyLibrary_getSubLibrary, METH_VARARGS, "Get the sub-library named <name>" }
|
||||
|
|
|
@ -114,8 +114,8 @@ extern "C" {
|
|||
// Standart Accessors (Attributes).
|
||||
DirectGetLongAttribute(PyPoint_getX,getX,PyPoint,Point)
|
||||
DirectGetLongAttribute(PyPoint_getY,getY,PyPoint,Point)
|
||||
DirectSetLongAttribute(PyPoint_SetX,setX,"Point.setX",PyPoint,Point)
|
||||
DirectSetLongAttribute(PyPoint_SetY,setY,"Point.setY",PyPoint,Point)
|
||||
DirectSetLongAttribute(PyPoint_SetX,setX,PyPoint,Point)
|
||||
DirectSetLongAttribute(PyPoint_SetY,setY,PyPoint,Point)
|
||||
|
||||
|
||||
// Standart destroy (Attribute).
|
||||
|
|
|
@ -53,8 +53,8 @@ extern "C" {
|
|||
DirectGetLongAttribute(PyRoutingPad_getSourceY ,getSourceY ,PyRoutingPad,RoutingPad)
|
||||
DirectGetLongAttribute(PyRoutingPad_getTargetX ,getTargetX ,PyRoutingPad,RoutingPad)
|
||||
DirectGetLongAttribute(PyRoutingPad_getTargetY ,getTargetY ,PyRoutingPad,RoutingPad)
|
||||
// DirectSetLongAttribute(PyRoutingPad_setX ,setX ,"RoutingPad.setX",PyRoutingPad,RoutingPad)
|
||||
// DirectSetLongAttribute(PyRoutingPad_setY ,setY ,"RoutingPad.setY",PyRoutingPad,RoutingPad)
|
||||
//DirectSetLongAttribute(PyRoutingPad_setX ,setX ,PyRoutingPad,RoutingPad)
|
||||
//DirectSetLongAttribute(PyRoutingPad_setY ,setY ,PyRoutingPad,RoutingPad)
|
||||
|
||||
// Standart destroy (Attribute).
|
||||
DBoDestroyAttribute(PyRoutingPad_destroy, PyRoutingPad)
|
||||
|
|
|
@ -55,7 +55,7 @@ extern "C" {
|
|||
DirectGetLongAttribute(PySegment_getTargetX,getTargetX,PySegment,Segment)
|
||||
DirectGetLongAttribute(PySegment_getTargetY,getTargetY,PySegment,Segment)
|
||||
DirectGetLongAttribute(PySegment_getWidth ,getWidth ,PySegment,Segment)
|
||||
DirectSetLongAttribute(PySegment_setWidth ,setWidth ,"Segment.setWidth",PySegment,Segment)
|
||||
DirectSetLongAttribute(PySegment_setWidth ,setWidth ,PySegment,Segment)
|
||||
DirectVoidMethod(Segment,segment,invert)
|
||||
accessorHook(getSourceHook,PySegment,Segment)
|
||||
accessorHook(getTargetHook,PySegment,Segment)
|
||||
|
|
|
@ -47,9 +47,9 @@ extern "C" {
|
|||
DirectGetLongAttribute(PyVertical_getX ,getX ,PyVertical,Vertical)
|
||||
DirectGetLongAttribute(PyVertical_getDySource,getDySource,PyVertical,Vertical)
|
||||
DirectGetLongAttribute(PyVertical_getDyTarget,getDyTarget,PyVertical,Vertical)
|
||||
DirectSetLongAttribute(PyVertical_setX,setX,"Vertical.setX",PyVertical,Vertical)
|
||||
DirectSetLongAttribute(PyVertical_setDySource,setDySource,"Vertical.setDySource",PyVertical,Vertical)
|
||||
DirectSetLongAttribute(PyVertical_setDyTarget,setDyTarget,"Vertical.setDyTarget",PyVertical,Vertical)
|
||||
DirectSetLongAttribute(PyVertical_setX ,setX ,PyVertical,Vertical)
|
||||
DirectSetLongAttribute(PyVertical_setDySource,setDySource,PyVertical,Vertical)
|
||||
DirectSetLongAttribute(PyVertical_setDyTarget,setDyTarget,PyVertical,Vertical)
|
||||
|
||||
// Standard destroy (Attribute).
|
||||
DBoDestroyAttribute(PyVertical_destroy, PyVertical)
|
||||
|
|
|
@ -107,6 +107,7 @@ using namespace std;
|
|||
extern ConverterState __cs;
|
||||
extern int __objectOffset;
|
||||
|
||||
int PyAny_AsInt ( PyObject* object );
|
||||
long PyAny_AsLong ( PyObject* object );
|
||||
|
||||
|
||||
|
@ -257,7 +258,7 @@ extern "C" {
|
|||
# define DirectGetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetBoolAttribute()") \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
if (cobject->FUNC_NAME()) \
|
||||
Py_RETURN_TRUE; \
|
||||
Py_RETURN_FALSE; \
|
||||
|
@ -272,7 +273,7 @@ extern "C" {
|
|||
# define DirectIsAFromCStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectIsAFromCStringAttribute()") \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
HTRY \
|
||||
char* value = NULL; \
|
||||
if ( !PyArg_ParseTuple(args, "s:", &value) ) \
|
||||
|
@ -287,13 +288,13 @@ extern "C" {
|
|||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Long.
|
||||
// Attribute Method Macro For Int.
|
||||
|
||||
# define DirectGetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
# define DirectGetIntAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetLongAttribute()") \
|
||||
return ( PyLong_FromLong(cobject->FUNC_NAME()) ); \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
return Py_BuildValue("i", cobject->FUNC_NAME()); \
|
||||
}
|
||||
|
||||
|
||||
|
@ -303,8 +304,19 @@ extern "C" {
|
|||
# define DirectGetUIntAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetUIntAttribute()") \
|
||||
return ( Py_BuildValue ("I",cobject->FUNC_NAME()) ); \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
return Py_BuildValue ("I",cobject->FUNC_NAME()); \
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Long.
|
||||
|
||||
# define DirectGetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
return Py_BuildValue("l", cobject->FUNC_NAME()); \
|
||||
}
|
||||
|
||||
|
||||
|
@ -314,8 +326,8 @@ extern "C" {
|
|||
# define DirectGetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetDoubleAttribute()") \
|
||||
return ( Py_BuildValue ("d",cobject->FUNC_NAME()) ); \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
return Py_BuildValue ("d",cobject->FUNC_NAME()); \
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,8 +337,19 @@ extern "C" {
|
|||
# define DirectGetStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetStringAttribute()") \
|
||||
return ( Py_BuildValue ("s",cobject->FUNC_NAME().c_str()) ); \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
return Py_BuildValue ("s",cobject->FUNC_NAME().c_str()); \
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Name.
|
||||
|
||||
# define DirectGetNameAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
return Py_BuildValue ("s",getString(cobject->FUNC_NAME()).c_str()); \
|
||||
}
|
||||
|
||||
|
||||
|
@ -515,15 +538,17 @@ extern "C" {
|
|||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Booleans.
|
||||
|
||||
#define DirectSetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,STR_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
#define DirectSetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,STR_FUNC_NAME "()") \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME "()") \
|
||||
\
|
||||
HTRY \
|
||||
PyObject* arg0; \
|
||||
if ( not PyArg_ParseTuple ( args, "O:" STR_FUNC_NAME, &arg0 ) or PyBool_Check(arg0) ) \
|
||||
if (not PyArg_ParseTuple( args, "O:" #FUNC_NAME, &arg0 ) or not PyBool_Check(arg0) ) { \
|
||||
PyErr_SetString(ConstructorError, #SELF_TYPE"."#FUNC_NAME"(): Argument is not a boolean."); \
|
||||
return NULL; \
|
||||
} \
|
||||
\
|
||||
(PyObject_IsTrue(arg0)) ? cobject->FUNC_NAME (true) : cobject->FUNC_NAME (false); \
|
||||
HCATCH \
|
||||
|
@ -533,35 +558,54 @@ extern "C" {
|
|||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Long.
|
||||
// Attribute Method Macro For Int.
|
||||
|
||||
#define DirectSetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \
|
||||
#define DirectSetIntAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetLongAttribute()") \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
\
|
||||
HTRY \
|
||||
PyObject* arg0; \
|
||||
if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \
|
||||
if ( ! PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \
|
||||
return ( NULL ); \
|
||||
cobject->FUNC_NAME ( Isobar::PyAny_AsLong(arg0) ); \
|
||||
cobject->FUNC_NAME ( Isobar::PyAny_AsInt(arg0) ); \
|
||||
HCATCH \
|
||||
\
|
||||
Py_RETURN_NONE; \
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Long.
|
||||
|
||||
#define DirectSetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
\
|
||||
HTRY \
|
||||
PyObject* arg0; \
|
||||
if ( ! PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \
|
||||
return ( NULL ); \
|
||||
cobject->FUNC_NAME ( Isobar::PyAny_AsLong(arg0) ); \
|
||||
HCATCH \
|
||||
\
|
||||
Py_RETURN_NONE; \
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Double.
|
||||
|
||||
#define DirectSetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \
|
||||
#define DirectSetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetDoubleAttribute()") \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
\
|
||||
HTRY \
|
||||
PyObject* arg0; \
|
||||
if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \
|
||||
if ( ! PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \
|
||||
return ( NULL ); \
|
||||
cobject->FUNC_NAME ( PyFloat_AsDouble(arg0) ); \
|
||||
HCATCH \
|
||||
|
@ -573,14 +617,14 @@ extern "C" {
|
|||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For C String (char*).
|
||||
|
||||
#define DirectSetCStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \
|
||||
#define DirectSetCStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
|
||||
{ \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetCStringAttribute()") \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \
|
||||
\
|
||||
HTRY \
|
||||
char* value = NULL; \
|
||||
if ( !PyArg_ParseTuple(args, "s:" PY_FORMAT, &value) ) \
|
||||
if ( !PyArg_ParseTuple(args, "s:" #SELF_TYPE"."#FUNC_NAME"()", &value) ) \
|
||||
return NULL; \
|
||||
cobject->FUNC_NAME ( value ); \
|
||||
HCATCH \
|
||||
|
|
|
@ -95,9 +95,9 @@ extern "C" {
|
|||
DirectGetDoubleAttribute(PyHSVr_GetHue ,getHue ,PyHSVr,DisplayStyle::HSVr)
|
||||
DirectGetDoubleAttribute(PyHSVr_GetSaturation,getSaturation,PyHSVr,DisplayStyle::HSVr)
|
||||
DirectGetDoubleAttribute(PyHSVr_GetValue ,getValue ,PyHSVr,DisplayStyle::HSVr)
|
||||
DirectSetDoubleAttribute(PyHSVr_SetHue ,setHue ,"HSVr.setHue" ,PyHSVr,DisplayStyle::HSVr)
|
||||
DirectSetDoubleAttribute(PyHSVr_SetSaturation,setSaturation,"HSVr.setSaturation",PyHSVr,DisplayStyle::HSVr)
|
||||
DirectSetDoubleAttribute(PyHSVr_SetValue ,setValue ,"HSVr.setValue" ,PyHSVr,DisplayStyle::HSVr)
|
||||
DirectSetDoubleAttribute(PyHSVr_SetHue ,setHue ,PyHSVr,DisplayStyle::HSVr)
|
||||
DirectSetDoubleAttribute(PyHSVr_SetSaturation,setSaturation,PyHSVr,DisplayStyle::HSVr)
|
||||
DirectSetDoubleAttribute(PyHSVr_SetValue ,setValue ,PyHSVr,DisplayStyle::HSVr)
|
||||
|
||||
// Standart Predicates (Attributes).
|
||||
DirectGetBoolAttribute(PyHSVr_IsId,isId,PyHSVr,DisplayStyle::HSVr)
|
||||
|
|
Loading…
Reference in New Issue