source: valtobtest/subversion-1.6.2/subversion/bindings/swig/proxy/swigrun.swg @ 3

Last change on this file since 3 was 3, checked in by valtob, 15 years ago

subversion source 1.6.2 as test

File size: 16.9 KB
Line 
1/* -----------------------------------------------------------------------------
2 * swigrun.swg
3 *
4 * This file contains generic CAPI SWIG runtime support for pointer
5 * type checking.
6 * ----------------------------------------------------------------------------- */
7
8/* This should only be incremented when either the layout of swig_type_info changes,
9   or for whatever reason, the runtime changes incompatibly */
10#define SWIG_RUNTIME_VERSION "4"
11
12/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
13#ifdef SWIG_TYPE_TABLE
14# define SWIG_QUOTE_STRING(x) #x
15# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
16# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
17#else
18# define SWIG_TYPE_TABLE_NAME
19#endif
20
21/*
22  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
23  creating a static or dynamic library from the swig runtime code.
24  In 99.9% of the cases, swig just needs to declare them as 'static'.
25 
26  But only do this if is strictly necessary, ie, if you have problems
27  with your compiler or so.
28*/
29
30#ifndef SWIGRUNTIME
31# define SWIGRUNTIME SWIGINTERN
32#endif
33
34#ifndef SWIGRUNTIMEINLINE
35# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
36#endif
37
38/*  Generic buffer size */
39#ifndef SWIG_BUFFER_SIZE
40# define SWIG_BUFFER_SIZE 1024
41#endif
42
43/* Flags for pointer conversions */
44#define SWIG_POINTER_DISOWN        0x1
45#define SWIG_CAST_NEW_MEMORY       0x2
46
47/* Flags for new pointer objects */
48#define SWIG_POINTER_OWN           0x1
49
50
51/*
52   Flags/methods for returning states.
53   
54   The swig conversion methods, as ConvertPtr, return and integer
55   that tells if the conversion was successful or not. And if not,
56   an error code can be returned (see swigerrors.swg for the codes).
57   
58   Use the following macros/flags to set or process the returning
59   states.
60   
61   In old swig versions, you usually write code as:
62
63     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
64       // success code
65     } else {
66       //fail code
67     }
68
69   Now you can be more explicit as:
70
71    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
72    if (SWIG_IsOK(res)) {
73      // success code
74    } else {
75      // fail code
76    }
77
78   that seems to be the same, but now you can also do
79
80    Type *ptr;
81    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
82    if (SWIG_IsOK(res)) {
83      // success code
84      if (SWIG_IsNewObj(res) {
85        ...
86        delete *ptr;
87      } else {
88        ...
89      }
90    } else {
91      // fail code
92    }
93   
94   I.e., now SWIG_ConvertPtr can return new objects and you can
95   identify the case and take care of the deallocation. Of course that
96   requires also to SWIG_ConvertPtr to return new result values, as
97
98      int SWIG_ConvertPtr(obj, ptr,...) {         
99        if (<obj is ok>) {                             
100          if (<need new object>) {                     
101            *ptr = <ptr to new allocated object>;
102            return SWIG_NEWOBJ;               
103          } else {                                     
104            *ptr = <ptr to old object>;       
105            return SWIG_OLDOBJ;               
106          }                                   
107        } else {                                       
108          return SWIG_BADOBJ;                 
109        }                                             
110      }
111
112   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
113   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
114   swig errors code.
115
116   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
117   allows to return the 'cast rank', for example, if you have this
118
119       int food(double)
120       int fooi(int);
121
122   and you call
123 
124      food(1)   // cast rank '1'  (1 -> 1.0)
125      fooi(1)   // cast rank '0'
126
127   just use the SWIG_AddCast()/SWIG_CheckState()
128
129
130 */
131#define SWIG_OK                    (0)
132#define SWIG_ERROR                 (-1)
133#define SWIG_IsOK(r)               (r >= 0)
134#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError) 
135
136/* The CastRankLimit says how many bits are used for the cast rank */
137#define SWIG_CASTRANKLIMIT         (1 << 8)
138/* The NewMask denotes the object was created (using new/malloc) */
139#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
140/* The TmpMask is for in/out typemaps that use temporal objects */
141#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
142/* Simple returning values */
143#define SWIG_BADOBJ                (SWIG_ERROR)
144#define SWIG_OLDOBJ                (SWIG_OK)
145#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
146#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
147/* Check, add and del mask methods */
148#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
149#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
150#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
151#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
152#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
153#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
154
155
156/* Cast-Rank Mode */
157#if defined(SWIG_CASTRANK_MODE)
158#  ifndef SWIG_TypeRank
159#    define SWIG_TypeRank             unsigned long
160#  endif
161#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
162#    define SWIG_MAXCASTRANK          (2)
163#  endif
164#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
165#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
166SWIGINTERNINLINE int SWIG_AddCast(int r) {
167  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
168}
169SWIGINTERNINLINE int SWIG_CheckState(int r) {
170  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
171}
172#else /* no cast-rank mode */
173#  define SWIG_AddCast
174#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
175#endif
176
177
178
179
180#include <string.h>
181
182#ifdef __cplusplus
183extern "C" {
184#endif
185
186typedef void *(*swig_converter_func)(void *, int *);
187typedef struct swig_type_info *(*swig_dycast_func)(void **);
188
189/* Structure to store information on one type */
190typedef struct swig_type_info {
191  const char             *name;                 /* mangled name of this type */
192  const char             *str;                  /* human readable name of this type */
193  swig_dycast_func        dcast;                /* dynamic cast function down a hierarchy */
194  struct swig_cast_info  *cast;                 /* linked list of types that can cast into this type */
195  void                   *clientdata;           /* language specific type data */
196  int                    owndata;               /* flag if the structure owns the clientdata */
197} swig_type_info;
198
199/* Structure to store a type and conversion function used for casting */
200typedef struct swig_cast_info {
201  swig_type_info         *type;                 /* pointer to type that is equivalent to this type */
202  swig_converter_func     converter;            /* function to cast the void pointers */
203  struct swig_cast_info  *next;                 /* pointer to next cast in linked list */
204  struct swig_cast_info  *prev;                 /* pointer to the previous cast */
205} swig_cast_info;
206
207/* Structure used to store module information
208 * Each module generates one structure like this, and the runtime collects
209 * all of these structures and stores them in a circularly linked list.*/
210typedef struct swig_module_info {
211  swig_type_info         **types;               /* Array of pointers to swig_type_info structures that are in this module */
212  size_t                 size;                  /* Number of types in this module */
213  struct swig_module_info *next;                /* Pointer to next element in circularly linked list */
214  swig_type_info         **type_initial;        /* Array of initially generated type structures */
215  swig_cast_info         **cast_initial;        /* Array of initially generated casting structures */
216  void                    *clientdata;          /* Language specific module data */
217} swig_module_info;
218
219/*
220  Compare two type names skipping the space characters, therefore
221  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
222
223  Return 0 when the two name types are equivalent, as in
224  strncmp, but skipping ' '.
225*/
226SWIGRUNTIME int
227SWIG_TypeNameComp(const char *f1, const char *l1,
228                  const char *f2, const char *l2) {
229  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
230    while ((*f1 == ' ') && (f1 != l1)) ++f1;
231    while ((*f2 == ' ') && (f2 != l2)) ++f2;
232    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
233  }
234  return (int)((l1 - f1) - (l2 - f2));
235}
236
237/*
238  Check type equivalence in a name list like <name1>|<name2>|...
239  Return 0 if not equal, 1 if equal
240*/
241SWIGRUNTIME int
242SWIG_TypeEquiv(const char *nb, const char *tb) {
243  int equiv = 0;
244  const char* te = tb + strlen(tb);
245  const char* ne = nb;
246  while (!equiv && *ne) {
247    for (nb = ne; *ne; ++ne) {
248      if (*ne == '|') break;
249    }
250    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
251    if (*ne) ++ne;
252  }
253  return equiv;
254}
255
256/*
257  Check type equivalence in a name list like <name1>|<name2>|...
258  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
259*/
260SWIGRUNTIME int
261SWIG_TypeCompare(const char *nb, const char *tb) {
262  int equiv = 0;
263  const char* te = tb + strlen(tb);
264  const char* ne = nb;
265  while (!equiv && *ne) {
266    for (nb = ne; *ne; ++ne) {
267      if (*ne == '|') break;
268    }
269    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
270    if (*ne) ++ne;
271  }
272  return equiv;
273}
274
275
276/* think of this as a c++ template<> or a scheme macro */
277#define SWIG_TypeCheck_Template(comparison, ty)         \
278  if (ty) {                                             \
279    swig_cast_info *iter = ty->cast;                    \
280    while (iter) {                                      \
281      if (comparison) {                                 \
282        if (iter == ty->cast) return iter;              \
283        /* Move iter to the top of the linked list */   \
284        iter->prev->next = iter->next;                  \
285        if (iter->next)                                 \
286          iter->next->prev = iter->prev;                \
287        iter->next = ty->cast;                          \
288        iter->prev = 0;                                 \
289        if (ty->cast) ty->cast->prev = iter;            \
290        ty->cast = iter;                                \
291        return iter;                                    \
292      }                                                 \
293      iter = iter->next;                                \
294    }                                                   \
295  }                                                     \
296  return 0
297
298/*
299  Check the typename
300*/
301SWIGRUNTIME swig_cast_info *
302SWIG_TypeCheck(const char *c, swig_type_info *ty) {
303  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
304}
305
306/* Same as previous function, except strcmp is replaced with a pointer comparison */
307SWIGRUNTIME swig_cast_info *
308SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
309  SWIG_TypeCheck_Template(iter->type == from, into);
310}
311
312/*
313  Cast a pointer up an inheritance hierarchy
314*/
315SWIGRUNTIMEINLINE void *
316SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
317  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
318}
319
320/*
321   Dynamic pointer casting. Down an inheritance hierarchy
322*/
323SWIGRUNTIME swig_type_info *
324SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
325  swig_type_info *lastty = ty;
326  if (!ty || !ty->dcast) return ty;
327  while (ty && (ty->dcast)) {
328    ty = (*ty->dcast)(ptr);
329    if (ty) lastty = ty;
330  }
331  return lastty;
332}
333
334/*
335  Return the name associated with this type
336*/
337SWIGRUNTIMEINLINE const char *
338SWIG_TypeName(const swig_type_info *ty) {
339  return ty->name;
340}
341
342/*
343  Return the pretty name associated with this type,
344  that is an unmangled type name in a form presentable to the user.
345*/
346SWIGRUNTIME const char *
347SWIG_TypePrettyName(const swig_type_info *type) {
348  /* The "str" field contains the equivalent pretty names of the
349     type, separated by vertical-bar characters.  We choose
350     to print the last name, as it is often (?) the most
351     specific. */
352  if (!type) return NULL;
353  if (type->str != NULL) {
354    const char *last_name = type->str;
355    const char *s;
356    for (s = type->str; *s; s++)
357      if (*s == '|') last_name = s+1;
358    return last_name;
359  }
360  else
361    return type->name;
362}
363
364/*
365   Set the clientdata field for a type
366*/
367SWIGRUNTIME void
368SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
369  swig_cast_info *cast = ti->cast;
370  /* if (ti->clientdata == clientdata) return; */
371  ti->clientdata = clientdata;
372 
373  while (cast) {
374    if (!cast->converter) {
375      swig_type_info *tc = cast->type;
376      if (!tc->clientdata) {
377        SWIG_TypeClientData(tc, clientdata);
378      }
379    }   
380    cast = cast->next;
381  }
382}
383SWIGRUNTIME void
384SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
385  SWIG_TypeClientData(ti, clientdata);
386  ti->owndata = 1;
387}
388 
389/*
390  Search for a swig_type_info structure only by mangled name
391  Search is a O(log #types)
392 
393  We start searching at module start, and finish searching when start == end. 
394  Note: if start == end at the beginning of the function, we go all the way around
395  the circular list.
396*/
397SWIGRUNTIME swig_type_info *
398SWIG_MangledTypeQueryModule(swig_module_info *start,
399                            swig_module_info *end,
400                            const char *name) {
401  swig_module_info *iter = start;
402  do {
403    if (iter->size) {
404      register size_t l = 0;
405      register size_t r = iter->size - 1;
406      do {
407        /* since l+r >= 0, we can (>> 1) instead (/ 2) */
408        register size_t i = (l + r) >> 1;
409        const char *iname = iter->types[i]->name;
410        if (iname) {
411          register int compare = strcmp(name, iname);
412          if (compare == 0) {       
413            return iter->types[i];
414          } else if (compare < 0) {
415            if (i) {
416              r = i - 1;
417            } else {
418              break;
419            }
420          } else if (compare > 0) {
421            l = i + 1;
422          }
423        } else {
424          break; /* should never happen */
425        }
426      } while (l <= r);
427    }
428    iter = iter->next;
429  } while (iter != end);
430  return 0;
431}
432
433/*
434  Search for a swig_type_info structure for either a mangled name or a human readable name.
435  It first searches the mangled names of the types, which is a O(log #types)
436  If a type is not found it then searches the human readable names, which is O(#types).
437 
438  We start searching at module start, and finish searching when start == end. 
439  Note: if start == end at the beginning of the function, we go all the way around
440  the circular list.
441*/
442SWIGRUNTIME swig_type_info *
443SWIG_TypeQueryModule(swig_module_info *start,
444                     swig_module_info *end,
445                     const char *name) {
446  /* STEP 1: Search the name field using binary search */
447  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
448  if (ret) {
449    return ret;
450  } else {
451    /* STEP 2: If the type hasn't been found, do a complete search
452       of the str field (the human readable name) */
453    swig_module_info *iter = start;
454    do {
455      register size_t i = 0;
456      for (; i < iter->size; ++i) {
457        if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
458          return iter->types[i];
459      }
460      iter = iter->next;
461    } while (iter != end);
462  }
463 
464  /* neither found a match */
465  return 0;
466}
467
468/*
469   Pack binary data into a string
470*/
471SWIGRUNTIME char *
472SWIG_PackData(char *c, void *ptr, size_t sz) {
473  static const char hex[17] = "0123456789abcdef";
474  register const unsigned char *u = (unsigned char *) ptr;
475  register const unsigned char *eu =  u + sz;
476  for (; u != eu; ++u) {
477    register unsigned char uu = *u;
478    *(c++) = hex[(uu & 0xf0) >> 4];
479    *(c++) = hex[uu & 0xf];
480  }
481  return c;
482}
483
484/*
485   Unpack binary data from a string
486*/
487SWIGRUNTIME const char *
488SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
489  register unsigned char *u = (unsigned char *) ptr;
490  register const unsigned char *eu = u + sz;
491  for (; u != eu; ++u) {
492    register char d = *(c++);
493    register unsigned char uu;
494    if ((d >= '0') && (d <= '9'))
495      uu = ((d - '0') << 4);
496    else if ((d >= 'a') && (d <= 'f'))
497      uu = ((d - ('a'-10)) << 4);
498    else
499      return (char *) 0;
500    d = *(c++);
501    if ((d >= '0') && (d <= '9'))
502      uu |= (d - '0');
503    else if ((d >= 'a') && (d <= 'f'))
504      uu |= (d - ('a'-10));
505    else
506      return (char *) 0;
507    *u = uu;
508  }
509  return c;
510}
511
512/*
513   Pack 'void *' into a string buffer.
514*/
515SWIGRUNTIME char *
516SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
517  char *r = buff;
518  if ((2*sizeof(void *) + 2) > bsz) return 0;
519  *(r++) = '_';
520  r = SWIG_PackData(r,&ptr,sizeof(void *));
521  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
522  strcpy(r,name);
523  return buff;
524}
525
526SWIGRUNTIME const char *
527SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
528  if (*c != '_') {
529    if (strcmp(c,"NULL") == 0) {
530      *ptr = (void *) 0;
531      return name;
532    } else {
533      return 0;
534    }
535  }
536  return SWIG_UnpackData(++c,ptr,sizeof(void *));
537}
538
539SWIGRUNTIME char *
540SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
541  char *r = buff;
542  size_t lname = (name ? strlen(name) : 0);
543  if ((2*sz + 2 + lname) > bsz) return 0;
544  *(r++) = '_';
545  r = SWIG_PackData(r,ptr,sz);
546  if (lname) {
547    strncpy(r,name,lname+1);
548  } else {
549    *r = 0;
550  }
551  return buff;
552}
553
554SWIGRUNTIME const char *
555SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
556  if (*c != '_') {
557    if (strcmp(c,"NULL") == 0) {
558      memset(ptr,0,sz);
559      return name;
560    } else {
561      return 0;
562    }
563  }
564  return SWIG_UnpackData(++c,ptr,sz);
565}
566
567#ifdef __cplusplus
568}
569#endif
Note: See TracBrowser for help on using the repository browser.