[MOAB-dev] r3138 - MOAB/trunk/tools/iMesh/python

jvporter at wisc.edu jvporter at wisc.edu
Mon Sep 14 17:50:22 CDT 2009


Author: jvporter
Date: 2009-09-14 17:50:22 -0500 (Mon, 14 Sep 2009)
New Revision: 3138

Modified:
   MOAB/trunk/tools/iMesh/python/iBase.c
   MOAB/trunk/tools/iMesh/python/iBase_Python.h
   MOAB/trunk/tools/iMesh/python/iMesh.c
   MOAB/trunk/tools/iMesh/python/iMesh_Python.h
Log:
Make PyTAPS more friendly to being extended via C/C++.


Modified: MOAB/trunk/tools/iMesh/python/iBase.c
===================================================================
--- MOAB/trunk/tools/iMesh/python/iBase.c	2009-09-14 18:04:38 UTC (rev 3137)
+++ MOAB/trunk/tools/iMesh/python/iBase.c	2009-09-14 22:50:22 UTC (rev 3138)
@@ -1,5 +1,6 @@
 #define _IBASE_MODULE
 #include "iBase_Python.h"
+#include "common.h"
 
 #include <numpy/arrayobject.h>
 

Modified: MOAB/trunk/tools/iMesh/python/iBase_Python.h
===================================================================
--- MOAB/trunk/tools/iMesh/python/iBase_Python.h	2009-09-14 18:04:38 UTC (rev 3137)
+++ MOAB/trunk/tools/iMesh/python/iBase_Python.h	2009-09-14 22:50:22 UTC (rev 3138)
@@ -1,11 +1,13 @@
 #ifndef PYTAPS_IBASE_PYTHON_H
 #define PYTAPS_IBASE_PYTHON_H
 
-#include "common.h"
-
 #include <Python.h>
 #include <iBase.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct
 {
     PyObject_HEAD
@@ -109,4 +111,8 @@
 
 #endif
 
+#ifdef __cplusplus
+} // extern "C"
 #endif
+
+#endif

Modified: MOAB/trunk/tools/iMesh/python/iMesh.c
===================================================================
--- MOAB/trunk/tools/iMesh/python/iMesh.c	2009-09-14 18:04:38 UTC (rev 3137)
+++ MOAB/trunk/tools/iMesh/python/iMesh.c	2009-09-14 22:50:22 UTC (rev 3138)
@@ -1,7 +1,22 @@
 #include "errors.h"
+#include "common.h"
 #include "iMesh_Python.h"
-#include "iBase_Python.h"
+#include "numpy_extensions.h"
 
+static enum iBase_TagValueType char_to_type(char c);
+static char type_to_char(enum iBase_TagValueType t);
+
+static PyTypeObject iMeshIter_Type;
+static PyTypeObject iMeshEntitySet_Type;
+static int NPY_IMESHENTSET;
+
+static PyTypeObject iMeshTag_Type;
+static int NPY_IMESHTAG;
+
+static iMeshEntitySet_Object * iMeshEntitySet_New(iMesh_Object *mesh);
+static iMeshTag_Object * iMeshTag_New(iMesh_Object *mesh);
+
+
 /* TODO: these are never freed! */
 static PyObject *g_helper_module;
 static PyObject *g_adj_list;

Modified: MOAB/trunk/tools/iMesh/python/iMesh_Python.h
===================================================================
--- MOAB/trunk/tools/iMesh/python/iMesh_Python.h	2009-09-14 18:04:38 UTC (rev 3137)
+++ MOAB/trunk/tools/iMesh/python/iMesh_Python.h	2009-09-14 22:50:22 UTC (rev 3138)
@@ -1,34 +1,20 @@
 #ifndef PYTAPS_IMESH_PYTHON_H
 #define PYTAPS_IMESH_PYTHON_H
 
-#include "common.h"
-
 #include <Python.h>
 #include <iMesh.h>
-
-#define PY_IBASE_UNIQUE_SYMBOL itaps_IBASE_API
 #include "iBase_Python.h"
 
-#define PY_ARRAY_UNIQUE_SYMBOL itaps_ARRAY_API
-#include "numpy_extensions.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-static int checkError(iMesh_Instance mesh,int err);
-static enum iBase_TagValueType char_to_type(char c);
-static char type_to_char(enum iBase_TagValueType t);
-
-static PyObject *
-AdjacencyList_New(PyObject *adj,PyObject *offsets);
-static PyObject *
-IndexedAdjacencyList_New(PyObject *ents, PyObject *adj,PyObject *indices,
-                         PyObject *offsets);
-
 typedef struct
 {
     PyObject_HEAD
     iMesh_Instance mesh;
 } iMesh_Object;
 
-
 typedef struct
 {
     PyObject_HEAD
@@ -41,19 +27,12 @@
     };
 } iMeshIter_Object;
 
-static PyTypeObject iMeshIter_Type;
-
 typedef struct
 {
     iBaseEntitySet_Object set;
     iMesh_Object *mesh;
 } iMeshEntitySet_Object;
 
-static PyTypeObject iMeshEntitySet_Type;
-static int NPY_IMESHENTSET;
-
-static iMeshEntitySet_Object * iMeshEntitySet_New(iMesh_Object *mesh);
-
 #define iMeshEntitySet_NewRaw()                         \
     (iMeshEntitySet_Object*)PyObject_CallObject(        \
         (PyObject*)&iMeshEntitySet_Type,NULL)
@@ -62,7 +41,7 @@
     PyObject_TypeCheck((o),&iMeshEntitySet_Type)
 
 #define iMeshEntitySet_GetMesh(o)                       \
-    ((iMeshEntitySet_Object*)(o))->mesh
+    ( ((iMeshEntitySet_Object*)(o))->mesh )
 
 typedef struct
 {
@@ -70,11 +49,6 @@
     iMesh_Object *mesh;
 } iMeshTag_Object;
 
-static PyTypeObject iMeshTag_Type;
-static int NPY_IMESHTAG;
-
-static iMeshTag_Object * iMeshTag_New(iMesh_Object *mesh);
-
 #define iMeshTag_NewRaw()                               \
     (iMeshTag_Object*)PyObject_CallObject(              \
         (PyObject*)&iMeshTag_Type,NULL)
@@ -83,6 +57,11 @@
     PyObject_TypeCheck((o),&iMeshTag_Type)
 
 #define iMeshTag_GetMesh(o)                             \
-    ((iMeshTag_Object*)(o))->mesh
+    ( ((iMeshTag_Object*)(o))->mesh )
 
+
+#ifdef __cplusplus
+} // extern "C"
 #endif
+
+#endif



More information about the moab-dev mailing list