/[adonthell]/adonthell-0.3/src/py_adonthell.i
ViewVC logotype

Diff of /adonthell-0.3/src/py_adonthell.i

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39 by ksterker, Sun May 18 21:54:20 2003 UTC revision 1.40 by ksterker, Sat Apr 16 17:56:32 2005 UTC
# Line 15  Line 15 
15  #include "input.h"  #include "input.h"
16  #include "audio.h"  #include "audio.h"
17  #include "character_base.h"  #include "character_base.h"
 #include "item_storage.h"  
 #include "inventory.h"  
 #include "manager.h"  
18  #include "quest.h"  #include "quest.h"
19  #include "drawing_area.h"  #include "drawing_area.h"
20  #include "drawable.h"  #include "drawable.h"
# Line 39  Line 36 
36  #include "win_image.h"  #include "win_image.h"
37  #include "win_write.h"  #include "win_write.h"
38  #include "win_mapview.h"  #include "win_mapview.h"
39  #include "win_font.h"  #include "win_ttf.h"
40  #include "win_theme.h"  #include "win_theme.h"
41  #include "win_base.h"  #include "win_base.h"
42  #include "text_bubble.h"  #include "text_bubble.h"
# Line 58  Line 55 
55  #define     SDLK_UNDO 322  #define     SDLK_UNDO 322
56  #endif  #endif
57    
58    // Workaround for bug in pyptrtypes.swg
59    #define SWIG_append_msg SWIG_append_errmsg
60    
61  // This enum allows clearer ownership operation:  // This enum allows clearer ownership operation:
62  // obj.thisown = Python (Python will destroy the object)  // obj.thisown = Python (Python will destroy the object)
63  // obj.thisown = C (C have to destroy the object)  // obj.thisown = C (C has to destroy the object)
64  enum {Python = 1, C = 0};  enum {Python = 1, C = 0};
65    
66  %}  // pass an instance to python
67    PyObject *pass_instance (void *instance, const char* class_name)
 // Same enum available for Python  
 enum {Python = 1, C = 0};  
   
 %typemap(python,in) string  
68  {  {
69      if (PyString_Check ($input))      swig_type_info * ti = SWIG_TypeQuery (class_name);
70      {      if (ti) return SWIG_NewPointerObj (instance, ti, C);
71          $1 = string (PyString_AsString($input));      else printf ("*** pass_instance: Type '%s' not known to SWIG!\n", class_name);
72      }      return NULL;
     else  
     {  
         PyErr_SetString (PyExc_TypeError, "not a String");  
         return NULL;  
     }  
73  }  }
 %typemap(python,in) const string = string;  
74    
75  %typemap(python,in) string &  %}
 {  
     if (PyString_Check ($input))  
     {  
         $1 = new string (PyString_AsString($input));  
     }  
     else  
     {  
         PyErr_SetString (PyExc_TypeError, "not a String");  
         return NULL;  
     }  
 }  
 %typemap(python,in) const string & = string &;  
 %typemap(python,in) const std::string & = string &;  
   
 %typemap(python,out) string  
 {  
     $result = PyString_FromString((const char *)$1.c_str());  
 }  
 %typemap(python,out) const string = string;  
76    
77  %typemap(python,out) string &  // Same enum available for Python
78  {  enum {Python = 1, C = 0};
     $result = PyString_FromString((const char *)$1->c_str());  
     // delete $1;  
 }  
 %typemap(python,out) const string & = string &;  
79    
80  %typemap (python, freearg) string &  %include "std_string.i"
 {  
     if ($1 != NULL)  
     {  
         delete $1;  
     }  
 }  
 %typemap (python, freearg) const string & = string &;  
 %typemap (python, freearg) const std::string & = string &;  
81    
82  %typemap (python,in) PyObject *pyfunc  %typemap (in) PyObject *pyfunc
83  {  {
84      if (!PyCallable_Check($input))      if (!PyCallable_Check($input))
85      {      {
# Line 130  enum {Python = 1, C = 0}; Line 89  enum {Python = 1, C = 0};
89      $1 = $input;      $1 = $input;
90  }  }
91    
92  %typemap (python,in) PyObject*  %typemap (in) PyObject*
93  {  {
94      $1 = $input;      $1 = $input;
95  }  }
96    
 %include "typemaps.i"  
 %apply unsigned int *INOUT { unsigned int *count };  
   
   
97  %include "types.h"  %include "types.h"
98  %include "fileops.h"  %include "fileops.h"
99  %include "event.h"  %include "event.h"
# Line 153  enum {Python = 1, C = 0}; Line 108  enum {Python = 1, C = 0};
108  %include "input.h"  %include "input.h"
109  %include "audio.h"  %include "audio.h"
110  %include "character_base.h"  %include "character_base.h"
 %include "slot.h"  
111  %include "py_object.h"  %include "py_object.h"
 %include "item_base.h"  
 %include "item_storage.h"  
 %include "inventory.h"  
 %include "manager.h"  
112  %include "drawing_area.h"  %include "drawing_area.h"
113  %include "quest.h"  %include "quest.h"
114  %include "drawable.h"  %include "drawable.h"

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26