/[thuban]/branches/WIP-pyshapelib-bramz/libraries/pyprojection/Projection.i
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/libraries/pyprojection/Projection.i

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

trunk/thuban/libraries/pyprojection/Projection.i revision 1610 by jan, Tue Aug 19 21:19:59 2003 UTC branches/WIP-pyshapelib-bramz/libraries/pyprojection/Projection.i revision 2734 by bramz, Thu Mar 1 12:42:59 2007 UTC
# Line 126  typedef enum {DEGREES, RADIANS} Units; Line 126  typedef enum {DEGREES, RADIANS} Units;
126    
127  /* Exception handler for the Projection constructor */  /* Exception handler for the Projection constructor */
128  %typemap(python,except) Projection * {  %typemap(python,except) Projection * {
129        /* Use pj_get_errno_ref to access the pj_errno because directly
130         * accessing pj_errno doesn't work on windows if the proj library is
131         * in a DLL */
132        *pj_get_errno_ref() = 0;
133      $function;      $function;
134      if (!$source)      if (!$source)
135      {      {
136          SWIG_exception(SWIG_IOError, pj_strerrno(pj_errno));          /* FIXME: There's a case where $source is NULL and pj_errno is
137             * not set, namely when memory allocation of the Projection
138             * struct fails. */
139            SWIG_exception(SWIG_IOError, pj_strerrno(*pj_get_errno_ref()));
140      }      }
141  }  }
142    
# Line 148  typedef struct { Line 155  typedef struct {
155              return PyCObject_FromVoidPtr(self->proj, NULL);              return PyCObject_FromVoidPtr(self->proj, NULL);
156          }          }
157    
158    
159            /* The __del__ method generated by the old SWIG version we're
160             * tries to access self.thisown which may not be set at all when
161             * there was an exception during construction.  Therefore we
162             * override it with our own version.
163             * FIXME: It would be better to upgrade to a newer SWIG version
164             * or to get rid of SWIG entirely.
165             */
166            %pragma(python) addtoclass = "
167        def __del__(self,Projectionc=Projectionc):
168            if getattr(self, 'thisown', 0):
169                Projectionc.delete_Projection(self)
170        "
171    
172      }      }
173  } Projection;  } Projection;
174    

Legend:
Removed from v.1610  
changed lines
  Added in v.2734

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26