naev 0.12.6
cmark_wrap.c
1// clang-format off
2/*
3 * From: https://github.com/jgm/cmark-lua
4 */
5/* ----------------------------------------------------------------------------
6 * This file was automatically generated by SWIG (https://www.swig.org).
7 * Version 4.2.1
8 *
9 * Do not make changes to this file unless you know what you are doing - modify
10 * the SWIG interface file instead.
11 * ----------------------------------------------------------------------------- */
12
13
14#define SWIG_VERSION 0x040201
15#define SWIGLUA
16#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA
17#define SWIG_LUA_MODULE_GLOBAL
18
19/* -----------------------------------------------------------------------------
20 * This section contains generic SWIG labels for method/variable
21 * declarations/attributes, and other compiler dependent labels.
22 * ----------------------------------------------------------------------------- */
23
24/* template workaround for compilers that cannot correctly implement the C++ standard */
25#ifndef SWIGTEMPLATEDISAMBIGUATOR
26# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
27# define SWIGTEMPLATEDISAMBIGUATOR template
28# elif defined(__HP_aCC)
29/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
30/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
31# define SWIGTEMPLATEDISAMBIGUATOR template
32# else
33# define SWIGTEMPLATEDISAMBIGUATOR
34# endif
35#endif
36
37/* inline attribute */
38#ifndef SWIGINLINE
39# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
40# define SWIGINLINE inline
41# else
42# define SWIGINLINE
43# endif
44#endif
45
46/* attribute recognised by some compilers to avoid 'unused' warnings */
47#ifndef SWIGUNUSED
48# if defined(__GNUC__)
49# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
50# define SWIGUNUSED __attribute__ ((__unused__))
51# else
52# define SWIGUNUSED
53# endif
54# elif defined(__ICC)
55# define SWIGUNUSED __attribute__ ((__unused__))
56# else
57# define SWIGUNUSED
58# endif
59#endif
60
61#ifndef SWIG_MSC_UNSUPPRESS_4505
62# if defined(_MSC_VER)
63# pragma warning(disable : 4505) /* unreferenced local function has been removed */
64# endif
65#endif
66
67#ifndef SWIGUNUSEDPARM
68# ifdef __cplusplus
69# define SWIGUNUSEDPARM(p)
70# else
71# define SWIGUNUSEDPARM(p) p SWIGUNUSED
72# endif
73#endif
74
75/* internal SWIG method */
76#ifndef SWIGINTERN
77# define SWIGINTERN static SWIGUNUSED
78#endif
79
80/* internal inline SWIG method */
81#ifndef SWIGINTERNINLINE
82# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
83#endif
84
85/* exporting methods */
86#if defined(__GNUC__)
87# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
88# ifndef GCC_HASCLASSVISIBILITY
89# define GCC_HASCLASSVISIBILITY
90# endif
91# endif
92#endif
93
94#ifndef SWIGEXPORT
95# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
96# if defined(STATIC_LINKED)
97# define SWIGEXPORT
98# else
99# define SWIGEXPORT __declspec(dllexport)
100# endif
101# else
102# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
103# define SWIGEXPORT __attribute__ ((visibility("default")))
104# else
105# define SWIGEXPORT
106# endif
107# endif
108#endif
109
110/* calling conventions for Windows */
111#ifndef SWIGSTDCALL
112# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
113# define SWIGSTDCALL __stdcall
114# else
115# define SWIGSTDCALL
116# endif
117#endif
118
119/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
120#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
121# define _CRT_SECURE_NO_DEPRECATE
122#endif
123
124/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
125#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
126# define _SCL_SECURE_NO_DEPRECATE
127#endif
128
129/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
130#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
131# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
132#endif
133
134/* Intel's compiler complains if a variable which was never initialised is
135 * cast to void, which is a common idiom which we use to indicate that we
136 * are aware a variable isn't used. So we just silence that warning.
137 * See: https://github.com/swig/swig/issues/192 for more discussion.
138 */
139#ifdef __INTEL_COMPILER
140# pragma warning disable 592
141#endif
142
143#if defined(__cplusplus) && __cplusplus >=201103L
144# define SWIG_NULLPTR nullptr
145#else
146# define SWIG_NULLPTR NULL
147#endif
148
149/* -----------------------------------------------------------------------------
150 * swigcompat.swg
151 *
152 * Macros to provide support compatibility with older C and C++ standards.
153 * ----------------------------------------------------------------------------- */
154
155/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF
156 * if you're missing it.
157 */
158#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \
159 (defined __cplusplus && __cplusplus >= 201103L) || \
160 defined SWIG_HAVE_SNPRINTF) && \
161 !defined SWIG_NO_SNPRINTF
162# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A)
163# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B)
164#else
165/* Fallback versions ignore the buffer size, but most of our uses either have a
166 * fixed maximum possible size or dynamically allocate a buffer that's large
167 * enough.
168 */
169# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A)
170# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B)
171#endif
172
173/* -----------------------------------------------------------------------------
174 * swigrun.swg
175 *
176 * This file contains generic C API SWIG runtime support for pointer
177 * type checking.
178 * ----------------------------------------------------------------------------- */
179
180/* This should only be incremented when either the layout of swig_type_info changes,
181 or for whatever reason, the runtime changes incompatibly */
182#define SWIG_RUNTIME_VERSION "4"
183
184/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
185#ifdef SWIG_TYPE_TABLE
186# define SWIG_QUOTE_STRING(x) #x
187# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
188# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
189#else
190# define SWIG_TYPE_TABLE_NAME
191#endif
192
193/*
194 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
195 creating a static or dynamic library from the SWIG runtime code.
196 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
197
198 But only do this if strictly necessary, ie, if you have problems
199 with your compiler or suchlike.
200*/
201
202#ifndef SWIGRUNTIME
203# define SWIGRUNTIME SWIGINTERN
204#endif
205
206#ifndef SWIGRUNTIMEINLINE
207# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
208#endif
209
210/* Generic buffer size */
211#ifndef SWIG_BUFFER_SIZE
212# define SWIG_BUFFER_SIZE 1024
213#endif
214
215/* Flags for pointer conversions */
216#define SWIG_POINTER_DISOWN 0x1
217#define SWIG_CAST_NEW_MEMORY 0x2
218#define SWIG_POINTER_NO_NULL 0x4
219#define SWIG_POINTER_CLEAR 0x8
220#define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN)
221
222/* Flags for new pointer objects */
223#define SWIG_POINTER_OWN 0x1
224
225
226/*
227 Flags/methods for returning states.
228
229 The SWIG conversion methods, as ConvertPtr, return an integer
230 that tells if the conversion was successful or not. And if not,
231 an error code can be returned (see swigerrors.swg for the codes).
232
233 Use the following macros/flags to set or process the returning
234 states.
235
236 In old versions of SWIG, code such as the following was usually written:
237
238 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
239 // success code
240 } else {
241 //fail code
242 }
243
244 Now you can be more explicit:
245
246 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
247 if (SWIG_IsOK(res)) {
248 // success code
249 } else {
250 // fail code
251 }
252
253 which is the same really, but now you can also do
254
255 Type *ptr;
256 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
257 if (SWIG_IsOK(res)) {
258 // success code
259 if (SWIG_IsNewObj(res) {
260 ...
261 delete *ptr;
262 } else {
263 ...
264 }
265 } else {
266 // fail code
267 }
268
269 I.e., now SWIG_ConvertPtr can return new objects and you can
270 identify the case and take care of the deallocation. Of course that
271 also requires SWIG_ConvertPtr to return new result values, such as
272
273 int SWIG_ConvertPtr(obj, ptr,...) {
274 if (<obj is ok>) {
275 if (<need new object>) {
276 *ptr = <ptr to new allocated object>;
277 return SWIG_NEWOBJ;
278 } else {
279 *ptr = <ptr to old object>;
280 return SWIG_OLDOBJ;
281 }
282 } else {
283 return SWIG_BADOBJ;
284 }
285 }
286
287 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
288 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
289 SWIG errors code.
290
291 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
292 allows returning the 'cast rank', for example, if you have this
293
294 int food(double)
295 int fooi(int);
296
297 and you call
298
299 food(1) // cast rank '1' (1 -> 1.0)
300 fooi(1) // cast rank '0'
301
302 just use the SWIG_AddCast()/SWIG_CheckState()
303*/
304
305#define SWIG_OK (0)
306/* Runtime errors are < 0 */
307#define SWIG_ERROR (-1)
308/* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */
309/* Errors in range -100 to -199 are language specific errors defined in *errors.swg */
310/* Errors < -200 are generic runtime specific errors */
311#define SWIG_ERROR_RELEASE_NOT_OWNED (-200)
312
313#define SWIG_IsOK(r) (r >= 0)
314#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
315
316/* The CastRankLimit says how many bits are used for the cast rank */
317#define SWIG_CASTRANKLIMIT (1 << 8)
318/* The NewMask denotes the object was created (using new/malloc) */
319#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
320/* The TmpMask is for in/out typemaps that use temporary objects */
321#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
322/* Simple returning values */
323#define SWIG_BADOBJ (SWIG_ERROR)
324#define SWIG_OLDOBJ (SWIG_OK)
325#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
326#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
327/* Check, add and del object mask methods */
328#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
329#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
330#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
331#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
332#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
333#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
334
335/* Cast-Rank Mode */
336#if defined(SWIG_CASTRANK_MODE)
337# ifndef SWIG_TypeRank
338# define SWIG_TypeRank unsigned long
339# endif
340# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
341# define SWIG_MAXCASTRANK (2)
342# endif
343# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
344# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
345SWIGINTERNINLINE int SWIG_AddCast(int r) {
346 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
347}
348SWIGINTERNINLINE int SWIG_CheckState(int r) {
349 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
350}
351#else /* no cast-rank mode */
352# define SWIG_AddCast(r) (r)
353# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
354#endif
355
356
357#include <string.h>
358
359#ifdef __cplusplus
360extern "C" {
361#endif
362
363typedef void *(*swig_converter_func)(void *, int *);
364typedef struct swig_type_info *(*swig_dycast_func)(void **);
365
366/* Structure to store information on one type */
367typedef struct swig_type_info {
368 const char *name; /* mangled name of this type */
369 const char *str; /* human readable name of this type */
370 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
371 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
372 void *clientdata; /* language specific type data */
373 int owndata; /* flag if the structure owns the clientdata */
375
376/* Structure to store a type and conversion function used for casting */
377typedef struct swig_cast_info {
378 swig_type_info *type; /* pointer to type that is equivalent to this type */
379 swig_converter_func converter; /* function to cast the void pointers */
380 struct swig_cast_info *next; /* pointer to next cast in linked list */
381 struct swig_cast_info *prev; /* pointer to the previous cast */
383
384/* Structure used to store module information
385 * Each module generates one structure like this, and the runtime collects
386 * all of these structures and stores them in a circularly linked list.*/
387typedef struct swig_module_info {
388 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
389 size_t size; /* Number of types in this module */
390 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
391 swig_type_info **type_initial; /* Array of initially generated type structures */
392 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
393 void *clientdata; /* Language specific module data */
395
396/*
397 Compare two type names skipping the space characters, therefore
398 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
399
400 Return 0 when the two name types are equivalent, as in
401 strncmp, but skipping ' '.
402*/
403SWIGRUNTIME int
404SWIG_TypeNameComp(const char *f1, const char *l1,
405 const char *f2, const char *l2) {
406 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
407 while ((*f1 == ' ') && (f1 != l1)) ++f1;
408 while ((*f2 == ' ') && (f2 != l2)) ++f2;
409 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
410 }
411 return (int)((l1 - f1) - (l2 - f2));
412}
413
414/*
415 Check type equivalence in a name list like <name1>|<name2>|...
416 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
417*/
418SWIGRUNTIME int
419SWIG_TypeCmp(const char *nb, const char *tb) {
420 int equiv = 1;
421 const char* te = tb + strlen(tb);
422 const char* ne = nb;
423 while (equiv != 0 && *ne) {
424 for (nb = ne; *ne; ++ne) {
425 if (*ne == '|') break;
426 }
427 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
428 if (*ne) ++ne;
429 }
430 return equiv;
431}
432
433/*
434 Check type equivalence in a name list like <name1>|<name2>|...
435 Return 0 if not equal, 1 if equal
436*/
437SWIGRUNTIME int
438SWIG_TypeEquiv(const char *nb, const char *tb) {
439 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
440}
441
442/*
443 Check the typename
444*/
445SWIGRUNTIME swig_cast_info *
446SWIG_TypeCheck(const char *c, swig_type_info *ty) {
447 if (ty) {
448 swig_cast_info *iter = ty->cast;
449 while (iter) {
450 if (strcmp(iter->type->name, c) == 0) {
451 if (iter == ty->cast)
452 return iter;
453 /* Move iter to the top of the linked list */
454 iter->prev->next = iter->next;
455 if (iter->next)
456 iter->next->prev = iter->prev;
457 iter->next = ty->cast;
458 iter->prev = 0;
459 if (ty->cast) ty->cast->prev = iter;
460 ty->cast = iter;
461 return iter;
462 }
463 iter = iter->next;
464 }
465 }
466 return 0;
467}
468
469/*
470 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
471*/
472SWIGRUNTIME swig_cast_info *
473SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) {
474 if (ty) {
475 swig_cast_info *iter = ty->cast;
476 while (iter) {
477 if (iter->type == from) {
478 if (iter == ty->cast)
479 return iter;
480 /* Move iter to the top of the linked list */
481 iter->prev->next = iter->next;
482 if (iter->next)
483 iter->next->prev = iter->prev;
484 iter->next = ty->cast;
485 iter->prev = 0;
486 if (ty->cast) ty->cast->prev = iter;
487 ty->cast = iter;
488 return iter;
489 }
490 iter = iter->next;
491 }
492 }
493 return 0;
494}
495
496/*
497 Cast a pointer up an inheritance hierarchy
498*/
499SWIGRUNTIMEINLINE void *
500SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
501 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
502}
503
504/*
505 Dynamic pointer casting. Down an inheritance hierarchy
506*/
507SWIGRUNTIME swig_type_info *
508SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
509 swig_type_info *lastty = ty;
510 if (!ty || !ty->dcast) return ty;
511 while (ty && (ty->dcast)) {
512 ty = (*ty->dcast)(ptr);
513 if (ty) lastty = ty;
514 }
515 return lastty;
516}
517
518/*
519 Return the name associated with this type
520*/
521SWIGRUNTIMEINLINE const char *
522SWIG_TypeName(const swig_type_info *ty) {
523 return ty->name;
524}
525
526/*
527 Return the pretty name associated with this type,
528 that is an unmangled type name in a form presentable to the user.
529*/
530SWIGRUNTIME const char *
531SWIG_TypePrettyName(const swig_type_info *type) {
532 /* The "str" field contains the equivalent pretty names of the
533 type, separated by vertical-bar characters. Choose the last
534 name. It should be the most specific; a fully resolved name
535 but not necessarily with default template parameters expanded. */
536 if (!type) return NULL;
537 if (type->str != NULL) {
538 const char *last_name = type->str;
539 const char *s;
540 for (s = type->str; *s; s++)
541 if (*s == '|') last_name = s+1;
542 return last_name;
543 }
544 else
545 return type->name;
546}
547
548/*
549 Set the clientdata field for a type
550*/
551SWIGRUNTIME void
552SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
553 swig_cast_info *cast = ti->cast;
554 /* if (ti->clientdata == clientdata) return; */
555 ti->clientdata = clientdata;
556
557 while (cast) {
558 if (!cast->converter) {
559 swig_type_info *tc = cast->type;
560 if (!tc->clientdata) {
561 SWIG_TypeClientData(tc, clientdata);
562 }
563 }
564 cast = cast->next;
565 }
566}
567SWIGRUNTIME void
568SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
569 SWIG_TypeClientData(ti, clientdata);
570 ti->owndata = 1;
571}
572
573/*
574 Search for a swig_type_info structure only by mangled name
575 Search is a O(log #types)
576
577 We start searching at module start, and finish searching when start == end.
578 Note: if start == end at the beginning of the function, we go all the way around
579 the circular list.
580*/
581SWIGRUNTIME swig_type_info *
582SWIG_MangledTypeQueryModule(swig_module_info *start,
583 swig_module_info *end,
584 const char *name) {
585 swig_module_info *iter = start;
586 do {
587 if (iter->size) {
588 size_t l = 0;
589 size_t r = iter->size - 1;
590 do {
591 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
592 size_t i = (l + r) >> 1;
593 const char *iname = iter->types[i]->name;
594 if (iname) {
595 int compare = strcmp(name, iname);
596 if (compare == 0) {
597 return iter->types[i];
598 } else if (compare < 0) {
599 if (i) {
600 r = i - 1;
601 } else {
602 break;
603 }
604 } else if (compare > 0) {
605 l = i + 1;
606 }
607 } else {
608 break; /* should never happen */
609 }
610 } while (l <= r);
611 }
612 iter = iter->next;
613 } while (iter != end);
614 return 0;
615}
616
617/*
618 Search for a swig_type_info structure for either a mangled name or a human readable name.
619 It first searches the mangled names of the types, which is a O(log #types)
620 If a type is not found it then searches the human readable names, which is O(#types).
621
622 We start searching at module start, and finish searching when start == end.
623 Note: if start == end at the beginning of the function, we go all the way around
624 the circular list.
625*/
626SWIGRUNTIME swig_type_info *
627SWIG_TypeQueryModule(swig_module_info *start,
628 swig_module_info *end,
629 const char *name) {
630 /* STEP 1: Search the name field using binary search */
631 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
632 if (ret) {
633 return ret;
634 } else {
635 /* STEP 2: If the type hasn't been found, do a complete search
636 of the str field (the human readable name) */
637 swig_module_info *iter = start;
638 do {
639 size_t i = 0;
640 for (; i < iter->size; ++i) {
641 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
642 return iter->types[i];
643 }
644 iter = iter->next;
645 } while (iter != end);
646 }
647
648 /* neither found a match */
649 return 0;
650}
651
652/*
653 Pack binary data into a string
654*/
655SWIGRUNTIME char *
656SWIG_PackData(char *c, void *ptr, size_t sz) {
657 static const char hex[17] = "0123456789abcdef";
658 const unsigned char *u = (unsigned char *) ptr;
659 const unsigned char *eu = u + sz;
660 for (; u != eu; ++u) {
661 unsigned char uu = *u;
662 *(c++) = hex[(uu & 0xf0) >> 4];
663 *(c++) = hex[uu & 0xf];
664 }
665 return c;
666}
667
668/*
669 Unpack binary data from a string
670*/
671SWIGRUNTIME const char *
672SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
673 unsigned char *u = (unsigned char *) ptr;
674 const unsigned char *eu = u + sz;
675 for (; u != eu; ++u) {
676 char d = *(c++);
677 unsigned char uu;
678 if ((d >= '0') && (d <= '9'))
679 uu = (unsigned char)((d - '0') << 4);
680 else if ((d >= 'a') && (d <= 'f'))
681 uu = (unsigned char)((d - ('a'-10)) << 4);
682 else
683 return (char *) 0;
684 d = *(c++);
685 if ((d >= '0') && (d <= '9'))
686 uu |= (unsigned char)(d - '0');
687 else if ((d >= 'a') && (d <= 'f'))
688 uu |= (unsigned char)(d - ('a'-10));
689 else
690 return (char *) 0;
691 *u = uu;
692 }
693 return c;
694}
695
696/*
697 Pack 'void *' into a string buffer.
698*/
699SWIGRUNTIME char *
700SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
701 char *r = buff;
702 if ((2*sizeof(void *) + 2) > bsz) return 0;
703 *(r++) = '_';
704 r = SWIG_PackData(r,&ptr,sizeof(void *));
705 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
706 strcpy(r,name);
707 return buff;
708}
709
710SWIGRUNTIME const char *
711SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
712 if (*c != '_') {
713 if (strcmp(c,"NULL") == 0) {
714 *ptr = (void *) 0;
715 return name;
716 } else {
717 return 0;
718 }
719 }
720 return SWIG_UnpackData(++c,ptr,sizeof(void *));
721}
722
723SWIGRUNTIME char *
724SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
725 char *r = buff;
726 size_t lname = (name ? strlen(name) : 0);
727 if ((2*sz + 2 + lname) > bsz) return 0;
728 *(r++) = '_';
729 r = SWIG_PackData(r,ptr,sz);
730 if (lname) {
731 strncpy(r,name,lname+1);
732 } else {
733 *r = 0;
734 }
735 return buff;
736}
737
738SWIGRUNTIME const char *
739SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
740 if (*c != '_') {
741 if (strcmp(c,"NULL") == 0) {
742 memset(ptr,0,sz);
743 return name;
744 } else {
745 return 0;
746 }
747 }
748 return SWIG_UnpackData(++c,ptr,sz);
749}
750
751#ifdef __cplusplus
752}
753#endif
754
755/* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */
756#define SWIG_UnknownError -1
757#define SWIG_IOError -2
758#define SWIG_RuntimeError -3
759#define SWIG_IndexError -4
760#define SWIG_TypeError -5
761#define SWIG_DivisionByZero -6
762#define SWIG_OverflowError -7
763#define SWIG_SyntaxError -8
764#define SWIG_ValueError -9
765#define SWIG_SystemError -10
766#define SWIG_AttributeError -11
767#define SWIG_MemoryError -12
768#define SWIG_NullReferenceError -13
769
770
771/* -----------------------------------------------------------------------------
772 * luarun.swg
773 *
774 * This file contains the runtime support for Lua modules
775 * and includes code for managing global variables and pointer
776 * type checking.
777 * ----------------------------------------------------------------------------- */
778
779#ifdef __cplusplus
780extern "C" {
781#endif
782
783#include "lua.h"
784#include "lauxlib.h"
785#include <stdlib.h> /* for malloc */
786#include <assert.h> /* for a few sanity tests */
787
788/* -----------------------------------------------------------------------------
789 * Lua flavors
790 * ----------------------------------------------------------------------------- */
791
792#define SWIG_LUA_FLAVOR_LUA 1
793#define SWIG_LUA_FLAVOR_ELUA 2
794#define SWIG_LUA_FLAVOR_ELUAC 3
795
796#if !defined(SWIG_LUA_TARGET)
797# error SWIG_LUA_TARGET not defined
798#endif
799
800#if defined(SWIG_LUA_ELUA_EMULATE)
801
802struct swig_elua_entry;
803
804typedef struct swig_elua_key {
805 int type;
806 union {
807 const char* strkey;
808 lua_Number numkey;
809 } key;
810} swig_elua_key;
811
812typedef struct swig_elua_val {
813 int type;
814 union {
815 lua_Number number;
816 const struct swig_elua_entry *table;
817 const char *string;
818 lua_CFunction function;
819 struct {
820 char member;
821 long lvalue;
822 void *pvalue;
823 swig_type_info **ptype;
824 } userdata;
825 } value;
826} swig_elua_val;
827
828typedef struct swig_elua_entry {
829 swig_elua_key key;
830 swig_elua_val value;
831} swig_elua_entry;
832
833#define LSTRKEY(x) {LUA_TSTRING, {.strkey = x} }
834#define LNUMKEY(x) {LUA_TNUMBER, {.numkey = x} }
835#define LNILKEY {LUA_TNIL, {.strkey = 0} }
836
837#define LNUMVAL(x) {LUA_TNUMBER, {.number = x} }
838#define LFUNCVAL(x) {LUA_TFUNCTION, {.function = x} }
839#define LROVAL(x) {LUA_TTABLE, {.table = x} }
840#define LNILVAL {LUA_TNIL, {.string = 0} }
841#define LSTRVAL(x) {LUA_TSTRING, {.string = x} }
842
843#define LUA_REG_TYPE swig_elua_entry
844
845#define SWIG_LUA_ELUA_EMUL_METATABLE_KEY "__metatable"
846
847#define lua_pushrotable(L,p)\
848 lua_newtable(L);\
849 assert(p);\
850 SWIG_Lua_elua_emulate_register(L,(swig_elua_entry*)(p));
851
852#define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\
853 LSTRKEY(B), {LUA_TUSERDATA, { .userdata={0,0,(void*)(C),&D} } }
854
855#define SWIG_LUA_CONSTTAB_BINARY(B,S,C,D)\
856 LSTRKEY(B), {LUA_TUSERDATA, { .userdata={1,S,(void*)(C),&D} } }
857#endif
858
859#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
860# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
861# define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
862# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
863# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
864 /* Those two types of constants are not supported in elua */
865
866#ifndef SWIG_LUA_CONSTTAB_POINTER
867#warning eLua does not support pointers as constants. By default, nil will be used as value
868#define SWIG_LUA_CONSTTAB_POINTER(B,C,D) LSTRKEY(B), LNILVAL
869#endif
870
871#ifndef SWIG_LUA_CONSTTAB_BINARY
872#warning eLua does not support pointers to member as constants. By default, nil will be used as value
873#define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D) LSTRKEY(B), LNILVAL
874#endif
875#else /* SWIG_LUA_FLAVOR_LUA */
876# define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
877# define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
878# define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
879# define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
880# define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\
881 SWIG_LUA_POINTER, (char *)B, 0, 0, (void *)C, &D
882# define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D)\
883 SWIG_LUA_BINARY, (char *)B, S, 0, (void *)C, &D
884#endif
885
886#ifndef SWIG_LUA_ELUA_EMULATE
887#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
888# define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
889# define LSTRVAL LRO_STRVAL
890#endif
891#endif /* SWIG_LUA_ELUA_EMULATE*/
892
893#ifndef SWIG_LUA_ELUA_EMULATE
894#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
895
896#ifndef MIN_OPT_LEVEL
897#define MIN_OPT_LEVEL 2
898#endif
899
900#include "lrodefs.h"
901#include "lrotable.h"
902#endif
903#endif /* SWIG_LUA_ELUA_EMULATE*/
904/* -----------------------------------------------------------------------------
905 * compatibility defines
906 * ----------------------------------------------------------------------------- */
907
908/* History of Lua C API length functions: In Lua 5.0 (and before?)
909 there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen",
910 but a compatibility define of "lua_strlen" was added. In Lua 5.2,
911 this function was again renamed, to "lua_rawlen" (to emphasize that
912 it doesn't call the "__len" metamethod), and the compatibility
913 define of lua_strlen was removed. All SWIG uses have been updated
914 to "lua_rawlen", and we add our own defines of that here for older
915 versions of Lua. */
916#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
917# define lua_rawlen lua_strlen
918#elif LUA_VERSION_NUM == 501
919# define lua_rawlen lua_objlen
920#endif
921
922/* lua_tolstring() was added in Lua 5.1. It should be a little more
923 efficient than making two separate calls and it avoids problems with order
924 of evaluation so SWIG calls lua_tolstring() when it wants the length and
925 we provide a compatibility implementation for Lua 5.0. */
926#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
927static const char *(lua_tolstring)(lua_State *L, int idx, size_t *len) {
928 /* Call lua_tostring() first as it may convert the value from number to
929 string. */
930 const char *result = lua_tostring(L, idx);
931 if (len) *len = lua_strlen(L, idx);
932 return result;
933}
934#endif
935
936
937/* lua_pushglobaltable is the recommended "future-proof" way to get
938 the global table for Lua 5.2 and later. Here we define
939 lua_pushglobaltable ourselves for Lua versions before 5.2. */
940#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
941# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
942#endif
943
944/* lua_absindex was introduced in Lua 5.2 */
945#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
946# define lua_absindex(L,i) ((i)>0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
947#endif
948
949/* lua_rawsetp was introduced in Lua 5.2 */
950#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
951#define lua_rawsetp(L,index,ptr)\
952 lua_pushlightuserdata(L,(void*)(ptr));\
953 lua_insert(L,-2);\
954 lua_rawset(L,index);
955
956#define lua_rawgetp(L,index,ptr)\
957 lua_pushlightuserdata(L,(void*)(ptr));\
958 lua_rawget(L,index);
959
960#endif
961
962/* --------------------------------------------------------------------------
963 * Helper functions for error handling
964 * -------------------------------------------------------------------------- */
965
966/* Push the string STR on the Lua stack, like lua_pushstring, but
967 prefixed with the location of the innermost Lua call-point
968 (as formatted by luaL_where). */
969SWIGRUNTIME void
970SWIG_Lua_pusherrstring (lua_State *L, const char *str)
971{
972 luaL_where (L, 1);
973 lua_pushstring (L, str);
974 lua_concat (L, 2);
975}
976
977/* Push a formatted string generated from FMT and following args on
978 the Lua stack, like lua_pushfstring, but prefixed with the
979 location of the innermost Lua call-point (as formatted by luaL_where). */
980SWIGRUNTIME void
981SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
982{
983 va_list argp;
984 va_start(argp, fmt);
985 luaL_where(L, 1);
986 lua_pushvfstring(L, fmt, argp);
987 va_end(argp);
988 lua_concat(L, 2);
989}
990
991
992/* -----------------------------------------------------------------------------
993 * global swig types
994 * ----------------------------------------------------------------------------- */
995/* Constant table */
996#define SWIG_LUA_INT 1
997#define SWIG_LUA_FLOAT 2
998#define SWIG_LUA_STRING 3
999#define SWIG_LUA_POINTER 4
1000#define SWIG_LUA_BINARY 5
1001#define SWIG_LUA_CHAR 6
1002
1003/* Structure for variable linking table */
1004typedef struct {
1005 const char *name;
1006 lua_CFunction get;
1007 lua_CFunction set;
1009
1010#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
1011typedef const LUA_REG_TYPE swig_lua_method;
1012typedef const LUA_REG_TYPE swig_lua_const_info;
1013#else /* Normal lua */
1014typedef luaL_Reg swig_lua_method;
1015
1016/* Constant information structure */
1017typedef struct {
1018 int type;
1019 char *name;
1020 long lvalue;
1021 double dvalue;
1022 void *pvalue;
1023 swig_type_info **ptype;
1024} swig_lua_const_info;
1025
1026#endif
1027
1028typedef struct {
1029 const char *name;
1030 lua_CFunction getmethod;
1031 lua_CFunction setmethod;
1033
1034
1035struct swig_lua_class;
1036/* Can be used to create namespaces. Currently used to wrap class static methods/variables/constants */
1037typedef struct swig_lua_namespace {
1038 const char *name;
1039 swig_lua_method *ns_methods;
1040 swig_lua_attribute *ns_attributes;
1041 swig_lua_const_info *ns_constants;
1042 struct swig_lua_class **ns_classes;
1043 struct swig_lua_namespace **ns_namespaces;
1045
1046typedef struct swig_lua_class {
1047 const char *name; /* Name that this class has in Lua */
1048 const char *fqname; /* Fully qualified name - Scope + class name */
1049 swig_type_info **type;
1050 lua_CFunction constructor;
1051 void (*destructor)(void *);
1052 swig_lua_method *methods;
1053 swig_lua_attribute *attributes;
1054 swig_lua_namespace *cls_static;
1055 swig_lua_method *metatable; /* 0 for -eluac */
1056 struct swig_lua_class **bases;
1057 const char **base_names;
1059
1060/* this is the struct for wrapping all pointers in SwigLua
1061*/
1062typedef struct {
1063 swig_type_info *type;
1064 int own; /* 1 if owned & must be destroyed */
1065 void *ptr;
1067
1068/* this is the struct for wrapping arbitrary packed binary data
1069(currently it is only used for member function pointers)
1070the data ordering is similar to swig_lua_userdata, but it is currently not possible
1071to tell the two structures apart within SWIG, other than by looking at the type
1072*/
1073typedef struct {
1074 swig_type_info *type;
1075 int own; /* 1 if owned & must be destroyed */
1076 char data[1]; /* arbitrary amount of data */
1078
1079/* Common SWIG API */
1080#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
1081#define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
1082#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
1083/* for C++ member pointers, ie, member methods */
1084#define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
1085#define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type)
1086
1087/* Runtime API */
1088#define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
1089#define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
1090#define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
1091
1092/* Contract support */
1093#define SWIG_contract_assert(expr, msg) \
1094 do { if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } } while (0)
1095
1096
1097/* helper #defines */
1098#define SWIG_fail {goto fail;}
1099#define SWIG_fail_arg(func_name,argnum,type) \
1100 {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
1101 func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
1102 goto fail;}
1103#define SWIG_fail_ptr(func_name,argnum,type) \
1104 SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
1105#define SWIG_check_num_args(func_name,a,b) \
1106 if (lua_gettop(L)<a || lua_gettop(L)>b) \
1107 {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
1108 goto fail;}
1109
1110
1111#define SWIG_Lua_get_table(L,n) \
1112 (lua_pushstring(L, n), lua_rawget(L,-2))
1113
1114#define SWIG_Lua_add_function(L,n,f) \
1115 (lua_pushstring(L, n), \
1116 lua_pushcfunction(L, f), \
1117 lua_rawset(L,-3))
1118
1119#define SWIG_Lua_add_boolean(L,n,b) \
1120 (lua_pushstring(L, n), \
1121 lua_pushboolean(L, b), \
1122 lua_rawset(L,-3))
1123
1124/* special helper for allowing 'nil' for usertypes */
1125#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
1126
1127#ifdef __cplusplus
1128/* Special helper for member function pointers
1129it gets the address, casts it, then dereferences it */
1130/*#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) */
1131#endif
1132
1133/* storing/access of swig_module_info */
1134SWIGRUNTIME swig_module_info *
1135SWIG_Lua_GetModule(lua_State *L) {
1136 swig_module_info *ret = 0;
1137 lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1138 lua_rawget(L,LUA_REGISTRYINDEX);
1139 if (lua_islightuserdata(L,-1))
1140 ret=(swig_module_info*)lua_touserdata(L,-1);
1141 lua_pop(L,1); /* tidy */
1142 return ret;
1143}
1144
1145SWIGRUNTIME void
1146SWIG_Lua_SetModule(lua_State *L, swig_module_info *module) {
1147 /* add this all into the Lua registry: */
1148 lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1149 lua_pushlightuserdata(L,(void*)module);
1150 lua_rawset(L,LUA_REGISTRYINDEX);
1151}
1152
1153/* -----------------------------------------------------------------------------
1154 * global variable support code: modules
1155 * ----------------------------------------------------------------------------- */
1156
1157/* this function is called when trying to set an immutable.
1158default action is to print an error.
1159This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
1160SWIGINTERN int SWIG_Lua_set_immutable(lua_State *L)
1161{
1162/* there should be 1 param passed in: the new value */
1163#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
1164 lua_pop(L,1); /* remove it */
1165 luaL_error(L,"This variable is immutable");
1166#endif
1167 return 0; /* should not return anything */
1168}
1169
1170#ifdef SWIG_LUA_ELUA_EMULATE
1171
1172SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own);
1173SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type);
1174static int swig_lua_elua_emulate_unique_key;
1175
1176/* This function emulates eLua rotables behaviour. It loads a rotable definition into the usual lua table. */
1177SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_entry *table)
1178{
1179 int i, table_parsed, parsed_tables_array, target_table;
1180 assert(lua_istable(L,-1));
1181 target_table = lua_gettop(L);
1182 /* Get the registry where we put all parsed tables to avoid loops */
1183 lua_rawgetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
1184 if(lua_isnil(L,-1)) {
1185 lua_pop(L,1);
1186 lua_newtable(L);
1187 lua_pushvalue(L,-1);
1188 lua_rawsetp(L,LUA_REGISTRYINDEX,(void*)(&swig_lua_elua_emulate_unique_key));
1189 }
1190 parsed_tables_array = lua_gettop(L);
1191 lua_pushvalue(L,target_table);
1192 lua_rawsetp(L, parsed_tables_array, table);
1193 table_parsed = 0;
1194 const int SWIGUNUSED pairs_start = lua_gettop(L);
1195 for(i = 0;table[i].key.type != LUA_TNIL || table[i].value.type != LUA_TNIL;i++)
1196 {
1197 const swig_elua_entry *entry = table + i;
1198 int is_metatable = 0;
1199 switch(entry->key.type) {
1200 case LUA_TSTRING:
1201 lua_pushstring(L,entry->key.key.strkey);
1202 if(strcmp(entry->key.key.strkey, SWIG_LUA_ELUA_EMUL_METATABLE_KEY) == 0)
1203 is_metatable = 1;
1204 break;
1205 case LUA_TNUMBER:
1206 lua_pushnumber(L,entry->key.key.numkey);
1207 break;
1208 case LUA_TNIL:
1209 lua_pushnil(L);
1210 break;
1211 default:
1212 assert(0);
1213 }
1214 switch(entry->value.type) {
1215 case LUA_TSTRING:
1216 lua_pushstring(L,entry->value.value.string);
1217 break;
1218 case LUA_TNUMBER:
1219 lua_pushnumber(L,entry->value.value.number);
1220 break;
1221 case LUA_TFUNCTION:
1222 lua_pushcfunction(L,entry->value.value.function);
1223 break;
1224 case LUA_TTABLE:
1225 lua_rawgetp(L,parsed_tables_array, entry->value.value.table);
1226 table_parsed = !lua_isnil(L,-1);
1227 if(!table_parsed) {
1228 lua_pop(L,1); /*remove nil */
1229 lua_newtable(L);
1230 SWIG_Lua_elua_emulate_register(L,entry->value.value.table);
1231 }
1232 if(is_metatable) {
1233 assert(lua_istable(L,-1));
1234 lua_pushvalue(L,-1);
1235 lua_setmetatable(L,target_table);
1236 }
1237
1238 break;
1239 case LUA_TUSERDATA:
1240 if(entry->value.value.userdata.member)
1241 SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue,
1242 entry->value.value.userdata.lvalue,
1243 *(entry->value.value.userdata.ptype));
1244 else
1245 SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue,
1246 *(entry->value.value.userdata.ptype),0);
1247 break;
1248 case LUA_TNIL:
1249 lua_pushnil(L);
1250 break;
1251 default:
1252 assert(0);
1253 }
1254 assert(lua_gettop(L) == pairs_start + 2);
1255 lua_rawset(L,target_table);
1256 }
1257 lua_pop(L,1); /* Removing parsed tables storage */
1258 assert(lua_gettop(L) == target_table);
1259}
1260
1261SWIGINTERN void SWIG_Lua_elua_emulate_register_clear(lua_State *L)
1262{
1263 lua_pushnil(L);
1264 lua_rawsetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
1265}
1266
1267SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L);
1268
1269SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L)
1270{
1271 SWIG_check_num_args("getmetatable(SWIG eLua emulation)", 1, 1);
1272 SWIG_Lua_get_class_registry(L);
1273 lua_getfield(L,-1,"lua_getmetatable");
1274 lua_remove(L,-2); /* remove the registry*/
1275 assert(!lua_isnil(L,-1));
1276 lua_pushvalue(L,1);
1277 assert(lua_gettop(L) == 3); /* object | function | object again */
1278 lua_call(L,1,1);
1279 if(!lua_isnil(L,-1)) /*There is an ordinary metatable */
1280 return 1;
1281 /*if it is a table, then emulate elua behaviour - check for __metatable attribute of a table*/
1282 assert(lua_gettop(L) == 2);
1283 if(lua_istable(L,-2)) {
1284 lua_pop(L,1); /*remove the nil*/
1285 lua_getfield(L,-1, SWIG_LUA_ELUA_EMUL_METATABLE_KEY);
1286 }
1287 assert(lua_gettop(L) == 2);
1288 return 1;
1289
1290fail:
1291 lua_error(L);
1292 return 0;
1293}
1294
1295SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L)
1296{
1297 SWIG_Lua_get_class_registry(L);
1298 lua_pushglobaltable(L);
1299 lua_pushstring(L,"lua_getmetatable");
1300 lua_getfield(L,-2,"getmetatable");
1301 assert(!lua_isnil(L,-1));
1302 lua_rawset(L,-4);
1303 lua_pushstring(L, "getmetatable");
1304 lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable);
1305 lua_rawset(L,-3);
1306 lua_pop(L,2);
1307
1308}
1309/* END OF REMOVE */
1310
1311#endif
1312/* -----------------------------------------------------------------------------
1313 * global variable support code: namespaces and modules (which are the same thing)
1314 * ----------------------------------------------------------------------------- */
1315
1316SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L)
1317{
1318/* there should be 2 params passed in
1319 (1) table (not the meta table)
1320 (2) string name of the attribute
1321*/
1322 assert(lua_istable(L,-2)); /* just in case */
1323 lua_getmetatable(L,-2);
1324 assert(lua_istable(L,-1));
1325 SWIG_Lua_get_table(L,".get"); /* find the .get table */
1326 assert(lua_istable(L,-1));
1327 /* look for the key in the .get table */
1328 lua_pushvalue(L,2); /* key */
1329 lua_rawget(L,-2);
1330 lua_remove(L,-2); /* stack tidy, remove .get table */
1331 if (lua_iscfunction(L,-1))
1332 { /* found it so call the fn & return its value */
1333 lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */
1334 lua_remove(L,-2); /* stack tidy, remove metatable */
1335 return 1;
1336 }
1337 lua_pop(L,1); /* remove whatever was there */
1338 /* ok, so try the .fn table */
1339 SWIG_Lua_get_table(L,".fn"); /* find the .get table */
1340 assert(lua_istable(L,-1)); /* just in case */
1341 lua_pushvalue(L,2); /* key */
1342 lua_rawget(L,-2); /* look for the fn */
1343 lua_remove(L,-2); /* stack tidy, remove .fn table */
1344 if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */
1345 { /* found it so return the fn & let lua call it */
1346 lua_remove(L,-2); /* stack tidy, remove metatable */
1347 return 1;
1348 }
1349 lua_pop(L,1); /* remove whatever was there */
1350 return 0;
1351}
1352
1353SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L)
1354{
1355/* there should be 3 params passed in
1356 (1) table (not the meta table)
1357 (2) string name of the attribute
1358 (3) any for the new value
1359*/
1360
1361 assert(lua_istable(L,1));
1362 lua_getmetatable(L,1); /* get the meta table */
1363 assert(lua_istable(L,-1));
1364
1365 SWIG_Lua_get_table(L,".set"); /* find the .set table */
1366 if (lua_istable(L,-1))
1367 {
1368 /* look for the key in the .set table */
1369 lua_pushvalue(L,2); /* key */
1370 lua_rawget(L,-2);
1371 if (lua_iscfunction(L,-1))
1372 { /* found it so call the fn & return its value */
1373 lua_pushvalue(L,3); /* value */
1374 lua_call(L,1,0);
1375 return 0;
1376 }
1377 lua_pop(L,1); /* remove the value */
1378 }
1379 lua_pop(L,1); /* remove the value .set table */
1380 lua_pop(L,1); /* remote metatable */
1381 lua_rawset(L,-3);
1382 return 0;
1383}
1384
1385#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
1386SWIGINTERN void SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]); /* forward declaration */
1387SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn); /* forward declaration */
1388SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss);
1389
1390/* helper function - register namespace methods and attributes into namespace */
1391SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *ns)
1392{
1393 int i;
1394 /* There must be namespace table (not metatable) at the top of the stack */
1395 assert(lua_istable(L,-1));
1396 SWIG_Lua_InstallConstants(L, ns->ns_constants);
1397
1398 /* add methods to the namespace/module table */
1399 for(i=0;ns->ns_methods[i].name;i++){
1400 SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].func);
1401 }
1402 lua_getmetatable(L,-1);
1403
1404 /* add fns */
1405 for(i=0;ns->ns_attributes[i].name;i++){
1406 SWIG_Lua_add_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod);
1407 }
1408
1409 /* clear stack - remove metatble */
1410 lua_pop(L,1);
1411 return 0;
1412}
1413
1414/* Register all classes in the namespace */
1415SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace *ns)
1416{
1417 swig_lua_class **classes;
1418
1419 /* There must be a module/namespace table at the top of the stack */
1420 assert(lua_istable(L,-1));
1421
1422 classes = ns->ns_classes;
1423
1424 if( classes != 0 ) {
1425 while(*classes != 0) {
1426 SWIG_Lua_class_register(L, *classes);
1427 classes++;
1428 }
1429 }
1430}
1431
1432/* Helper function. Creates namespace table and adds it to module table
1433 if 'reg' is true, then will register namespace table to parent one (must be on top of the stack
1434 when function is called).
1435 Function always returns newly registered table on top of the stack.
1436*/
1437SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns, int reg)
1438{
1439 swig_lua_namespace **sub_namespace;
1440 /* 1 argument - table on the top of the stack */
1441 const int SWIGUNUSED begin = lua_gettop(L);
1442 assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table or parent namespace table */
1443 lua_checkstack(L,5);
1444 lua_newtable(L); /* namespace itself */
1445 lua_newtable(L); /* metatable for namespace */
1446
1447 /* add a table called ".get" */
1448 lua_pushstring(L,".get");
1449 lua_newtable(L);
1450 lua_rawset(L,-3);
1451 /* add a table called ".set" */
1452 lua_pushstring(L,".set");
1453 lua_newtable(L);
1454 lua_rawset(L,-3);
1455 /* add a table called ".fn" */
1456 lua_pushstring(L,".fn");
1457 lua_newtable(L);
1458 lua_rawset(L,-3);
1459
1460 /* add accessor fns for using the .get,.set&.fn */
1461 SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get);
1462 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set);
1463
1464 lua_setmetatable(L,-2); /* set metatable */
1465
1466 /* Register all functions, variables etc */
1467 SWIG_Lua_add_namespace_details(L,ns);
1468 /* Register classes */
1469 SWIG_Lua_add_namespace_classes(L,ns);
1470
1471 sub_namespace = ns->ns_namespaces;
1472 if( sub_namespace != 0) {
1473 while(*sub_namespace != 0) {
1474 SWIG_Lua_namespace_register(L, *sub_namespace, 1);
1475 lua_pop(L,1); /* removing sub-namespace table */
1476 sub_namespace++;
1477 }
1478 }
1479
1480 if (reg) {
1481 lua_pushstring(L,ns->name);
1482 lua_pushvalue(L,-2);
1483 lua_rawset(L,-4); /* add namespace to module table */
1484 }
1485 assert(lua_gettop(L) == begin+1);
1486}
1487#endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
1488
1489/* -----------------------------------------------------------------------------
1490 * global variable support code: classes
1491 * ----------------------------------------------------------------------------- */
1492
1493SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname);
1494
1495typedef int (*swig_lua_base_iterator_func)(lua_State*,swig_type_info*, int, int *ret);
1496
1497SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED swig_type,
1498 int first_arg, swig_lua_base_iterator_func func, int *const ret)
1499{
1500 /* first_arg - position of the object in stack. Everything that is above are arguments
1501 * and is passed to every evocation of the func */
1502 int last_arg = lua_gettop(L);/* position of last argument */
1503 int original_metatable = last_arg + 1;
1504 size_t bases_count;
1505 int result = SWIG_ERROR;
1506 int bases_table;
1507 (void)swig_type;
1508 lua_getmetatable(L,first_arg);
1509
1510 /* initialise base search */
1511#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
1512 SWIG_Lua_get_table(L,".bases");
1513 assert(lua_istable(L,-1));
1514 bases_count = lua_rawlen(L,-1);
1515 bases_table = lua_gettop(L);
1516#else
1517 /* In elua .bases table doesn't exist. Use table from swig_lua_class */
1518 (void)bases_table;
1519 assert(swig_type!=0);
1520 swig_module_info *module=SWIG_GetModule(L);
1521 swig_lua_class **bases= ((swig_lua_class*)(swig_type->clientdata))->bases;
1522 const char **base_names= ((swig_lua_class*)(swig_type->clientdata))->base_names;
1523 bases_count = 0;
1524 for(;base_names[bases_count];
1525 bases_count++);/* get length of bases */
1526#endif
1527
1528 if(ret)
1529 *ret = 0;
1530 if(bases_count>0)
1531 {
1532 int to_remove;
1533 size_t i;
1534 int j;
1535 int subcall_last_arg;
1536 int subcall_first_arg = lua_gettop(L) + 1;/* Here a copy of first_arg and arguments begin */
1537 int valid = 1;
1538 swig_type_info *base_swig_type = 0;
1539 for(j=first_arg;j<=last_arg;j++)
1540 lua_pushvalue(L,j);
1541 subcall_last_arg = lua_gettop(L);
1542
1543 /* Trick: temporarily replacing original metatable with metatable for base class and call getter */
1544 for(i=0;i<bases_count;i++) {
1545 /* Iteration through class bases */
1546#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
1547 lua_rawgeti(L,bases_table,i+1);
1548 base_swig_type = 0;
1549 if(lua_isnil(L,-1)) {
1550 valid = 0;
1551 lua_pop(L,1);
1552 } else {
1553 valid = 1;
1554 }
1555#else /* In elua .bases table doesn't exist. Use table from swig_lua_class */
1556 swig_lua_class *base_class = bases[i];
1557 if(!base_class) {
1558 valid = 0;
1559 } else {
1560 valid = 1;
1561 SWIG_Lua_get_class_metatable(L,base_class->fqname);
1562 base_swig_type = SWIG_TypeQueryModule(module,module,base_names[i]);
1563 assert(base_swig_type != 0);
1564 }
1565#endif
1566
1567 if(!valid)
1568 continue;
1569 assert(lua_isuserdata(L, subcall_first_arg));
1570 assert(lua_istable(L,-1));
1571 lua_setmetatable(L,subcall_first_arg); /* Set new metatable */
1572 assert(lua_gettop(L) == subcall_last_arg);
1573 result = func(L, base_swig_type,subcall_first_arg, ret); /* Forward call */
1574 if(result != SWIG_ERROR) {
1575 break;
1576 }
1577 }
1578 /* Restore original metatable */
1579 lua_pushvalue(L,original_metatable);
1580 lua_setmetatable(L,first_arg);
1581 /* Clear - remove everything between last_arg and subcall_last_arg including */
1582 to_remove = subcall_last_arg - last_arg;
1583 for(j=0;j<to_remove;j++)
1584 lua_remove(L,last_arg+1);
1585 } else {
1586 /* Remove everything after last_arg */
1587 lua_pop(L, lua_gettop(L) - last_arg);
1588 }
1589 if(ret) assert(lua_gettop(L) == last_arg + *ret);
1590 return result;
1591}
1592
1593/* The class.get method helper, performs the lookup of class attributes.
1594 * It returns an error code. Number of function return values is passed inside 'ret'.
1595 * first_arg is not used in this function because function always has 2 arguments.
1596 */
1597SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
1598{
1599/* there should be 2 params passed in
1600 (1) userdata (not the meta table)
1601 (2) string name of the attribute
1602*/
1603 int bases_search_result;
1604 int substack_start = lua_gettop(L)-2;
1605 assert(first_arg == substack_start+1);
1606 (void)first_arg;
1607 lua_checkstack(L,5);
1608 assert(lua_isuserdata(L,-2)); /* just in case */
1609 lua_getmetatable(L,-2); /* get the meta table */
1610 assert(lua_istable(L,-1)); /* just in case */
1611 /* NEW: looks for the __getitem() fn
1612 this is a user provided get fn */
1613 SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
1614 if (lua_iscfunction(L,-1)) /* if it's there */
1615 { /* found it so call the fn & return its value */
1616 lua_pushvalue(L,substack_start+1); /* the userdata */
1617 lua_pushvalue(L,substack_start+2); /* the parameter */
1618 lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
1619 lua_remove(L,-2); /* stack tidy, remove metatable */
1620 if(ret) *ret = 1;
1621 return SWIG_OK;
1622 }
1623 lua_pop(L,1);
1624 /* Remove the metatable */
1625 lua_pop(L,1);
1626 /* Search in base classes */
1627 bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get_item,ret);
1628 return bases_search_result; /* sorry not known */
1629}
1630
1631
1632/* The class.get method helper, performs the lookup of class attributes.
1633 * It returns an error code. Number of function return values is passed inside 'ret'.
1634 * first_arg is not used in this function because function always has 2 arguments.
1635 */
1636SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
1637{
1638/* there should be 2 params passed in
1639 (1) userdata (not the meta table)
1640 (2) string name of the attribute
1641*/
1642 int bases_search_result;
1643 int substack_start = lua_gettop(L)-2;
1644 assert(first_arg == substack_start+1);
1645 (void)first_arg;
1646 lua_checkstack(L,5);
1647 assert(lua_isuserdata(L,-2)); /* just in case */
1648 lua_getmetatable(L,-2); /* get the meta table */
1649 assert(lua_istable(L,-1)); /* just in case */
1650 SWIG_Lua_get_table(L,".get"); /* find the .get table */
1651 assert(lua_istable(L,-1)); /* just in case */
1652 /* look for the key in the .get table */
1653 lua_pushvalue(L,substack_start+2); /* key */
1654 lua_rawget(L,-2);
1655 lua_remove(L,-2); /* stack tidy, remove .get table */
1656 if (lua_iscfunction(L,-1))
1657 { /* found it so call the fn & return its value */
1658 lua_pushvalue(L,substack_start+1); /* the userdata */
1659 lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */
1660 lua_remove(L,-2); /* stack tidy, remove metatable */
1661 if(ret)
1662 *ret = 1;
1663 return SWIG_OK;
1664 }
1665 lua_pop(L,1); /* remove whatever was there */
1666 /* ok, so try the .fn table */
1667 SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
1668 assert(lua_istable(L,-1)); /* just in case */
1669 lua_pushvalue(L,substack_start+2); /* key */
1670 lua_rawget(L,-2); /* look for the fn */
1671 lua_remove(L,-2); /* stack tidy, remove .fn table */
1672 if (lua_isfunction(L,-1)) /* note: if it's a C function or lua function */
1673 { /* found it so return the fn & let lua call it */
1674 lua_remove(L,-2); /* stack tidy, remove metatable */
1675 if(ret)
1676 *ret = 1;
1677 return SWIG_OK;
1678 }
1679 lua_pop(L,1); /* remove whatever was there */
1680 /* Remove the metatable */
1681 lua_pop(L,1);
1682 /* Search in base classes */
1683 bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get,ret);
1684 return bases_search_result; /* sorry not known */
1685}
1686
1687/* the class.get method, performs the lookup of class attributes
1688 */
1689SWIGINTERN int SWIG_Lua_class_get(lua_State *L)
1690{
1691/* there should be 2 params passed in
1692 (1) userdata (not the meta table)
1693 (2) string name of the attribute
1694*/
1695 int result;
1696 swig_lua_userdata *usr;
1697 swig_type_info *type;
1698 int ret = 0;
1699 assert(lua_isuserdata(L,1));
1700 usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
1701 type = usr->type;
1702 result = SWIG_Lua_class_do_get(L,type,1,&ret);
1703 if(result == SWIG_OK)
1704 return ret;
1705
1706 result = SWIG_Lua_class_do_get_item(L,type,1,&ret);
1707 if(result == SWIG_OK)
1708 return ret;
1709
1710 return 0;
1711}
1712
1713/* helper for the class.set method, performs the lookup of class attributes
1714 * It returns error code. Number of function return values is passed inside 'ret'
1715 */
1716SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int first_arg, int *ret)
1717{
1718/* there should be 3 params passed in
1719 (1) table (not the meta table)
1720 (2) string name of the attribute
1721 (3) any for the new value
1722 */
1723
1724 int bases_search_result;
1725 int substack_start = lua_gettop(L) - 3;
1726 lua_checkstack(L,5);
1727 assert(lua_isuserdata(L,substack_start+1)); /* just in case */
1728 lua_getmetatable(L,substack_start+1); /* get the meta table */
1729 assert(lua_istable(L,-1)); /* just in case */
1730 if(ret)
1731 *ret = 0; /* it is setter - number of return values is always 0 */
1732
1733 SWIG_Lua_get_table(L,".set"); /* find the .set table */
1734 if (lua_istable(L,-1))
1735 {
1736 /* look for the key in the .set table */
1737 lua_pushvalue(L,substack_start+2); /* key */
1738 lua_rawget(L,-2);
1739 lua_remove(L,-2); /* tidy stack, remove .set table */
1740 if (lua_iscfunction(L,-1))
1741 { /* found it so call the fn & return its value */
1742 lua_pushvalue(L,substack_start+1); /* userdata */
1743 lua_pushvalue(L,substack_start+3); /* value */
1744 lua_call(L,2,0);
1745 lua_remove(L,substack_start+4); /*remove metatable*/
1746 return SWIG_OK;
1747 }
1748 lua_pop(L,1); /* remove the value */
1749 } else {
1750 lua_pop(L,1); /* remove the answer for .set table request*/
1751 }
1752 /* NEW: looks for the __setitem() fn
1753 this is a user provided set fn */
1754 SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
1755 if (lua_iscfunction(L,-1)) /* if it's there */
1756 { /* found it so call the fn & return its value */
1757 lua_pushvalue(L,substack_start+1); /* the userdata */
1758 lua_pushvalue(L,substack_start+2); /* the parameter */
1759 lua_pushvalue(L,substack_start+3); /* the value */
1760 lua_call(L,3,0); /* 3 values in ,0 out */
1761 lua_remove(L,-2); /* stack tidy, remove metatable */
1762 return SWIG_OK;
1763 }
1764 lua_pop(L,1); /* remove value */
1765
1766 lua_pop(L,1); /* remove metatable */
1767 /* Search among bases */
1768 bases_search_result = SWIG_Lua_iterate_bases(L,type,first_arg,SWIG_Lua_class_do_set,ret);
1769 if(ret)
1770 assert(*ret == 0);
1771 assert(lua_gettop(L) == substack_start + 3);
1772 return bases_search_result;
1773}
1774
1775/* This is the actual method exported to Lua. It calls SWIG_Lua_class_do_set and correctly
1776 * handles return values.
1777 */
1778SWIGINTERN int SWIG_Lua_class_set(lua_State *L)
1779{
1780/* There should be 3 params passed in
1781 (1) table (not the meta table)
1782 (2) string name of the attribute
1783 (3) any for the new value
1784 */
1785 int ret = 0;
1786 int result;
1787 swig_lua_userdata *usr;
1788 swig_type_info *type;
1789 assert(lua_isuserdata(L,1));
1790 usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
1791 type = usr->type;
1792 result = SWIG_Lua_class_do_set(L,type,1,&ret);
1793 if(result != SWIG_OK) {
1794 SWIG_Lua_pushferrstring(L,"Assignment not possible. No setter/member with this name. For custom assignments implement __setitem method.");
1795 lua_error(L);
1796 } else {
1797 assert(ret==0);
1798 }
1799 return 0;
1800}
1801
1802/* the class.destruct method called by the interpreter */
1803SWIGINTERN int SWIG_Lua_class_destruct(lua_State *L)
1804{
1805/* there should be 1 params passed in
1806 (1) userdata (not the meta table) */
1807 swig_lua_userdata *usr;
1808 swig_lua_class *clss;
1809 assert(lua_isuserdata(L,-1)); /* just in case */
1810 usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
1811 /* if must be destroyed & has a destructor */
1812 if (usr->own) /* if must be destroyed */
1813 {
1814 clss=(swig_lua_class*)usr->type->clientdata; /* get the class */
1815 if (clss && clss->destructor) /* there is a destroy fn */
1816 {
1817 clss->destructor(usr->ptr); /* bye bye */
1818 }
1819 }
1820 return 0;
1821}
1822
1823/* the class.__tostring method called by the interpreter and print */
1824SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L)
1825{
1826/* there should be 1 param passed in
1827 (1) userdata (not the metatable) */
1828 swig_lua_userdata* userData;
1829 assert(lua_isuserdata(L,1)); /* just in case */
1830 userData = (swig_lua_userdata*)lua_touserdata(L,1); /* get the userdata address */
1831
1832 lua_pushfstring(L, "<userdata of type '%s' at %p>", userData->type->str, userData->ptr);
1833 return 1;
1834}
1835
1836/* to manually disown some userdata */
1837SWIGINTERN int SWIG_Lua_class_disown(lua_State *L)
1838{
1839/* there should be 1 params passed in
1840 (1) userdata (not the meta table) */
1841 swig_lua_userdata *usr;
1842 assert(lua_isuserdata(L,-1)); /* just in case */
1843 usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
1844
1845 usr->own = 0; /* clear our ownership */
1846 return 0;
1847}
1848
1849/* lua callable function to compare userdata's value
1850the issue is that two userdata may point to the same thing
1851but to lua, they are different objects */
1852SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L)
1853{
1854 int result;
1855 swig_lua_userdata *usr1,*usr2;
1856 if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
1857 return 0; /* nil reply */
1858 usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
1859 usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
1860 /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
1861 result=(usr1->ptr==usr2->ptr);
1862 lua_pushboolean(L,result);
1863 return 1;
1864}
1865
1866/* populate table at the top of the stack with metamethods that ought to be inherited */
1867SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L)
1868{
1869 SWIG_Lua_add_boolean(L, "__add", 1);
1870 SWIG_Lua_add_boolean(L, "__sub", 1);
1871 SWIG_Lua_add_boolean(L, "__mul", 1);
1872 SWIG_Lua_add_boolean(L, "__div", 1);
1873 SWIG_Lua_add_boolean(L, "__mod", 1);
1874 SWIG_Lua_add_boolean(L, "__pow", 1);
1875 SWIG_Lua_add_boolean(L, "__unm", 1);
1876 SWIG_Lua_add_boolean(L, "__len", 1 );
1877 SWIG_Lua_add_boolean(L, "__concat", 1 );
1878 SWIG_Lua_add_boolean(L, "__eq", 1);
1879 SWIG_Lua_add_boolean(L, "__lt", 1);
1880 SWIG_Lua_add_boolean(L, "__le", 1);
1881 SWIG_Lua_add_boolean(L, "__call", 1);
1882 SWIG_Lua_add_boolean(L, "__tostring", 1);
1883 SWIG_Lua_add_boolean(L, "__gc", 0);
1884}
1885
1886/* creates the swig registry */
1887SWIGINTERN void SWIG_Lua_create_class_registry(lua_State *L)
1888{
1889 /* create main SWIG registry table */
1890 lua_pushstring(L,"SWIG");
1891 lua_newtable(L);
1892 /* populate it with some predefined data */
1893
1894 /* .library table. Placeholder */
1895 lua_pushstring(L,".library");
1896 lua_newtable(L);
1897 {
1898 /* list of metamethods that class inherits from its bases */
1899 lua_pushstring(L,"inheritable_metamethods");
1900 lua_newtable(L);
1901 /* populate with list of metamethods */
1902 SWIG_Lua_populate_inheritable_metamethods(L);
1903 lua_rawset(L,-3);
1904 }
1905 lua_rawset(L,-3);
1906
1907 lua_rawset(L,LUA_REGISTRYINDEX);
1908}
1909
1910/* gets the swig registry (or creates it) */
1911SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L)
1912{
1913 /* add this all into the swig registry: */
1914 lua_pushstring(L,"SWIG");
1915 lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */
1916 if (!lua_istable(L,-1)) /* not there */
1917 { /* must be first time, so add it */
1918 lua_pop(L,1); /* remove the result */
1919 SWIG_Lua_create_class_registry(L);
1920 /* then get it */
1921 lua_pushstring(L,"SWIG");
1922 lua_rawget(L,LUA_REGISTRYINDEX);
1923 }
1924}
1925
1926SWIGINTERN void SWIG_Lua_get_inheritable_metamethods(lua_State *L)
1927{
1928 SWIG_Lua_get_class_registry(L);
1929 lua_pushstring(L, ".library");
1930 lua_rawget(L,-2);
1931 assert( !lua_isnil(L,-1) );
1932 lua_pushstring(L, "inheritable_metamethods");
1933 lua_rawget(L,-2);
1934
1935 /* Remove class registry and library table */
1936 lua_remove(L,-2);
1937 lua_remove(L,-2);
1938}
1939
1940/* Helper function to get the classes metatable from the register */
1941SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname)
1942{
1943 SWIG_Lua_get_class_registry(L); /* get the registry */
1944 lua_pushstring(L,cname); /* get the name */
1945 lua_rawget(L,-2); /* get it */
1946 lua_remove(L,-2); /* tidy up (remove registry) */
1947}
1948
1949/* Set up the base classes pointers.
1950Each class structure has a list of pointers to the base class structures.
1951This function fills them.
1952It cannot be done at compile time, as this will not work with hireachies
1953spread over more than one swig file.
1954Therefore it must be done at runtime, querying the SWIG type system.
1955*/
1956SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss)
1957{
1958 int i=0;
1959 swig_module_info *module=SWIG_GetModule(L);
1960 for(i=0;clss->base_names[i];i++)
1961 {
1962 if (clss->bases[i]==0) /* not found yet */
1963 {
1964 /* lookup and cache the base class */
1965 swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
1966 if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
1967 }
1968 }
1969}
1970
1971#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
1972/* Merges two tables */
1973SWIGINTERN void SWIG_Lua_merge_tables_by_index(lua_State *L, int target, int source)
1974{
1975 /* iterating */
1976 lua_pushnil(L);
1977 while (lua_next(L,source) != 0) {
1978 /* -1 - value, -2 - index */
1979 /* have to copy to assign */
1980 lua_pushvalue(L,-2); /* copy of index */
1981 lua_pushvalue(L,-2); /* copy of value */
1982 lua_rawset(L, target);
1983 lua_pop(L,1);
1984 /* only key is left */
1985 }
1986}
1987
1988/* Merges two tables with given name. original - index of target metatable, base - index of source metatable */
1989SWIGINTERN void SWIG_Lua_merge_tables(lua_State *L, const char* name, int original, int base)
1990{
1991 /* push original[name], then base[name] */
1992 lua_pushstring(L,name);
1993 lua_rawget(L,original);
1994 int original_table = lua_gettop(L);
1995 lua_pushstring(L,name);
1996 lua_rawget(L,base);
1997 int base_table = lua_gettop(L);
1998 SWIG_Lua_merge_tables_by_index(L, original_table, base_table);
1999 /* clearing stack */
2000 lua_pop(L,2);
2001}
2002
2003/* Function takes all symbols from base and adds it to derived class. It's just a helper. */
2004SWIGINTERN void SWIG_Lua_class_squash_base(lua_State *L, swig_lua_class *base_cls)
2005{
2006 /* There is one parameter - original, i.e. 'derived' class metatable */
2007 assert(lua_istable(L,-1));
2008 int original = lua_gettop(L);
2009 SWIG_Lua_get_class_metatable(L,base_cls->fqname);
2010 int base = lua_gettop(L);
2011 SWIG_Lua_merge_tables(L, ".fn", original, base );
2012 SWIG_Lua_merge_tables(L, ".set", original, base );
2013 SWIG_Lua_merge_tables(L, ".get", original, base );
2014 lua_pop(L,1);
2015}
2016
2017/* Function squashes all symbols from 'clss' bases into itself */
2018SWIGINTERN void SWIG_Lua_class_squash_bases(lua_State *L, swig_lua_class *clss)
2019{
2020 int i;
2021 SWIG_Lua_get_class_metatable(L,clss->fqname);
2022 for(i=0;clss->base_names[i];i++)
2023 {
2024 if (clss->bases[i]==0) /* Somehow it's not found. Skip it */
2025 continue;
2026 /* Thing is: all bases are already registered. Thus they have already executed
2027 * this function. So we just need to squash them into us, because their bases
2028 * are already squashed into them. No need for recursion here!
2029 */
2030 SWIG_Lua_class_squash_base(L, clss->bases[i]);
2031 }
2032 lua_pop(L,1); /*tidy stack*/
2033}
2034#endif
2035
2036#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
2037/* helper add a variable to a registered class */
2038SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn)
2039{
2040 assert(lua_istable(L,-1)); /* just in case */
2041 SWIG_Lua_get_table(L,".get"); /* find the .get table */
2042 assert(lua_istable(L,-1)); /* just in case */
2043 SWIG_Lua_add_function(L,name,getFn);
2044 lua_pop(L,1); /* tidy stack (remove table) */
2045 if (setFn)
2046 {
2047 SWIG_Lua_get_table(L,".set"); /* find the .set table */
2048 assert(lua_istable(L,-1)); /* just in case */
2049 SWIG_Lua_add_function(L,name,setFn);
2050 lua_pop(L,1); /* tidy stack (remove table) */
2051 }
2052}
2053
2054/* helper to recursively add class static details (static attributes, operations and constants) */
2055SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State *L, swig_lua_class *clss)
2056{
2057 int i = 0;
2058 /* The class namespace table must be on the top of the stack */
2059 assert(lua_istable(L,-1));
2060 /* call all the base classes first: we can then override these later: */
2061 for(i=0;clss->bases[i];i++)
2062 {
2063 SWIG_Lua_add_class_static_details(L,clss->bases[i]);
2064 }
2065
2066 SWIG_Lua_add_namespace_details(L, clss->cls_static);
2067}
2068
2069SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss); /* forward declaration */
2070
2071/* helper to recursively add class details (attributes & operations) */
2072SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_class *clss)
2073{
2074 int i;
2075 size_t bases_count = 0;
2076 /* Add bases to .bases table */
2077 SWIG_Lua_get_table(L,".bases");
2078 assert(lua_istable(L,-1)); /* just in case */
2079 for(i=0;clss->bases[i];i++)
2080 {
2081 SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
2082 /* Base class must be already registered */
2083 assert(lua_istable(L,-1));
2084 lua_rawseti(L,-2,i+1); /* In lua indexing starts from 1 */
2085 bases_count++;
2086 }
2087 assert(lua_rawlen(L,-1) == bases_count);
2088 lua_pop(L,1); /* remove .bases table */
2089 /* add attributes */
2090 for(i=0;clss->attributes[i].name;i++){
2091 SWIG_Lua_add_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
2092 }
2093 /* add methods to the metatable */
2094 SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
2095 assert(lua_istable(L,-1)); /* just in case */
2096 for(i=0;clss->methods[i].name;i++){
2097 SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].func);
2098 }
2099 lua_pop(L,1); /* tidy stack (remove table) */
2100 /* add operator overloads
2101 This adds methods from metatable array to metatable. Can mess up garbage
2102 collectind if someone defines __gc method
2103 */
2104 if(clss->metatable) {
2105 for(i=0;clss->metatable[i].name;i++) {
2106 SWIG_Lua_add_function(L,clss->metatable[i].name,clss->metatable[i].func);
2107 }
2108 }
2109
2110#if !defined(SWIG_LUA_SQUASH_BASES)
2111 /* Adding metamethods that are defined in base classes. If bases were squashed
2112 * then it is obviously unnecessary
2113 */
2114 SWIG_Lua_add_class_user_metamethods(L, clss);
2115#endif
2116}
2117
2118/* Helpers to add user defined class metamedhods - __add, __sub etc. The helpers are needed
2119 for the following issue: Lua runtime checks for metamethod existence with rawget function
2120 ignoring our SWIG-provided __index and __newindex functions. Thus our inheritance-aware method
2121 search algorithm doesn't work in such case. (Not to say that Lua runtime queries metamethod directly
2122 in metatable and not in object).
2123 Current solution is this: if somewhere in hierarchy metamethod __x is defined, then all descendants
2124 are automatically given a special proxy __x that calls the real __x method.
2125 Obvious idea - to copy __x instead of creating __x-proxy is wrong because if someone changes __x in runtime,
2126 those changes must be reflected in all descendants.
2127*/
2128
2129SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration*/
2130
2131/* The real function that resolves a metamethod.
2132 * Function searches given class and all its bases (recursively) for first instance of something that is
2133 * not equal to SWIG_Lua_resolve_metamethod. (Almost always this 'something' is actual metamethod implementation
2134 * and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the
2135 * answer.
2136 * Returns 1 if found, 0 otherwise.
2137 * clss is class which metatable we will search for method
2138 * metamethod_name_idx is index in L where metamethod name (as string) lies
2139 * skip_check allows skipping searching metamethod in the given class and immediately going to searching in bases. skip_check
2140 * is not carried to subsequent recursive calls - false is always passed. It is set to true only at first call from
2141 * SWIG_Lua_resolve_metamethod
2142 * */
2143SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx,
2144 int skip_check)
2145{
2146 /* This function is called recursively */
2147 int result = 0;
2148 int i = 0;
2149
2150 if (!skip_check) {
2151 SWIG_Lua_get_class_metatable(L, clss->fqname);
2152 lua_pushvalue(L, metamethod_name_idx);
2153 lua_rawget(L,-2);
2154 /* If this is cfunction and it is equal to SWIG_Lua_resolve_metamethod then
2155 * this isn't the function we are looking for :)
2156 * lua_tocfunction will return NULL if not cfunction
2157 */
2158 if (!lua_isnil(L,-1) && lua_tocfunction(L,-1) != SWIG_Lua_resolve_metamethod ) {
2159 lua_remove(L,-2); /* removing class metatable */
2160 return 1;
2161 }
2162 lua_pop(L,2); /* remove class metatable and query result */
2163 }
2164
2165 /* Forwarding calls to bases */
2166 for(i=0;clss->bases[i];i++)
2167 {
2168 result = SWIG_Lua_do_resolve_metamethod(L, clss->bases[i], metamethod_name_idx, 0);
2169 if (result)
2170 break;
2171 }
2172
2173 return result;
2174}
2175
2176/* The proxy function for metamethod. All parameters are passed as cclosure. Searches for actual method
2177 * and calls it */
2178SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
2179{
2180 int numargs;
2181 int metamethod_name_idx;
2182 const swig_lua_class* clss;
2183 int result;
2184
2185 lua_checkstack(L,5);
2186 numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */
2187
2188 /* Get upvalues from closure */
2189 lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/
2190 metamethod_name_idx = lua_gettop(L);
2191
2192 lua_pushvalue(L, lua_upvalueindex(2));
2193 clss = (const swig_lua_class*)(lua_touserdata(L,-1));
2194 lua_pop(L,1); /* remove lightuserdata with clss from stack */
2195
2196 /* Actual work */
2197 result = SWIG_Lua_do_resolve_metamethod(L, clss, metamethod_name_idx, 1);
2198 if (!result) {
2199 SWIG_Lua_pushferrstring(L,"The metamethod proxy is set, but it failed to find actual metamethod. Memory corruption is most likely explanation.");
2200 lua_error(L);
2201 return 0;
2202 }
2203
2204 lua_remove(L,-2); /* remove metamethod key */
2205 lua_insert(L,1); /* move function to correct position */
2206 lua_call(L, numargs, LUA_MULTRET);
2207 return lua_gettop(L); /* return all results */
2208}
2209
2210
2211/* If given metamethod must be present in given class, then creates appropriate proxy
2212 * Returns 1 if successfully added, 0 if not added because no base class has it, -1
2213 * if method is defined in the class metatable itself
2214 */
2215SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *clss, const int metatable_index)
2216{
2217 int key_index;
2218 int success = 0;
2219 int i = 0;
2220
2221 /* metamethod name - on the top of the stack */
2222 assert(lua_isstring(L,-1));
2223
2224 key_index = lua_gettop(L);
2225
2226 /* Check whether method is already defined in metatable */
2227 lua_pushvalue(L,key_index); /* copy of the key */
2228 lua_gettable(L,metatable_index);
2229 if( !lua_isnil(L,-1) ) {
2230 lua_pop(L,1);
2231 return -1;
2232 }
2233 lua_pop(L,1);
2234
2235 /* Iterating over immediate bases */
2236 for(i=0;clss->bases[i];i++)
2237 {
2238 const swig_lua_class *base = clss->bases[i];
2239 SWIG_Lua_get_class_metatable(L, base->fqname);
2240 lua_pushvalue(L, key_index);
2241 lua_rawget(L, -2);
2242 if( !lua_isnil(L,-1) ) {
2243 lua_pushvalue(L, key_index);
2244
2245 /* Add proxy function */
2246 lua_pushvalue(L, key_index); /* first closure value is function name */
2247 lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */
2248 lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2);
2249
2250 lua_rawset(L, metatable_index);
2251 success = 1;
2252 }
2253 lua_pop(L,1); /* remove function or nil */
2254 lua_pop(L,1); /* remove base class metatable */
2255
2256 if( success )
2257 break;
2258 }
2259
2260 return success;
2261}
2262
2263SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
2264{
2265 int metatable_index;
2266 int metamethods_info_index;
2267 int tostring_undefined;
2268 int eq_undefined = 0;
2269
2270 SWIG_Lua_get_class_metatable(L, clss->fqname);
2271 metatable_index = lua_gettop(L);
2272 SWIG_Lua_get_inheritable_metamethods(L);
2273 assert(lua_istable(L,-1));
2274 metamethods_info_index = lua_gettop(L);
2275 lua_pushnil(L); /* first key */
2276 while(lua_next(L, metamethods_info_index) != 0 ) {
2277 /* key at index -2, value at index -1 */
2278 const int is_inheritable = lua_toboolean(L,-2);
2279 lua_pop(L,1); /* remove value - we don't need it anymore */
2280
2281 if(is_inheritable) { /* if metamethod is inheritable */
2282 SWIG_Lua_add_class_user_metamethod(L,clss,metatable_index);
2283 }
2284 }
2285
2286 lua_pop(L,1); /* remove inheritable metamethods table */
2287
2288 /* Special handling for __tostring method */
2289 lua_pushstring(L, "__tostring");
2290 lua_pushvalue(L,-1);
2291 lua_rawget(L,metatable_index);
2292 tostring_undefined = lua_isnil(L,-1);
2293 lua_pop(L,1);
2294 if( tostring_undefined ) {
2295 lua_pushcfunction(L, SWIG_Lua_class_tostring);
2296 lua_rawset(L, metatable_index);
2297 } else {
2298 lua_pop(L,1); /* remove copy of the key */
2299 }
2300
2301 /* Special handling for __eq method */
2302 lua_pushstring(L, "__eq");
2303 lua_pushvalue(L,-1);
2304 lua_rawget(L,metatable_index);
2305 eq_undefined = lua_isnil(L,-1);
2306 lua_pop(L,1);
2307 if( eq_undefined ) {
2308 lua_pushcfunction(L, SWIG_Lua_class_equal);
2309 lua_rawset(L, metatable_index);
2310 } else {
2311 lua_pop(L,1); /* remove copy of the key */
2312 }
2313 /* Warning: __index and __newindex are SWIG-defined. For user-defined operator[]
2314 * a __getitem/__setitem method should be defined
2315 */
2316 lua_pop(L,1); /* pop class metatable */
2317}
2318
2319/* Register class static methods,attributes etc as well as constructor proxy */
2320SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *clss)
2321{
2322 const int SWIGUNUSED begin = lua_gettop(L);
2323 lua_checkstack(L,5); /* just in case */
2324 assert(lua_istable(L,-1)); /* just in case */
2325 assert(strcmp(clss->name, clss->cls_static->name) == 0); /* in class those 2 must be equal */
2326
2327 SWIG_Lua_namespace_register(L,clss->cls_static, 1);
2328
2329 assert(lua_istable(L,-1)); /* just in case */
2330
2331 /* add its constructor to module with the name of the class
2332 so you can do MyClass(...) as well as new_MyClass(...)
2333 BUT only if a constructor is defined
2334 (this overcomes the problem of pure virtual classes without constructors)*/
2335 if (clss->constructor)
2336 {
2337 lua_getmetatable(L,-1);
2338 assert(lua_istable(L,-1)); /* just in case */
2339 SWIG_Lua_add_function(L,"__call", clss->constructor);
2340 lua_pop(L,1);
2341 }
2342
2343 assert(lua_istable(L,-1)); /* just in case */
2344 SWIG_Lua_add_class_static_details(L, clss);
2345
2346 /* clear stack */
2347 lua_pop(L,1);
2348 assert( lua_gettop(L) == begin );
2349}
2350
2351/* Performs the instance (non-static) class registration process. Metatable for class is created
2352 * and added to the class registry.
2353 */
2354SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *clss)
2355{
2356 const int SWIGUNUSED begin = lua_gettop(L);
2357 int i;
2358 /* if name already there (class is already registered) then do nothing */
2359 SWIG_Lua_get_class_registry(L); /* get the registry */
2360 lua_pushstring(L,clss->fqname); /* get the name */
2361 lua_rawget(L,-2);
2362 if(!lua_isnil(L,-1)) {
2363 lua_pop(L,2);
2364 assert(lua_gettop(L)==begin);
2365 return;
2366 }
2367 lua_pop(L,2); /* tidy stack */
2368 /* Recursively initialize all bases */
2369 for(i=0;clss->bases[i];i++)
2370 {
2371 SWIG_Lua_class_register_instance(L,clss->bases[i]);
2372 }
2373 /* Again, get registry and push name */
2374 SWIG_Lua_get_class_registry(L); /* get the registry */
2375 lua_pushstring(L,clss->fqname); /* get the name */
2376 lua_newtable(L); /* create the metatable */
2377#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
2378 /* If squashing is requested, then merges all bases metatable into this one.
2379 * It would get us all special methods: __getitem, __add etc.
2380 * This would set .fn, .type, and other .xxx incorrectly, but we will overwrite it right away
2381 */
2382 {
2383 int new_metatable_index = lua_absindex(L,-1);
2384 for(i=0;clss->bases[i];i++)
2385 {
2386 int base_metatable;
2387 SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
2388 base_metatable = lua_absindex(L,-1);
2389 SWIG_Lua_merge_tables_by_index(L,new_metatable_index, base_metatable);
2390 lua_pop(L,1);
2391 }
2392 }
2393 /* And now we will overwrite all incorrectly set data */
2394#endif
2395 /* add string of class name called ".type" */
2396 lua_pushstring(L,".type");
2397 lua_pushstring(L,clss->fqname);
2398 lua_rawset(L,-3);
2399 /* add a table called bases */
2400 lua_pushstring(L,".bases");
2401 lua_newtable(L);
2402 lua_rawset(L,-3);
2403 /* add a table called ".get" */
2404 lua_pushstring(L,".get");
2405 lua_newtable(L);
2406 lua_rawset(L,-3);
2407 /* add a table called ".set" */
2408 lua_pushstring(L,".set");
2409 lua_newtable(L);
2410 lua_rawset(L,-3);
2411 /* add a table called ".fn" */
2412 lua_pushstring(L,".fn");
2413 lua_newtable(L);
2414 /* add manual disown method */
2415 SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown);
2416 lua_rawset(L,-3);
2417 /* add accessor fns for using the .get,.set&.fn */
2418 SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
2419 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
2420 SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
2421 /* add it */
2422 lua_rawset(L,-3); /* metatable into registry */
2423 lua_pop(L,1); /* tidy stack (remove registry) */
2424 assert(lua_gettop(L) == begin);
2425
2426#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
2427 /* Now merge all symbols from .fn, .set, .get etc from bases to our tables */
2428 SWIG_Lua_class_squash_bases(L,clss);
2429#endif
2430 SWIG_Lua_get_class_metatable(L,clss->fqname);
2431 SWIG_Lua_add_class_instance_details(L,clss); /* recursive adding of details (atts & ops) */
2432 lua_pop(L,1); /* tidy stack (remove class metatable) */
2433 assert( lua_gettop(L) == begin );
2434}
2435
2436SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss)
2437{
2438 int SWIGUNUSED begin;
2439 assert(lua_istable(L,-1)); /* This is a table (module or namespace) where classes will be added */
2440 SWIG_Lua_class_register_instance(L,clss);
2441 SWIG_Lua_class_register_static(L,clss);
2442
2443 /* Add links from static part to instance part and vice versa */
2444 /* [SWIG registry] [Module]
2445 * "MyClass" ----> [MyClass metatable] <===== "MyClass" -+> [static part]
2446 * ".get" ----> ... | | getmetatable()----|
2447 * ".set" ----> ... | | |
2448 * ".static" --------------)----------------/ [static part metatable]
2449 * | ".get" --> ...
2450 * | ".set" --> ....
2451 * |=============================== ".instance"
2452 */
2453 begin = lua_gettop(L);
2454 lua_pushstring(L,clss->cls_static->name);
2455 lua_rawget(L,-2); /* get class static table */
2456 assert(lua_istable(L,-1));
2457 lua_getmetatable(L,-1);
2458 assert(lua_istable(L,-1)); /* get class static metatable */
2459 lua_pushstring(L,".instance"); /* prepare key */
2460
2461 SWIG_Lua_get_class_metatable(L,clss->fqname); /* get class metatable */
2462 assert(lua_istable(L,-1));
2463 lua_pushstring(L,".static"); /* prepare key */
2464 lua_pushvalue(L, -4); /* push static class TABLE */
2465 assert(lua_istable(L,-1));
2466 lua_rawset(L,-3); /* assign static class table(!NOT metatable) as ".static" member of class metatable */
2467 lua_rawset(L,-3); /* assign class metatable as ".instance" member of class static METATABLE */
2468 lua_pop(L,2);
2469 assert(lua_gettop(L) == begin);
2470}
2471#endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
2472
2473#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
2474SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_class *clss)
2475{
2476 const int SWIGUNUSED begin = lua_gettop(L);
2477 int i;
2478 /* if name already there (class is already registered) then do nothing */
2479 SWIG_Lua_get_class_registry(L); /* get the registry */
2480 lua_pushstring(L,clss->fqname); /* get the name */
2481 lua_rawget(L,-2);
2482 if(!lua_isnil(L,-1)) {
2483 lua_pop(L,2);
2484 assert(lua_gettop(L)==begin);
2485 return;
2486 }
2487 lua_pop(L,2); /* tidy stack */
2488 /* Recursively initialize all bases */
2489 for(i=0;clss->bases[i];i++)
2490 {
2491 SWIG_Lua_elua_class_register_instance(L,clss->bases[i]);
2492 }
2493 /* Again, get registry and push name */
2494 SWIG_Lua_get_class_registry(L); /* get the registry */
2495 lua_pushstring(L,clss->fqname); /* get the name */
2496 assert(clss->metatable);
2497 lua_pushrotable(L, (void*)(clss->metatable)); /* create the metatable */
2498 lua_rawset(L,-3);
2499 lua_pop(L,1);
2500 assert(lua_gettop(L) == begin);
2501}
2502#endif /* elua && eluac */
2503
2504/* -----------------------------------------------------------------------------
2505 * Class/structure conversion fns
2506 * ----------------------------------------------------------------------------- */
2507
2508/* helper to add metatable to new lua object */
2509SWIGINTERN void SWIG_Lua_AddMetatable(lua_State *L,swig_type_info *type)
2510{
2511 if (type->clientdata) /* there is clientdata: so add the metatable */
2512 {
2513 SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->fqname);
2514 if (lua_istable(L,-1))
2515 {
2516 lua_setmetatable(L,-2);
2517 }
2518 else
2519 {
2520 lua_pop(L,1);
2521 }
2522 }
2523}
2524
2525/* pushes a new object into the lua stack */
2526SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own)
2527{
2528 swig_lua_userdata *usr;
2529 if (!ptr){
2530 lua_pushnil(L);
2531 return;
2532 }
2533 usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */
2534 usr->ptr=ptr; /* set the ptr */
2535 usr->type=type;
2536 usr->own=own;
2537#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
2538 SWIG_Lua_AddMetatable(L,type); /* add metatable */
2539#endif
2540}
2541
2542/* takes a object from the lua stack & converts it into an object of the correct type
2543 (if possible) */
2544SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags)
2545{
2546 int ret = SWIG_ERROR;
2547 swig_lua_userdata *usr;
2548 swig_cast_info *cast;
2549 /* special case: lua nil => NULL pointer */
2550 if (lua_isnil(L,index))
2551 {
2552 *ptr=0;
2553 return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
2554 }
2555 if (lua_islightuserdata(L,index))
2556 {
2557 *ptr=lua_touserdata(L,index);
2558 return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
2559 }
2560 usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
2561 if (usr)
2562 {
2563 if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !usr->own)
2564 {
2565 return SWIG_ERROR_RELEASE_NOT_OWNED;
2566 }
2567 if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
2568 {
2569 usr->own = 0;
2570 }
2571 if (!type) /* special cast void*, no casting fn */
2572 {
2573 *ptr=usr->ptr;
2574 ret = SWIG_OK;
2575 }
2576 else
2577 {
2578 cast=SWIG_TypeCheck(usr->type->name,type); /* performs normal type checking */
2579 if (cast)
2580 {
2581 int newmemory = 0;
2582 *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
2583 assert(!newmemory); /* newmemory handling not yet implemented */
2584 ret = SWIG_OK;
2585 }
2586 }
2587 if ((ret == SWIG_OK) && (flags & SWIG_POINTER_CLEAR))
2588 {
2589 usr->ptr = 0;
2590 }
2591 }
2592 return ret;
2593}
2594
2595SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags,
2596 int argnum,const char *func_name){
2597 void *result = 0;
2598 if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
2599 luaL_error (L,"Error in %s, expected a %s at argument number %d\n",
2600 func_name,(type && type->str)?type->str:"void*",argnum);
2601 }
2602 return result;
2603}
2604
2605/* pushes a packed userdata. user for member fn pointers only */
2606SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type)
2607{
2608 swig_lua_rawdata *raw;
2609 assert(ptr); /* not acceptable to pass in a NULL value */
2610 raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */
2611 raw->type=type;
2612 raw->own=0;
2613 memcpy(raw->data,ptr,size); /* copy the data */
2614 SWIG_Lua_AddMetatable(L,type); /* add metatable */
2615}
2616
2617/* converts a packed userdata. user for member fn pointers only */
2618SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type)
2619{
2620 swig_lua_rawdata *raw;
2621 raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */
2622 if (!raw) return SWIG_ERROR; /* error */
2623 if (type==0 || type==raw->type) /* void* or identical type */
2624 {
2625 memcpy(ptr,raw->data,size); /* copy it */
2626 return SWIG_OK; /* ok */
2627 }
2628 return SWIG_ERROR; /* error */
2629}
2630
2631/* a function to get the typestring of a piece of data */
2632SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
2633{
2634 swig_lua_userdata *usr;
2635 if (lua_isuserdata(L,tp))
2636 {
2637 usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */
2638 if (usr && usr->type && usr->type->str)
2639 return usr->type->str;
2640 return "userdata (unknown type)";
2641 }
2642 return lua_typename(L,lua_type(L,tp));
2643}
2644
2645/* lua callable function to get the userdata's type */
2646SWIGRUNTIME int SWIG_Lua_type(lua_State *L)
2647{
2648 lua_pushstring(L,SWIG_Lua_typename(L,1));
2649 return 1;
2650}
2651
2652/* -----------------------------------------------------------------------------
2653 * global variable support code: class/struct typemap functions
2654 * ----------------------------------------------------------------------------- */
2655
2656#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
2657/* Install Constants */
2658SWIGINTERN void
2659SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
2660 int i;
2661 for (i = 0; constants[i].type; i++) {
2662 switch(constants[i].type) {
2663 case SWIG_LUA_INT:
2664 lua_pushstring(L,constants[i].name);
2665 lua_pushinteger(L,(lua_Integer)constants[i].lvalue);
2666 lua_rawset(L,-3);
2667 break;
2668 case SWIG_LUA_FLOAT:
2669 lua_pushstring(L,constants[i].name);
2670 lua_pushnumber(L,(lua_Number)constants[i].dvalue);
2671 lua_rawset(L,-3);
2672 break;
2673 case SWIG_LUA_CHAR:
2674 lua_pushstring(L,constants[i].name);
2675 {
2676 char c = (char)constants[i].lvalue;
2677 lua_pushlstring(L,&c,1);
2678 }
2679 lua_rawset(L,-3);
2680 break;
2681 case SWIG_LUA_STRING:
2682 lua_pushstring(L,constants[i].name);
2683 lua_pushstring(L,(char *) constants[i].pvalue);
2684 lua_rawset(L,-3);
2685 break;
2686 case SWIG_LUA_POINTER:
2687 lua_pushstring(L,constants[i].name);
2688 SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
2689 lua_rawset(L,-3);
2690 break;
2691 case SWIG_LUA_BINARY:
2692 lua_pushstring(L,constants[i].name);
2693 SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
2694 lua_rawset(L,-3);
2695 break;
2696 default:
2697 break;
2698 }
2699 }
2700}
2701#endif
2702
2703/* -----------------------------------------------------------------------------
2704 * executing lua code from within the wrapper
2705 * ----------------------------------------------------------------------------- */
2706
2707#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
2708#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
2709#endif
2710/* Executes a C string in Lua which is a really simple way of calling lua from C
2711Unfortunately lua keeps changing its APIs, so we need a conditional compile
2712In lua 5.0.X it's lua_dostring()
2713In lua 5.1.X it's luaL_dostring()
2714*/
2715SWIGINTERN int
2716SWIG_Lua_dostring(lua_State *L, const char *str) {
2717 int ok,top;
2718 if (str==0 || str[0]==0) return 0; /* nothing to do */
2719 top=lua_gettop(L); /* save stack */
2720#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
2721 ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */
2722#else
2723 ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */
2724#endif
2725 if (ok!=0) {
2726 SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
2727 }
2728 lua_settop(L,top); /* restore the stack */
2729 return ok;
2730}
2731
2732#ifdef __cplusplus
2733}
2734#endif
2735
2736/* ------------------------------ end luarun.swg ------------------------------ */
2737
2738
2739/* -------- TYPES TABLE (BEGIN) -------- */
2740
2741#define SWIGTYPE_p_FILE swig_types[0]
2742#define SWIGTYPE_p_cmark_delim_type swig_types[1]
2743#define SWIGTYPE_p_cmark_event_type swig_types[2]
2744#define SWIGTYPE_p_cmark_iter swig_types[3]
2745#define SWIGTYPE_p_cmark_list_type swig_types[4]
2746#define SWIGTYPE_p_cmark_mem swig_types[5]
2747#define SWIGTYPE_p_cmark_node swig_types[6]
2748#define SWIGTYPE_p_cmark_node_type swig_types[7]
2749#define SWIGTYPE_p_cmark_parser swig_types[8]
2750#define SWIGTYPE_p_f_p_void__void swig_types[9]
2751#define SWIGTYPE_p_f_p_void_size_t__p_void swig_types[10]
2752#define SWIGTYPE_p_f_size_t_size_t__p_void swig_types[11]
2753#define SWIGTYPE_p_void swig_types[12]
2754static swig_type_info *swig_types[14];
2755static swig_module_info swig_module = {swig_types, 13, 0, 0, 0, 0};
2756#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2757#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2758
2759/* -------- TYPES TABLE (END) -------- */
2760
2761#define SWIG_name "cmark"
2762#define SWIG_init luaopen_cmark
2763#define SWIG_init_user luaopen_cmark_user
2764
2765#define SWIG_LUACODE luaopen_cmark_luacode
2766
2767#include "cmark.h"
2768
2769
2770SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
2771 int ret = lua_isstring(L, idx);
2772 if (!ret)
2773 ret = lua_isnil(L, idx);
2774 return ret;
2775}
2776
2777
2778extern void push_cmark_node(lua_State *L, cmark_node *node)
2779{
2780 SWIG_NewPointerObj(L,node,SWIGTYPE_p_cmark_node,0);
2781}
2782
2783#ifdef __cplusplus
2784extern "C" {
2785#endif
2786static int _wrap_markdown_to_html(lua_State* L) {
2787 int SWIG_arg = 0;
2788 char *arg1 = (char *) 0 ;
2789 size_t arg2 ;
2790 int arg3 ;
2791 char *result = 0 ;
2792
2793 SWIG_check_num_args("cmark_markdown_to_html",3,3)
2794 if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("cmark_markdown_to_html",1,"char const *");
2795 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_markdown_to_html",2,"size_t");
2796 if(!lua_isnumber(L,3)) SWIG_fail_arg("cmark_markdown_to_html",3,"int");
2797 arg1 = (char *)lua_tostring(L, 1);
2798 SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative");
2799 arg2 = (size_t)lua_tonumber(L, 2);
2800 arg3 = (int)lua_tonumber(L, 3);
2801 result = (char *)cmark_markdown_to_html((char const *)arg1,arg2,arg3);
2802 lua_pushstring(L,(const char *)result); SWIG_arg++;
2803 return SWIG_arg;
2804
2805 fail: SWIGUNUSED;
2806 lua_error(L);
2807 return 0;
2808}
2809
2810
2811static int _wrap_mem_calloc_set(lua_State* L) {
2812 int SWIG_arg = 0;
2813 struct cmark_mem *arg1 = (struct cmark_mem *) 0 ;
2814 void *(*arg2)(size_t,size_t) = (void *(*)(size_t,size_t)) 0 ;
2815
2816 SWIG_check_num_args("cmark_mem::calloc",2,2)
2817 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_mem::calloc",1,"struct cmark_mem *");
2818 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_mem::calloc",2,"void *(*)(size_t,size_t)");
2819
2820 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_mem,0))){
2821 SWIG_fail_ptr("mem_calloc_set",1,SWIGTYPE_p_cmark_mem);
2822 }
2823
2824
2825 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_f_size_t_size_t__p_void,0))){
2826 SWIG_fail_ptr("mem_calloc_set",2,SWIGTYPE_p_f_size_t_size_t__p_void);
2827 }
2828
2829 if (arg1) (arg1)->calloc = arg2;
2830
2831 return SWIG_arg;
2832
2833 fail: SWIGUNUSED;
2834 lua_error(L);
2835 return 0;
2836}
2837
2838
2839static int _wrap_mem_calloc_get(lua_State* L) {
2840 int SWIG_arg = 0;
2841 struct cmark_mem *arg1 = (struct cmark_mem *) 0 ;
2842 void *(*result)(size_t,size_t) = 0 ;
2843
2844 SWIG_check_num_args("cmark_mem::calloc",1,1)
2845 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_mem::calloc",1,"struct cmark_mem *");
2846
2847 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_mem,0))){
2848 SWIG_fail_ptr("mem_calloc_get",1,SWIGTYPE_p_cmark_mem);
2849 }
2850
2851 result = (void *(*)(size_t,size_t)) ((arg1)->calloc);
2852 SWIG_NewPointerObj(L,result,SWIGTYPE_p_f_size_t_size_t__p_void,0); SWIG_arg++;
2853 return SWIG_arg;
2854
2855 fail: SWIGUNUSED;
2856 lua_error(L);
2857 return 0;
2858}
2859
2860
2861static int _wrap_mem_realloc_set(lua_State* L) {
2862 int SWIG_arg = 0;
2863 struct cmark_mem *arg1 = (struct cmark_mem *) 0 ;
2864 void *(*arg2)(void *,size_t) = (void *(*)(void *,size_t)) 0 ;
2865
2866 SWIG_check_num_args("cmark_mem::realloc",2,2)
2867 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_mem::realloc",1,"struct cmark_mem *");
2868 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_mem::realloc",2,"void *(*)(void *,size_t)");
2869
2870 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_mem,0))){
2871 SWIG_fail_ptr("mem_realloc_set",1,SWIGTYPE_p_cmark_mem);
2872 }
2873
2874
2875 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_f_p_void_size_t__p_void,0))){
2876 SWIG_fail_ptr("mem_realloc_set",2,SWIGTYPE_p_f_p_void_size_t__p_void);
2877 }
2878
2879 if (arg1) (arg1)->realloc = arg2;
2880
2881 return SWIG_arg;
2882
2883 fail: SWIGUNUSED;
2884 lua_error(L);
2885 return 0;
2886}
2887
2888
2889static int _wrap_mem_realloc_get(lua_State* L) {
2890 int SWIG_arg = 0;
2891 struct cmark_mem *arg1 = (struct cmark_mem *) 0 ;
2892 void *(*result)(void *,size_t) = 0 ;
2893
2894 SWIG_check_num_args("cmark_mem::realloc",1,1)
2895 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_mem::realloc",1,"struct cmark_mem *");
2896
2897 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_mem,0))){
2898 SWIG_fail_ptr("mem_realloc_get",1,SWIGTYPE_p_cmark_mem);
2899 }
2900
2901 result = (void *(*)(void *,size_t)) ((arg1)->realloc);
2902 SWIG_NewPointerObj(L,result,SWIGTYPE_p_f_p_void_size_t__p_void,0); SWIG_arg++;
2903 return SWIG_arg;
2904
2905 fail: SWIGUNUSED;
2906 lua_error(L);
2907 return 0;
2908}
2909
2910
2911static int _wrap_mem_free_set(lua_State* L) {
2912 int SWIG_arg = 0;
2913 struct cmark_mem *arg1 = (struct cmark_mem *) 0 ;
2914 void (*arg2)(void *) = (void (*)(void *)) 0 ;
2915
2916 SWIG_check_num_args("cmark_mem::free",2,2)
2917 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_mem::free",1,"struct cmark_mem *");
2918 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_mem::free",2,"void (*)(void *)");
2919
2920 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_mem,0))){
2921 SWIG_fail_ptr("mem_free_set",1,SWIGTYPE_p_cmark_mem);
2922 }
2923
2924
2925 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_f_p_void__void,0))){
2926 SWIG_fail_ptr("mem_free_set",2,SWIGTYPE_p_f_p_void__void);
2927 }
2928
2929 if (arg1) (arg1)->free = arg2;
2930
2931 return SWIG_arg;
2932
2933 fail: SWIGUNUSED;
2934 lua_error(L);
2935 return 0;
2936}
2937
2938
2939static int _wrap_mem_free_get(lua_State* L) {
2940 int SWIG_arg = 0;
2941 struct cmark_mem *arg1 = (struct cmark_mem *) 0 ;
2942 void (*result)(void *) = 0 ;
2943
2944 SWIG_check_num_args("cmark_mem::free",1,1)
2945 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_mem::free",1,"struct cmark_mem *");
2946
2947 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_mem,0))){
2948 SWIG_fail_ptr("mem_free_get",1,SWIGTYPE_p_cmark_mem);
2949 }
2950
2951 result = (void (*)(void *)) ((arg1)->free);
2952 SWIG_NewPointerObj(L,result,SWIGTYPE_p_f_p_void__void,0); SWIG_arg++;
2953 return SWIG_arg;
2954
2955 fail: SWIGUNUSED;
2956 lua_error(L);
2957 return 0;
2958}
2959
2960
2961static int _wrap_new_mem(lua_State* L) {
2962 int SWIG_arg = 0;
2963 struct cmark_mem *result = 0 ;
2964
2965 SWIG_check_num_args("cmark_mem::cmark_mem",0,0)
2966 result = (struct cmark_mem *)calloc(1, sizeof(struct cmark_mem));
2967 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_mem,1); SWIG_arg++;
2968 return SWIG_arg;
2969
2970 fail: SWIGUNUSED;
2971 lua_error(L);
2972 return 0;
2973}
2974
2975
2976static void swig_delete_mem(void *obj) {
2977struct cmark_mem *arg1 = (struct cmark_mem *) obj;
2978free((char *) arg1);
2979}
2980static int _proxy__wrap_new_mem(lua_State *L) {
2981 assert(lua_istable(L,1));
2982 lua_pushcfunction(L,_wrap_new_mem);
2983 assert(!lua_isnil(L,-1));
2984 lua_replace(L,1); /* replace our table with real constructor */
2985 lua_call(L,lua_gettop(L)-1,1);
2986 return 1;
2987}
2988static swig_lua_attribute swig_mem_attributes[] = {
2989 { "calloc", _wrap_mem_calloc_get, _wrap_mem_calloc_set },
2990 { "realloc", _wrap_mem_realloc_get, _wrap_mem_realloc_set },
2991 { "free", _wrap_mem_free_get, _wrap_mem_free_set },
2992 {0,0,0}
2993};
2994static swig_lua_method swig_mem_methods[]= {
2995 {0,0}
2996};
2997static swig_lua_method swig_mem_meta[] = {
2998 {0,0}
2999};
3000
3001static swig_lua_attribute swig_mem_Sf_SwigStatic_attributes[] = {
3002 {0,0,0}
3003};
3004static swig_lua_const_info swig_mem_Sf_SwigStatic_constants[]= {
3005 {0,0,0,0,0,0}
3006};
3007static swig_lua_method swig_mem_Sf_SwigStatic_methods[]= {
3008 {0,0}
3009};
3010static swig_lua_class* swig_mem_Sf_SwigStatic_classes[]= {
3011 0
3012};
3013
3014static swig_lua_namespace swig_mem_Sf_SwigStatic = {
3015 "mem",
3016 swig_mem_Sf_SwigStatic_methods,
3017 swig_mem_Sf_SwigStatic_attributes,
3018 swig_mem_Sf_SwigStatic_constants,
3019 swig_mem_Sf_SwigStatic_classes,
3020 0
3021};
3022static swig_lua_class *swig_mem_bases[] = {0};
3023static const char *swig_mem_base_names[] = {0};
3024static swig_lua_class _wrap_class_mem = { "mem", "mem", &SWIGTYPE_p_cmark_mem,_proxy__wrap_new_mem, swig_delete_mem, swig_mem_methods, swig_mem_attributes, &swig_mem_Sf_SwigStatic, swig_mem_meta, swig_mem_bases, swig_mem_base_names };
3025
3026static int _wrap_get_default_mem_allocator(lua_State* L) {
3027 int SWIG_arg = 0;
3028 cmark_mem *result = 0 ;
3029
3030 SWIG_check_num_args("cmark_get_default_mem_allocator",0,0)
3031 result = (cmark_mem *)cmark_get_default_mem_allocator();
3032 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_mem,0); SWIG_arg++;
3033 return SWIG_arg;
3034
3035 fail: SWIGUNUSED;
3036 lua_error(L);
3037 return 0;
3038}
3039
3040
3041static int _wrap_node_new(lua_State* L) {
3042 int SWIG_arg = 0;
3043 cmark_node_type arg1 ;
3044 cmark_node *result = 0 ;
3045
3046 SWIG_check_num_args("cmark_node_new",1,1)
3047 if(!lua_isnumber(L,1)) SWIG_fail_arg("cmark_node_new",1,"cmark_node_type");
3048 arg1 = (cmark_node_type)(int)lua_tonumber(L, 1);
3049 result = (cmark_node *)cmark_node_new(arg1);
3050 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3051 return SWIG_arg;
3052
3053 fail: SWIGUNUSED;
3054 lua_error(L);
3055 return 0;
3056}
3057
3058
3059static int _wrap_node_new_with_mem(lua_State* L) {
3060 int SWIG_arg = 0;
3061 cmark_node_type arg1 ;
3062 cmark_mem *arg2 = (cmark_mem *) 0 ;
3063 cmark_node *result = 0 ;
3064
3065 SWIG_check_num_args("cmark_node_new_with_mem",2,2)
3066 if(!lua_isnumber(L,1)) SWIG_fail_arg("cmark_node_new_with_mem",1,"cmark_node_type");
3067 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_node_new_with_mem",2,"cmark_mem *");
3068 arg1 = (cmark_node_type)(int)lua_tonumber(L, 1);
3069
3070 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_mem,0))){
3071 SWIG_fail_ptr("node_new_with_mem",2,SWIGTYPE_p_cmark_mem);
3072 }
3073
3074 result = (cmark_node *)cmark_node_new_with_mem(arg1,arg2);
3075 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3076 return SWIG_arg;
3077
3078 fail: SWIGUNUSED;
3079 lua_error(L);
3080 return 0;
3081}
3082
3083
3084static int _wrap_node_free(lua_State* L) {
3085 int SWIG_arg = 0;
3086 cmark_node *arg1 = (cmark_node *) 0 ;
3087
3088 SWIG_check_num_args("cmark_node_free",1,1)
3089 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_free",1,"cmark_node *");
3090
3091 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3092 SWIG_fail_ptr("node_free",1,SWIGTYPE_p_cmark_node);
3093 }
3094
3095 cmark_node_free(arg1);
3096
3097 return SWIG_arg;
3098
3099 fail: SWIGUNUSED;
3100 lua_error(L);
3101 return 0;
3102}
3103
3104
3105static int _wrap_node_next(lua_State* L) {
3106 int SWIG_arg = 0;
3107 cmark_node *arg1 = (cmark_node *) 0 ;
3108 cmark_node *result = 0 ;
3109
3110 SWIG_check_num_args("cmark_node_next",1,1)
3111 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_next",1,"cmark_node *");
3112
3113 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3114 SWIG_fail_ptr("node_next",1,SWIGTYPE_p_cmark_node);
3115 }
3116
3117 result = (cmark_node *)cmark_node_next(arg1);
3118 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3119 return SWIG_arg;
3120
3121 fail: SWIGUNUSED;
3122 lua_error(L);
3123 return 0;
3124}
3125
3126
3127static int _wrap_node_previous(lua_State* L) {
3128 int SWIG_arg = 0;
3129 cmark_node *arg1 = (cmark_node *) 0 ;
3130 cmark_node *result = 0 ;
3131
3132 SWIG_check_num_args("cmark_node_previous",1,1)
3133 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_previous",1,"cmark_node *");
3134
3135 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3136 SWIG_fail_ptr("node_previous",1,SWIGTYPE_p_cmark_node);
3137 }
3138
3139 result = (cmark_node *)cmark_node_previous(arg1);
3140 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3141 return SWIG_arg;
3142
3143 fail: SWIGUNUSED;
3144 lua_error(L);
3145 return 0;
3146}
3147
3148
3149static int _wrap_node_parent(lua_State* L) {
3150 int SWIG_arg = 0;
3151 cmark_node *arg1 = (cmark_node *) 0 ;
3152 cmark_node *result = 0 ;
3153
3154 SWIG_check_num_args("cmark_node_parent",1,1)
3155 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_parent",1,"cmark_node *");
3156
3157 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3158 SWIG_fail_ptr("node_parent",1,SWIGTYPE_p_cmark_node);
3159 }
3160
3161 result = (cmark_node *)cmark_node_parent(arg1);
3162 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3163 return SWIG_arg;
3164
3165 fail: SWIGUNUSED;
3166 lua_error(L);
3167 return 0;
3168}
3169
3170
3171static int _wrap_node_first_child(lua_State* L) {
3172 int SWIG_arg = 0;
3173 cmark_node *arg1 = (cmark_node *) 0 ;
3174 cmark_node *result = 0 ;
3175
3176 SWIG_check_num_args("cmark_node_first_child",1,1)
3177 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_first_child",1,"cmark_node *");
3178
3179 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3180 SWIG_fail_ptr("node_first_child",1,SWIGTYPE_p_cmark_node);
3181 }
3182
3183 result = (cmark_node *)cmark_node_first_child(arg1);
3184 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3185 return SWIG_arg;
3186
3187 fail: SWIGUNUSED;
3188 lua_error(L);
3189 return 0;
3190}
3191
3192
3193static int _wrap_node_last_child(lua_State* L) {
3194 int SWIG_arg = 0;
3195 cmark_node *arg1 = (cmark_node *) 0 ;
3196 cmark_node *result = 0 ;
3197
3198 SWIG_check_num_args("cmark_node_last_child",1,1)
3199 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_last_child",1,"cmark_node *");
3200
3201 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3202 SWIG_fail_ptr("node_last_child",1,SWIGTYPE_p_cmark_node);
3203 }
3204
3205 result = (cmark_node *)cmark_node_last_child(arg1);
3206 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3207 return SWIG_arg;
3208
3209 fail: SWIGUNUSED;
3210 lua_error(L);
3211 return 0;
3212}
3213
3214
3215static int _wrap_iter_new(lua_State* L) {
3216 int SWIG_arg = 0;
3217 cmark_node *arg1 = (cmark_node *) 0 ;
3218 cmark_iter *result = 0 ;
3219
3220 SWIG_check_num_args("cmark_iter_new",1,1)
3221 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_iter_new",1,"cmark_node *");
3222
3223 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3224 SWIG_fail_ptr("iter_new",1,SWIGTYPE_p_cmark_node);
3225 }
3226
3227 result = (cmark_iter *)cmark_iter_new(arg1);
3228 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_iter,0); SWIG_arg++;
3229 return SWIG_arg;
3230
3231 fail: SWIGUNUSED;
3232 lua_error(L);
3233 return 0;
3234}
3235
3236
3237static int _wrap_iter_free(lua_State* L) {
3238 int SWIG_arg = 0;
3239 cmark_iter *arg1 = (cmark_iter *) 0 ;
3240
3241 SWIG_check_num_args("cmark_iter_free",1,1)
3242 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_iter_free",1,"cmark_iter *");
3243
3244 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_iter,0))){
3245 SWIG_fail_ptr("iter_free",1,SWIGTYPE_p_cmark_iter);
3246 }
3247
3248 cmark_iter_free(arg1);
3249
3250 return SWIG_arg;
3251
3252 fail: SWIGUNUSED;
3253 lua_error(L);
3254 return 0;
3255}
3256
3257
3258static int _wrap_iter_next(lua_State* L) {
3259 int SWIG_arg = 0;
3260 cmark_iter *arg1 = (cmark_iter *) 0 ;
3261 cmark_event_type result;
3262
3263 SWIG_check_num_args("cmark_iter_next",1,1)
3264 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_iter_next",1,"cmark_iter *");
3265
3266 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_iter,0))){
3267 SWIG_fail_ptr("iter_next",1,SWIGTYPE_p_cmark_iter);
3268 }
3269
3270 result = (cmark_event_type)cmark_iter_next(arg1);
3271 lua_pushnumber(L, (lua_Number)(int)(result)); SWIG_arg++;
3272 return SWIG_arg;
3273
3274 fail: SWIGUNUSED;
3275 lua_error(L);
3276 return 0;
3277}
3278
3279
3280static int _wrap_iter_get_node(lua_State* L) {
3281 int SWIG_arg = 0;
3282 cmark_iter *arg1 = (cmark_iter *) 0 ;
3283 cmark_node *result = 0 ;
3284
3285 SWIG_check_num_args("cmark_iter_get_node",1,1)
3286 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_iter_get_node",1,"cmark_iter *");
3287
3288 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_iter,0))){
3289 SWIG_fail_ptr("iter_get_node",1,SWIGTYPE_p_cmark_iter);
3290 }
3291
3292 result = (cmark_node *)cmark_iter_get_node(arg1);
3293 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3294 return SWIG_arg;
3295
3296 fail: SWIGUNUSED;
3297 lua_error(L);
3298 return 0;
3299}
3300
3301
3302static int _wrap_iter_get_event_type(lua_State* L) {
3303 int SWIG_arg = 0;
3304 cmark_iter *arg1 = (cmark_iter *) 0 ;
3305 cmark_event_type result;
3306
3307 SWIG_check_num_args("cmark_iter_get_event_type",1,1)
3308 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_iter_get_event_type",1,"cmark_iter *");
3309
3310 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_iter,0))){
3311 SWIG_fail_ptr("iter_get_event_type",1,SWIGTYPE_p_cmark_iter);
3312 }
3313
3314 result = (cmark_event_type)cmark_iter_get_event_type(arg1);
3315 lua_pushnumber(L, (lua_Number)(int)(result)); SWIG_arg++;
3316 return SWIG_arg;
3317
3318 fail: SWIGUNUSED;
3319 lua_error(L);
3320 return 0;
3321}
3322
3323
3324static int _wrap_iter_get_root(lua_State* L) {
3325 int SWIG_arg = 0;
3326 cmark_iter *arg1 = (cmark_iter *) 0 ;
3327 cmark_node *result = 0 ;
3328
3329 SWIG_check_num_args("cmark_iter_get_root",1,1)
3330 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_iter_get_root",1,"cmark_iter *");
3331
3332 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_iter,0))){
3333 SWIG_fail_ptr("iter_get_root",1,SWIGTYPE_p_cmark_iter);
3334 }
3335
3336 result = (cmark_node *)cmark_iter_get_root(arg1);
3337 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
3338 return SWIG_arg;
3339
3340 fail: SWIGUNUSED;
3341 lua_error(L);
3342 return 0;
3343}
3344
3345
3346static int _wrap_iter_reset(lua_State* L) {
3347 int SWIG_arg = 0;
3348 cmark_iter *arg1 = (cmark_iter *) 0 ;
3349 cmark_node *arg2 = (cmark_node *) 0 ;
3350 cmark_event_type arg3 ;
3351
3352 SWIG_check_num_args("cmark_iter_reset",3,3)
3353 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_iter_reset",1,"cmark_iter *");
3354 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_iter_reset",2,"cmark_node *");
3355 if(!lua_isnumber(L,3)) SWIG_fail_arg("cmark_iter_reset",3,"cmark_event_type");
3356
3357 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_iter,0))){
3358 SWIG_fail_ptr("iter_reset",1,SWIGTYPE_p_cmark_iter);
3359 }
3360
3361
3362 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_node,0))){
3363 SWIG_fail_ptr("iter_reset",2,SWIGTYPE_p_cmark_node);
3364 }
3365
3366 arg3 = (cmark_event_type)(int)lua_tonumber(L, 3);
3367 cmark_iter_reset(arg1,arg2,arg3);
3368
3369 return SWIG_arg;
3370
3371 fail: SWIGUNUSED;
3372 lua_error(L);
3373 return 0;
3374}
3375
3376
3377static int _wrap_node_get_user_data(lua_State* L) {
3378 int SWIG_arg = 0;
3379 cmark_node *arg1 = (cmark_node *) 0 ;
3380 void *result = 0 ;
3381
3382 SWIG_check_num_args("cmark_node_get_user_data",1,1)
3383 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_user_data",1,"cmark_node *");
3384
3385 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3386 SWIG_fail_ptr("node_get_user_data",1,SWIGTYPE_p_cmark_node);
3387 }
3388
3389 result = (void *)cmark_node_get_user_data(arg1);
3390 SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++;
3391 return SWIG_arg;
3392
3393 fail: SWIGUNUSED;
3394 lua_error(L);
3395 return 0;
3396}
3397
3398
3399static int _wrap_node_set_user_data(lua_State* L) {
3400 int SWIG_arg = 0;
3401 cmark_node *arg1 = (cmark_node *) 0 ;
3402 void *arg2 = (void *) 0 ;
3403 int result;
3404
3405 SWIG_check_num_args("cmark_node_set_user_data",2,2)
3406 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_user_data",1,"cmark_node *");
3407 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_node_set_user_data",2,"void *");
3408
3409 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3410 SWIG_fail_ptr("node_set_user_data",1,SWIGTYPE_p_cmark_node);
3411 }
3412
3413 arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"node_set_user_data");
3414 result = (int)cmark_node_set_user_data(arg1,arg2);
3415 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3416 return SWIG_arg;
3417
3418 fail: SWIGUNUSED;
3419 lua_error(L);
3420 return 0;
3421}
3422
3423
3424static int _wrap_node_get_type(lua_State* L) {
3425 int SWIG_arg = 0;
3426 cmark_node *arg1 = (cmark_node *) 0 ;
3427 cmark_node_type result;
3428
3429 SWIG_check_num_args("cmark_node_get_type",1,1)
3430 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_type",1,"cmark_node *");
3431
3432 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3433 SWIG_fail_ptr("node_get_type",1,SWIGTYPE_p_cmark_node);
3434 }
3435
3436 result = (cmark_node_type)cmark_node_get_type(arg1);
3437 lua_pushnumber(L, (lua_Number)(int)(result)); SWIG_arg++;
3438 return SWIG_arg;
3439
3440 fail: SWIGUNUSED;
3441 lua_error(L);
3442 return 0;
3443}
3444
3445
3446static int _wrap_node_get_type_string(lua_State* L) {
3447 int SWIG_arg = 0;
3448 cmark_node *arg1 = (cmark_node *) 0 ;
3449 char *result = 0 ;
3450
3451 SWIG_check_num_args("cmark_node_get_type_string",1,1)
3452 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_type_string",1,"cmark_node *");
3453
3454 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3455 SWIG_fail_ptr("node_get_type_string",1,SWIGTYPE_p_cmark_node);
3456 }
3457
3458 result = (char *)cmark_node_get_type_string(arg1);
3459 lua_pushstring(L,(const char *)result); SWIG_arg++;
3460 return SWIG_arg;
3461
3462 fail: SWIGUNUSED;
3463 lua_error(L);
3464 return 0;
3465}
3466
3467
3468static int _wrap_node_get_literal(lua_State* L) {
3469 int SWIG_arg = 0;
3470 cmark_node *arg1 = (cmark_node *) 0 ;
3471 char *result = 0 ;
3472
3473 SWIG_check_num_args("cmark_node_get_literal",1,1)
3474 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_literal",1,"cmark_node *");
3475
3476 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3477 SWIG_fail_ptr("node_get_literal",1,SWIGTYPE_p_cmark_node);
3478 }
3479
3480 result = (char *)cmark_node_get_literal(arg1);
3481 lua_pushstring(L,(const char *)result); SWIG_arg++;
3482 return SWIG_arg;
3483
3484 fail: SWIGUNUSED;
3485 lua_error(L);
3486 return 0;
3487}
3488
3489
3490static int _wrap_node_set_literal(lua_State* L) {
3491 int SWIG_arg = 0;
3492 cmark_node *arg1 = (cmark_node *) 0 ;
3493 char *arg2 = (char *) 0 ;
3494 int result;
3495
3496 SWIG_check_num_args("cmark_node_set_literal",2,2)
3497 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_literal",1,"cmark_node *");
3498 if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("cmark_node_set_literal",2,"char const *");
3499
3500 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3501 SWIG_fail_ptr("node_set_literal",1,SWIGTYPE_p_cmark_node);
3502 }
3503
3504 arg2 = (char *)lua_tostring(L, 2);
3505 result = (int)cmark_node_set_literal(arg1,(char const *)arg2);
3506 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3507 return SWIG_arg;
3508
3509 fail: SWIGUNUSED;
3510 lua_error(L);
3511 return 0;
3512}
3513
3514
3515static int _wrap_node_get_heading_level(lua_State* L) {
3516 int SWIG_arg = 0;
3517 cmark_node *arg1 = (cmark_node *) 0 ;
3518 int result;
3519
3520 SWIG_check_num_args("cmark_node_get_heading_level",1,1)
3521 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_heading_level",1,"cmark_node *");
3522
3523 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3524 SWIG_fail_ptr("node_get_heading_level",1,SWIGTYPE_p_cmark_node);
3525 }
3526
3527 result = (int)cmark_node_get_heading_level(arg1);
3528 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3529 return SWIG_arg;
3530
3531 fail: SWIGUNUSED;
3532 lua_error(L);
3533 return 0;
3534}
3535
3536
3537static int _wrap_node_set_heading_level(lua_State* L) {
3538 int SWIG_arg = 0;
3539 cmark_node *arg1 = (cmark_node *) 0 ;
3540 int arg2 ;
3541 int result;
3542
3543 SWIG_check_num_args("cmark_node_set_heading_level",2,2)
3544 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_heading_level",1,"cmark_node *");
3545 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_node_set_heading_level",2,"int");
3546
3547 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3548 SWIG_fail_ptr("node_set_heading_level",1,SWIGTYPE_p_cmark_node);
3549 }
3550
3551 arg2 = (int)lua_tonumber(L, 2);
3552 result = (int)cmark_node_set_heading_level(arg1,arg2);
3553 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3554 return SWIG_arg;
3555
3556 fail: SWIGUNUSED;
3557 lua_error(L);
3558 return 0;
3559}
3560
3561
3562static int _wrap_node_get_list_type(lua_State* L) {
3563 int SWIG_arg = 0;
3564 cmark_node *arg1 = (cmark_node *) 0 ;
3565 cmark_list_type result;
3566
3567 SWIG_check_num_args("cmark_node_get_list_type",1,1)
3568 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_list_type",1,"cmark_node *");
3569
3570 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3571 SWIG_fail_ptr("node_get_list_type",1,SWIGTYPE_p_cmark_node);
3572 }
3573
3574 result = (cmark_list_type)cmark_node_get_list_type(arg1);
3575 lua_pushnumber(L, (lua_Number)(int)(result)); SWIG_arg++;
3576 return SWIG_arg;
3577
3578 fail: SWIGUNUSED;
3579 lua_error(L);
3580 return 0;
3581}
3582
3583
3584static int _wrap_node_set_list_type(lua_State* L) {
3585 int SWIG_arg = 0;
3586 cmark_node *arg1 = (cmark_node *) 0 ;
3587 cmark_list_type arg2 ;
3588 int result;
3589
3590 SWIG_check_num_args("cmark_node_set_list_type",2,2)
3591 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_list_type",1,"cmark_node *");
3592 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_node_set_list_type",2,"cmark_list_type");
3593
3594 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3595 SWIG_fail_ptr("node_set_list_type",1,SWIGTYPE_p_cmark_node);
3596 }
3597
3598 arg2 = (cmark_list_type)(int)lua_tonumber(L, 2);
3599 result = (int)cmark_node_set_list_type(arg1,arg2);
3600 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3601 return SWIG_arg;
3602
3603 fail: SWIGUNUSED;
3604 lua_error(L);
3605 return 0;
3606}
3607
3608
3609static int _wrap_node_get_list_delim(lua_State* L) {
3610 int SWIG_arg = 0;
3611 cmark_node *arg1 = (cmark_node *) 0 ;
3612 cmark_delim_type result;
3613
3614 SWIG_check_num_args("cmark_node_get_list_delim",1,1)
3615 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_list_delim",1,"cmark_node *");
3616
3617 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3618 SWIG_fail_ptr("node_get_list_delim",1,SWIGTYPE_p_cmark_node);
3619 }
3620
3621 result = (cmark_delim_type)cmark_node_get_list_delim(arg1);
3622 lua_pushnumber(L, (lua_Number)(int)(result)); SWIG_arg++;
3623 return SWIG_arg;
3624
3625 fail: SWIGUNUSED;
3626 lua_error(L);
3627 return 0;
3628}
3629
3630
3631static int _wrap_node_set_list_delim(lua_State* L) {
3632 int SWIG_arg = 0;
3633 cmark_node *arg1 = (cmark_node *) 0 ;
3634 cmark_delim_type arg2 ;
3635 int result;
3636
3637 SWIG_check_num_args("cmark_node_set_list_delim",2,2)
3638 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_list_delim",1,"cmark_node *");
3639 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_node_set_list_delim",2,"cmark_delim_type");
3640
3641 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3642 SWIG_fail_ptr("node_set_list_delim",1,SWIGTYPE_p_cmark_node);
3643 }
3644
3645 arg2 = (cmark_delim_type)(int)lua_tonumber(L, 2);
3646 result = (int)cmark_node_set_list_delim(arg1,arg2);
3647 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3648 return SWIG_arg;
3649
3650 fail: SWIGUNUSED;
3651 lua_error(L);
3652 return 0;
3653}
3654
3655
3656static int _wrap_node_get_list_start(lua_State* L) {
3657 int SWIG_arg = 0;
3658 cmark_node *arg1 = (cmark_node *) 0 ;
3659 int result;
3660
3661 SWIG_check_num_args("cmark_node_get_list_start",1,1)
3662 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_list_start",1,"cmark_node *");
3663
3664 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3665 SWIG_fail_ptr("node_get_list_start",1,SWIGTYPE_p_cmark_node);
3666 }
3667
3668 result = (int)cmark_node_get_list_start(arg1);
3669 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3670 return SWIG_arg;
3671
3672 fail: SWIGUNUSED;
3673 lua_error(L);
3674 return 0;
3675}
3676
3677
3678static int _wrap_node_set_list_start(lua_State* L) {
3679 int SWIG_arg = 0;
3680 cmark_node *arg1 = (cmark_node *) 0 ;
3681 int arg2 ;
3682 int result;
3683
3684 SWIG_check_num_args("cmark_node_set_list_start",2,2)
3685 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_list_start",1,"cmark_node *");
3686 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_node_set_list_start",2,"int");
3687
3688 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3689 SWIG_fail_ptr("node_set_list_start",1,SWIGTYPE_p_cmark_node);
3690 }
3691
3692 arg2 = (int)lua_tonumber(L, 2);
3693 result = (int)cmark_node_set_list_start(arg1,arg2);
3694 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3695 return SWIG_arg;
3696
3697 fail: SWIGUNUSED;
3698 lua_error(L);
3699 return 0;
3700}
3701
3702
3703static int _wrap_node_get_list_tight(lua_State* L) {
3704 int SWIG_arg = 0;
3705 cmark_node *arg1 = (cmark_node *) 0 ;
3706 int result;
3707
3708 SWIG_check_num_args("cmark_node_get_list_tight",1,1)
3709 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_list_tight",1,"cmark_node *");
3710
3711 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3712 SWIG_fail_ptr("node_get_list_tight",1,SWIGTYPE_p_cmark_node);
3713 }
3714
3715 result = (int)cmark_node_get_list_tight(arg1);
3716 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3717 return SWIG_arg;
3718
3719 fail: SWIGUNUSED;
3720 lua_error(L);
3721 return 0;
3722}
3723
3724
3725static int _wrap_node_set_list_tight(lua_State* L) {
3726 int SWIG_arg = 0;
3727 cmark_node *arg1 = (cmark_node *) 0 ;
3728 int arg2 ;
3729 int result;
3730
3731 SWIG_check_num_args("cmark_node_set_list_tight",2,2)
3732 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_list_tight",1,"cmark_node *");
3733 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_node_set_list_tight",2,"int");
3734
3735 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3736 SWIG_fail_ptr("node_set_list_tight",1,SWIGTYPE_p_cmark_node);
3737 }
3738
3739 arg2 = (int)lua_tonumber(L, 2);
3740 result = (int)cmark_node_set_list_tight(arg1,arg2);
3741 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3742 return SWIG_arg;
3743
3744 fail: SWIGUNUSED;
3745 lua_error(L);
3746 return 0;
3747}
3748
3749
3750static int _wrap_node_get_fence_info(lua_State* L) {
3751 int SWIG_arg = 0;
3752 cmark_node *arg1 = (cmark_node *) 0 ;
3753 char *result = 0 ;
3754
3755 SWIG_check_num_args("cmark_node_get_fence_info",1,1)
3756 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_fence_info",1,"cmark_node *");
3757
3758 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3759 SWIG_fail_ptr("node_get_fence_info",1,SWIGTYPE_p_cmark_node);
3760 }
3761
3762 result = (char *)cmark_node_get_fence_info(arg1);
3763 lua_pushstring(L,(const char *)result); SWIG_arg++;
3764 return SWIG_arg;
3765
3766 fail: SWIGUNUSED;
3767 lua_error(L);
3768 return 0;
3769}
3770
3771
3772static int _wrap_node_set_fence_info(lua_State* L) {
3773 int SWIG_arg = 0;
3774 cmark_node *arg1 = (cmark_node *) 0 ;
3775 char *arg2 = (char *) 0 ;
3776 int result;
3777
3778 SWIG_check_num_args("cmark_node_set_fence_info",2,2)
3779 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_fence_info",1,"cmark_node *");
3780 if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("cmark_node_set_fence_info",2,"char const *");
3781
3782 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3783 SWIG_fail_ptr("node_set_fence_info",1,SWIGTYPE_p_cmark_node);
3784 }
3785
3786 arg2 = (char *)lua_tostring(L, 2);
3787 result = (int)cmark_node_set_fence_info(arg1,(char const *)arg2);
3788 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3789 return SWIG_arg;
3790
3791 fail: SWIGUNUSED;
3792 lua_error(L);
3793 return 0;
3794}
3795
3796
3797static int _wrap_node_get_url(lua_State* L) {
3798 int SWIG_arg = 0;
3799 cmark_node *arg1 = (cmark_node *) 0 ;
3800 char *result = 0 ;
3801
3802 SWIG_check_num_args("cmark_node_get_url",1,1)
3803 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_url",1,"cmark_node *");
3804
3805 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3806 SWIG_fail_ptr("node_get_url",1,SWIGTYPE_p_cmark_node);
3807 }
3808
3809 result = (char *)cmark_node_get_url(arg1);
3810 lua_pushstring(L,(const char *)result); SWIG_arg++;
3811 return SWIG_arg;
3812
3813 fail: SWIGUNUSED;
3814 lua_error(L);
3815 return 0;
3816}
3817
3818
3819static int _wrap_node_set_url(lua_State* L) {
3820 int SWIG_arg = 0;
3821 cmark_node *arg1 = (cmark_node *) 0 ;
3822 char *arg2 = (char *) 0 ;
3823 int result;
3824
3825 SWIG_check_num_args("cmark_node_set_url",2,2)
3826 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_url",1,"cmark_node *");
3827 if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("cmark_node_set_url",2,"char const *");
3828
3829 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3830 SWIG_fail_ptr("node_set_url",1,SWIGTYPE_p_cmark_node);
3831 }
3832
3833 arg2 = (char *)lua_tostring(L, 2);
3834 result = (int)cmark_node_set_url(arg1,(char const *)arg2);
3835 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3836 return SWIG_arg;
3837
3838 fail: SWIGUNUSED;
3839 lua_error(L);
3840 return 0;
3841}
3842
3843
3844static int _wrap_node_get_title(lua_State* L) {
3845 int SWIG_arg = 0;
3846 cmark_node *arg1 = (cmark_node *) 0 ;
3847 char *result = 0 ;
3848
3849 SWIG_check_num_args("cmark_node_get_title",1,1)
3850 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_title",1,"cmark_node *");
3851
3852 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3853 SWIG_fail_ptr("node_get_title",1,SWIGTYPE_p_cmark_node);
3854 }
3855
3856 result = (char *)cmark_node_get_title(arg1);
3857 lua_pushstring(L,(const char *)result); SWIG_arg++;
3858 return SWIG_arg;
3859
3860 fail: SWIGUNUSED;
3861 lua_error(L);
3862 return 0;
3863}
3864
3865
3866static int _wrap_node_set_title(lua_State* L) {
3867 int SWIG_arg = 0;
3868 cmark_node *arg1 = (cmark_node *) 0 ;
3869 char *arg2 = (char *) 0 ;
3870 int result;
3871
3872 SWIG_check_num_args("cmark_node_set_title",2,2)
3873 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_title",1,"cmark_node *");
3874 if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("cmark_node_set_title",2,"char const *");
3875
3876 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3877 SWIG_fail_ptr("node_set_title",1,SWIGTYPE_p_cmark_node);
3878 }
3879
3880 arg2 = (char *)lua_tostring(L, 2);
3881 result = (int)cmark_node_set_title(arg1,(char const *)arg2);
3882 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3883 return SWIG_arg;
3884
3885 fail: SWIGUNUSED;
3886 lua_error(L);
3887 return 0;
3888}
3889
3890
3891static int _wrap_node_get_on_enter(lua_State* L) {
3892 int SWIG_arg = 0;
3893 cmark_node *arg1 = (cmark_node *) 0 ;
3894 char *result = 0 ;
3895
3896 SWIG_check_num_args("cmark_node_get_on_enter",1,1)
3897 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_on_enter",1,"cmark_node *");
3898
3899 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3900 SWIG_fail_ptr("node_get_on_enter",1,SWIGTYPE_p_cmark_node);
3901 }
3902
3903 result = (char *)cmark_node_get_on_enter(arg1);
3904 lua_pushstring(L,(const char *)result); SWIG_arg++;
3905 return SWIG_arg;
3906
3907 fail: SWIGUNUSED;
3908 lua_error(L);
3909 return 0;
3910}
3911
3912
3913static int _wrap_node_set_on_enter(lua_State* L) {
3914 int SWIG_arg = 0;
3915 cmark_node *arg1 = (cmark_node *) 0 ;
3916 char *arg2 = (char *) 0 ;
3917 int result;
3918
3919 SWIG_check_num_args("cmark_node_set_on_enter",2,2)
3920 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_on_enter",1,"cmark_node *");
3921 if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("cmark_node_set_on_enter",2,"char const *");
3922
3923 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3924 SWIG_fail_ptr("node_set_on_enter",1,SWIGTYPE_p_cmark_node);
3925 }
3926
3927 arg2 = (char *)lua_tostring(L, 2);
3928 result = (int)cmark_node_set_on_enter(arg1,(char const *)arg2);
3929 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3930 return SWIG_arg;
3931
3932 fail: SWIGUNUSED;
3933 lua_error(L);
3934 return 0;
3935}
3936
3937
3938static int _wrap_node_get_on_exit(lua_State* L) {
3939 int SWIG_arg = 0;
3940 cmark_node *arg1 = (cmark_node *) 0 ;
3941 char *result = 0 ;
3942
3943 SWIG_check_num_args("cmark_node_get_on_exit",1,1)
3944 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_on_exit",1,"cmark_node *");
3945
3946 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3947 SWIG_fail_ptr("node_get_on_exit",1,SWIGTYPE_p_cmark_node);
3948 }
3949
3950 result = (char *)cmark_node_get_on_exit(arg1);
3951 lua_pushstring(L,(const char *)result); SWIG_arg++;
3952 return SWIG_arg;
3953
3954 fail: SWIGUNUSED;
3955 lua_error(L);
3956 return 0;
3957}
3958
3959
3960static int _wrap_node_set_on_exit(lua_State* L) {
3961 int SWIG_arg = 0;
3962 cmark_node *arg1 = (cmark_node *) 0 ;
3963 char *arg2 = (char *) 0 ;
3964 int result;
3965
3966 SWIG_check_num_args("cmark_node_set_on_exit",2,2)
3967 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_set_on_exit",1,"cmark_node *");
3968 if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("cmark_node_set_on_exit",2,"char const *");
3969
3970 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3971 SWIG_fail_ptr("node_set_on_exit",1,SWIGTYPE_p_cmark_node);
3972 }
3973
3974 arg2 = (char *)lua_tostring(L, 2);
3975 result = (int)cmark_node_set_on_exit(arg1,(char const *)arg2);
3976 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3977 return SWIG_arg;
3978
3979 fail: SWIGUNUSED;
3980 lua_error(L);
3981 return 0;
3982}
3983
3984
3985static int _wrap_node_get_start_line(lua_State* L) {
3986 int SWIG_arg = 0;
3987 cmark_node *arg1 = (cmark_node *) 0 ;
3988 int result;
3989
3990 SWIG_check_num_args("cmark_node_get_start_line",1,1)
3991 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_start_line",1,"cmark_node *");
3992
3993 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
3994 SWIG_fail_ptr("node_get_start_line",1,SWIGTYPE_p_cmark_node);
3995 }
3996
3997 result = (int)cmark_node_get_start_line(arg1);
3998 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
3999 return SWIG_arg;
4000
4001 fail: SWIGUNUSED;
4002 lua_error(L);
4003 return 0;
4004}
4005
4006
4007static int _wrap_node_get_start_column(lua_State* L) {
4008 int SWIG_arg = 0;
4009 cmark_node *arg1 = (cmark_node *) 0 ;
4010 int result;
4011
4012 SWIG_check_num_args("cmark_node_get_start_column",1,1)
4013 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_start_column",1,"cmark_node *");
4014
4015 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4016 SWIG_fail_ptr("node_get_start_column",1,SWIGTYPE_p_cmark_node);
4017 }
4018
4019 result = (int)cmark_node_get_start_column(arg1);
4020 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4021 return SWIG_arg;
4022
4023 fail: SWIGUNUSED;
4024 lua_error(L);
4025 return 0;
4026}
4027
4028
4029static int _wrap_node_get_end_line(lua_State* L) {
4030 int SWIG_arg = 0;
4031 cmark_node *arg1 = (cmark_node *) 0 ;
4032 int result;
4033
4034 SWIG_check_num_args("cmark_node_get_end_line",1,1)
4035 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_end_line",1,"cmark_node *");
4036
4037 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4038 SWIG_fail_ptr("node_get_end_line",1,SWIGTYPE_p_cmark_node);
4039 }
4040
4041 result = (int)cmark_node_get_end_line(arg1);
4042 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4043 return SWIG_arg;
4044
4045 fail: SWIGUNUSED;
4046 lua_error(L);
4047 return 0;
4048}
4049
4050
4051static int _wrap_node_get_end_column(lua_State* L) {
4052 int SWIG_arg = 0;
4053 cmark_node *arg1 = (cmark_node *) 0 ;
4054 int result;
4055
4056 SWIG_check_num_args("cmark_node_get_end_column",1,1)
4057 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_get_end_column",1,"cmark_node *");
4058
4059 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4060 SWIG_fail_ptr("node_get_end_column",1,SWIGTYPE_p_cmark_node);
4061 }
4062
4063 result = (int)cmark_node_get_end_column(arg1);
4064 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4065 return SWIG_arg;
4066
4067 fail: SWIGUNUSED;
4068 lua_error(L);
4069 return 0;
4070}
4071
4072
4073static int _wrap_node_unlink(lua_State* L) {
4074 int SWIG_arg = 0;
4075 cmark_node *arg1 = (cmark_node *) 0 ;
4076
4077 SWIG_check_num_args("cmark_node_unlink",1,1)
4078 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_unlink",1,"cmark_node *");
4079
4080 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4081 SWIG_fail_ptr("node_unlink",1,SWIGTYPE_p_cmark_node);
4082 }
4083
4084 cmark_node_unlink(arg1);
4085
4086 return SWIG_arg;
4087
4088 fail: SWIGUNUSED;
4089 lua_error(L);
4090 return 0;
4091}
4092
4093
4094static int _wrap_node_insert_before(lua_State* L) {
4095 int SWIG_arg = 0;
4096 cmark_node *arg1 = (cmark_node *) 0 ;
4097 cmark_node *arg2 = (cmark_node *) 0 ;
4098 int result;
4099
4100 SWIG_check_num_args("cmark_node_insert_before",2,2)
4101 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_insert_before",1,"cmark_node *");
4102 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_node_insert_before",2,"cmark_node *");
4103
4104 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4105 SWIG_fail_ptr("node_insert_before",1,SWIGTYPE_p_cmark_node);
4106 }
4107
4108
4109 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_node,0))){
4110 SWIG_fail_ptr("node_insert_before",2,SWIGTYPE_p_cmark_node);
4111 }
4112
4113 result = (int)cmark_node_insert_before(arg1,arg2);
4114 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4115 return SWIG_arg;
4116
4117 fail: SWIGUNUSED;
4118 lua_error(L);
4119 return 0;
4120}
4121
4122
4123static int _wrap_node_insert_after(lua_State* L) {
4124 int SWIG_arg = 0;
4125 cmark_node *arg1 = (cmark_node *) 0 ;
4126 cmark_node *arg2 = (cmark_node *) 0 ;
4127 int result;
4128
4129 SWIG_check_num_args("cmark_node_insert_after",2,2)
4130 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_insert_after",1,"cmark_node *");
4131 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_node_insert_after",2,"cmark_node *");
4132
4133 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4134 SWIG_fail_ptr("node_insert_after",1,SWIGTYPE_p_cmark_node);
4135 }
4136
4137
4138 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_node,0))){
4139 SWIG_fail_ptr("node_insert_after",2,SWIGTYPE_p_cmark_node);
4140 }
4141
4142 result = (int)cmark_node_insert_after(arg1,arg2);
4143 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4144 return SWIG_arg;
4145
4146 fail: SWIGUNUSED;
4147 lua_error(L);
4148 return 0;
4149}
4150
4151
4152static int _wrap_node_replace(lua_State* L) {
4153 int SWIG_arg = 0;
4154 cmark_node *arg1 = (cmark_node *) 0 ;
4155 cmark_node *arg2 = (cmark_node *) 0 ;
4156 int result;
4157
4158 SWIG_check_num_args("cmark_node_replace",2,2)
4159 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_replace",1,"cmark_node *");
4160 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_node_replace",2,"cmark_node *");
4161
4162 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4163 SWIG_fail_ptr("node_replace",1,SWIGTYPE_p_cmark_node);
4164 }
4165
4166
4167 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_node,0))){
4168 SWIG_fail_ptr("node_replace",2,SWIGTYPE_p_cmark_node);
4169 }
4170
4171 result = (int)cmark_node_replace(arg1,arg2);
4172 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4173 return SWIG_arg;
4174
4175 fail: SWIGUNUSED;
4176 lua_error(L);
4177 return 0;
4178}
4179
4180
4181static int _wrap_node_prepend_child(lua_State* L) {
4182 int SWIG_arg = 0;
4183 cmark_node *arg1 = (cmark_node *) 0 ;
4184 cmark_node *arg2 = (cmark_node *) 0 ;
4185 int result;
4186
4187 SWIG_check_num_args("cmark_node_prepend_child",2,2)
4188 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_prepend_child",1,"cmark_node *");
4189 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_node_prepend_child",2,"cmark_node *");
4190
4191 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4192 SWIG_fail_ptr("node_prepend_child",1,SWIGTYPE_p_cmark_node);
4193 }
4194
4195
4196 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_node,0))){
4197 SWIG_fail_ptr("node_prepend_child",2,SWIGTYPE_p_cmark_node);
4198 }
4199
4200 result = (int)cmark_node_prepend_child(arg1,arg2);
4201 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4202 return SWIG_arg;
4203
4204 fail: SWIGUNUSED;
4205 lua_error(L);
4206 return 0;
4207}
4208
4209
4210static int _wrap_node_append_child(lua_State* L) {
4211 int SWIG_arg = 0;
4212 cmark_node *arg1 = (cmark_node *) 0 ;
4213 cmark_node *arg2 = (cmark_node *) 0 ;
4214 int result;
4215
4216 SWIG_check_num_args("cmark_node_append_child",2,2)
4217 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_node_append_child",1,"cmark_node *");
4218 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_node_append_child",2,"cmark_node *");
4219
4220 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4221 SWIG_fail_ptr("node_append_child",1,SWIGTYPE_p_cmark_node);
4222 }
4223
4224
4225 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_node,0))){
4226 SWIG_fail_ptr("node_append_child",2,SWIGTYPE_p_cmark_node);
4227 }
4228
4229 result = (int)cmark_node_append_child(arg1,arg2);
4230 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4231 return SWIG_arg;
4232
4233 fail: SWIGUNUSED;
4234 lua_error(L);
4235 return 0;
4236}
4237
4238
4239static int _wrap_consolidate_text_nodes(lua_State* L) {
4240 int SWIG_arg = 0;
4241 cmark_node *arg1 = (cmark_node *) 0 ;
4242
4243 SWIG_check_num_args("cmark_consolidate_text_nodes",1,1)
4244 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_consolidate_text_nodes",1,"cmark_node *");
4245
4246 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4247 SWIG_fail_ptr("consolidate_text_nodes",1,SWIGTYPE_p_cmark_node);
4248 }
4249
4250 cmark_consolidate_text_nodes(arg1);
4251
4252 return SWIG_arg;
4253
4254 fail: SWIGUNUSED;
4255 lua_error(L);
4256 return 0;
4257}
4258
4259
4260static int _wrap_parser_new(lua_State* L) {
4261 int SWIG_arg = 0;
4262 int arg1 ;
4263 cmark_parser *result = 0 ;
4264
4265 SWIG_check_num_args("cmark_parser_new",1,1)
4266 if(!lua_isnumber(L,1)) SWIG_fail_arg("cmark_parser_new",1,"int");
4267 arg1 = (int)lua_tonumber(L, 1);
4268 result = (cmark_parser *)cmark_parser_new(arg1);
4269 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_parser,0); SWIG_arg++;
4270 return SWIG_arg;
4271
4272 fail: SWIGUNUSED;
4273 lua_error(L);
4274 return 0;
4275}
4276
4277
4278static int _wrap_parser_new_with_mem(lua_State* L) {
4279 int SWIG_arg = 0;
4280 int arg1 ;
4281 cmark_mem *arg2 = (cmark_mem *) 0 ;
4282 cmark_parser *result = 0 ;
4283
4284 SWIG_check_num_args("cmark_parser_new_with_mem",2,2)
4285 if(!lua_isnumber(L,1)) SWIG_fail_arg("cmark_parser_new_with_mem",1,"int");
4286 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_parser_new_with_mem",2,"cmark_mem *");
4287 arg1 = (int)lua_tonumber(L, 1);
4288
4289 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_mem,0))){
4290 SWIG_fail_ptr("parser_new_with_mem",2,SWIGTYPE_p_cmark_mem);
4291 }
4292
4293 result = (cmark_parser *)cmark_parser_new_with_mem(arg1,arg2);
4294 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_parser,0); SWIG_arg++;
4295 return SWIG_arg;
4296
4297 fail: SWIGUNUSED;
4298 lua_error(L);
4299 return 0;
4300}
4301
4302
4303static int _wrap_parser_new_with_mem_into_root(lua_State* L) {
4304 int SWIG_arg = 0;
4305 int arg1 ;
4306 cmark_mem *arg2 = (cmark_mem *) 0 ;
4307 cmark_node *arg3 = (cmark_node *) 0 ;
4308 cmark_parser *result = 0 ;
4309
4310 SWIG_check_num_args("cmark_parser_new_with_mem_into_root",3,3)
4311 if(!lua_isnumber(L,1)) SWIG_fail_arg("cmark_parser_new_with_mem_into_root",1,"int");
4312 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cmark_parser_new_with_mem_into_root",2,"cmark_mem *");
4313 if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("cmark_parser_new_with_mem_into_root",3,"cmark_node *");
4314 arg1 = (int)lua_tonumber(L, 1);
4315
4316 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_cmark_mem,0))){
4317 SWIG_fail_ptr("parser_new_with_mem_into_root",2,SWIGTYPE_p_cmark_mem);
4318 }
4319
4320
4321 if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_cmark_node,0))){
4322 SWIG_fail_ptr("parser_new_with_mem_into_root",3,SWIGTYPE_p_cmark_node);
4323 }
4324
4325 result = (cmark_parser *)cmark_parser_new_with_mem_into_root(arg1,arg2,arg3);
4326 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_parser,0); SWIG_arg++;
4327 return SWIG_arg;
4328
4329 fail: SWIGUNUSED;
4330 lua_error(L);
4331 return 0;
4332}
4333
4334
4335static int _wrap_parser_free(lua_State* L) {
4336 int SWIG_arg = 0;
4337 cmark_parser *arg1 = (cmark_parser *) 0 ;
4338
4339 SWIG_check_num_args("cmark_parser_free",1,1)
4340 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_parser_free",1,"cmark_parser *");
4341
4342 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_parser,0))){
4343 SWIG_fail_ptr("parser_free",1,SWIGTYPE_p_cmark_parser);
4344 }
4345
4346 cmark_parser_free(arg1);
4347
4348 return SWIG_arg;
4349
4350 fail: SWIGUNUSED;
4351 lua_error(L);
4352 return 0;
4353}
4354
4355
4356static int _wrap_parser_feed(lua_State* L) {
4357 int SWIG_arg = 0;
4358 cmark_parser *arg1 = (cmark_parser *) 0 ;
4359 char *arg2 = (char *) 0 ;
4360 size_t arg3 ;
4361
4362 SWIG_check_num_args("cmark_parser_feed",3,3)
4363 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_parser_feed",1,"cmark_parser *");
4364 if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("cmark_parser_feed",2,"char const *");
4365 if(!lua_isnumber(L,3)) SWIG_fail_arg("cmark_parser_feed",3,"size_t");
4366
4367 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_parser,0))){
4368 SWIG_fail_ptr("parser_feed",1,SWIGTYPE_p_cmark_parser);
4369 }
4370
4371 arg2 = (char *)lua_tostring(L, 2);
4372 SWIG_contract_assert((lua_tonumber(L,3)>=0),"number must not be negative");
4373 arg3 = (size_t)lua_tonumber(L, 3);
4374 cmark_parser_feed(arg1,(char const *)arg2,arg3);
4375
4376 return SWIG_arg;
4377
4378 fail: SWIGUNUSED;
4379 lua_error(L);
4380 return 0;
4381}
4382
4383
4384static int _wrap_parser_finish(lua_State* L) {
4385 int SWIG_arg = 0;
4386 cmark_parser *arg1 = (cmark_parser *) 0 ;
4387 cmark_node *result = 0 ;
4388
4389 SWIG_check_num_args("cmark_parser_finish",1,1)
4390 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_parser_finish",1,"cmark_parser *");
4391
4392 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_parser,0))){
4393 SWIG_fail_ptr("parser_finish",1,SWIGTYPE_p_cmark_parser);
4394 }
4395
4396 result = (cmark_node *)cmark_parser_finish(arg1);
4397 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
4398 return SWIG_arg;
4399
4400 fail: SWIGUNUSED;
4401 lua_error(L);
4402 return 0;
4403}
4404
4405
4406static int _wrap_parse_document(lua_State* L) {
4407 int SWIG_arg = 0;
4408 char *arg1 = (char *) 0 ;
4409 size_t arg2 ;
4410 int arg3 ;
4411 cmark_node *result = 0 ;
4412
4413 SWIG_check_num_args("cmark_parse_document",3,3)
4414 if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("cmark_parse_document",1,"char const *");
4415 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_parse_document",2,"size_t");
4416 if(!lua_isnumber(L,3)) SWIG_fail_arg("cmark_parse_document",3,"int");
4417 arg1 = (char *)lua_tostring(L, 1);
4418 SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative");
4419 arg2 = (size_t)lua_tonumber(L, 2);
4420 arg3 = (int)lua_tonumber(L, 3);
4421 result = (cmark_node *)cmark_parse_document((char const *)arg1,arg2,arg3);
4422 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
4423 return SWIG_arg;
4424
4425 fail: SWIGUNUSED;
4426 lua_error(L);
4427 return 0;
4428}
4429
4430
4431static int _wrap_parse_file(lua_State* L) {
4432 int SWIG_arg = 0;
4433 FILE *arg1 = (FILE *) 0 ;
4434 int arg2 ;
4435 cmark_node *result = 0 ;
4436
4437 SWIG_check_num_args("cmark_parse_file",2,2)
4438 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_parse_file",1,"FILE *");
4439 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_parse_file",2,"int");
4440
4441 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_FILE,0))){
4442 SWIG_fail_ptr("parse_file",1,SWIGTYPE_p_FILE);
4443 }
4444
4445 arg2 = (int)lua_tonumber(L, 2);
4446 result = (cmark_node *)cmark_parse_file(arg1,arg2);
4447 SWIG_NewPointerObj(L,result,SWIGTYPE_p_cmark_node,0); SWIG_arg++;
4448 return SWIG_arg;
4449
4450 fail: SWIGUNUSED;
4451 lua_error(L);
4452 return 0;
4453}
4454
4455
4456static int _wrap_render_xml(lua_State* L) {
4457 int SWIG_arg = 0;
4458 cmark_node *arg1 = (cmark_node *) 0 ;
4459 int arg2 ;
4460 char *result = 0 ;
4461
4462 SWIG_check_num_args("cmark_render_xml",2,2)
4463 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_render_xml",1,"cmark_node *");
4464 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_render_xml",2,"int");
4465
4466 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4467 SWIG_fail_ptr("render_xml",1,SWIGTYPE_p_cmark_node);
4468 }
4469
4470 arg2 = (int)lua_tonumber(L, 2);
4471 result = (char *)cmark_render_xml(arg1,arg2);
4472 lua_pushstring(L,(const char *)result); SWIG_arg++;
4473 return SWIG_arg;
4474
4475 fail: SWIGUNUSED;
4476 lua_error(L);
4477 return 0;
4478}
4479
4480
4481static int _wrap_render_html(lua_State* L) {
4482 int SWIG_arg = 0;
4483 cmark_node *arg1 = (cmark_node *) 0 ;
4484 int arg2 ;
4485 char *result = 0 ;
4486
4487 SWIG_check_num_args("cmark_render_html",2,2)
4488 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_render_html",1,"cmark_node *");
4489 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_render_html",2,"int");
4490
4491 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4492 SWIG_fail_ptr("render_html",1,SWIGTYPE_p_cmark_node);
4493 }
4494
4495 arg2 = (int)lua_tonumber(L, 2);
4496 result = (char *)cmark_render_html(arg1,arg2);
4497 lua_pushstring(L,(const char *)result); SWIG_arg++;
4498 return SWIG_arg;
4499
4500 fail: SWIGUNUSED;
4501 lua_error(L);
4502 return 0;
4503}
4504
4505
4506static int _wrap_render_man(lua_State* L) {
4507 int SWIG_arg = 0;
4508 cmark_node *arg1 = (cmark_node *) 0 ;
4509 int arg2 ;
4510 int arg3 ;
4511 char *result = 0 ;
4512
4513 SWIG_check_num_args("cmark_render_man",3,3)
4514 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_render_man",1,"cmark_node *");
4515 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_render_man",2,"int");
4516 if(!lua_isnumber(L,3)) SWIG_fail_arg("cmark_render_man",3,"int");
4517
4518 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4519 SWIG_fail_ptr("render_man",1,SWIGTYPE_p_cmark_node);
4520 }
4521
4522 arg2 = (int)lua_tonumber(L, 2);
4523 arg3 = (int)lua_tonumber(L, 3);
4524 result = (char *)cmark_render_man(arg1,arg2,arg3);
4525 lua_pushstring(L,(const char *)result); SWIG_arg++;
4526 return SWIG_arg;
4527
4528 fail: SWIGUNUSED;
4529 lua_error(L);
4530 return 0;
4531}
4532
4533
4534static int _wrap_render_commonmark(lua_State* L) {
4535 int SWIG_arg = 0;
4536 cmark_node *arg1 = (cmark_node *) 0 ;
4537 int arg2 ;
4538 int arg3 ;
4539 char *result = 0 ;
4540
4541 SWIG_check_num_args("cmark_render_commonmark",3,3)
4542 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_render_commonmark",1,"cmark_node *");
4543 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_render_commonmark",2,"int");
4544 if(!lua_isnumber(L,3)) SWIG_fail_arg("cmark_render_commonmark",3,"int");
4545
4546 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4547 SWIG_fail_ptr("render_commonmark",1,SWIGTYPE_p_cmark_node);
4548 }
4549
4550 arg2 = (int)lua_tonumber(L, 2);
4551 arg3 = (int)lua_tonumber(L, 3);
4552 result = (char *)cmark_render_commonmark(arg1,arg2,arg3);
4553 lua_pushstring(L,(const char *)result); SWIG_arg++;
4554 return SWIG_arg;
4555
4556 fail: SWIGUNUSED;
4557 lua_error(L);
4558 return 0;
4559}
4560
4561
4562static int _wrap_render_latex(lua_State* L) {
4563 int SWIG_arg = 0;
4564 cmark_node *arg1 = (cmark_node *) 0 ;
4565 int arg2 ;
4566 int arg3 ;
4567 char *result = 0 ;
4568
4569 SWIG_check_num_args("cmark_render_latex",3,3)
4570 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cmark_render_latex",1,"cmark_node *");
4571 if(!lua_isnumber(L,2)) SWIG_fail_arg("cmark_render_latex",2,"int");
4572 if(!lua_isnumber(L,3)) SWIG_fail_arg("cmark_render_latex",3,"int");
4573
4574 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_cmark_node,0))){
4575 SWIG_fail_ptr("render_latex",1,SWIGTYPE_p_cmark_node);
4576 }
4577
4578 arg2 = (int)lua_tonumber(L, 2);
4579 arg3 = (int)lua_tonumber(L, 3);
4580 result = (char *)cmark_render_latex(arg1,arg2,arg3);
4581 lua_pushstring(L,(const char *)result); SWIG_arg++;
4582 return SWIG_arg;
4583
4584 fail: SWIGUNUSED;
4585 lua_error(L);
4586 return 0;
4587}
4588
4589
4590static int _wrap_version(lua_State* L) {
4591 int SWIG_arg = 0;
4592 int result;
4593
4594 SWIG_check_num_args("cmark_version",0,0)
4595 result = (int)cmark_version();
4596 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
4597 return SWIG_arg;
4598
4599 fail: SWIGUNUSED;
4600 lua_error(L);
4601 return 0;
4602}
4603
4604
4605static int _wrap_version_string(lua_State* L) {
4606 int SWIG_arg = 0;
4607 char *result = 0 ;
4608
4609 SWIG_check_num_args("cmark_version_string",0,0)
4610 result = (char *)cmark_version_string();
4611 lua_pushstring(L,(const char *)result); SWIG_arg++;
4612 return SWIG_arg;
4613
4614 fail: SWIGUNUSED;
4615 lua_error(L);
4616 return 0;
4617}
4618
4619
4620static swig_lua_attribute swig_SwigModule_attributes[] = {
4621 {0,0,0}
4622};
4623static swig_lua_const_info swig_SwigModule_constants[]= {
4624 {SWIG_LUA_CONSTTAB_INT("NODE_NONE", (CMARK_NODE_NONE))},
4625 {SWIG_LUA_CONSTTAB_INT("NODE_DOCUMENT", (CMARK_NODE_DOCUMENT))},
4626 {SWIG_LUA_CONSTTAB_INT("NODE_BLOCK_QUOTE", (CMARK_NODE_BLOCK_QUOTE))},
4627 {SWIG_LUA_CONSTTAB_INT("NODE_LIST", (CMARK_NODE_LIST))},
4628 {SWIG_LUA_CONSTTAB_INT("NODE_ITEM", (CMARK_NODE_ITEM))},
4629 {SWIG_LUA_CONSTTAB_INT("NODE_CODE_BLOCK", (CMARK_NODE_CODE_BLOCK))},
4630 {SWIG_LUA_CONSTTAB_INT("NODE_HTML_BLOCK", (CMARK_NODE_HTML_BLOCK))},
4631 {SWIG_LUA_CONSTTAB_INT("NODE_CUSTOM_BLOCK", (CMARK_NODE_CUSTOM_BLOCK))},
4632 {SWIG_LUA_CONSTTAB_INT("NODE_PARAGRAPH", (CMARK_NODE_PARAGRAPH))},
4633 {SWIG_LUA_CONSTTAB_INT("NODE_HEADING", (CMARK_NODE_HEADING))},
4634 {SWIG_LUA_CONSTTAB_INT("NODE_THEMATIC_BREAK", (CMARK_NODE_THEMATIC_BREAK))},
4635 {SWIG_LUA_CONSTTAB_INT("NODE_FIRST_BLOCK", (CMARK_NODE_FIRST_BLOCK))},
4636 {SWIG_LUA_CONSTTAB_INT("NODE_LAST_BLOCK", (CMARK_NODE_LAST_BLOCK))},
4637 {SWIG_LUA_CONSTTAB_INT("NODE_TEXT", (CMARK_NODE_TEXT))},
4638 {SWIG_LUA_CONSTTAB_INT("NODE_SOFTBREAK", (CMARK_NODE_SOFTBREAK))},
4639 {SWIG_LUA_CONSTTAB_INT("NODE_LINEBREAK", (CMARK_NODE_LINEBREAK))},
4640 {SWIG_LUA_CONSTTAB_INT("NODE_CODE", (CMARK_NODE_CODE))},
4641 {SWIG_LUA_CONSTTAB_INT("NODE_HTML_INLINE", (CMARK_NODE_HTML_INLINE))},
4642 {SWIG_LUA_CONSTTAB_INT("NODE_CUSTOM_INLINE", (CMARK_NODE_CUSTOM_INLINE))},
4643 {SWIG_LUA_CONSTTAB_INT("NODE_EMPH", (CMARK_NODE_EMPH))},
4644 {SWIG_LUA_CONSTTAB_INT("NODE_STRONG", (CMARK_NODE_STRONG))},
4645 {SWIG_LUA_CONSTTAB_INT("NODE_LINK", (CMARK_NODE_LINK))},
4646 {SWIG_LUA_CONSTTAB_INT("NODE_IMAGE", (CMARK_NODE_IMAGE))},
4647 {SWIG_LUA_CONSTTAB_INT("NODE_FIRST_INLINE", (CMARK_NODE_FIRST_INLINE))},
4648 {SWIG_LUA_CONSTTAB_INT("NODE_LAST_INLINE", (CMARK_NODE_LAST_INLINE))},
4649 {SWIG_LUA_CONSTTAB_INT("NO_LIST", (CMARK_NO_LIST))},
4650 {SWIG_LUA_CONSTTAB_INT("BULLET_LIST", (CMARK_BULLET_LIST))},
4651 {SWIG_LUA_CONSTTAB_INT("ORDERED_LIST", (CMARK_ORDERED_LIST))},
4652 {SWIG_LUA_CONSTTAB_INT("NO_DELIM", (CMARK_NO_DELIM))},
4653 {SWIG_LUA_CONSTTAB_INT("PERIOD_DELIM", (CMARK_PERIOD_DELIM))},
4654 {SWIG_LUA_CONSTTAB_INT("PAREN_DELIM", (CMARK_PAREN_DELIM))},
4655 {SWIG_LUA_CONSTTAB_INT("EVENT_NONE", (CMARK_EVENT_NONE))},
4656 {SWIG_LUA_CONSTTAB_INT("EVENT_DONE", (CMARK_EVENT_DONE))},
4657 {SWIG_LUA_CONSTTAB_INT("EVENT_ENTER", (CMARK_EVENT_ENTER))},
4658 {SWIG_LUA_CONSTTAB_INT("EVENT_EXIT", (CMARK_EVENT_EXIT))},
4659 {SWIG_LUA_CONSTTAB_INT("OPT_DEFAULT", (0))},
4660 {SWIG_LUA_CONSTTAB_INT("OPT_SOURCEPOS", ((1 << 1)))},
4661 {SWIG_LUA_CONSTTAB_INT("OPT_HARDBREAKS", ((1 << 2)))},
4662 {SWIG_LUA_CONSTTAB_INT("OPT_SAFE", ((1 << 3)))},
4663 {SWIG_LUA_CONSTTAB_INT("OPT_UNSAFE", ((1 << 17)))},
4664 {SWIG_LUA_CONSTTAB_INT("OPT_NOBREAKS", ((1 << 4)))},
4665 {SWIG_LUA_CONSTTAB_INT("OPT_NORMALIZE", ((1 << 8)))},
4666 {SWIG_LUA_CONSTTAB_INT("OPT_VALIDATE_UTF8", ((1 << 9)))},
4667 {SWIG_LUA_CONSTTAB_INT("OPT_SMART", ((1 << 10)))},
4668 {0,0,0,0,0,0}
4669};
4670static swig_lua_method swig_SwigModule_methods[]= {
4671 { "markdown_to_html", _wrap_markdown_to_html},
4672 { "get_default_mem_allocator", _wrap_get_default_mem_allocator},
4673 { "node_new", _wrap_node_new},
4674 { "node_new_with_mem", _wrap_node_new_with_mem},
4675 { "node_free", _wrap_node_free},
4676 { "node_next", _wrap_node_next},
4677 { "node_previous", _wrap_node_previous},
4678 { "node_parent", _wrap_node_parent},
4679 { "node_first_child", _wrap_node_first_child},
4680 { "node_last_child", _wrap_node_last_child},
4681 { "iter_new", _wrap_iter_new},
4682 { "iter_free", _wrap_iter_free},
4683 { "iter_next", _wrap_iter_next},
4684 { "iter_get_node", _wrap_iter_get_node},
4685 { "iter_get_event_type", _wrap_iter_get_event_type},
4686 { "iter_get_root", _wrap_iter_get_root},
4687 { "iter_reset", _wrap_iter_reset},
4688 { "node_get_user_data", _wrap_node_get_user_data},
4689 { "node_set_user_data", _wrap_node_set_user_data},
4690 { "node_get_type", _wrap_node_get_type},
4691 { "node_get_type_string", _wrap_node_get_type_string},
4692 { "node_get_literal", _wrap_node_get_literal},
4693 { "node_set_literal", _wrap_node_set_literal},
4694 { "node_get_heading_level", _wrap_node_get_heading_level},
4695 { "node_set_heading_level", _wrap_node_set_heading_level},
4696 { "node_get_list_type", _wrap_node_get_list_type},
4697 { "node_set_list_type", _wrap_node_set_list_type},
4698 { "node_get_list_delim", _wrap_node_get_list_delim},
4699 { "node_set_list_delim", _wrap_node_set_list_delim},
4700 { "node_get_list_start", _wrap_node_get_list_start},
4701 { "node_set_list_start", _wrap_node_set_list_start},
4702 { "node_get_list_tight", _wrap_node_get_list_tight},
4703 { "node_set_list_tight", _wrap_node_set_list_tight},
4704 { "node_get_fence_info", _wrap_node_get_fence_info},
4705 { "node_set_fence_info", _wrap_node_set_fence_info},
4706 { "node_get_url", _wrap_node_get_url},
4707 { "node_set_url", _wrap_node_set_url},
4708 { "node_get_title", _wrap_node_get_title},
4709 { "node_set_title", _wrap_node_set_title},
4710 { "node_get_on_enter", _wrap_node_get_on_enter},
4711 { "node_set_on_enter", _wrap_node_set_on_enter},
4712 { "node_get_on_exit", _wrap_node_get_on_exit},
4713 { "node_set_on_exit", _wrap_node_set_on_exit},
4714 { "node_get_start_line", _wrap_node_get_start_line},
4715 { "node_get_start_column", _wrap_node_get_start_column},
4716 { "node_get_end_line", _wrap_node_get_end_line},
4717 { "node_get_end_column", _wrap_node_get_end_column},
4718 { "node_unlink", _wrap_node_unlink},
4719 { "node_insert_before", _wrap_node_insert_before},
4720 { "node_insert_after", _wrap_node_insert_after},
4721 { "node_replace", _wrap_node_replace},
4722 { "node_prepend_child", _wrap_node_prepend_child},
4723 { "node_append_child", _wrap_node_append_child},
4724 { "consolidate_text_nodes", _wrap_consolidate_text_nodes},
4725 { "parser_new", _wrap_parser_new},
4726 { "parser_new_with_mem", _wrap_parser_new_with_mem},
4727 { "parser_new_with_mem_into_root", _wrap_parser_new_with_mem_into_root},
4728 { "parser_free", _wrap_parser_free},
4729 { "parser_feed", _wrap_parser_feed},
4730 { "parser_finish", _wrap_parser_finish},
4731 { "parse_document", _wrap_parse_document},
4732 { "parse_file", _wrap_parse_file},
4733 { "render_xml", _wrap_render_xml},
4734 { "render_html", _wrap_render_html},
4735 { "render_man", _wrap_render_man},
4736 { "render_commonmark", _wrap_render_commonmark},
4737 { "render_latex", _wrap_render_latex},
4738 { "version", _wrap_version},
4739 { "version_string", _wrap_version_string},
4740 {0,0}
4741};
4742static swig_lua_class* swig_SwigModule_classes[]= {
4743&_wrap_class_mem,
4744 0
4745};
4746static swig_lua_namespace* swig_SwigModule_namespaces[] = {
4747 0
4748};
4749
4750static swig_lua_namespace swig_SwigModule = {
4751 "cmark",
4752 swig_SwigModule_methods,
4753 swig_SwigModule_attributes,
4754 swig_SwigModule_constants,
4755 swig_SwigModule_classes,
4756 swig_SwigModule_namespaces
4757};
4758#ifdef __cplusplus
4759}
4760#endif
4761
4762/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4763
4764static swig_type_info _swigt__p_FILE = {"_p_FILE", "FILE *", 0, 0, (void*)0, 0};
4765static swig_type_info _swigt__p_cmark_delim_type = {"_p_cmark_delim_type", "cmark_delim_type *|enum cmark_delim_type *", 0, 0, (void*)0, 0};
4766static swig_type_info _swigt__p_cmark_event_type = {"_p_cmark_event_type", "cmark_event_type *|enum cmark_event_type *", 0, 0, (void*)0, 0};
4767static swig_type_info _swigt__p_cmark_iter = {"_p_cmark_iter", "cmark_iter *|struct cmark_iter *", 0, 0, (void*)0, 0};
4768static swig_type_info _swigt__p_cmark_list_type = {"_p_cmark_list_type", "cmark_list_type *|enum cmark_list_type *", 0, 0, (void*)0, 0};
4769static swig_type_info _swigt__p_cmark_mem = {"_p_cmark_mem", "cmark_mem *|struct cmark_mem *", 0, 0, (void*)&_wrap_class_mem, 0};
4770static swig_type_info _swigt__p_cmark_node = {"_p_cmark_node", "cmark_node *|struct cmark_node *", 0, 0, (void*)0, 0};
4771static swig_type_info _swigt__p_cmark_node_type = {"_p_cmark_node_type", "cmark_node_type *|enum cmark_node_type *", 0, 0, (void*)0, 0};
4772static swig_type_info _swigt__p_cmark_parser = {"_p_cmark_parser", "cmark_parser *|struct cmark_parser *", 0, 0, (void*)0, 0};
4773static swig_type_info _swigt__p_f_p_void__void = {"_p_f_p_void__void", "void (*)(void *)", 0, 0, (void*)0, 0};
4774static swig_type_info _swigt__p_f_p_void_size_t__p_void = {"_p_f_p_void_size_t__p_void", "void *(*)(void *,size_t)", 0, 0, (void*)0, 0};
4775static swig_type_info _swigt__p_f_size_t_size_t__p_void = {"_p_f_size_t_size_t__p_void", "void *(*)(size_t,size_t)", 0, 0, (void*)0, 0};
4776static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
4777
4778static swig_type_info *swig_type_initial[] = {
4779 &_swigt__p_FILE,
4780 &_swigt__p_cmark_delim_type,
4781 &_swigt__p_cmark_event_type,
4782 &_swigt__p_cmark_iter,
4783 &_swigt__p_cmark_list_type,
4784 &_swigt__p_cmark_mem,
4785 &_swigt__p_cmark_node,
4786 &_swigt__p_cmark_node_type,
4787 &_swigt__p_cmark_parser,
4788 &_swigt__p_f_p_void__void,
4789 &_swigt__p_f_p_void_size_t__p_void,
4790 &_swigt__p_f_size_t_size_t__p_void,
4791 &_swigt__p_void,
4792};
4793
4794static swig_cast_info _swigc__p_FILE[] = { {&_swigt__p_FILE, 0, 0, 0},{0, 0, 0, 0}};
4795static swig_cast_info _swigc__p_cmark_delim_type[] = { {&_swigt__p_cmark_delim_type, 0, 0, 0},{0, 0, 0, 0}};
4796static swig_cast_info _swigc__p_cmark_event_type[] = { {&_swigt__p_cmark_event_type, 0, 0, 0},{0, 0, 0, 0}};
4797static swig_cast_info _swigc__p_cmark_iter[] = { {&_swigt__p_cmark_iter, 0, 0, 0},{0, 0, 0, 0}};
4798static swig_cast_info _swigc__p_cmark_list_type[] = { {&_swigt__p_cmark_list_type, 0, 0, 0},{0, 0, 0, 0}};
4799static swig_cast_info _swigc__p_cmark_mem[] = { {&_swigt__p_cmark_mem, 0, 0, 0},{0, 0, 0, 0}};
4800static swig_cast_info _swigc__p_cmark_node[] = { {&_swigt__p_cmark_node, 0, 0, 0},{0, 0, 0, 0}};
4801static swig_cast_info _swigc__p_cmark_node_type[] = { {&_swigt__p_cmark_node_type, 0, 0, 0},{0, 0, 0, 0}};
4802static swig_cast_info _swigc__p_cmark_parser[] = { {&_swigt__p_cmark_parser, 0, 0, 0},{0, 0, 0, 0}};
4803static swig_cast_info _swigc__p_f_p_void__void[] = { {&_swigt__p_f_p_void__void, 0, 0, 0},{0, 0, 0, 0}};
4804static swig_cast_info _swigc__p_f_p_void_size_t__p_void[] = { {&_swigt__p_f_p_void_size_t__p_void, 0, 0, 0},{0, 0, 0, 0}};
4805static swig_cast_info _swigc__p_f_size_t_size_t__p_void[] = { {&_swigt__p_f_size_t_size_t__p_void, 0, 0, 0},{0, 0, 0, 0}};
4806static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
4807
4808static swig_cast_info *swig_cast_initial[] = {
4809 _swigc__p_FILE,
4810 _swigc__p_cmark_delim_type,
4811 _swigc__p_cmark_event_type,
4812 _swigc__p_cmark_iter,
4813 _swigc__p_cmark_list_type,
4814 _swigc__p_cmark_mem,
4815 _swigc__p_cmark_node,
4816 _swigc__p_cmark_node_type,
4817 _swigc__p_cmark_parser,
4818 _swigc__p_f_p_void__void,
4819 _swigc__p_f_p_void_size_t__p_void,
4820 _swigc__p_f_size_t_size_t__p_void,
4821 _swigc__p_void,
4822};
4823
4824
4825/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
4826
4827/* -----------------------------------------------------------------------------
4828 * Type initialization:
4829 * This problem is tough by the requirement that no dynamic
4830 * memory is used. Also, since swig_type_info structures store pointers to
4831 * swig_cast_info structures and swig_cast_info structures store pointers back
4832 * to swig_type_info structures, we need some lookup code at initialization.
4833 * The idea is that swig generates all the structures that are needed.
4834 * The runtime then collects these partially filled structures.
4835 * The SWIG_InitializeModule function takes these initial arrays out of
4836 * swig_module, and does all the lookup, filling in the swig_module.types
4837 * array with the correct data and linking the correct swig_cast_info
4838 * structures together.
4839 *
4840 * The generated swig_type_info structures are assigned statically to an initial
4841 * array. We just loop through that array, and handle each type individually.
4842 * First we lookup if this type has been already loaded, and if so, use the
4843 * loaded structure instead of the generated one. Then we have to fill in the
4844 * cast linked list. The cast data is initially stored in something like a
4845 * two-dimensional array. Each row corresponds to a type (there are the same
4846 * number of rows as there are in the swig_type_initial array). Each entry in
4847 * a column is one of the swig_cast_info structures for that type.
4848 * The cast_initial array is actually an array of arrays, because each row has
4849 * a variable number of columns. So to actually build the cast linked list,
4850 * we find the array of casts associated with the type, and loop through it
4851 * adding the casts to the list. The one last trick we need to do is making
4852 * sure the type pointer in the swig_cast_info struct is correct.
4853 *
4854 * First off, we lookup the cast->type name to see if it is already loaded.
4855 * There are three cases to handle:
4856 * 1) If the cast->type has already been loaded AND the type we are adding
4857 * casting info to has not been loaded (it is in this module), THEN we
4858 * replace the cast->type pointer with the type pointer that has already
4859 * been loaded.
4860 * 2) If BOTH types (the one we are adding casting info to, and the
4861 * cast->type) are loaded, THEN the cast info has already been loaded by
4862 * the previous module so we just ignore it.
4863 * 3) Finally, if cast->type has not already been loaded, then we add that
4864 * swig_cast_info to the linked list (because the cast->type) pointer will
4865 * be correct.
4866 * ----------------------------------------------------------------------------- */
4867
4868#ifdef __cplusplus
4869extern "C" {
4870#if 0
4871} /* c-mode */
4872#endif
4873#endif
4874
4875#if 0
4876#define SWIGRUNTIME_DEBUG
4877#endif
4878
4879#ifndef SWIG_INIT_CLIENT_DATA_TYPE
4880#define SWIG_INIT_CLIENT_DATA_TYPE void *
4881#endif
4882
4883SWIGRUNTIME void
4884SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) {
4885 size_t i;
4886 swig_module_info *module_head, *iter;
4887 int init;
4888
4889 /* check to see if the circular list has been setup, if not, set it up */
4890 if (swig_module.next==0) {
4891 /* Initialize the swig_module */
4892 swig_module.type_initial = swig_type_initial;
4893 swig_module.cast_initial = swig_cast_initial;
4894 swig_module.next = &swig_module;
4895 init = 1;
4896 } else {
4897 init = 0;
4898 }
4899
4900 /* Try and load any already created modules */
4901 module_head = SWIG_GetModule(clientdata);
4902 if (!module_head) {
4903 /* This is the first module loaded for this interpreter */
4904 /* so set the swig module into the interpreter */
4905 SWIG_SetModule(clientdata, &swig_module);
4906 } else {
4907 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
4908 iter=module_head;
4909 do {
4910 if (iter==&swig_module) {
4911 /* Our module is already in the list, so there's nothing more to do. */
4912 return;
4913 }
4914 iter=iter->next;
4915 } while (iter!= module_head);
4916
4917 /* otherwise we must add our module into the list */
4918 swig_module.next = module_head->next;
4919 module_head->next = &swig_module;
4920 }
4921
4922 /* When multiple interpreters are used, a module could have already been initialized in
4923 a different interpreter, but not yet have a pointer in this interpreter.
4924 In this case, we do not want to continue adding types... everything should be
4925 set up already */
4926 if (init == 0) return;
4927
4928 /* Now work on filling in swig_module.types */
4929#ifdef SWIGRUNTIME_DEBUG
4930 printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
4931#endif
4932 for (i = 0; i < swig_module.size; ++i) {
4933 swig_type_info *type = 0;
4934 swig_type_info *ret;
4935 swig_cast_info *cast;
4936
4937#ifdef SWIGRUNTIME_DEBUG
4938 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
4939#endif
4940
4941 /* if there is another module already loaded */
4942 if (swig_module.next != &swig_module) {
4943 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
4944 }
4945 if (type) {
4946 /* Overwrite clientdata field */
4947#ifdef SWIGRUNTIME_DEBUG
4948 printf("SWIG_InitializeModule: found type %s\n", type->name);
4949#endif
4950 if (swig_module.type_initial[i]->clientdata) {
4951 type->clientdata = swig_module.type_initial[i]->clientdata;
4952#ifdef SWIGRUNTIME_DEBUG
4953 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
4954#endif
4955 }
4956 } else {
4957 type = swig_module.type_initial[i];
4958 }
4959
4960 /* Insert casting types */
4961 cast = swig_module.cast_initial[i];
4962 while (cast->type) {
4963
4964 /* Don't need to add information already in the list */
4965 ret = 0;
4966#ifdef SWIGRUNTIME_DEBUG
4967 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
4968#endif
4969 if (swig_module.next != &swig_module) {
4970 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
4971#ifdef SWIGRUNTIME_DEBUG
4972 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
4973#endif
4974 }
4975 if (ret) {
4976 if (type == swig_module.type_initial[i]) {
4977#ifdef SWIGRUNTIME_DEBUG
4978 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
4979#endif
4980 cast->type = ret;
4981 ret = 0;
4982 } else {
4983 /* Check for casting already in the list */
4984 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
4985#ifdef SWIGRUNTIME_DEBUG
4986 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
4987#endif
4988 if (!ocast) ret = 0;
4989 }
4990 }
4991
4992 if (!ret) {
4993#ifdef SWIGRUNTIME_DEBUG
4994 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
4995#endif
4996 if (type->cast) {
4997 type->cast->prev = cast;
4998 cast->next = type->cast;
4999 }
5000 type->cast = cast;
5001 }
5002 cast++;
5003 }
5004 /* Set entry in modules->types array equal to the type */
5005 swig_module.types[i] = type;
5006 }
5007 swig_module.types[i] = 0;
5008
5009#ifdef SWIGRUNTIME_DEBUG
5010 printf("**** SWIG_InitializeModule: Cast List ******\n");
5011 for (i = 0; i < swig_module.size; ++i) {
5012 int j = 0;
5013 swig_cast_info *cast = swig_module.cast_initial[i];
5014 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
5015 while (cast->type) {
5016 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
5017 cast++;
5018 ++j;
5019 }
5020 printf("---- Total casts: %d\n",j);
5021 }
5022 printf("**** SWIG_InitializeModule: Cast List ******\n");
5023#endif
5024}
5025
5026/* This function will propagate the clientdata field of type to
5027* any new swig_type_info structures that have been added into the list
5028* of equivalent types. It is like calling
5029* SWIG_TypeClientData(type, clientdata) a second time.
5030*/
5031SWIGRUNTIME void
5032SWIG_PropagateClientData(void) {
5033 size_t i;
5034 swig_cast_info *equiv;
5035 static int init_run = 0;
5036
5037 if (init_run) return;
5038 init_run = 1;
5039
5040 for (i = 0; i < swig_module.size; i++) {
5041 if (swig_module.types[i]->clientdata) {
5042 equiv = swig_module.types[i]->cast;
5043 while (equiv) {
5044 if (!equiv->converter) {
5045 if (equiv->type && !equiv->type->clientdata)
5046 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
5047 }
5048 equiv = equiv->next;
5049 }
5050 }
5051 }
5052}
5053
5054#ifdef __cplusplus
5055#if 0
5056{ /* c-mode */
5057#endif
5058}
5059#endif
5060
5061
5062
5063/* Forward declaration of where the user's %init{} gets inserted */
5064void SWIG_init_user(lua_State* L );
5065
5066#ifdef __cplusplus
5067extern "C" {
5068#endif
5069/* this is the initialization function
5070 added at the very end of the code
5071 the function is always called SWIG_init, but an earlier #define will rename it
5072*/
5073#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
5074LUALIB_API int SWIG_init(lua_State* L)
5075#else
5076SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
5077#endif
5078{
5079#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
5080 int i;
5081 int globalRegister = 0;
5082 /* start with global table */
5083 lua_pushglobaltable (L);
5084 /* SWIG's internal initialisation */
5085 SWIG_InitializeModule((void*)L);
5086 SWIG_PropagateClientData();
5087#endif
5088
5089#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE)
5090 /* add a global fn */
5091 SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
5092 SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_class_equal);
5093#endif
5094
5095#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
5096 /* set up base class pointers (the hierarchy) */
5097 for (i = 0; swig_types[i]; i++){
5098 if (swig_types[i]->clientdata){
5099 SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
5100 }
5101 }
5102#ifdef SWIG_LUA_MODULE_GLOBAL
5103 globalRegister = 1;
5104#endif
5105
5106
5107#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
5108 SWIG_Lua_namespace_register(L,&swig_SwigModule, globalRegister);
5109#endif
5110
5111#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
5112 for (i = 0; swig_types[i]; i++){
5113 if (swig_types[i]->clientdata){
5114 SWIG_Lua_elua_class_register_instance(L,(swig_lua_class*)(swig_types[i]->clientdata));
5115 }
5116 }
5117#endif
5118
5119#if defined(SWIG_LUA_ELUA_EMULATE)
5120 lua_newtable(L);
5121 SWIG_Lua_elua_emulate_register(L,swig_SwigModule.ns_methods);
5122 SWIG_Lua_elua_emulate_register_clear(L);
5123 if(globalRegister) {
5124 lua_pushstring(L,swig_SwigModule.name);
5125 lua_pushvalue(L,-2);
5126 lua_rawset(L,-4);
5127 }
5128#endif
5129
5130#endif
5131
5132#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
5133 /* invoke user-specific initialization */
5134 SWIG_init_user(L);
5135 /* end module */
5136 /* Note: We do not clean up the stack here (Lua will do this for us). At this
5137 point, we have the globals table and out module table on the stack. Returning
5138 one value makes the module table the result of the require command. */
5139 return 1;
5140#else
5141 return 0;
5142#endif
5143}
5144
5145#ifdef __cplusplus
5146}
5147#endif
5148
5149
5150const char* SWIG_LUACODE=
5151 "\n"
5152 "\n"
5153 "function cmark.parse_string(s, opts)\n"
5154 " return cmark.parse_document(s, string.len(s), opts)\n"
5155 "end\n"
5156 "\n"
5157 "function cmark.walk(node)\n"
5158 " local iter = cmark.iter_new(node)\n"
5159 " return function()\n"
5160 " while true do\n"
5161 " local et = cmark.iter_next(iter)\n"
5162 " if et == cmark.EVENT_DONE then break end\n"
5163 " local cur = cmark.iter_get_node(iter)\n"
5164 " return cur, (et == cmark.EVENT_ENTER), cmark.node_get_type(cur)\n"
5165 " end\n"
5166 " cmark.iter_free(iter)\n"
5167 " return nil\n"
5168 " end\n"
5169 "end";
5170
5171void SWIG_init_user(lua_State* L)
5172{
5173 /* exec Lua code if applicable */
5174 SWIG_Lua_dostring(L,SWIG_LUACODE);
5175}
static const double c[]
Definition rng.c:256
static const double d[]
Definition rng.c:263