Salome HOME
Updated copyright comment
[modules/kernel.git] / src / DSC / DSC_Python / calcium.i
index 7f673029d5b2917a6e0c42d2928d19af893fc634..3d50af19dcfe42e8f4cec2b325d1eb0752359fde 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <Salome_file_i.hxx>
 #include <omniORB4/CORBA.h>
 
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-
-struct omniORBpyAPI {
-
-  PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-           CORBA::Boolean hold_lock);
-  // Convert a C++ object reference to a Python object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-             CORBA::Boolean hold_lock);
-  // Convert a Python object reference to a C++ object reference.
-  // Raises BAD_PARAM if the Python object is not an object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
-  // Sets the Python exception state to reflect the given C++ system
-  // exception. Always returns NULL. The caller must hold the Python
-  // interpreter lock.
-};
-
-  omniORBpyAPI* api;
-  PyObject* dsc ;
-
+#include <Python.h>
+#include <omniORBpy.h>
+omniORBpyAPI* api=0;
+PyObject* dsc ;
 
 %}
 
 %init
 %{
-#include <capsulethunk.h>
   // init section
 #ifdef WITH_NUMPY
   import_array()
@@ -80,7 +59,7 @@ struct omniORBpyAPI {
     return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBpyAPI*)PyCapsule_New(pyapi,NULL,NULL);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 
   PyObject* engines = PyImport_ImportModule("Engines");
@@ -196,7 +175,7 @@ const char* typecode_string(int typecode) {
         "unsigned short","int","unsigned int","long","unsigned long",
         "longlong","unsigned longlong",
         "float","double","long double","complex float","complex double","complex long double",
-        "object","string","unicode","void","ntypes","notype","char","unkown"};
+        "object","string","unicode","void","ntypes","notype","char","unknown"};
   return type_names[typecode];
 }