Code

moving trunk for module inkscape
[inkscape.git] / src / extension / script / inkscape_perl_wrap.cpp
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 1.3.23
4  * 
5  * This file is not intended to be easily readable and contains a number of 
6  * coding conventions designed to improve portability and efficiency. Do not make
7  * changes to this file unless you know what you are doing--modify the SWIG 
8  * interface file instead. 
9  * ----------------------------------------------------------------------------- */
12 #ifdef __cplusplus
13 template<class T> class SwigValueWrapper {
14     T *tt;
15 public:
16     SwigValueWrapper() : tt(0) { }
17     SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
18     SwigValueWrapper(const T& t) : tt(new T(t)) { }
19     ~SwigValueWrapper() { delete tt; } 
20     SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
21     operator T&() const { return *tt; }
22     T *operator&() { return tt; }
23 private:
24     SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
25 };
26 #endif
29 #ifndef SWIG_TEMPLATE_DISAMBIGUATOR
30 #  if defined(__SUNPRO_CC) 
31 #    define SWIG_TEMPLATE_DISAMBIGUATOR template
32 #  else
33 #    define SWIG_TEMPLATE_DISAMBIGUATOR 
34 #  endif
35 #endif
37 /***********************************************************************
38  * common.swg
39  *
40  *     This file contains generic SWIG runtime support for pointer
41  *     type checking as well as a few commonly used macros to control
42  *     external linkage.
43  *
44  * Author : David Beazley (beazley@cs.uchicago.edu)
45  *
46  * Copyright (c) 1999-2000, The University of Chicago
47  * 
48  * This file may be freely redistributed without license or fee provided
49  * this copyright message remains intact.
50  ************************************************************************/
52 #include <string.h>
54 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
55 #  if !defined(STATIC_LINKED)
56 #    define SWIGEXPORT(a) __declspec(dllexport) a
57 #  else
58 #    define SWIGEXPORT(a) a
59 #  endif
60 #else
61 #  define SWIGEXPORT(a) a
62 #endif
64 #define SWIGRUNTIME(x) static x
66 #ifndef SWIGINLINE
67 #if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
68 #  define SWIGINLINE inline
69 #else
70 #  define SWIGINLINE
71 #endif
72 #endif
75 /* This should only be incremented when either the layout of swig_type_info changes,
76    or for whatever reason, the runtime changes incompatibly */
77 #define SWIG_RUNTIME_VERSION "1"
79 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
80 #ifdef SWIG_TYPE_TABLE
81 #define SWIG_QUOTE_STRING(x) #x
82 #define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
83 #define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
84 #else
85 #define SWIG_TYPE_TABLE_NAME
86 #endif
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
92 typedef void *(*swig_converter_func)(void *);
93 typedef struct swig_type_info *(*swig_dycast_func)(void **);
95 typedef struct swig_type_info {
96   const char             *name;
97   swig_converter_func     converter;
98   const char             *str;
99   void                   *clientdata;
100   swig_dycast_func        dcast;
101   struct swig_type_info  *next;
102   struct swig_type_info  *prev;
103 } swig_type_info;
105 static swig_type_info *swig_type_list = 0;
106 static swig_type_info **swig_type_list_handle = &swig_type_list;
108 /* 
109    Compare two type names skipping the space characters, therefore
110    "char*" == "char *" and "Class<int>" == "Class<int >", etc.
112    Return 0 when the two name types are equivalent, as in
113    strncmp, but skipping ' '.
114 */
115 static int
116 SWIG_TypeNameComp(const char *f1, const char *l1,
117                   const char *f2, const char *l2) {
118   for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
119     while ((*f1 == ' ') && (f1 != l1)) ++f1;
120     while ((*f2 == ' ') && (f2 != l2)) ++f2;
121     if (*f1 != *f2) return *f1 - *f2;
122   }
123   return (l1 - f1) - (l2 - f2);
126 /*
127   Check type equivalence in a name list like <name1>|<name2>|...
128 */
129 static int
130 SWIG_TypeEquiv(const char *nb, const char *tb) {
131   int equiv = 0;
132   const char* te = tb + strlen(tb);
133   const char* ne = nb;
134   while (!equiv && *ne) {
135     for (nb = ne; *ne; ++ne) {
136       if (*ne == '|') break;
137     }
138     equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0;
139     if (*ne) ++ne;
140   }
141   return equiv;
143   
145 /* Register a type mapping with the type-checking */
146 static swig_type_info *
147 SWIG_TypeRegister(swig_type_info *ti) {
148   swig_type_info *tc, *head, *ret, *next;
149   /* Check to see if this type has already been registered */
150   tc = *swig_type_list_handle;
151   while (tc) {
152     /* check simple type equivalence */
153     int typeequiv = (strcmp(tc->name, ti->name) == 0);   
154     /* check full type equivalence, resolving typedefs */
155     if (!typeequiv) {
156       /* only if tc is not a typedef (no '|' on it) */
157       if (tc->str && ti->str && !strstr(tc->str,"|")) {
158         typeequiv = SWIG_TypeEquiv(ti->str,tc->str);
159       }
160     }
161     if (typeequiv) {
162       /* Already exists in the table.  Just add additional types to the list */
163       if (ti->clientdata) tc->clientdata = ti->clientdata;
164       head = tc;
165       next = tc->next;
166       goto l1;
167     }
168     tc = tc->prev;
169   }
170   head = ti;
171   next = 0;
173   /* Place in list */
174   ti->prev = *swig_type_list_handle;
175   *swig_type_list_handle = ti;
177   /* Build linked lists */
178   l1:
179   ret = head;
180   tc = ti + 1;
181   /* Patch up the rest of the links */
182   while (tc->name) {
183     head->next = tc;
184     tc->prev = head;
185     head = tc;
186     tc++;
187   }
188   if (next) next->prev = head;
189   head->next = next;
191   return ret;
194 /* Check the typename */
195 static swig_type_info *
196 SWIG_TypeCheck(char *c, swig_type_info *ty) {
197   swig_type_info *s;
198   if (!ty) return 0;        /* Void pointer */
199   s = ty->next;             /* First element always just a name */
200   do {
201     if (strcmp(s->name,c) == 0) {
202       if (s == ty->next) return s;
203       /* Move s to the top of the linked list */
204       s->prev->next = s->next;
205       if (s->next) {
206         s->next->prev = s->prev;
207       }
208       /* Insert s as second element in the list */
209       s->next = ty->next;
210       if (ty->next) ty->next->prev = s;
211       ty->next = s;
212       s->prev = ty;
213       return s;
214     }
215     s = s->next;
216   } while (s && (s != ty->next));
217   return 0;
220 /* Cast a pointer up an inheritance hierarchy */
221 static SWIGINLINE void *
222 SWIG_TypeCast(swig_type_info *ty, void *ptr) {
223   if ((!ty) || (!ty->converter)) return ptr;
224   return (*ty->converter)(ptr);
227 /* Dynamic pointer casting. Down an inheritance hierarchy */
228 static swig_type_info *
229 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
230   swig_type_info *lastty = ty;
231   if (!ty || !ty->dcast) return ty;
232   while (ty && (ty->dcast)) {
233     ty = (*ty->dcast)(ptr);
234     if (ty) lastty = ty;
235   }
236   return lastty;
239 /* Return the name associated with this type */
240 static SWIGINLINE const char *
241 SWIG_TypeName(const swig_type_info *ty) {
242   return ty->name;
245 /* Return the pretty name associated with this type,
246    that is an unmangled type name in a form presentable to the user.
247 */
248 static const char *
249 SWIG_TypePrettyName(const swig_type_info *type) {
250   /* The "str" field contains the equivalent pretty names of the
251      type, separated by vertical-bar characters.  We choose
252      to print the last name, as it is often (?) the most
253      specific. */
254   if (type->str != NULL) {
255     const char *last_name = type->str;
256     const char *s;
257     for (s = type->str; *s; s++)
258       if (*s == '|') last_name = s+1;
259     return last_name;
260   }
261   else
262     return type->name;
265 /* Search for a swig_type_info structure */
266 static swig_type_info *
267 SWIG_TypeQuery(const char *name) {
268   swig_type_info *ty = *swig_type_list_handle;
269   while (ty) {
270     if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
271     if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
272     ty = ty->prev;
273   }
274   return 0;
277 /* Set the clientdata field for a type */
278 static void
279 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
280   swig_type_info *tc, *equiv;
281   if (ti->clientdata) return;
282   /* if (ti->clientdata == clientdata) return; */
283   ti->clientdata = clientdata;
284   equiv = ti->next;
285   while (equiv) {
286     if (!equiv->converter) {
287       tc = *swig_type_list_handle;
288       while (tc) {
289         if ((strcmp(tc->name, equiv->name) == 0))
290           SWIG_TypeClientData(tc,clientdata);
291         tc = tc->prev;
292       }
293     }
294     equiv = equiv->next;
295   }
298 /* Pack binary data into a string */
299 static char *
300 SWIG_PackData(char *c, void *ptr, size_t sz) {
301   static char hex[17] = "0123456789abcdef";
302   unsigned char *u = (unsigned char *) ptr;
303   const unsigned char *eu =  u + sz;
304   register unsigned char uu;
305   for (; u != eu; ++u) {
306     uu = *u;
307     *(c++) = hex[(uu & 0xf0) >> 4];
308     *(c++) = hex[uu & 0xf];
309   }
310   return c;
313 /* Unpack binary data from a string */
314 static char *
315 SWIG_UnpackData(char *c, void *ptr, size_t sz) {
316   register unsigned char uu = 0;
317   register int d;
318   unsigned char *u = (unsigned char *) ptr;
319   const unsigned char *eu =  u + sz;
320   for (; u != eu; ++u) {
321     d = *(c++);
322     if ((d >= '0') && (d <= '9'))
323       uu = ((d - '0') << 4);
324     else if ((d >= 'a') && (d <= 'f'))
325       uu = ((d - ('a'-10)) << 4);
326     d = *(c++);
327     if ((d >= '0') && (d <= '9'))
328       uu |= (d - '0');
329     else if ((d >= 'a') && (d <= 'f'))
330       uu |= (d - ('a'-10));
331     *u = uu;
332   }
333   return c;
336 /* This function will propagate the clientdata field of type to
337 * any new swig_type_info structures that have been added into the list
338 * of equivalent types.  It is like calling
339 * SWIG_TypeClientData(type, clientdata) a second time.
340 */
341 static void
342 SWIG_PropagateClientData(swig_type_info *type) {
343   swig_type_info *equiv = type->next;
344   swig_type_info *tc;
345   if (!type->clientdata) return;
346   while (equiv) {
347     if (!equiv->converter) {
348       tc = *swig_type_list_handle;
349       while (tc) {
350         if ((strcmp(tc->name, equiv->name) == 0) && !tc->clientdata)
351           SWIG_TypeClientData(tc, type->clientdata);
352         tc = tc->prev;
353       }
354     }
355     equiv = equiv->next;
356   }
359 #ifdef __cplusplus
361 #endif
363 /* ---------------------------------------------------------------------- -*- c -*-
364  * perl5.swg
365  *
366  * Perl5 runtime library
367  * $Header$
368  * ----------------------------------------------------------------------------- */
370 #define SWIGPERL
371 #define SWIGPERL5
372 #ifdef __cplusplus
373 /* Needed on some windows machines---since MS plays funny games with the header files under C++ */
374 #include <math.h>
375 #include <stdlib.h>
376 extern "C" {
377 #endif
378 #include "EXTERN.h"
379 #include "perl.h"
380 #include "XSUB.h"
382 /* Get rid of free and malloc defined by perl */
383 #undef free
384 #undef malloc
386 #ifndef pTHX_
387 #define pTHX_
388 #endif
390 #include <string.h>
391 #ifdef __cplusplus
393 #endif
395 /* Macro to call an XS function */
397 #ifdef PERL_OBJECT 
398 #  define SWIG_CALLXS(_name) _name(cv,pPerl) 
399 #else 
400 #  ifndef MULTIPLICITY 
401 #    define SWIG_CALLXS(_name) _name(cv) 
402 #  else 
403 #    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
404 #  endif 
405 #endif 
407 /* Contract support */
409 #define SWIG_contract_assert(expr,msg) if (!(expr)) { SWIG_croak(msg); } else
411 /* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */
413 #ifdef PERL_OBJECT
414 #define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
415 typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
417 #ifdef __cplusplus
418 extern "C" {
419 #endif
420 typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *);
421 #ifdef __cplusplus
423 #endif
425 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
426 #define SWIGCLASS_STATIC
427 #else
428 #define MAGIC_PPERL
429 #define SWIGCLASS_STATIC static
430 #ifndef MULTIPLICITY
431 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
432 typedef int (*SwigMagicFunc)(SV *, MAGIC *);
434 #ifdef __cplusplus
435 extern "C" {
436 #endif
437 typedef int (*SwigMagicFuncHack)(SV *, MAGIC *);
438 #ifdef __cplusplus
440 #endif
443 #else
444 #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
445 typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
446 #ifdef __cplusplus
447 extern "C" {
448 #endif
449 typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *);
450 #ifdef __cplusplus
452 #endif
454 #endif
455 #endif
457 #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
458 #define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
459 #endif
461 /* Modifications for newer Perl 5.005 releases */
463 #if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50))))
464 #  ifndef PL_sv_yes
465 #    define PL_sv_yes sv_yes
466 #  endif
467 #  ifndef PL_sv_undef
468 #    define PL_sv_undef sv_undef
469 #  endif
470 #  ifndef PL_na
471 #    define PL_na na
472 #  endif
473 #endif
475 #include <stdlib.h>
477 #ifdef __cplusplus
478 extern "C" {
479 #endif
481 #define SWIG_OWNER 1
482 #define SWIG_SHADOW 2
484 /* Common SWIG API */
486 #ifdef PERL_OBJECT
487 #  define SWIG_ConvertPtr(obj, pp, type, flags) \
488      SWIG_Perl_ConvertPtr(pPerl, obj, pp, type, flags)
489 #  define SWIG_NewPointerObj(p, type, flags) \
490      SWIG_Perl_NewPointerObj(pPerl, p, type, flags)
491 #  define SWIG_MakePackedObj(sv, p, s, type)    \
492      SWIG_Perl_MakePackedObj(pPerl, sv, p, s, type)
493 #  define SWIG_ConvertPacked(obj, p, s, type, flags) \
494      SWIG_Perl_ConvertPacked(pPerl, obj, p, s, type, flags)
496 #else
497 #  define SWIG_ConvertPtr(obj, pp, type, flags) \
498      SWIG_Perl_ConvertPtr(obj, pp, type, flags)
499 #  define SWIG_NewPointerObj(p, type, flags) \
500      SWIG_Perl_NewPointerObj(p, type, flags)
501 #  define SWIG_MakePackedObj(sv, p, s, type)    \
502      SWIG_Perl_MakePackedObj(sv, p, s, type )
503 #  define SWIG_ConvertPacked(obj, p, s, type, flags) \
504      SWIG_Perl_ConvertPacked(obj, p, s, type, flags)
505 #endif
507 /* Perl-specific API */
508 #ifdef PERL_OBJECT
509 #  define SWIG_MakePtr(sv, ptr, type, flags) \
510      SWIG_Perl_MakePtr(pPerl, sv, ptr, type, flags)
511 #  define SWIG_SetError(str) \
512      SWIG_Perl_SetError(pPerl, str)
513 #else
514 #  define SWIG_MakePtr(sv, ptr, type, flags) \
515      SWIG_Perl_MakePtr(sv, ptr, type, flags)
516 #  define SWIG_SetError(str) \
517      SWIG_Perl_SetError(str)
518 #  define SWIG_SetErrorSV(str) \
519      SWIG_Perl_SetErrorSV(str)
520 #endif
522 #define SWIG_SetErrorf SWIG_Perl_SetErrorf
525 #ifdef PERL_OBJECT
526 #  define SWIG_MAYBE_PERL_OBJECT CPerlObj *pPerl,
527 #else
528 #  define SWIG_MAYBE_PERL_OBJECT
529 #endif
531 /* load the swig_runtime_list_handle variable from the interpreter */
532 static void SWIG_Perl_LookupTypePointer() {
533   SV *pointer;
535   /* first check if pointer already created */
536   pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
537   if (pointer && SvOK(pointer)) {
538     swig_type_list_handle = INT2PTR(swig_type_info **, SvIV(pointer));
539   } else {
540     /* create a new pointer */
541     pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
542     sv_setiv(pointer, PTR2IV(swig_type_list_handle));
543   }
546 static swig_type_info *
547 SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) {
548   swig_type_info *s;
549   if (!ty) return 0;        /* Void pointer */
550   s = ty->next;             /* First element always just a name */
551   do {
552     if (sv_derived_from(rv, (char *) s->name)) {
553       if (s == ty->next) return s;
554       /* Move s to the top of the linked list */
555       s->prev->next = s->next;
556       if (s->next) {
557         s->next->prev = s->prev;
558       }
559       /* Insert s as second element in the list */
560       s->next = ty->next;
561       if (ty->next) ty->next->prev = s;
562       ty->next = s;
563       s->prev = ty;
564       return s;
565     }
566     s = s->next;
567   } while (s && (s != ty->next));
568   return 0;
571 /* Function for getting a pointer value */
573 static int
574 SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
575   swig_type_info *tc;
576   void *voidptr = (void *)0;
578   /* If magical, apply more magic */
579   if (SvGMAGICAL(sv))
580     mg_get(sv);
582   /* Check to see if this is an object */
583   if (sv_isobject(sv)) {
584     SV *tsv = (SV*) SvRV(sv);
585     IV tmp = 0;
586     if ((SvTYPE(tsv) == SVt_PVHV)) {
587       MAGIC *mg;
588       if (SvMAGICAL(tsv)) {
589         mg = mg_find(tsv,'P');
590         if (mg) {
591           sv = mg->mg_obj;
592           if (sv_isobject(sv)) {
593             tmp = SvIV((SV*)SvRV(sv));
594           }
595         }
596       } else {
597         return -1;
598       }
599     } else {
600       tmp = SvIV((SV*)SvRV(sv));
601     }
602     voidptr = (void *)tmp;
603     if (!_t) {
604       *(ptr) = voidptr;
605       return 0;
606     }
607   } else if (! SvOK(sv)) {            /* Check for undef */
608     *(ptr) = (void *) 0;
609     return 0;
610   } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
611     *(ptr) = (void *) 0;
612     if (!SvROK(sv))
613       return 0;
614     else
615       return -1;
616   } else {                            /* Don't know what it is */
617     *(ptr) = (void *) 0;
618     return -1;
619   }
620   if (_t) {
621     /* Now see if the types match */
622     char *_c = HvNAME(SvSTASH(SvRV(sv)));
623     tc = SWIG_TypeCheck(_c,_t);
624     if (!tc) {
625       *ptr = voidptr;
626       return -1;
627     }
628     *ptr = SWIG_TypeCast(tc,voidptr);
629     return 0;
630   }
631   *ptr = voidptr;
632   return 0;
635 static void
636 SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
637   if (ptr && (flags & SWIG_SHADOW)) {
638     SV *self;
639     SV *obj=newSV(0);
640     HV *hash=newHV();
641     HV *stash;
642     sv_setref_pv(obj, (char *) t->name, ptr);
643     stash=SvSTASH(SvRV(obj));
644     if (flags & SWIG_OWNER) {
645       HV *hv;
646       GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
647       if (!isGV(gv))
648         gv_init(gv, stash, "OWNER", 5, FALSE);
649       hv=GvHVn(gv);
650       hv_store_ent(hv, obj, newSViv(1), 0);
651     }
652     sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
653     SvREFCNT_dec(obj);
654     self=newRV_noinc((SV *)hash);
655     sv_setsv(sv, self);
656     SvREFCNT_dec((SV *)self);
657     sv_bless(sv, stash);
658   }
659   else {
660     sv_setref_pv(sv, (char *) t->name, ptr);
661   }
664 static SWIGINLINE SV *
665 SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
666   SV *result = sv_newmortal();
667   SWIG_MakePtr(result, ptr, t, flags);
668   return result;
671 static void
672   SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
673   char result[1024];
674   char *r = result;
675   if ((2*sz + 1 + strlen(type->name)) > 1000) return;
676   *(r++) = '_';
677   r = SWIG_PackData(r,ptr,sz);
678   strcpy(r,type->name);
679   sv_setpv(sv, result);
682 /* Convert a packed value value */
683 static int
684 SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
685   swig_type_info *tc;
686   char  *c = 0;
688   if ((!obj) || (!SvOK(obj))) return -1;
689   c = SvPV(obj, PL_na);
690   /* Pointer values must start with leading underscore */
691   if (*c != '_') return -1;
692   c++;
693   c = SWIG_UnpackData(c,ptr,sz);
694   if (ty) {
695     tc = SWIG_TypeCheck(c,ty);
696     if (!tc) return -1;
697   }
698   return 0;
701 static SWIGINLINE void
702 SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) {
703   if (error) sv_setpv(perl_get_sv("@", TRUE), error);
706 static SWIGINLINE void
707 SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV *error) {
708   if (error) sv_setsv(perl_get_sv("@", TRUE), error);
711 static void
712 SWIG_Perl_SetErrorf(const char *fmt, ...) {
713   va_list args;
714   va_start(args, fmt);
715   sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV**), 0, Null(bool*));
716   va_end(args);
719 /* Macros for low-level exception handling */
720 #define SWIG_fail       goto fail
721 #define SWIG_croak(x)   { SWIG_SetError(x); goto fail; }
722 #define SWIG_croakSV(x) { SWIG_SetErrorSV(x); goto fail; }
723 /* most preprocessors do not support vararg macros :-( */
724 /* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */
727 typedef XS(SwigPerlWrapper);
728 typedef SwigPerlWrapper *SwigPerlWrapperPtr;
730 /* Structure for command table */
731 typedef struct {
732   const char         *name;
733   SwigPerlWrapperPtr  wrapper;
734 } swig_command_info;
736 /* Information for constant table */
738 #define SWIG_INT     1
739 #define SWIG_FLOAT   2
740 #define SWIG_STRING  3
741 #define SWIG_POINTER 4
742 #define SWIG_BINARY  5
744 /* Constant information structure */
745 typedef struct swig_constant_info {
746     int              type;
747     const char      *name;
748     long             lvalue;
749     double           dvalue;
750     void            *pvalue;
751     swig_type_info **ptype;
752 } swig_constant_info;
754 #ifdef __cplusplus
756 #endif
758 /* Structure for variable table */
759 typedef struct {
760   const char   *name;
761   SwigMagicFunc   set;
762   SwigMagicFunc   get;
763   swig_type_info  **type;
764 } swig_variable_info;
766 /* Magic variable code */
767 #ifndef PERL_OBJECT
768 #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
769   #ifndef MULTIPLICITY
770      static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) {
771   #else
772      static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) {
773   #endif
774 #else
775 #  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
776 static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) {
777 #endif
778   MAGIC *mg;
779   sv_magic(sv,sv,'U',(char *) name,strlen(name));
780   mg = mg_find(sv,'U');
781   mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
782   mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
783   mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
784   mg->mg_virtual->svt_len = 0;
785   mg->mg_virtual->svt_clear = 0;
786   mg->mg_virtual->svt_free = 0;
794 #ifdef do_open
795   #undef do_open
796 #endif
797 #ifdef do_close
798   #undef do_close
799 #endif
800 #ifdef scalar
801   #undef scalar
802 #endif
803 #ifdef list
804   #undef list
805 #endif
806 #ifdef apply
807   #undef apply
808 #endif
809 #ifdef convert
810   #undef convert
811 #endif
812 #ifdef Error
813   #undef Error
814 #endif
815 #ifdef form
816   #undef form
817 #endif
818 #ifdef vform
819   #undef vform
820 #endif
821 #ifdef LABEL
822   #undef LABEL
823 #endif
824 #ifdef METHOD
825   #undef METHOD
826 #endif
827 #ifdef Move
828   #undef Move
829 #endif
830 #ifdef yylex
831   #undef yylex
832 #endif
833 #ifdef yyparse
834   #undef yyparse
835 #endif
836 #ifdef yyerror
837   #undef yyerror
838 #endif
839 #ifdef invert
840   #undef invert
841 #endif
842 #ifdef ref
843   #undef ref
844 #endif
845 #ifdef ENTER
846   #undef ENTER
847 #endif
850 /* -------- TYPES TABLE (BEGIN) -------- */
852 #define  SWIGTYPE_p_Inkscape__Extension__Script__Desktop swig_types[0] 
853 #define  SWIGTYPE_p_Inkscape__Extension__Script__Inkscape swig_types[1] 
854 #define  SWIGTYPE_p_Inkscape__Extension__Script__DialogManager swig_types[2] 
855 #define  SWIGTYPE_p_Inkscape__Extension__Script__Document swig_types[3] 
856 static swig_type_info *swig_types[5];
858 /* -------- TYPES TABLE (END) -------- */
860 #define SWIG_init    boot_inkscape_perl
862 #define SWIG_name   "inkscape_perlc::boot_inkscape_perl"
863 #define SWIG_prefix "inkscape_perlc::"
865 #ifdef __cplusplus
866 extern "C"
867 #endif
868 #ifndef PERL_OBJECT
869 #ifndef MULTIPLICITY
870 SWIGEXPORT(void) SWIG_init (CV* cv);
871 #else
872 SWIGEXPORT(void) SWIG_init (pTHXo_ CV* cv);
873 #endif
874 #else
875 SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
876 #endif
879 #include "InkscapeBinding.h"
882 static void xs_init _((pTHX));
883 static PerlInterpreter *my_perl;
885 int perl_eval(char *string) {
886   char *argv[2];
887   argv[0] = string;
888   argv[1] = (char *) 0;
889   return perl_call_argv("eval",0,argv);
892 extern "C" int
893 InkscapePerlParseBuf(char *startupCodeBuf, char *codeBuf)
895     STRLEN n_a;
896     int  exitstatus;
897     char *embedding[] = { "", "-e", "0" };
898         
899     my_perl = perl_alloc();
900     if (!my_perl)
901        return 0;
902     perl_construct( my_perl );
904     exitstatus = perl_parse( my_perl, xs_init, 3,
905                            embedding, (char **) NULL );
906     if (exitstatus)
907         return 0;
909     /* Initialize all of the module variables */
911     exitstatus = perl_run( my_perl );
913     SV *retSV = eval_pv(startupCodeBuf, TRUE);
914     char *ret = SvPV(retSV, n_a);
915     //printf("## module ret:%s\n", ret);
917     retSV = eval_pv("$inkscape = inkscape_perlc::getInkscape();\n", TRUE);
918     ret = SvPV(retSV, n_a);
919     //printf("## inkscape ret:%s\n", ret);
921     retSV = eval_pv(codeBuf, TRUE);
922     ret = SvPV(retSV, n_a);
923     //printf("## code ret:%s\n", ret);
925     perl_destruct( my_perl );
926     perl_free( my_perl );
928     return 1;
931 /* Register any extra external extensions */
933 /* Do not delete this line--writemain depends on it */
934 /* EXTERN_C void boot_DynaLoader _((CV* cv)); */
936 static void
937 xs_init(pTHX)
939 /*  dXSUB_SYS; */
940     char *file = __FILE__;
941     {
942       /*        newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); */
943         newXS(SWIG_name, SWIG_init, file);
944 #ifdef SWIGMODINIT
945         SWIGMODINIT
946 #endif
947     }
952 #ifdef PERL_OBJECT
953 #define MAGIC_CLASS _wrap_inkscape_perl_var::
954 class _wrap_inkscape_perl_var : public CPerlObj {
955 public:
956 #else
957 #define MAGIC_CLASS
958 #endif
959 SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) {
960     MAGIC_PPERL
961     sv = sv; mg = mg;
962     croak("Value is read-only.");
963     return 0;
967 #ifdef PERL_OBJECT
968 };
969 #endif
971 #ifdef __cplusplus
972 extern "C" {
973 #endif
974 XS(_wrap_getInkscape) {
975     {
976         Inkscape::Extension::Script::Inkscape *result;
977         int argvi = 0;
978         dXSARGS;
979         
980         if ((items < 0) || (items > 0)) {
981             SWIG_croak("Usage: getInkscape();");
982         }
983         result = (Inkscape::Extension::Script::Inkscape *)Inkscape::Extension::Script::getInkscape();
984         
985         ST(argvi) = sv_newmortal();
986         SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_Inkscape__Extension__Script__Inkscape, SWIG_SHADOW|0);
987         XSRETURN(argvi);
988         fail:
989         ;
990     }
991     croak(Nullch);
995 XS(_wrap_delete_Inkscape) {
996     {
997         Inkscape::Extension::Script::Inkscape *arg1 = (Inkscape::Extension::Script::Inkscape *) 0 ;
998         int argvi = 0;
999         dXSARGS;
1000         
1001         if ((items < 1) || (items > 1)) {
1002             SWIG_croak("Usage: delete_Inkscape(self);");
1003         }
1004         {
1005             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__Inkscape,0) < 0) {
1006                 SWIG_croak("Type error in argument 1 of delete_Inkscape. Expected _p_Inkscape__Extension__Script__Inkscape");
1007             }
1008         }
1009         delete arg1;
1010         
1011         
1012         XSRETURN(argvi);
1013         fail:
1014         ;
1015     }
1016     croak(Nullch);
1020 XS(_wrap_Inkscape_getDesktop) {
1021     {
1022         Inkscape::Extension::Script::Inkscape *arg1 = (Inkscape::Extension::Script::Inkscape *) 0 ;
1023         Inkscape::Extension::Script::Desktop *result;
1024         int argvi = 0;
1025         dXSARGS;
1026         
1027         if ((items < 1) || (items > 1)) {
1028             SWIG_croak("Usage: Inkscape_getDesktop(self);");
1029         }
1030         {
1031             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__Inkscape,0) < 0) {
1032                 SWIG_croak("Type error in argument 1 of Inkscape_getDesktop. Expected _p_Inkscape__Extension__Script__Inkscape");
1033             }
1034         }
1035         result = (Inkscape::Extension::Script::Desktop *)(arg1)->getDesktop();
1036         
1037         ST(argvi) = sv_newmortal();
1038         SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_Inkscape__Extension__Script__Desktop, SWIG_SHADOW|0);
1039         XSRETURN(argvi);
1040         fail:
1041         ;
1042     }
1043     croak(Nullch);
1047 XS(_wrap_Inkscape_getDialogManager) {
1048     {
1049         Inkscape::Extension::Script::Inkscape *arg1 = (Inkscape::Extension::Script::Inkscape *) 0 ;
1050         Inkscape::Extension::Script::DialogManager *result;
1051         int argvi = 0;
1052         dXSARGS;
1053         
1054         if ((items < 1) || (items > 1)) {
1055             SWIG_croak("Usage: Inkscape_getDialogManager(self);");
1056         }
1057         {
1058             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__Inkscape,0) < 0) {
1059                 SWIG_croak("Type error in argument 1 of Inkscape_getDialogManager. Expected _p_Inkscape__Extension__Script__Inkscape");
1060             }
1061         }
1062         result = (Inkscape::Extension::Script::DialogManager *)(arg1)->getDialogManager();
1063         
1064         ST(argvi) = sv_newmortal();
1065         SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_Inkscape__Extension__Script__DialogManager, SWIG_SHADOW|0);
1066         XSRETURN(argvi);
1067         fail:
1068         ;
1069     }
1070     croak(Nullch);
1074 XS(_wrap_delete_DialogManager) {
1075     {
1076         Inkscape::Extension::Script::DialogManager *arg1 = (Inkscape::Extension::Script::DialogManager *) 0 ;
1077         int argvi = 0;
1078         dXSARGS;
1079         
1080         if ((items < 1) || (items > 1)) {
1081             SWIG_croak("Usage: delete_DialogManager(self);");
1082         }
1083         {
1084             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__DialogManager,0) < 0) {
1085                 SWIG_croak("Type error in argument 1 of delete_DialogManager. Expected _p_Inkscape__Extension__Script__DialogManager");
1086             }
1087         }
1088         delete arg1;
1089         
1090         
1091         XSRETURN(argvi);
1092         fail:
1093         ;
1094     }
1095     croak(Nullch);
1099 XS(_wrap_DialogManager_showAbout) {
1100     {
1101         Inkscape::Extension::Script::DialogManager *arg1 = (Inkscape::Extension::Script::DialogManager *) 0 ;
1102         int argvi = 0;
1103         dXSARGS;
1104         
1105         if ((items < 1) || (items > 1)) {
1106             SWIG_croak("Usage: DialogManager_showAbout(self);");
1107         }
1108         {
1109             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__DialogManager,0) < 0) {
1110                 SWIG_croak("Type error in argument 1 of DialogManager_showAbout. Expected _p_Inkscape__Extension__Script__DialogManager");
1111             }
1112         }
1113         (arg1)->showAbout();
1114         
1115         
1116         XSRETURN(argvi);
1117         fail:
1118         ;
1119     }
1120     croak(Nullch);
1124 XS(_wrap_delete_Desktop) {
1125     {
1126         Inkscape::Extension::Script::Desktop *arg1 = (Inkscape::Extension::Script::Desktop *) 0 ;
1127         int argvi = 0;
1128         dXSARGS;
1129         
1130         if ((items < 1) || (items > 1)) {
1131             SWIG_croak("Usage: delete_Desktop(self);");
1132         }
1133         {
1134             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__Desktop,0) < 0) {
1135                 SWIG_croak("Type error in argument 1 of delete_Desktop. Expected _p_Inkscape__Extension__Script__Desktop");
1136             }
1137         }
1138         delete arg1;
1139         
1140         
1141         XSRETURN(argvi);
1142         fail:
1143         ;
1144     }
1145     croak(Nullch);
1149 XS(_wrap_Desktop_getDocument) {
1150     {
1151         Inkscape::Extension::Script::Desktop *arg1 = (Inkscape::Extension::Script::Desktop *) 0 ;
1152         Inkscape::Extension::Script::Document *result;
1153         int argvi = 0;
1154         dXSARGS;
1155         
1156         if ((items < 1) || (items > 1)) {
1157             SWIG_croak("Usage: Desktop_getDocument(self);");
1158         }
1159         {
1160             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__Desktop,0) < 0) {
1161                 SWIG_croak("Type error in argument 1 of Desktop_getDocument. Expected _p_Inkscape__Extension__Script__Desktop");
1162             }
1163         }
1164         result = (Inkscape::Extension::Script::Document *)(arg1)->getDocument();
1165         
1166         ST(argvi) = sv_newmortal();
1167         SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_Inkscape__Extension__Script__Document, SWIG_SHADOW|0);
1168         XSRETURN(argvi);
1169         fail:
1170         ;
1171     }
1172     croak(Nullch);
1176 XS(_wrap_delete_Document) {
1177     {
1178         Inkscape::Extension::Script::Document *arg1 = (Inkscape::Extension::Script::Document *) 0 ;
1179         int argvi = 0;
1180         dXSARGS;
1181         
1182         if ((items < 1) || (items > 1)) {
1183             SWIG_croak("Usage: delete_Document(self);");
1184         }
1185         {
1186             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__Document,0) < 0) {
1187                 SWIG_croak("Type error in argument 1 of delete_Document. Expected _p_Inkscape__Extension__Script__Document");
1188             }
1189         }
1190         delete arg1;
1191         
1192         
1193         XSRETURN(argvi);
1194         fail:
1195         ;
1196     }
1197     croak(Nullch);
1201 XS(_wrap_Document_hello) {
1202     {
1203         Inkscape::Extension::Script::Document *arg1 = (Inkscape::Extension::Script::Document *) 0 ;
1204         int argvi = 0;
1205         dXSARGS;
1206         
1207         if ((items < 1) || (items > 1)) {
1208             SWIG_croak("Usage: Document_hello(self);");
1209         }
1210         {
1211             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_Inkscape__Extension__Script__Document,0) < 0) {
1212                 SWIG_croak("Type error in argument 1 of Document_hello. Expected _p_Inkscape__Extension__Script__Document");
1213             }
1214         }
1215         (arg1)->hello();
1216         
1217         
1218         XSRETURN(argvi);
1219         fail:
1220         ;
1221     }
1222     croak(Nullch);
1227 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
1229 static swig_type_info _swigt__p_Inkscape__Extension__Script__Desktop[] = {{"inkscape_perl::Desktop", 0, "Inkscape::Extension::Script::Desktop *", 0, 0, 0, 0},{"inkscape_perl::Desktop", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
1230 static swig_type_info _swigt__p_Inkscape__Extension__Script__Inkscape[] = {{"inkscape_perl::Inkscape", 0, "Inkscape::Extension::Script::Inkscape *", 0, 0, 0, 0},{"inkscape_perl::Inkscape", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
1231 static swig_type_info _swigt__p_Inkscape__Extension__Script__DialogManager[] = {{"inkscape_perl::DialogManager", 0, "Inkscape::Extension::Script::DialogManager *", 0, 0, 0, 0},{"inkscape_perl::DialogManager", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
1232 static swig_type_info _swigt__p_Inkscape__Extension__Script__Document[] = {{"inkscape_perl::Document", 0, "Inkscape::Extension::Script::Document *", 0, 0, 0, 0},{"inkscape_perl::Document", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
1234 static swig_type_info *swig_types_initial[] = {
1235 _swigt__p_Inkscape__Extension__Script__Desktop, 
1236 _swigt__p_Inkscape__Extension__Script__Inkscape, 
1237 _swigt__p_Inkscape__Extension__Script__DialogManager, 
1238 _swigt__p_Inkscape__Extension__Script__Document, 
1240 };
1243 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
1245 static swig_constant_info swig_constants[] = {
1246 {0,0,0,0,0,0}
1247 };
1248 #ifdef __cplusplus
1250 #endif
1251 static swig_variable_info swig_variables[] = {
1252 {0,0,0,0}
1253 };
1254 static swig_command_info swig_commands[] = {
1255 {"inkscape_perlc::getInkscape", _wrap_getInkscape},
1256 {"inkscape_perlc::delete_Inkscape", _wrap_delete_Inkscape},
1257 {"inkscape_perlc::Inkscape_getDesktop", _wrap_Inkscape_getDesktop},
1258 {"inkscape_perlc::Inkscape_getDialogManager", _wrap_Inkscape_getDialogManager},
1259 {"inkscape_perlc::delete_DialogManager", _wrap_delete_DialogManager},
1260 {"inkscape_perlc::DialogManager_showAbout", _wrap_DialogManager_showAbout},
1261 {"inkscape_perlc::delete_Desktop", _wrap_delete_Desktop},
1262 {"inkscape_perlc::Desktop_getDocument", _wrap_Desktop_getDocument},
1263 {"inkscape_perlc::delete_Document", _wrap_delete_Document},
1264 {"inkscape_perlc::Document_hello", _wrap_Document_hello},
1265 {0,0}
1266 };
1268 #ifdef __cplusplus
1269 extern "C"
1270 #endif
1272 XS(SWIG_init) {
1273     dXSARGS;
1274     int i;
1275     static int _init = 0;
1276     if (!_init) {
1277         SWIG_Perl_LookupTypePointer();
1278         for (i = 0; swig_types_initial[i]; i++) {
1279             swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
1280         }       
1281         _init = 1;
1282     }
1283     
1284     /* Install commands */
1285     for (i = 0; swig_commands[i].name; i++) {
1286         newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
1287     }
1288     
1289     /* Install variables */
1290     for (i = 0; swig_variables[i].name; i++) {
1291         SV *sv;
1292         sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2);
1293         if (swig_variables[i].type) {
1294             SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
1295         } else {
1296             sv_setiv(sv,(IV) 0);
1297         }
1298         swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
1299     }
1300     
1301     /* Install constant */
1302     for (i = 0; swig_constants[i].type; i++) {
1303         SV *sv;
1304         sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2);
1305         switch(swig_constants[i].type) {
1306             case SWIG_INT:
1307             sv_setiv(sv, (IV) swig_constants[i].lvalue);
1308             break;
1309             case SWIG_FLOAT:
1310             sv_setnv(sv, (double) swig_constants[i].dvalue);
1311             break;
1312             case SWIG_STRING:
1313             sv_setpv(sv, (char *) swig_constants[i].pvalue);
1314             break;
1315             case SWIG_POINTER:
1316             SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
1317             break;
1318             case SWIG_BINARY:
1319             SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
1320             break;
1321             default:
1322             break;
1323         }
1324         SvREADONLY_on(sv);
1325     }
1326     
1327     SWIG_TypeClientData(SWIGTYPE_p_Inkscape__Extension__Script__Inkscape, (void*) "inkscape_perl::Inkscape");
1328     SWIG_TypeClientData(SWIGTYPE_p_Inkscape__Extension__Script__DialogManager, (void*) "inkscape_perl::DialogManager");
1329     SWIG_TypeClientData(SWIGTYPE_p_Inkscape__Extension__Script__Desktop, (void*) "inkscape_perl::Desktop");
1330     SWIG_TypeClientData(SWIGTYPE_p_Inkscape__Extension__Script__Document, (void*) "inkscape_perl::Document");
1331     ST(0) = &PL_sv_yes;
1332     XSRETURN(1);