Exported Layer::getTopEnclosure() in Python interface.

This commit is contained in:
Jean-Paul Chaput 2020-11-14 18:51:41 +01:00
parent e4d821e5b6
commit a4eb811bcb
3 changed files with 111 additions and 66 deletions

View File

@ -707,6 +707,7 @@ extern "C" {
__cs.addType( "inst" , &PyTypeInstance , "<Instance>" , false, "ent" ); __cs.addType( "inst" , &PyTypeInstance , "<Instance>" , false, "ent" );
__cs.addType( "instCol" , &PyTypeInstanceCollection , "<InstanceCollection>" , false ); __cs.addType( "instCol" , &PyTypeInstanceCollection , "<InstanceCollection>" , false );
__cs.addType( "mat" , &PyTypeMaterial , "<Material>" , false ); __cs.addType( "mat" , &PyTypeMaterial , "<Material>" , false );
__cs.addType( "layer" , &PyTypeLayer , "<Layer>" , false );
__cs.addType( "basicLayer" , &PyTypeBasicLayer , "<BasicLayer>" , false, "layer" ); __cs.addType( "basicLayer" , &PyTypeBasicLayer , "<BasicLayer>" , false, "layer" );
__cs.addType( "regLayer" , &PyTypeRegularLayer , "<RegularLayer>" , false, "layer" ); __cs.addType( "regLayer" , &PyTypeRegularLayer , "<RegularLayer>" , false, "layer" );
__cs.addType( "contLayer" , &PyTypeContactLayer , "<ContactLayer>" , false, "layer" ); __cs.addType( "contLayer" , &PyTypeContactLayer , "<ContactLayer>" , false, "layer" );
@ -717,7 +718,6 @@ extern "C" {
__cs.addType( "blayerColl" , &PyTypeBasicLayerCollection , "<BasicLayerCollection>" , false ); __cs.addType( "blayerColl" , &PyTypeBasicLayerCollection , "<BasicLayerCollection>" , false );
__cs.addType( "rlayerColl" , &PyTypeRegularLayerCollection, "<RegularLayerCollection>", false ); __cs.addType( "rlayerColl" , &PyTypeRegularLayerCollection, "<RegularLayerCollection>", false );
__cs.addType( "vlayerColl" , &PyTypeViaLayerCollection , "<ViaLayerCollection>" , false ); __cs.addType( "vlayerColl" , &PyTypeViaLayerCollection , "<ViaLayerCollection>" , false );
__cs.addType( "layer" , &PyTypeLayer , "<Layer>" , false );
__cs.addType( "lmask" , &PyTypeLayerMask , "<Layer::Mask>" , false ); __cs.addType( "lmask" , &PyTypeLayerMask , "<Layer::Mask>" , false );
__cs.addType( "library" , &PyTypeLibrary , "<Library>" , false ); __cs.addType( "library" , &PyTypeLibrary , "<Library>" , false );
__cs.addType( "ref" , &PyTypeReference , "<Reference>" , false, "ent" ); __cs.addType( "ref" , &PyTypeReference , "<Reference>" , false, "ent" );

View File

@ -133,32 +133,73 @@ extern "C" {
static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \
{ \ { \
cdebug_log(20,0) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ cdebug_log(20,0) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \
\
Layer* rlayer = NULL; \ Layer* rlayer = NULL; \
\ \
HTRY \ HTRY \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \
PyObject* arg0 = NULL; \
bool useSymbolic = true; \
\ \
PyObject* arg0 = NULL; \ if (PyArg_ParseTuple( args, "|O:"#SELF_TYPE"."#FUNC_NAME"()", &arg0)) { \
bool useSymbolic = true; \ if (arg0) useSymbolic = PyObject_IsTrue(arg0); \
\ } else { \
if (PyArg_ParseTuple( args, "|O:"#SELF_TYPE"."#FUNC_NAME"()", &arg0)) { \ PyErr_SetString( ConstructorError \
if (arg0 != NULL) { \ , #SELF_TYPE"."#FUNC_NAME"(): Takes exactly one boolean parameter." ); \
useSymbolic = PyObject_IsTrue(arg0); \ return NULL; \
} \ } \
} else { \ rlayer = const_cast<SELF_TYPE*>( cobject->FUNC_NAME(useSymbolic) ); \
PyErr_SetString ( ConstructorError \
, "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \
return NULL; \
} \
rlayer = const_cast<SELF_TYPE*>(cobject->FUNC_NAME(useSymbolic)); \
HCATCH \ HCATCH \
\ \
if (rlayer == NULL) Py_RETURN_NONE; \ if (not rlayer) Py_RETURN_NONE; \
return PyLayer_LinkDerived(rlayer); \ return PyLayer_LinkDerived(rlayer); \
} }
# define accessorLayerFromUInt(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \
{ \
cdebug_log(20,0) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \
Layer* rlayer = NULL; \
\
HTRY \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \
unsigned int flags = 0; \
\
if (not PyArg_ParseTuple( args, "I:"#SELF_TYPE"."#FUNC_NAME"()", &flags)) { \
PyErr_SetString( ConstructorError \
, #SELF_TYPE"."#FUNC_NAME"(): Takes exactly one integer parameter." ); \
return NULL; \
} \
rlayer = const_cast<SELF_TYPE*>( cobject->FUNC_NAME(uint32_t(flags)) ); \
HCATCH \
\
if (not rlayer) Py_RETURN_NONE; \
return PyLayer_LinkDerived(rlayer); \
}
# define accessorDbuFromUInt(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \
{ \
cdebug_log(20,0) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \
DbU::Unit u = 0; \
\
HTRY \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \
unsigned int flags = 0; \
\
if (not PyArg_ParseTuple( args, "I:"#SELF_TYPE"."#FUNC_NAME"()", &flags)) { \
PyErr_SetString( ConstructorError \
, #SELF_TYPE"."#FUNC_NAME"(): Takes exactly one integer parameter." ); \
return NULL; \
} \
u = cobject->FUNC_NAME( uint32_t(flags) ); \
HCATCH \
\
return PyDbU_FromLong(u); \
}
# define predicateFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ # define predicateFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \
{ \ { \
@ -309,28 +350,30 @@ extern "C" {
GetNameMethod (Layer, layer) GetNameMethod (Layer, layer)
predicateFromLayer ( above ,PyLayer,Layer) predicateFromLayer ( above ,PyLayer,Layer)
predicateFromLayer ( below ,PyLayer,Layer) predicateFromLayer ( below ,PyLayer,Layer)
predicateFromLayer ( contains ,PyLayer,Layer) predicateFromLayer ( contains ,PyLayer,Layer)
predicateFromLayer ( intersect ,PyLayer,Layer) predicateFromLayer ( intersect ,PyLayer,Layer)
predicateFromVoid ( isSymbolic ,PyLayer,Layer) predicateFromVoid ( isSymbolic ,PyLayer,Layer)
predicateFromVoid ( isBlockage ,PyLayer,Layer) predicateFromVoid ( isBlockage ,PyLayer,Layer)
accessorDbuFromOptBasicLayer( getExtentionCap ,PyLayer,Layer) accessorDbuFromOptBasicLayer( getExtentionCap ,PyLayer,Layer)
accessorDbuFromOptBasicLayer( getExtentionWidth,PyLayer,Layer) accessorDbuFromOptBasicLayer( getExtentionWidth ,PyLayer,Layer)
accessorCollectionFromVoid ( getBasicLayers ,PyLayer,Layer,BasicLayer) accessorCollectionFromVoid ( getBasicLayers ,PyLayer,Layer,BasicLayer)
accessorMaskFromVoid ( getMask ,PyLayer,Layer) accessorMaskFromVoid ( getMask ,PyLayer,Layer)
accessorMaskFromVoid ( getExtractMask ,PyLayer,Layer) accessorMaskFromVoid ( getExtractMask ,PyLayer,Layer)
accessorLayerFromVoid ( getBlockageLayer ,PyLayer,Layer) accessorLayerFromVoid ( getBlockageLayer ,PyLayer,Layer)
accessorLayerFromVoid ( getCut ,PyLayer,Layer) accessorLayerFromVoid ( getCut ,PyLayer,Layer)
accessorLayerFromVoid ( getTop ,PyLayer,Layer) accessorLayerFromVoid ( getTop ,PyLayer,Layer)
accessorLayerFromVoid ( getBottom ,PyLayer,Layer) accessorLayerFromVoid ( getBottom ,PyLayer,Layer)
accessorLayerFromLayer ( getOpposite ,PyLayer,Layer) accessorLayerFromLayer ( getOpposite ,PyLayer,Layer)
accessorLayerFromOptBool ( getMetalAbove ,PyLayer,Layer) accessorLayerFromOptBool ( getMetalAbove ,PyLayer,Layer)
accessorLayerFromOptBool ( getMetalBelow ,PyLayer,Layer) accessorLayerFromOptBool ( getMetalBelow ,PyLayer,Layer)
accessorLayerFromOptBool ( getCutAbove ,PyLayer,Layer) accessorLayerFromOptBool ( getCutAbove ,PyLayer,Layer)
accessorLayerFromOptBool ( getCutBelow ,PyLayer,Layer) accessorLayerFromOptBool ( getCutBelow ,PyLayer,Layer)
DirectGetLongAttribute (PyLayer_getMinimalSize ,getMinimalSize ,PyLayer,Layer) accessorDbuFromUInt ( getTopEnclosure ,PyLayer,Layer)
DirectGetLongAttribute (PyLayer_getMinimalSpacing,getMinimalSpacing,PyLayer,Layer) accessorDbuFromUInt ( getBottomEnclosure,PyLayer,Layer)
DirectGetLongAttribute (PyLayer_getMinimalSize ,getMinimalSize ,PyLayer,Layer)
DirectGetLongAttribute (PyLayer_getMinimalSpacing,getMinimalSpacing ,PyLayer,Layer)
SetNameMethod(Layer, layer) SetNameMethod(Layer, layer)
updatorFromDbu (setMinimalSize ,PyLayer,Layer) updatorFromDbu (setMinimalSize ,PyLayer,Layer)
@ -379,6 +422,10 @@ extern "C" {
, "Returns the cut layer below this one." } , "Returns the cut layer below this one." }
, { "getEnclosure" , (PyCFunction)PyLayer_getEnclosure , METH_VARARGS , { "getEnclosure" , (PyCFunction)PyLayer_getEnclosure , METH_VARARGS
, "Returns the enclosure (global or for one BasicLayer)." } , "Returns the enclosure (global or for one BasicLayer)." }
, { "getTopEnclosure" , (PyCFunction)PyLayer_getTopEnclosure , METH_VARARGS
, "Returns the top layer enclosure." }
, { "getBottomEnclosure" , (PyCFunction)PyLayer_getBottomEnclosure , METH_VARARGS
, "Returns the bottom layer enclosure." }
, { "getExtentionCap" , (PyCFunction)PyLayer_getExtentionCap , METH_VARARGS , { "getExtentionCap" , (PyCFunction)PyLayer_getExtentionCap , METH_VARARGS
, "Returns the extention cap (global or for one BasicLayer)." } , "Returns the extention cap (global or for one BasicLayer)." }
, { "getExtentionWidth" , (PyCFunction)PyLayer_getExtentionWidth , METH_VARARGS , { "getExtentionWidth" , (PyCFunction)PyLayer_getExtentionWidth , METH_VARARGS

View File

@ -282,35 +282,33 @@ extern "C" {
} }
# define predicateFromLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ # define predicateFromLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \
{ \ { \
cdebug_log(20,0) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ cdebug_log(20,0) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \
\ \
HTRY \ HTRY \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \
\ PyObject* arg0 = NULL; \
PyObject* arg0 = NULL; \ bool rvalue = false; \
bool rvalue = false; \ __cs.init (#SELF_TYPE"."#FUNC_NAME"()"); \
\ if (PyArg_ParseTuple( args, "O&:"#SELF_TYPE"."#FUNC_NAME"()", Converter, &arg0)) { \
__cs.init (#SELF_TYPE"."#FUNC_NAME"()"); \ if (__cs.getObjectIds() == ":layer") \
if (PyArg_ParseTuple( args, "O&:"#SELF_TYPE"."#FUNC_NAME"()", Converter, &arg0)) { \ rvalue = cobject->FUNC_NAME( PYLAYER_O(arg0) ); \
if ( __cs.getObjectIds() == ":layer" ) \ else { \
rvalue = cobject->FUNC_NAME( PYLAYER_O(arg0) ); \ PyErr_SetString ( ConstructorError \
else { \ , #SELF_TYPE"."#FUNC_NAME"(): The sole parameter is not a Layer." ); \
PyErr_SetString ( ConstructorError \ return NULL; \
, "invalid parameter type for "#SELF_TYPE"."#FUNC_NAME"()." ); \ } \
return NULL; \ } else { \
} \ PyErr_SetString ( ConstructorError \
} else { \ , #SELF_TYPE"."#FUNC_NAME"(): Takes only *one* Layer parameter. " ); \
PyErr_SetString ( ConstructorError \ return NULL; \
, "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \ } \
return NULL; \ if (rvalue) Py_RETURN_TRUE; \
} \ HCATCH \
if (rvalue) Py_RETURN_TRUE; \ \
HCATCH \ Py_RETURN_FALSE; \
\
Py_RETURN_FALSE; \
} }