root/branches/branch-5-0/mapserver/mapscript/mapscript.i

Revision 6377, 7.2 kB (checked in by sdlime, 1 year ago)

Updated mapscript.i to use mapserver.h instead of map.h.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2 ===========================================================================
3  $Id$
4  
5  Project:  MapServer
6  Purpose:  SWIG interface file for the MapServer mapscript module
7  Author:   Steve Lime
8            Sean Gillies, sgillies@frii.com
9              
10  ===========================================================================
11  Copyright (c) 1996-2005 Regents of the University of Minnesota.
12  
13  Permission is hereby granted, free of charge, to any person obtaining a
14  copy of this software and associated documentation files (the "Software"),
15  to deal in the Software without restriction, including without limitation
16  the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  and/or sell copies of the Software, and to permit persons to whom the
18  Software is furnished to do so, subject to the following conditions:
19  
20  The above copyright notice and this permission notice shall be included
21  in all copies or substantial portions of the Software.
22  
23  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  DEALINGS IN THE SOFTWARE.
30 ============================================================================
31 */
32
33 %module mapscript
34
35 %{
36 #include "../../mapserver.h"
37 #include "../../maptemplate.h"
38 #include "../../mapogcsld.h"
39 #include "../../mapows.h"
40 #include "../../cgiutil.h"
41 #include "../../mapcopy.h"
42 #include "../../maperror.h"
43 #include "../../mapprimitive.h"
44 #include "../../mapshape.h"
45
46 #ifdef SWIGPYTHON
47 #include "pygdioctx/pygdioctx.h"
48 #endif
49
50 %}
51
52 /* Problem with SWIG CSHARP typemap for pointers */
53 #ifndef SWIGCSHARP
54 %include typemaps.i
55 #endif
56
57 %include constraints.i
58
59 %include carrays.i
60 %array_class(int, intarray)
61
62 /*
63 ===========================================================================
64  Supporting 'None' as an argument to attribute accessor functions
65
66  Typemaps to support NULL in attribute accessor functions
67  provided to Steve Lime by David Beazley and tested for Python
68  only by Sean Gillies.
69    
70  With the use of these typemaps we can execute statements like
71
72    layer.group = None
73
74 ============================================================================
75 */
76
77 #ifdef __cplusplus
78 %typemap(memberin) char * {
79   if ($1) delete [] $1;
80   if ($input) {
81      $1 = ($1_type) (new char[strlen($input)+1]);
82      strcpy((char *) $1,$input);
83   } else {
84      $1 = 0;
85   }
86 }
87 %typemap(memberin,warning="451:Setting const char * member may leak
88 memory.") const char * {
89   if ($input) {
90      $1 = ($1_type) (new char[strlen($input)+1]);
91      strcpy((char *) $1,$input);
92   } else {
93      $1 = 0;
94   }
95 }
96 %typemap(globalin) char * {
97   if ($1) delete [] $1;
98   if ($input) {
99      $1 = ($1_type) (new char[strlen($input)+1]);
100      strcpy((char *) $1,$input);
101   } else {
102      $1 = 0;
103   }
104 }
105 %typemap(globalin,warning="451:Setting const char * variable may leak
106 memory.") const char * {
107   if ($input) {
108      $1 = ($1_type) (new char[strlen($input)+1]);
109      strcpy((char *) $1,$input);
110   } else {
111      $1 = 0;
112   }
113 }
114 #else
115 %typemap(memberin) char * {
116   if ($1) free((char*)$1);
117   if ($input) {
118      $1 = ($1_type) malloc(strlen($input)+1);
119      strcpy((char*)$1,$input);
120   } else {
121      $1 = 0;
122   }
123 }
124 %typemap(memberin,warning="451:Setting const char * member may leak
125 memory.") const char * {
126   if ($input) {
127      $1 = ($1_type) malloc(strlen($input)+1);
128      strcpy((char*)$1,$input);
129   } else {
130      $1 = 0;
131   }
132 }
133 %typemap(globalin) char * {
134   if ($1) free((char*)$1);
135   if ($input) {
136      $1 = ($1_type) malloc(strlen($input)+1);
137      strcpy((char*)$1,$input);
138   } else {
139      $1 = 0;
140   }
141 }
142 %typemap(globalin,warning="451:Setting const char * variable may leak
143 memory.") const char * {
144   if ($input) {
145      $1 = ($1_type) malloc(strlen($input)+1);
146      strcpy((char*)$1,$input);
147   } else {
148      $1 = 0;
149   }
150 }
151 #endif /* __cplusplus */
152
153 /* GD Buffer Mapping for use with imageObj::getBytes */
154 %{
155 #ifdef __cplusplus
156 extern "C" {
157 #endif
158
159 typedef struct {
160     unsigned char *data;
161     int size;
162     int owns_data;
163 } gdBuffer;
164
165 #ifdef __cplusplus
166 }
167 #endif
168 %}
169
170 /*
171 ============================================================================
172  Exceptions
173
174  Note: Python exceptions are in pymodule.i
175 ============================================================================
176 */
177
178 #if defined(SWIGCSHARP) || defined(SWIGJAVA) || defined(SWIGRUBY)
179 %include "../mserror.i"
180 #endif
181
182 /*
183 ============================================================================
184  Language-specific module code
185 ============================================================================
186 */
187
188 /* C# */
189 #ifdef SWIGCSHARP
190 %include "csmodule.i"
191 #endif
192
193 /* Java */
194 #ifdef SWIGJAVA
195 %include "javamodule.i"
196 #endif
197
198 /* Python */
199 #ifdef SWIGPYTHON
200 %include "pymodule.i"
201 #endif /* SWIGPYTHON */
202
203 /* Ruby */
204 #ifdef SWIGRUBY
205 %include "rbmodule.i"
206 #endif
207
208 /* Perl */
209 #ifdef SWIGPERL5
210 %include "plmodule.i"
211 #endif
212
213 /* Tcl */
214 #ifdef SWIGTCL8
215 %include "tclmodule.i"
216 #endif /* SWIGTCL8 */
217
218 /*
219 =============================================================================
220  Wrap MapServer structs into mapscript classes
221 =============================================================================
222 */
223
224 %include "../../mapserver.h"
225 %include "../../mapprimitive.h"
226 %include "../../mapshape.h"
227 %include "../../mapproject.h"
228 %include "../../mapsymbol.h"
229
230 %apply Pointer NONNULL { mapObj *map };
231 %apply Pointer NONNULL { layerObj *layer };
232
233 /*
234 =============================================================================
235  Class extension methods are now included from separate interface files 
236 =============================================================================
237 */
238    
239 %include "../swiginc/error.i"
240 %include "../swiginc/map.i"
241 %include "../swiginc/mapzoom.i"
242 %include "../swiginc/symbol.i"
243 %include "../swiginc/symbolset.i"
244 %include "../swiginc/layer.i"
245 %include "../swiginc/class.i"
246 %include "../swiginc/style.i"
247 %include "../swiginc/rect.i"
248 %include "../swiginc/image.i"
249 %include "../swiginc/shape.i"
250 %include "../swiginc/point.i"
251 %include "../swiginc/line.i"
252 %include "../swiginc/shapefile.i"
253 %include "../swiginc/outputformat.i"
254 %include "../swiginc/projection.i"
255 %include "../swiginc/dbfinfo.i"
256 %include "../swiginc/labelcache.i"
257 %include "../swiginc/color.i"
258 %include "../swiginc/hashtable.i"
259 %include "../swiginc/resultcache.i"
260 %include "../swiginc/owsrequest.i"
261 %include "../swiginc/connpool.i"
262 %include "../swiginc/msio.i"
263 %include "../swiginc/web.i"
264 %include "../swiginc/label.i"
265 %include "../swiginc/scalebar.i"
266 %include "../swiginc/legend.i"
267 %include "../swiginc/referencemap.i"
268 %include "../swiginc/querymap.i"
269
270 /*
271 =============================================================================
272  Language-specific extensions to mapserver classes are included here
273 =============================================================================
274 */
275
276 /* Java */
277 #ifdef SWIGJAVA
278 %include "javaextend.i"
279 #endif
280
281 /* Python */
282 #ifdef SWIGPYTHON
283 %include "pyextend.i"
284 #endif /* SWIGPYTHON */
285
286 /* Ruby */
287 #ifdef SWIGRUBY
288 %include "rbextend.i"
289 #endif
290
Note: See TracBrowser for help on using the browser.