xmlsec-ruby 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/xmlsec/simple-xmlsec.c +13 -8
- data/ext/xmlsec/simple-xmlsec_wrap.c +440 -123
- metadata +3 -3
data/ext/xmlsec/simple-xmlsec.c
CHANGED
@@ -18,6 +18,8 @@
|
|
18
18
|
int initialize() ;
|
19
19
|
void SecShutdown() ;
|
20
20
|
void cleanup(xmlSecDSigCtxPtr dsigCtx) ;
|
21
|
+
int verify_document(xmlDocPtr doc, const char* key);
|
22
|
+
int verify_file(const char* xmlMessage, const char* key);
|
21
23
|
void xmlSecErrorCallback(const char* file, int line, const char* func, const char* errorObject, const char* errorSubject, int reason, const char* msg);
|
22
24
|
static int
|
23
25
|
xmlSecAppAddIDAttr(xmlNodePtr node, const xmlChar* attrName, const xmlChar* nodeName, const xmlChar* nsHref) {
|
@@ -80,12 +82,20 @@ xmlSecAppAddIDAttr(xmlNodePtr node, const xmlChar* attrName, const xmlChar* node
|
|
80
82
|
/* functions */
|
81
83
|
int verify_file(const char* xmlMessage, const char* key) {
|
82
84
|
xmlDocPtr doc = NULL;
|
85
|
+
/* Init libxml and libxslt libraries */
|
86
|
+
xmlInitParser();
|
87
|
+
LIBXML_TEST_VERSION
|
88
|
+
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
89
|
+
xmlSubstituteEntitiesDefault(1);
|
90
|
+
doc = xmlParseDoc((xmlChar *) xmlMessage) ;
|
91
|
+
return verify_document(doc, key);
|
92
|
+
}
|
93
|
+
|
94
|
+
int verify_document(xmlDocPtr doc, const char* key) {
|
95
|
+
initialize();
|
83
96
|
xmlNodePtr node = NULL;
|
84
97
|
xmlSecDSigCtxPtr dsigCtx = NULL;
|
85
98
|
int res = 0;
|
86
|
-
initialize();
|
87
|
-
|
88
|
-
doc = xmlParseDoc((xmlChar *) xmlMessage) ;
|
89
99
|
|
90
100
|
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
91
101
|
cleanup(dsigCtx);
|
@@ -147,11 +157,6 @@ void cleanup(xmlSecDSigCtxPtr dsigCtx) {
|
|
147
157
|
|
148
158
|
int initialize()
|
149
159
|
{
|
150
|
-
/* Init libxml and libxslt libraries */
|
151
|
-
xmlInitParser();
|
152
|
-
LIBXML_TEST_VERSION
|
153
|
-
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
154
|
-
xmlSubstituteEntitiesDefault(1);
|
155
160
|
|
156
161
|
/* Init xmlsec library */
|
157
162
|
if(xmlSecInit() < 0) {
|
@@ -17,14 +17,14 @@
|
|
17
17
|
|
18
18
|
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
19
19
|
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
20
|
-
# if defined(__SUNPRO_CC)
|
21
|
-
#
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
#
|
20
|
+
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
21
|
+
# define SWIGTEMPLATEDISAMBIGUATOR template
|
22
|
+
# elif defined(__HP_aCC)
|
23
|
+
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
24
|
+
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
25
|
+
# define SWIGTEMPLATEDISAMBIGUATOR template
|
26
26
|
# else
|
27
|
-
#
|
27
|
+
# define SWIGTEMPLATEDISAMBIGUATOR
|
28
28
|
# endif
|
29
29
|
#endif
|
30
30
|
|
@@ -52,6 +52,12 @@
|
|
52
52
|
# endif
|
53
53
|
#endif
|
54
54
|
|
55
|
+
#ifndef SWIG_MSC_UNSUPPRESS_4505
|
56
|
+
# if defined(_MSC_VER)
|
57
|
+
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
|
58
|
+
# endif
|
59
|
+
#endif
|
60
|
+
|
55
61
|
#ifndef SWIGUNUSEDPARM
|
56
62
|
# ifdef __cplusplus
|
57
63
|
# define SWIGUNUSEDPARM(p)
|
@@ -107,6 +113,12 @@
|
|
107
113
|
# define _CRT_SECURE_NO_DEPRECATE
|
108
114
|
#endif
|
109
115
|
|
116
|
+
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
117
|
+
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
118
|
+
# define _SCL_SECURE_NO_DEPRECATE
|
119
|
+
#endif
|
120
|
+
|
121
|
+
|
110
122
|
/* -----------------------------------------------------------------------------
|
111
123
|
* This section contains generic SWIG labels for method/variable
|
112
124
|
* declarations/attributes, and other compiler dependent labels.
|
@@ -114,14 +126,14 @@
|
|
114
126
|
|
115
127
|
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
116
128
|
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
117
|
-
# if defined(__SUNPRO_CC)
|
118
|
-
#
|
119
|
-
#
|
120
|
-
|
121
|
-
|
122
|
-
#
|
129
|
+
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
130
|
+
# define SWIGTEMPLATEDISAMBIGUATOR template
|
131
|
+
# elif defined(__HP_aCC)
|
132
|
+
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
133
|
+
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
134
|
+
# define SWIGTEMPLATEDISAMBIGUATOR template
|
123
135
|
# else
|
124
|
-
#
|
136
|
+
# define SWIGTEMPLATEDISAMBIGUATOR
|
125
137
|
# endif
|
126
138
|
#endif
|
127
139
|
|
@@ -149,6 +161,12 @@
|
|
149
161
|
# endif
|
150
162
|
#endif
|
151
163
|
|
164
|
+
#ifndef SWIG_MSC_UNSUPPRESS_4505
|
165
|
+
# if defined(_MSC_VER)
|
166
|
+
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
|
167
|
+
# endif
|
168
|
+
#endif
|
169
|
+
|
152
170
|
#ifndef SWIGUNUSEDPARM
|
153
171
|
# ifdef __cplusplus
|
154
172
|
# define SWIGUNUSEDPARM(p)
|
@@ -204,16 +222,22 @@
|
|
204
222
|
# define _CRT_SECURE_NO_DEPRECATE
|
205
223
|
#endif
|
206
224
|
|
225
|
+
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
226
|
+
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
227
|
+
# define _SCL_SECURE_NO_DEPRECATE
|
228
|
+
#endif
|
229
|
+
|
230
|
+
|
207
231
|
/* -----------------------------------------------------------------------------
|
208
232
|
* swigrun.swg
|
209
233
|
*
|
210
|
-
* This file contains generic
|
234
|
+
* This file contains generic C API SWIG runtime support for pointer
|
211
235
|
* type checking.
|
212
236
|
* ----------------------------------------------------------------------------- */
|
213
237
|
|
214
238
|
/* This should only be incremented when either the layout of swig_type_info changes,
|
215
239
|
or for whatever reason, the runtime changes incompatibly */
|
216
|
-
#define SWIG_RUNTIME_VERSION "
|
240
|
+
#define SWIG_RUNTIME_VERSION "4"
|
217
241
|
|
218
242
|
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
|
219
243
|
#ifdef SWIG_TYPE_TABLE
|
@@ -226,11 +250,11 @@
|
|
226
250
|
|
227
251
|
/*
|
228
252
|
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
|
229
|
-
creating a static or dynamic library from the
|
230
|
-
In 99.9% of the cases,
|
253
|
+
creating a static or dynamic library from the SWIG runtime code.
|
254
|
+
In 99.9% of the cases, SWIG just needs to declare them as 'static'.
|
231
255
|
|
232
|
-
But only do this if
|
233
|
-
with your compiler or
|
256
|
+
But only do this if strictly necessary, ie, if you have problems
|
257
|
+
with your compiler or suchlike.
|
234
258
|
*/
|
235
259
|
|
236
260
|
#ifndef SWIGRUNTIME
|
@@ -248,6 +272,7 @@
|
|
248
272
|
|
249
273
|
/* Flags for pointer conversions */
|
250
274
|
#define SWIG_POINTER_DISOWN 0x1
|
275
|
+
#define SWIG_CAST_NEW_MEMORY 0x2
|
251
276
|
|
252
277
|
/* Flags for new pointer objects */
|
253
278
|
#define SWIG_POINTER_OWN 0x1
|
@@ -256,14 +281,14 @@
|
|
256
281
|
/*
|
257
282
|
Flags/methods for returning states.
|
258
283
|
|
259
|
-
The
|
284
|
+
The SWIG conversion methods, as ConvertPtr, return and integer
|
260
285
|
that tells if the conversion was successful or not. And if not,
|
261
286
|
an error code can be returned (see swigerrors.swg for the codes).
|
262
287
|
|
263
288
|
Use the following macros/flags to set or process the returning
|
264
289
|
states.
|
265
290
|
|
266
|
-
In old
|
291
|
+
In old versions of SWIG, code such as the following was usually written:
|
267
292
|
|
268
293
|
if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
|
269
294
|
// success code
|
@@ -271,7 +296,7 @@
|
|
271
296
|
//fail code
|
272
297
|
}
|
273
298
|
|
274
|
-
Now you can be more explicit
|
299
|
+
Now you can be more explicit:
|
275
300
|
|
276
301
|
int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
|
277
302
|
if (SWIG_IsOK(res)) {
|
@@ -280,7 +305,7 @@
|
|
280
305
|
// fail code
|
281
306
|
}
|
282
307
|
|
283
|
-
|
308
|
+
which is the same really, but now you can also do
|
284
309
|
|
285
310
|
Type *ptr;
|
286
311
|
int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
|
@@ -298,7 +323,7 @@
|
|
298
323
|
|
299
324
|
I.e., now SWIG_ConvertPtr can return new objects and you can
|
300
325
|
identify the case and take care of the deallocation. Of course that
|
301
|
-
|
326
|
+
also requires SWIG_ConvertPtr to return new result values, such as
|
302
327
|
|
303
328
|
int SWIG_ConvertPtr(obj, ptr,...) {
|
304
329
|
if (<obj is ok>) {
|
@@ -316,7 +341,7 @@
|
|
316
341
|
|
317
342
|
Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
|
318
343
|
more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
|
319
|
-
|
344
|
+
SWIG errors code.
|
320
345
|
|
321
346
|
Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
|
322
347
|
allows to return the 'cast rank', for example, if you have this
|
@@ -330,9 +355,8 @@
|
|
330
355
|
fooi(1) // cast rank '0'
|
331
356
|
|
332
357
|
just use the SWIG_AddCast()/SWIG_CheckState()
|
358
|
+
*/
|
333
359
|
|
334
|
-
|
335
|
-
*/
|
336
360
|
#define SWIG_OK (0)
|
337
361
|
#define SWIG_ERROR (-1)
|
338
362
|
#define SWIG_IsOK(r) (r >= 0)
|
@@ -357,7 +381,6 @@
|
|
357
381
|
#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
|
358
382
|
#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
|
359
383
|
|
360
|
-
|
361
384
|
/* Cast-Rank Mode */
|
362
385
|
#if defined(SWIG_CASTRANK_MODE)
|
363
386
|
# ifndef SWIG_TypeRank
|
@@ -380,18 +403,16 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
|
|
380
403
|
#endif
|
381
404
|
|
382
405
|
|
383
|
-
|
384
|
-
|
385
406
|
#include <string.h>
|
386
407
|
|
387
408
|
#ifdef __cplusplus
|
388
409
|
extern "C" {
|
389
410
|
#endif
|
390
411
|
|
391
|
-
typedef void *(*swig_converter_func)(void *);
|
412
|
+
typedef void *(*swig_converter_func)(void *, int *);
|
392
413
|
typedef struct swig_type_info *(*swig_dycast_func)(void **);
|
393
414
|
|
394
|
-
/* Structure to store
|
415
|
+
/* Structure to store information on one type */
|
395
416
|
typedef struct swig_type_info {
|
396
417
|
const char *name; /* mangled name of this type */
|
397
418
|
const char *str; /* human readable name of this type */
|
@@ -436,7 +457,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
|
|
436
457
|
while ((*f2 == ' ') && (f2 != l2)) ++f2;
|
437
458
|
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
|
438
459
|
}
|
439
|
-
return (l1 - f1) - (l2 - f2);
|
460
|
+
return (int)((l1 - f1) - (l2 - f2));
|
440
461
|
}
|
441
462
|
|
442
463
|
/*
|
@@ -478,48 +499,66 @@ SWIG_TypeCompare(const char *nb, const char *tb) {
|
|
478
499
|
}
|
479
500
|
|
480
501
|
|
481
|
-
/* think of this as a c++ template<> or a scheme macro */
|
482
|
-
#define SWIG_TypeCheck_Template(comparison, ty) \
|
483
|
-
if (ty) { \
|
484
|
-
swig_cast_info *iter = ty->cast; \
|
485
|
-
while (iter) { \
|
486
|
-
if (comparison) { \
|
487
|
-
if (iter == ty->cast) return iter; \
|
488
|
-
/* Move iter to the top of the linked list */ \
|
489
|
-
iter->prev->next = iter->next; \
|
490
|
-
if (iter->next) \
|
491
|
-
iter->next->prev = iter->prev; \
|
492
|
-
iter->next = ty->cast; \
|
493
|
-
iter->prev = 0; \
|
494
|
-
if (ty->cast) ty->cast->prev = iter; \
|
495
|
-
ty->cast = iter; \
|
496
|
-
return iter; \
|
497
|
-
} \
|
498
|
-
iter = iter->next; \
|
499
|
-
} \
|
500
|
-
} \
|
501
|
-
return 0
|
502
|
-
|
503
502
|
/*
|
504
503
|
Check the typename
|
505
504
|
*/
|
506
505
|
SWIGRUNTIME swig_cast_info *
|
507
506
|
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
|
508
|
-
|
507
|
+
if (ty) {
|
508
|
+
swig_cast_info *iter = ty->cast;
|
509
|
+
while (iter) {
|
510
|
+
if (strcmp(iter->type->name, c) == 0) {
|
511
|
+
if (iter == ty->cast)
|
512
|
+
return iter;
|
513
|
+
/* Move iter to the top of the linked list */
|
514
|
+
iter->prev->next = iter->next;
|
515
|
+
if (iter->next)
|
516
|
+
iter->next->prev = iter->prev;
|
517
|
+
iter->next = ty->cast;
|
518
|
+
iter->prev = 0;
|
519
|
+
if (ty->cast) ty->cast->prev = iter;
|
520
|
+
ty->cast = iter;
|
521
|
+
return iter;
|
522
|
+
}
|
523
|
+
iter = iter->next;
|
524
|
+
}
|
525
|
+
}
|
526
|
+
return 0;
|
509
527
|
}
|
510
528
|
|
511
|
-
/*
|
529
|
+
/*
|
530
|
+
Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
|
531
|
+
*/
|
512
532
|
SWIGRUNTIME swig_cast_info *
|
513
|
-
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *
|
514
|
-
|
533
|
+
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
|
534
|
+
if (ty) {
|
535
|
+
swig_cast_info *iter = ty->cast;
|
536
|
+
while (iter) {
|
537
|
+
if (iter->type == from) {
|
538
|
+
if (iter == ty->cast)
|
539
|
+
return iter;
|
540
|
+
/* Move iter to the top of the linked list */
|
541
|
+
iter->prev->next = iter->next;
|
542
|
+
if (iter->next)
|
543
|
+
iter->next->prev = iter->prev;
|
544
|
+
iter->next = ty->cast;
|
545
|
+
iter->prev = 0;
|
546
|
+
if (ty->cast) ty->cast->prev = iter;
|
547
|
+
ty->cast = iter;
|
548
|
+
return iter;
|
549
|
+
}
|
550
|
+
iter = iter->next;
|
551
|
+
}
|
552
|
+
}
|
553
|
+
return 0;
|
515
554
|
}
|
516
555
|
|
517
556
|
/*
|
518
557
|
Cast a pointer up an inheritance hierarchy
|
519
558
|
*/
|
520
559
|
SWIGRUNTIMEINLINE void *
|
521
|
-
SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
|
522
|
-
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
|
560
|
+
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
|
561
|
+
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
|
523
562
|
}
|
524
563
|
|
525
564
|
/*
|
@@ -792,6 +831,33 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|
792
831
|
|
793
832
|
#include <ruby.h>
|
794
833
|
|
834
|
+
/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
|
835
|
+
* breaks using rb_intern as an lvalue, as SWIG does. We work around this
|
836
|
+
* issue for now by disabling this.
|
837
|
+
* https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
|
838
|
+
*/
|
839
|
+
#ifdef rb_intern
|
840
|
+
# undef rb_intern
|
841
|
+
#endif
|
842
|
+
|
843
|
+
/* Remove global macros defined in Ruby's win32.h */
|
844
|
+
#ifdef write
|
845
|
+
# undef write
|
846
|
+
#endif
|
847
|
+
#ifdef read
|
848
|
+
# undef read
|
849
|
+
#endif
|
850
|
+
#ifdef bind
|
851
|
+
# undef bind
|
852
|
+
#endif
|
853
|
+
#ifdef close
|
854
|
+
# undef close
|
855
|
+
#endif
|
856
|
+
#ifdef connect
|
857
|
+
# undef connect
|
858
|
+
#endif
|
859
|
+
|
860
|
+
|
795
861
|
/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
|
796
862
|
#ifndef NUM2LL
|
797
863
|
#define NUM2LL(x) NUM2LONG((x))
|
@@ -820,12 +886,44 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|
820
886
|
#ifndef RSTRING_PTR
|
821
887
|
# define RSTRING_PTR(x) RSTRING(x)->ptr
|
822
888
|
#endif
|
889
|
+
#ifndef RSTRING_END
|
890
|
+
# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
|
891
|
+
#endif
|
823
892
|
#ifndef RARRAY_LEN
|
824
893
|
# define RARRAY_LEN(x) RARRAY(x)->len
|
825
894
|
#endif
|
826
895
|
#ifndef RARRAY_PTR
|
827
896
|
# define RARRAY_PTR(x) RARRAY(x)->ptr
|
828
897
|
#endif
|
898
|
+
#ifndef RFLOAT_VALUE
|
899
|
+
# define RFLOAT_VALUE(x) RFLOAT(x)->value
|
900
|
+
#endif
|
901
|
+
#ifndef DOUBLE2NUM
|
902
|
+
# define DOUBLE2NUM(x) rb_float_new(x)
|
903
|
+
#endif
|
904
|
+
#ifndef RHASH_TBL
|
905
|
+
# define RHASH_TBL(x) (RHASH(x)->tbl)
|
906
|
+
#endif
|
907
|
+
#ifndef RHASH_ITER_LEV
|
908
|
+
# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
|
909
|
+
#endif
|
910
|
+
#ifndef RHASH_IFNONE
|
911
|
+
# define RHASH_IFNONE(x) (RHASH(x)->ifnone)
|
912
|
+
#endif
|
913
|
+
#ifndef RHASH_SIZE
|
914
|
+
# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
|
915
|
+
#endif
|
916
|
+
#ifndef RHASH_EMPTY_P
|
917
|
+
# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
|
918
|
+
#endif
|
919
|
+
#ifndef RSTRUCT_LEN
|
920
|
+
# define RSTRUCT_LEN(x) RSTRUCT(x)->len
|
921
|
+
#endif
|
922
|
+
#ifndef RSTRUCT_PTR
|
923
|
+
# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
|
924
|
+
#endif
|
925
|
+
|
926
|
+
|
829
927
|
|
830
928
|
/*
|
831
929
|
* Need to be very careful about how these macros are defined, especially
|
@@ -887,6 +985,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|
887
985
|
#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
|
888
986
|
#endif
|
889
987
|
|
988
|
+
static VALUE _mSWIG = Qnil;
|
890
989
|
|
891
990
|
/* -----------------------------------------------------------------------------
|
892
991
|
* error manipulation
|
@@ -977,12 +1076,73 @@ SWIG_Ruby_ErrorType(int SWIG_code) {
|
|
977
1076
|
}
|
978
1077
|
|
979
1078
|
|
1079
|
+
/* This function is called when a user inputs a wrong argument to
|
1080
|
+
a method.
|
1081
|
+
*/
|
1082
|
+
SWIGINTERN
|
1083
|
+
const char* Ruby_Format_TypeError( const char* msg,
|
1084
|
+
const char* type,
|
1085
|
+
const char* name,
|
1086
|
+
const int argn,
|
1087
|
+
VALUE input )
|
1088
|
+
{
|
1089
|
+
char buf[128];
|
1090
|
+
VALUE str;
|
1091
|
+
VALUE asStr;
|
1092
|
+
if ( msg && *msg )
|
1093
|
+
{
|
1094
|
+
str = rb_str_new2(msg);
|
1095
|
+
}
|
1096
|
+
else
|
1097
|
+
{
|
1098
|
+
str = rb_str_new(NULL, 0);
|
1099
|
+
}
|
1100
|
+
|
1101
|
+
str = rb_str_cat2( str, "Expected argument " );
|
1102
|
+
sprintf( buf, "%d of type ", argn-1 );
|
1103
|
+
str = rb_str_cat2( str, buf );
|
1104
|
+
str = rb_str_cat2( str, type );
|
1105
|
+
str = rb_str_cat2( str, ", but got " );
|
1106
|
+
str = rb_str_cat2( str, rb_obj_classname(input) );
|
1107
|
+
str = rb_str_cat2( str, " " );
|
1108
|
+
asStr = rb_inspect(input);
|
1109
|
+
if ( RSTRING_LEN(asStr) > 30 )
|
1110
|
+
{
|
1111
|
+
str = rb_str_cat( str, StringValuePtr(asStr), 30 );
|
1112
|
+
str = rb_str_cat2( str, "..." );
|
1113
|
+
}
|
1114
|
+
else
|
1115
|
+
{
|
1116
|
+
str = rb_str_append( str, asStr );
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
if ( name )
|
1120
|
+
{
|
1121
|
+
str = rb_str_cat2( str, "\n\tin SWIG method '" );
|
1122
|
+
str = rb_str_cat2( str, name );
|
1123
|
+
str = rb_str_cat2( str, "'" );
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
return StringValuePtr( str );
|
1127
|
+
}
|
980
1128
|
|
1129
|
+
/* This function is called when an overloaded method fails */
|
1130
|
+
SWIGINTERN
|
1131
|
+
void Ruby_Format_OverloadedError(
|
1132
|
+
const int argc,
|
1133
|
+
const int maxargs,
|
1134
|
+
const char* method,
|
1135
|
+
const char* prototypes
|
1136
|
+
)
|
1137
|
+
{
|
1138
|
+
const char* msg = "Wrong # of arguments";
|
1139
|
+
if ( argc <= maxargs ) msg = "Wrong arguments";
|
1140
|
+
rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
|
1141
|
+
"Possible C/C++ prototypes are:\n%s",
|
1142
|
+
msg, method, prototypes);
|
1143
|
+
}
|
981
1144
|
|
982
1145
|
/* -----------------------------------------------------------------------------
|
983
|
-
* See the LICENSE file for information on copyright, usage and redistribution
|
984
|
-
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
985
|
-
*
|
986
1146
|
* rubytracking.swg
|
987
1147
|
*
|
988
1148
|
* This file contains support for tracking mappings from
|
@@ -995,26 +1155,54 @@ SWIG_Ruby_ErrorType(int SWIG_code) {
|
|
995
1155
|
extern "C" {
|
996
1156
|
#endif
|
997
1157
|
|
1158
|
+
/* Ruby 1.8 actually assumes the first case. */
|
1159
|
+
#if SIZEOF_VOIDP == SIZEOF_LONG
|
1160
|
+
# define SWIG2NUM(v) LONG2NUM((unsigned long)v)
|
1161
|
+
# define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
|
1162
|
+
#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
|
1163
|
+
# define SWIG2NUM(v) LL2NUM((unsigned long long)v)
|
1164
|
+
# define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
|
1165
|
+
#else
|
1166
|
+
# error sizeof(void*) is not the same as long or long long
|
1167
|
+
#endif
|
1168
|
+
|
998
1169
|
|
999
1170
|
/* Global Ruby hash table to store Trackings from C/C++
|
1000
|
-
structs to Ruby Objects.
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1171
|
+
structs to Ruby Objects.
|
1172
|
+
*/
|
1173
|
+
static VALUE swig_ruby_trackings = Qnil;
|
1174
|
+
|
1175
|
+
/* Global variable that stores a reference to the ruby
|
1176
|
+
hash table delete function. */
|
1177
|
+
static ID swig_ruby_hash_delete;
|
1006
1178
|
|
1007
1179
|
/* Setup a Ruby hash table to store Trackings */
|
1008
1180
|
SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
|
1009
1181
|
/* Create a ruby hash table to store Trackings from C++
|
1010
|
-
objects to Ruby objects.
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1182
|
+
objects to Ruby objects. */
|
1183
|
+
|
1184
|
+
/* Try to see if some other .so has already created a
|
1185
|
+
tracking hash table, which we keep hidden in an instance var
|
1186
|
+
in the SWIG module.
|
1187
|
+
This is done to allow multiple DSOs to share the same
|
1188
|
+
tracking table.
|
1189
|
+
*/
|
1190
|
+
ID trackings_id = rb_intern( "@__trackings__" );
|
1191
|
+
VALUE verbose = rb_gv_get("VERBOSE");
|
1192
|
+
rb_gv_set("VERBOSE", Qfalse);
|
1193
|
+
swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
|
1194
|
+
rb_gv_set("VERBOSE", verbose);
|
1195
|
+
|
1196
|
+
/* No, it hasn't. Create one ourselves */
|
1197
|
+
if ( swig_ruby_trackings == Qnil )
|
1198
|
+
{
|
1199
|
+
swig_ruby_trackings = rb_hash_new();
|
1200
|
+
rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
/* Now store a reference to the hash table delete function
|
1204
|
+
so that we only have to look it up once.*/
|
1205
|
+
swig_ruby_hash_delete = rb_intern("delete");
|
1018
1206
|
}
|
1019
1207
|
|
1020
1208
|
/* Get a Ruby number to reference a pointer */
|
@@ -1024,8 +1212,7 @@ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
|
|
1024
1212
|
a Ruby number object. */
|
1025
1213
|
|
1026
1214
|
/* Convert the pointer to a Ruby number */
|
1027
|
-
|
1028
|
-
return LONG2NUM(value);
|
1215
|
+
return SWIG2NUM(ptr);
|
1029
1216
|
}
|
1030
1217
|
|
1031
1218
|
/* Get a Ruby number to reference an object */
|
@@ -1035,8 +1222,7 @@ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
|
|
1035
1222
|
a Ruby number object. */
|
1036
1223
|
|
1037
1224
|
/* Convert the Object to a Ruby number */
|
1038
|
-
|
1039
|
-
return LONG2NUM(value);
|
1225
|
+
return SWIG2NUM(object);
|
1040
1226
|
}
|
1041
1227
|
|
1042
1228
|
/* Get a Ruby object from a previously stored reference */
|
@@ -1044,9 +1230,8 @@ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
|
|
1044
1230
|
/* The provided Ruby number object is a reference
|
1045
1231
|
to the Ruby object we want.*/
|
1046
1232
|
|
1047
|
-
/*
|
1048
|
-
|
1049
|
-
return (VALUE) value;
|
1233
|
+
/* Convert the Ruby number to a Ruby object */
|
1234
|
+
return NUM2SWIG(reference);
|
1050
1235
|
}
|
1051
1236
|
|
1052
1237
|
/* Add a Tracking from a C/C++ struct to a Ruby object */
|
@@ -1138,15 +1323,21 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
|
|
1138
1323
|
return target;
|
1139
1324
|
}
|
1140
1325
|
|
1326
|
+
/* For ruby1.8.4 and earlier. */
|
1327
|
+
#ifndef RUBY_INIT_STACK
|
1328
|
+
RUBY_EXTERN void Init_stack(VALUE* addr);
|
1329
|
+
# define RUBY_INIT_STACK \
|
1330
|
+
VALUE variable_in_this_stack_frame; \
|
1331
|
+
Init_stack(&variable_in_this_stack_frame);
|
1332
|
+
#endif
|
1333
|
+
|
1334
|
+
|
1141
1335
|
#ifdef __cplusplus
|
1142
1336
|
}
|
1143
1337
|
#endif
|
1144
1338
|
|
1145
1339
|
|
1146
1340
|
/* -----------------------------------------------------------------------------
|
1147
|
-
* See the LICENSE file for information on copyright, usage and redistribution
|
1148
|
-
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
1149
|
-
*
|
1150
1341
|
* rubyrun.swg
|
1151
1342
|
*
|
1152
1343
|
* This file contains the runtime support for Ruby modules
|
@@ -1190,7 +1381,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
|
|
1190
1381
|
/* Error manipulation */
|
1191
1382
|
|
1192
1383
|
#define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
|
1193
|
-
#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg)
|
1384
|
+
#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
|
1194
1385
|
#define SWIG_fail goto fail
|
1195
1386
|
|
1196
1387
|
|
@@ -1202,6 +1393,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
|
|
1202
1393
|
#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
|
1203
1394
|
#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
|
1204
1395
|
|
1396
|
+
#include "assert.h"
|
1205
1397
|
|
1206
1398
|
/* -----------------------------------------------------------------------------
|
1207
1399
|
* pointers/data manipulation
|
@@ -1209,9 +1401,6 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
|
|
1209
1401
|
|
1210
1402
|
#ifdef __cplusplus
|
1211
1403
|
extern "C" {
|
1212
|
-
#if 0
|
1213
|
-
} /* cc-mode */
|
1214
|
-
#endif
|
1215
1404
|
#endif
|
1216
1405
|
|
1217
1406
|
typedef struct {
|
@@ -1223,10 +1412,44 @@ typedef struct {
|
|
1223
1412
|
} swig_class;
|
1224
1413
|
|
1225
1414
|
|
1226
|
-
|
1415
|
+
/* Global pointer used to keep some internal SWIG stuff */
|
1227
1416
|
static VALUE _cSWIG_Pointer = Qnil;
|
1228
1417
|
static VALUE swig_runtime_data_type_pointer = Qnil;
|
1229
1418
|
|
1419
|
+
/* Global IDs used to keep some internal SWIG stuff */
|
1420
|
+
static ID swig_arity_id = 0;
|
1421
|
+
static ID swig_call_id = 0;
|
1422
|
+
|
1423
|
+
/*
|
1424
|
+
If your swig extension is to be run within an embedded ruby and has
|
1425
|
+
director callbacks, you should set -DRUBY_EMBEDDED during compilation.
|
1426
|
+
This will reset ruby's stack frame on each entry point from the main
|
1427
|
+
program the first time a virtual director function is invoked (in a
|
1428
|
+
non-recursive way).
|
1429
|
+
If this is not done, you run the risk of Ruby trashing the stack.
|
1430
|
+
*/
|
1431
|
+
|
1432
|
+
#ifdef RUBY_EMBEDDED
|
1433
|
+
|
1434
|
+
# define SWIG_INIT_STACK \
|
1435
|
+
if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
|
1436
|
+
++swig_virtual_calls;
|
1437
|
+
# define SWIG_RELEASE_STACK --swig_virtual_calls;
|
1438
|
+
# define Ruby_DirectorTypeMismatchException(x) \
|
1439
|
+
rb_raise( rb_eTypeError, "%s", x ); return c_result;
|
1440
|
+
|
1441
|
+
static unsigned int swig_virtual_calls = 0;
|
1442
|
+
|
1443
|
+
#else /* normal non-embedded extension */
|
1444
|
+
|
1445
|
+
# define SWIG_INIT_STACK
|
1446
|
+
# define SWIG_RELEASE_STACK
|
1447
|
+
# define Ruby_DirectorTypeMismatchException(x) \
|
1448
|
+
throw Swig::DirectorTypeMismatchException( x );
|
1449
|
+
|
1450
|
+
#endif /* RUBY_EMBEDDED */
|
1451
|
+
|
1452
|
+
|
1230
1453
|
SWIGRUNTIME VALUE
|
1231
1454
|
getExceptionClass(void) {
|
1232
1455
|
static int init = 0;
|
@@ -1258,6 +1481,8 @@ SWIG_Ruby_InitRuntime(void)
|
|
1258
1481
|
{
|
1259
1482
|
if (_mSWIG == Qnil) {
|
1260
1483
|
_mSWIG = rb_define_module("SWIG");
|
1484
|
+
swig_call_id = rb_intern("call");
|
1485
|
+
swig_arity_id = rb_intern("arity");
|
1261
1486
|
}
|
1262
1487
|
}
|
1263
1488
|
|
@@ -1281,7 +1506,7 @@ SWIGRUNTIME VALUE
|
|
1281
1506
|
SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
|
1282
1507
|
{
|
1283
1508
|
int own = flags & SWIG_POINTER_OWN;
|
1284
|
-
|
1509
|
+
int track;
|
1285
1510
|
char *klass_name;
|
1286
1511
|
swig_class *sklass;
|
1287
1512
|
VALUE klass;
|
@@ -1294,14 +1519,15 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
|
|
1294
1519
|
sklass = (swig_class *) type->clientdata;
|
1295
1520
|
|
1296
1521
|
/* Are we tracking this class and have we already returned this Ruby object? */
|
1297
|
-
|
1522
|
+
track = sklass->trackObjects;
|
1523
|
+
if (track) {
|
1298
1524
|
obj = SWIG_RubyInstanceFor(ptr);
|
1299
1525
|
|
1300
1526
|
/* Check the object's type and make sure it has the correct type.
|
1301
1527
|
It might not in cases where methods do things like
|
1302
1528
|
downcast methods. */
|
1303
1529
|
if (obj != Qnil) {
|
1304
|
-
VALUE value = rb_iv_get(obj, "__swigtype__");
|
1530
|
+
VALUE value = rb_iv_get(obj, "@__swigtype__");
|
1305
1531
|
char* type_name = RSTRING_PTR(value);
|
1306
1532
|
|
1307
1533
|
if (strcmp(type->name, type_name) == 0) {
|
@@ -1311,10 +1537,13 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
|
|
1311
1537
|
}
|
1312
1538
|
|
1313
1539
|
/* Create a new Ruby object */
|
1314
|
-
obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
|
1540
|
+
obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
|
1541
|
+
( own ? VOIDFUNC(sklass->destroy) :
|
1542
|
+
(track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
|
1543
|
+
), ptr);
|
1315
1544
|
|
1316
1545
|
/* If tracking is on for this class then track this object. */
|
1317
|
-
if (
|
1546
|
+
if (track) {
|
1318
1547
|
SWIG_RubyAddTracking(ptr, obj);
|
1319
1548
|
}
|
1320
1549
|
} else {
|
@@ -1324,7 +1553,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
|
|
1324
1553
|
free((void *) klass_name);
|
1325
1554
|
obj = Data_Wrap_Struct(klass, 0, 0, ptr);
|
1326
1555
|
}
|
1327
|
-
rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
|
1556
|
+
rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
|
1328
1557
|
|
1329
1558
|
return obj;
|
1330
1559
|
}
|
@@ -1336,7 +1565,7 @@ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
|
|
1336
1565
|
VALUE obj;
|
1337
1566
|
swig_class *sklass = (swig_class *) type->clientdata;
|
1338
1567
|
obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
|
1339
|
-
rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
|
1568
|
+
rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
|
1340
1569
|
return obj;
|
1341
1570
|
}
|
1342
1571
|
|
@@ -1344,7 +1573,7 @@ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
|
|
1344
1573
|
SWIGRUNTIMEINLINE char *
|
1345
1574
|
SWIG_Ruby_MangleStr(VALUE obj)
|
1346
1575
|
{
|
1347
|
-
VALUE stype = rb_iv_get(obj, "__swigtype__");
|
1576
|
+
VALUE stype = rb_iv_get(obj, "@__swigtype__");
|
1348
1577
|
return StringValuePtr(stype);
|
1349
1578
|
}
|
1350
1579
|
|
@@ -1426,8 +1655,11 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
|
|
1426
1655
|
tc = SWIG_TypeCheck(c, ty);
|
1427
1656
|
if (!tc) {
|
1428
1657
|
return SWIG_ERROR;
|
1658
|
+
} else {
|
1659
|
+
int newmemory = 0;
|
1660
|
+
*ptr = SWIG_TypeCast(tc, vptr, &newmemory);
|
1661
|
+
assert(!newmemory); /* newmemory handling not yet implemented */
|
1429
1662
|
}
|
1430
|
-
*ptr = SWIG_TypeCast(tc, vptr);
|
1431
1663
|
} else {
|
1432
1664
|
*ptr = vptr;
|
1433
1665
|
}
|
@@ -1508,10 +1740,42 @@ SWIG_Ruby_SetModule(swig_module_info *pointer)
|
|
1508
1740
|
rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
|
1509
1741
|
}
|
1510
1742
|
|
1743
|
+
/* This function can be used to check whether a proc or method or similarly
|
1744
|
+
callable function has been passed. Usually used in a %typecheck, like:
|
1745
|
+
|
1746
|
+
%typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
|
1747
|
+
$result = SWIG_Ruby_isCallable( $input );
|
1748
|
+
}
|
1749
|
+
*/
|
1750
|
+
SWIGINTERN
|
1751
|
+
int SWIG_Ruby_isCallable( VALUE proc )
|
1752
|
+
{
|
1753
|
+
if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
|
1754
|
+
return 1;
|
1755
|
+
return 0;
|
1756
|
+
}
|
1757
|
+
|
1758
|
+
/* This function can be used to check the arity (number of arguments)
|
1759
|
+
a proc or method can take. Usually used in a %typecheck.
|
1760
|
+
Valid arities will be that equal to minimal or those < 0
|
1761
|
+
which indicate a variable number of parameters at the end.
|
1762
|
+
*/
|
1763
|
+
SWIGINTERN
|
1764
|
+
int SWIG_Ruby_arity( VALUE proc, int minimal )
|
1765
|
+
{
|
1766
|
+
if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
|
1767
|
+
{
|
1768
|
+
VALUE num = rb_funcall( proc, swig_arity_id, 0 );
|
1769
|
+
int arity = NUM2INT(num);
|
1770
|
+
if ( arity < 0 && (arity+1) < -minimal ) return 1;
|
1771
|
+
if ( arity == minimal ) return 1;
|
1772
|
+
return 1;
|
1773
|
+
}
|
1774
|
+
return 0;
|
1775
|
+
}
|
1776
|
+
|
1777
|
+
|
1511
1778
|
#ifdef __cplusplus
|
1512
|
-
#if 0
|
1513
|
-
{ /* cc-mode */
|
1514
|
-
#endif
|
1515
1779
|
}
|
1516
1780
|
#endif
|
1517
1781
|
|
@@ -1526,8 +1790,9 @@ SWIG_Ruby_SetModule(swig_module_info *pointer)
|
|
1526
1790
|
/* -------- TYPES TABLE (BEGIN) -------- */
|
1527
1791
|
|
1528
1792
|
#define SWIGTYPE_p_char swig_types[0]
|
1529
|
-
|
1530
|
-
static
|
1793
|
+
#define SWIGTYPE_p_xmlDocPtr swig_types[1]
|
1794
|
+
static swig_type_info *swig_types[3];
|
1795
|
+
static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
|
1531
1796
|
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
|
1532
1797
|
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
|
1533
1798
|
|
@@ -1538,6 +1803,10 @@ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
|
|
1538
1803
|
|
1539
1804
|
static VALUE mXmlsec;
|
1540
1805
|
|
1806
|
+
#define SWIG_RUBY_THREAD_BEGIN_BLOCK
|
1807
|
+
#define SWIG_RUBY_THREAD_END_BLOCK
|
1808
|
+
|
1809
|
+
|
1541
1810
|
#define SWIGVERSION 0x020000
|
1542
1811
|
#define SWIG_VERSION SWIGVERSION
|
1543
1812
|
|
@@ -1545,6 +1814,9 @@ static VALUE mXmlsec;
|
|
1545
1814
|
#define SWIG_as_voidptr(a) (void *)((const void *)(a))
|
1546
1815
|
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
|
1547
1816
|
|
1817
|
+
|
1818
|
+
#include <libxml/tree.h>
|
1819
|
+
|
1548
1820
|
|
1549
1821
|
SWIGINTERN swig_type_info*
|
1550
1822
|
SWIG_pchar_descriptor(void)
|
@@ -1563,11 +1835,11 @@ SWIGINTERN int
|
|
1563
1835
|
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
|
1564
1836
|
{
|
1565
1837
|
if (TYPE(obj) == T_STRING) {
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1838
|
+
#if defined(StringValuePtr)
|
1839
|
+
char *cstr = StringValuePtr(obj);
|
1840
|
+
#else
|
1569
1841
|
char *cstr = STR2CSTR(obj);
|
1570
|
-
|
1842
|
+
#endif
|
1571
1843
|
size_t size = RSTRING_LEN(obj) + 1;
|
1572
1844
|
if (cptr) {
|
1573
1845
|
if (alloc) {
|
@@ -1601,14 +1873,12 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
|
|
1601
1873
|
|
1602
1874
|
|
1603
1875
|
#include <limits.h>
|
1604
|
-
#
|
1605
|
-
#
|
1606
|
-
#
|
1607
|
-
#
|
1608
|
-
#
|
1609
|
-
#endif
|
1610
|
-
#ifndef ULLONG_MAX
|
1611
|
-
# define ULLONG_MAX ULONG_LONG_MAX
|
1876
|
+
#if !defined(SWIG_NO_LLONG_MAX)
|
1877
|
+
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
|
1878
|
+
# define LLONG_MAX __LONG_LONG_MAX__
|
1879
|
+
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
1880
|
+
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
1881
|
+
# endif
|
1612
1882
|
#endif
|
1613
1883
|
|
1614
1884
|
|
@@ -1639,12 +1909,12 @@ _wrap_verify_file(int argc, VALUE *argv, VALUE self) {
|
|
1639
1909
|
}
|
1640
1910
|
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
|
1641
1911
|
if (!SWIG_IsOK(res1)) {
|
1642
|
-
SWIG_exception_fail(SWIG_ArgError(res1),
|
1912
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","verify_file", 1, argv[0] ));
|
1643
1913
|
}
|
1644
1914
|
arg1 = (char *)(buf1);
|
1645
1915
|
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
|
1646
1916
|
if (!SWIG_IsOK(res2)) {
|
1647
|
-
SWIG_exception_fail(SWIG_ArgError(res2),
|
1917
|
+
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","verify_file", 2, argv[1] ));
|
1648
1918
|
}
|
1649
1919
|
arg2 = (char *)(buf2);
|
1650
1920
|
result = (int)verify_file((char const *)arg1,(char const *)arg2);
|
@@ -1659,19 +1929,56 @@ fail:
|
|
1659
1929
|
}
|
1660
1930
|
|
1661
1931
|
|
1932
|
+
SWIGINTERN VALUE
|
1933
|
+
_wrap_verify_document(int argc, VALUE *argv, VALUE self) {
|
1934
|
+
xmlDocPtr arg1 ;
|
1935
|
+
char *arg2 = (char *) 0 ;
|
1936
|
+
int res2 ;
|
1937
|
+
char *buf2 = 0 ;
|
1938
|
+
int alloc2 = 0 ;
|
1939
|
+
int result;
|
1940
|
+
VALUE vresult = Qnil;
|
1941
|
+
|
1942
|
+
if ((argc < 2) || (argc > 2)) {
|
1943
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
1944
|
+
}
|
1945
|
+
{
|
1946
|
+
xmlDocPtr doc;
|
1947
|
+
Data_Get_Struct(argv[0], xmlDocPtr, doc);
|
1948
|
+
arg1 = doc;
|
1949
|
+
}
|
1950
|
+
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
|
1951
|
+
if (!SWIG_IsOK(res2)) {
|
1952
|
+
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","verify_document", 2, argv[1] ));
|
1953
|
+
}
|
1954
|
+
arg2 = (char *)(buf2);
|
1955
|
+
result = (int)verify_document(arg1,(char const *)arg2);
|
1956
|
+
vresult = SWIG_From_int((int)(result));
|
1957
|
+
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
1958
|
+
return vresult;
|
1959
|
+
fail:
|
1960
|
+
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
1961
|
+
return Qnil;
|
1962
|
+
}
|
1963
|
+
|
1964
|
+
|
1662
1965
|
|
1663
1966
|
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
|
1664
1967
|
|
1665
1968
|
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
|
1969
|
+
static swig_type_info _swigt__p_xmlDocPtr = {"_p_xmlDocPtr", "xmlDocPtr *", 0, 0, (void*)0, 0};
|
1666
1970
|
|
1667
1971
|
static swig_type_info *swig_type_initial[] = {
|
1668
1972
|
&_swigt__p_char,
|
1973
|
+
&_swigt__p_xmlDocPtr,
|
1669
1974
|
};
|
1670
1975
|
|
1671
1976
|
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
|
1977
|
+
static swig_cast_info _swigc__p_xmlDocPtr[] = { {&_swigt__p_xmlDocPtr, 0, 0, 0},{0, 0, 0, 0}};
|
1672
1978
|
|
1673
1979
|
static swig_cast_info *swig_cast_initial[] = {
|
1674
1980
|
_swigc__p_char,
|
1981
|
+
_swigc__p_xmlDocPtr,
|
1675
1982
|
};
|
1676
1983
|
|
1677
1984
|
|
@@ -1734,7 +2041,7 @@ SWIGRUNTIME void
|
|
1734
2041
|
SWIG_InitializeModule(void *clientdata) {
|
1735
2042
|
size_t i;
|
1736
2043
|
swig_module_info *module_head, *iter;
|
1737
|
-
int found;
|
2044
|
+
int found, init;
|
1738
2045
|
|
1739
2046
|
clientdata = clientdata;
|
1740
2047
|
|
@@ -1744,6 +2051,9 @@ SWIG_InitializeModule(void *clientdata) {
|
|
1744
2051
|
swig_module.type_initial = swig_type_initial;
|
1745
2052
|
swig_module.cast_initial = swig_cast_initial;
|
1746
2053
|
swig_module.next = &swig_module;
|
2054
|
+
init = 1;
|
2055
|
+
} else {
|
2056
|
+
init = 0;
|
1747
2057
|
}
|
1748
2058
|
|
1749
2059
|
/* Try and load any already created modules */
|
@@ -1772,6 +2082,12 @@ SWIG_InitializeModule(void *clientdata) {
|
|
1772
2082
|
module_head->next = &swig_module;
|
1773
2083
|
}
|
1774
2084
|
|
2085
|
+
/* When multiple interpeters are used, a module could have already been initialized in
|
2086
|
+
a different interpreter, but not yet have a pointer in this interpreter.
|
2087
|
+
In this case, we do not want to continue adding types... everything should be
|
2088
|
+
set up already */
|
2089
|
+
if (init == 0) return;
|
2090
|
+
|
1775
2091
|
/* Now work on filling in swig_module.types */
|
1776
2092
|
#ifdef SWIGRUNTIME_DEBUG
|
1777
2093
|
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
|
@@ -1924,5 +2240,6 @@ SWIGEXPORT void Init_xmlsec(void) {
|
|
1924
2240
|
|
1925
2241
|
SWIG_RubyInitializeTrackings();
|
1926
2242
|
rb_define_module_function(mXmlsec, "verify_file", _wrap_verify_file, -1);
|
2243
|
+
rb_define_module_function(mXmlsec, "verify_document", _wrap_verify_document, -1);
|
1927
2244
|
}
|
1928
2245
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmlsec-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Victor Lin
|