From: Axel R. <ro...@us...> - 2012-01-04 12:19:11
|
Update of /cvsroot/sdif/Easdif/swig/python In directory vz-cvs-3.sog:/tmp/cvs-serv1903/swig/python Modified Files: CMakeLists.txt easdif-python.i Log Message: Create derived class to render Frame and Entity into python iterable. Index: easdif-python.i =================================================================== RCS file: /cvsroot/sdif/Easdif/swig/python/easdif-python.i,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** easdif-python.i 10 Dec 2006 17:37:30 -0000 1.7 --- easdif-python.i 4 Jan 2012 12:19:09 -0000 1.8 *************** *** 6,9 **** --- 6,12 ---- // // $Log$ + // Revision 1.8 2012/01/04 12:19:09 roebel + // Create derived class to render Frame and Entity into python iterable. + // // Revision 1.7 2006/12/10 17:37:30 roebel // SelectionSet now renamed to SelectionSetI to prevent *************** *** 25,29 **** // // Revision 1.2 2003/05/28 16:57:03 roebel ! // Made configure switching map support according tothe swig version installed. // // Revision 1.1 2003/04/30 11:45:48 tisseran --- 28,32 ---- // // Revision 1.2 2003/05/28 16:57:03 roebel ! // Made configure switching map support according to the swig version installed. // // Revision 1.1 2003/04/30 11:45:48 tisseran *************** *** 51,54 **** --- 54,91 ---- }; + %{ + #include "swig/python/Extensions.h" + %} + + + %include "Extensions.h" + + %template(SelectionSetI) Easdif::SelectionSet<unsigned int>; + %exception Easdif::SDIFEntity::next() { + try { + $action + } + catch(const Easdif::SDIFEof& e) { + Easdif::SDIFFrame localFrame; + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + } + + + + %extend Easdif::SDIFEntity{ + Easdif::SDIFEntity& + __iter__() { + return *$self; + } + const Easdif::SDIFFrame + next() { + Easdif::SDIFFrame localFrame; + $self->ReadNextSelectedFrame(localFrame); + return localFrame; + } + } + Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/sdif/Easdif/swig/python/CMakeLists.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CMakeLists.txt 3 Jan 2012 01:28:40 -0000 1.11 --- CMakeLists.txt 4 Jan 2012 12:19:09 -0000 1.12 *************** *** 24,27 **** --- 24,29 ---- MESSAGE(STATUS "PYTHON_VERSION ${PYTHON_VERSION}") SET(BUILD_WITH_INSTALL_RPATH ON) + + ADD_LIBRARY(Extensions STATIC Extensions.cxx) SET(INTERFACE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/easdif-python.i) *************** *** 31,35 **** SET(CMAKE_SWIG_FLAGS "-I${CMAKE_CURRENT_BINARY_DIR}" "-I${CMAKE_CURRENT_SOURCE_DIR}") SWIG_ADD_MODULE(eaSDIF python ${INTERFACE_SRC} ) ! SWIG_LINK_LIBRARIES(eaSDIF Easdif_static${DEBUGEXT} ${PYTHON_LIBRARY}) ADD_CUSTOM_TARGET(pythonswig) ADD_DEPENDENCIES(pythonswig ${SWIG_MODULE_eaSDIF_REAL_NAME}) --- 33,37 ---- SET(CMAKE_SWIG_FLAGS "-I${CMAKE_CURRENT_BINARY_DIR}" "-I${CMAKE_CURRENT_SOURCE_DIR}") SWIG_ADD_MODULE(eaSDIF python ${INTERFACE_SRC} ) ! SWIG_LINK_LIBRARIES(eaSDIF Easdif_static${DEBUGEXT} Extensions ${PYTHON_LIBRARY}) ADD_CUSTOM_TARGET(pythonswig) ADD_DEPENDENCIES(pythonswig ${SWIG_MODULE_eaSDIF_REAL_NAME}) *************** *** 40,43 **** --- 42,46 ---- CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + IF(APPLE) SET(LOADPATH DYLD_LIBRARY_PATH) |