Changeset 51f563 in git


Ignore:
Timestamp:
Dec 6, 2012, 3:52:36 PM (11 years ago)
Author:
Alexander Dreyer <adreyer@…>
Branches:
(u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
Children:
7e18d198148353f88708cfa20f738ac338cb1f55
Parents:
35a0c12b6003b7ecc3cca7a1072c5f0d145a1829
git-author:
Alexander Dreyer <adreyer@gmx.de>2012-12-06 15:52:36+01:00
git-committer:
Alexander Dreyer <adreyer@gmx.de>2012-12-06 16:20:28+01:00
Message:
Simplified compile-time cases for pyobject embed xor load
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/pyobject.cc

    r35a0c12 r51f563  
    714714
    715715
    716 void pyobject_init()
     716#define PYOBJECT_ADD_C_PROC(name) \
     717  add_C_proc(currPack->libname, (char*)#name, FALSE, name);
     718
     719typedef  BOOLEAN (*func_type)(leftv, leftv);
     720void pyobject_init(int (*add_C_proc)(const char*, const char*, BOOLEAN,
     721                                     func_type) )
    717722{
    718723  int tok = -1;
     
    732737   
    733738    PythonInterpreter::init(tok);
    734   }
    735 }
    736 
    737 #define PYOBJECT_ADD_C_PROC(name) \
    738   psModulFunctions->iiAddCproc(currPack->libname, (char*)#name, FALSE, name);
    739 
     739
     740    PYOBJECT_ADD_C_PROC(python_import);
     741    PYOBJECT_ADD_C_PROC(python_eval);
     742    PYOBJECT_ADD_C_PROC(python_run);
     743  }
     744}
     745#undef PYOBJECT_ADD_C_PROC
     746
     747#ifndef EMBED_PYTHON
    740748extern "C" {
    741749  void mod_init(SModulFunctions* psModulFunctions)
    742750  {
    743     pyobject_init();
    744 
    745     PYOBJECT_ADD_C_PROC(python_import);
    746     PYOBJECT_ADD_C_PROC(python_eval);
    747     PYOBJECT_ADD_C_PROC(python_run);   
    748   }
    749 }
    750 #undef PYOBJECT_ADD_C_PROC
     751    pyobject_init(psModulFunctions->iiAddCproc);
     752  }
     753}
     754#endif
  • Singular/pyobject_setup.cc

    r35a0c12 r51f563  
    2020
    2121/* whether pyobject module is linked statically or dynamically */
     22
     23#ifdef EMBED_PYTHON // Case: we include the pyobject interface in the binary
     24
    2225#ifdef HAVE_PYTHON
     26#include "pyobject.cc"
     27static BOOLEAN pyobject_load()
     28{
     29   pyobject_init(iiAddCproc);
     30   return FALSE;
     31}
    2332
    24   #if defined(HAVE_STATIC)
    25     #ifdef HAVE_STATIC_PYTHON
    26       #define HAVE_STATIC_PYOBJECT
    27     #endif
    28   #else
    29     #ifdef EMBED_PYTHON
    30       #define HAVE_STATIC_PYOBJECT
    31     #else
    32       #define HAVE_DYNAMIC_PYOBJECT
    33     #endif
    34   #endif
     33#else // Forced embedding, but no (development version of) python available!
     34static BOOLEAN pyobject_load() { return TRUE; }
    3535#endif
    3636
    37 # ifdef HAVE_STATIC_PYOBJECT // Case: link pyobject interface statically
    38 #include "pyobject.cc"
    39 void pyobject_setup() { pyobject_init(); }
    4037
     38# else // Case: pyobject may be loaded from a dynamic module (prefered variant)
     39// Note: we do not need python at compile time.
     40static BOOLEAN pyobject_load()
     41{
     42  BOOLEAN jjLOADLIB(const char* libname, BOOLEAN autoexport);
     43  return jjLOADLIB("pyobject.so", TRUE);
     44}
     45#endif
    4146
    42 # elif defined(HAVE_DYNAMIC_PYOBJECT) // Case: pyobject is dynamic module (prefered variant)
    4347
    4448
     
    4650void* pyobject_autoload(blackbox* bbx)
    4751{
    48   BOOLEAN jjLOADLIB(const char* libname, BOOLEAN autoexport);
    49   if (jjLOADLIB("pyobject.so", TRUE)) return NULL;
    50 
     52  if (pyobject_load()) return NULL;
    5153  return bbx->blackbox_Init(bbx);
    5254}
     
    6567  setBlackboxStuff(bbx, "pyobject");
    6668}
    67  
    68 #else                // Case: no python
    69 void pyobject_setup() { }
    7069
    71 #endif  // HAVE_PYTHON
    72 
  • configure.ac

    r35a0c12 r51f563  
    6161LB_CHECK_FLINT(2.3,,AC_MSG_WARN([Unable to find FLINT (which is strongly recommended) on your machine: please use --with-flint=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)]))
    6262
     63AX_PYTHON_ENABLE()
    6364AX_PYTHON_WITH()
    6465AX_PYTHON_VERSION_ENSURE( [2.4] )
Note: See TracChangeset for help on using the changeset viewer.