[cig-commits] r14688 - in cs/spatialdata-0.1/trunk: libsrc/units tests/libtests/units

brad at geodynamics.org brad at geodynamics.org
Mon Apr 13 17:28:38 PDT 2009


Author: brad
Date: 2009-04-13 17:28:38 -0700 (Mon, 13 Apr 2009)
New Revision: 14688

Modified:
   cs/spatialdata-0.1/trunk/libsrc/units/Parser.cc
   cs/spatialdata-0.1/trunk/libsrc/units/Parser.hh
   cs/spatialdata-0.1/trunk/tests/libtests/units/Makefile.am
Log:
Fixed linking of units tests.

Modified: cs/spatialdata-0.1/trunk/libsrc/units/Parser.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/units/Parser.cc	2009-04-13 23:56:19 UTC (rev 14687)
+++ cs/spatialdata-0.1/trunk/libsrc/units/Parser.cc	2009-04-14 00:28:38 UTC (rev 14688)
@@ -24,8 +24,11 @@
 { // constructor
   // Should check for NULL, decode the exception, and throw a C++ equivalent
   PyObject *mod = PyImport_ImportModule("pyre.units");
+  assert(0 != mod);
   PyObject *cls = PyObject_GetAttrString(mod, "parser");
-  this->_p      = PyObject_CallFunctionObjArgs(cls, NULL);
+  assert(0 != cls);
+  _parser      = PyObject_CallFunctionObjArgs(cls, NULL);
+  assert(0 != _parser);
   Py_DECREF(cls);
   Py_DECREF(mod);
 } // constructor
@@ -34,7 +37,7 @@
 // Default destructor
 spatialdata::units::Parser::~Parser(void)
 { // destructor
-  Py_DECREF(this->_p);
+  Py_DECREF(_parser); _parser = 0;
 } // destructor
 
 // ----------------------------------------------------------------------
@@ -55,7 +58,7 @@
    * Any nontrivial setup/teardown should be moved to
    * constructor/destructor.
    */
-  PyObject *pyUnit  = PyObject_CallFunction(this->_p, "s", units);
+  PyObject *pyUnit  = PyObject_CallFunction(_parser, "s", units);
   PyObject *pyScale = PyObject_GetAttrString(pyUnit, "value");
   scale             = PyFloat_AsDouble(pyScale);
   Py_DECREF(pyScale);

Modified: cs/spatialdata-0.1/trunk/libsrc/units/Parser.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/units/Parser.hh	2009-04-13 23:56:19 UTC (rev 14687)
+++ cs/spatialdata-0.1/trunk/libsrc/units/Parser.hh	2009-04-14 00:28:38 UTC (rev 14688)
@@ -52,7 +52,7 @@
 private :
   // PRIVATE MEMBERS ////////////////////////////////////////////////////
 
-  PyObject *_p;
+  PyObject* _parser;
 }; // class Parser
 
 #endif // spatialdata_units_parser_hh

Modified: cs/spatialdata-0.1/trunk/tests/libtests/units/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/units/Makefile.am	2009-04-13 23:56:19 UTC (rev 14687)
+++ cs/spatialdata-0.1/trunk/tests/libtests/units/Makefile.am	2009-04-14 00:28:38 UTC (rev 14688)
@@ -26,8 +26,12 @@
 	TestNondimensional.hh \
 	TestParser.hh
 
-testunits_LDFLAGS =
+AM_CPPFLAGS = \
+	$(PETSC_INCLUDE) -I$(PYTHON_INCDIR) $(PYTHON_EGG_CPPFLAGS)
 
+testunits_LDFLAGS = \
+	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
+
 testunits_LDADD = \
 	-lcppunit -ldl \
 	$(top_builddir)/libsrc/libspatialdata.la



More information about the CIG-COMMITS mailing list