dep_selector 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,64 @@
1
+ //
2
+ // Author:: Christopher Walters (<cw@opscode.com>)
3
+ // Author:: Mark Anderson (<mark@opscode.com>)
4
+ // Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
5
+ // License:: Apache License, Version 2.0
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+
20
+ //
21
+ // swig -c++ -ruby dep_selector_swig.i
22
+ //
23
+ %module "dep_gecode"
24
+ %{
25
+ #include "dep_selector_to_gecode_interface.h"
26
+ %}
27
+
28
+ class VersionProblem;
29
+
30
+ VersionProblem * VersionProblemCreate(int packageCount);
31
+ void VersionProblemDestroy(VersionProblem * vp);
32
+
33
+ int VersionProblemSize(VersionProblem *p);
34
+ int VersionProblemPackageCount(VersionProblem *p);
35
+
36
+ // Return ID #
37
+
38
+ int AddPackage(VersionProblem *problem, int min, int max, int currentVersion);
39
+ // Add constraint for package pkg @ version,
40
+ // that dependentPackage is at version [minDependentVersion,maxDependentVersion]
41
+ // Returns false if system becomes insoluble.
42
+ bool AddVersionConstraint(VersionProblem *problem, int packageId, int version,
43
+ int dependentPackageId, int minDependentVersion, int maxDependentVersion);
44
+ void MarkPackageSuspicious(VersionProblem *problem, int packageId);
45
+
46
+ void MarkPackageRequired(VersionProblem *problem, int packageId);
47
+ void MarkPackagePreferredToBeAtLatest(VersionProblem *problem, int packageId, int weight);
48
+
49
+
50
+ int GetPackageVersion(VersionProblem *problem, int packageId);
51
+ bool GetPackageDisabledState(VersionProblem *problem, int packageId);
52
+
53
+ int GetPackageMax(VersionProblem *problem, int packageId);
54
+ int GetPackageMin(VersionProblem *problem, int packageId);
55
+
56
+ int GetDisabledVariableCount(VersionProblem *problem);
57
+
58
+ void VersionProblemDump(VersionProblem * problem);
59
+ void VersionProblemPrintPackageVar(VersionProblem * problem, int packageId);
60
+
61
+ VersionProblem * Solve(VersionProblem * problem);
62
+
63
+
64
+
@@ -0,0 +1,2462 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * This file was automatically generated by SWIG (http://www.swig.org).
3
+ * Version 1.3.31
4
+ *
5
+ * This file is not intended to be easily readable and contains a number of
6
+ * coding conventions designed to improve portability and efficiency. Do not make
7
+ * changes to this file unless you know what you are doing--modify the SWIG
8
+ * interface file instead.
9
+ * ----------------------------------------------------------------------------- */
10
+
11
+ #define SWIGRUBY
12
+
13
+ #ifdef __cplusplus
14
+ template<class T> class SwigValueWrapper {
15
+ T *tt;
16
+ public:
17
+ SwigValueWrapper() : tt(0) { }
18
+ SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
19
+ SwigValueWrapper(const T& t) : tt(new T(t)) { }
20
+ ~SwigValueWrapper() { delete tt; }
21
+ SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
22
+ operator T&() const { return *tt; }
23
+ T *operator&() { return tt; }
24
+ private:
25
+ SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
26
+ };
27
+ #endif
28
+
29
+ /* -----------------------------------------------------------------------------
30
+ * This section contains generic SWIG labels for method/variable
31
+ * declarations/attributes, and other compiler dependent labels.
32
+ * ----------------------------------------------------------------------------- */
33
+
34
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
35
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
36
+ # if defined(__SUNPRO_CC)
37
+ # if (__SUNPRO_CC <= 0x560)
38
+ # define SWIGTEMPLATEDISAMBIGUATOR template
39
+ # else
40
+ # define SWIGTEMPLATEDISAMBIGUATOR
41
+ # endif
42
+ # else
43
+ # define SWIGTEMPLATEDISAMBIGUATOR
44
+ # endif
45
+ #endif
46
+
47
+ /* inline attribute */
48
+ #ifndef SWIGINLINE
49
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
50
+ # define SWIGINLINE inline
51
+ # else
52
+ # define SWIGINLINE
53
+ # endif
54
+ #endif
55
+
56
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
57
+ #ifndef SWIGUNUSED
58
+ # if defined(__GNUC__)
59
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
60
+ # define SWIGUNUSED __attribute__ ((__unused__))
61
+ # else
62
+ # define SWIGUNUSED
63
+ # endif
64
+ # elif defined(__ICC)
65
+ # define SWIGUNUSED __attribute__ ((__unused__))
66
+ # else
67
+ # define SWIGUNUSED
68
+ # endif
69
+ #endif
70
+
71
+ #ifndef SWIGUNUSEDPARM
72
+ # ifdef __cplusplus
73
+ # define SWIGUNUSEDPARM(p)
74
+ # else
75
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
76
+ # endif
77
+ #endif
78
+
79
+ /* internal SWIG method */
80
+ #ifndef SWIGINTERN
81
+ # define SWIGINTERN static SWIGUNUSED
82
+ #endif
83
+
84
+ /* internal inline SWIG method */
85
+ #ifndef SWIGINTERNINLINE
86
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
87
+ #endif
88
+
89
+ /* exporting methods */
90
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
91
+ # ifndef GCC_HASCLASSVISIBILITY
92
+ # define GCC_HASCLASSVISIBILITY
93
+ # endif
94
+ #endif
95
+
96
+ #ifndef SWIGEXPORT
97
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
98
+ # if defined(STATIC_LINKED)
99
+ # define SWIGEXPORT
100
+ # else
101
+ # define SWIGEXPORT __declspec(dllexport)
102
+ # endif
103
+ # else
104
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
105
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
106
+ # else
107
+ # define SWIGEXPORT
108
+ # endif
109
+ # endif
110
+ #endif
111
+
112
+ /* calling conventions for Windows */
113
+ #ifndef SWIGSTDCALL
114
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
115
+ # define SWIGSTDCALL __stdcall
116
+ # else
117
+ # define SWIGSTDCALL
118
+ # endif
119
+ #endif
120
+
121
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
122
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
123
+ # define _CRT_SECURE_NO_DEPRECATE
124
+ #endif
125
+
126
+ /* -----------------------------------------------------------------------------
127
+ * This section contains generic SWIG labels for method/variable
128
+ * declarations/attributes, and other compiler dependent labels.
129
+ * ----------------------------------------------------------------------------- */
130
+
131
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
132
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
133
+ # if defined(__SUNPRO_CC)
134
+ # if (__SUNPRO_CC <= 0x560)
135
+ # define SWIGTEMPLATEDISAMBIGUATOR template
136
+ # else
137
+ # define SWIGTEMPLATEDISAMBIGUATOR
138
+ # endif
139
+ # else
140
+ # define SWIGTEMPLATEDISAMBIGUATOR
141
+ # endif
142
+ #endif
143
+
144
+ /* inline attribute */
145
+ #ifndef SWIGINLINE
146
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
147
+ # define SWIGINLINE inline
148
+ # else
149
+ # define SWIGINLINE
150
+ # endif
151
+ #endif
152
+
153
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
154
+ #ifndef SWIGUNUSED
155
+ # if defined(__GNUC__)
156
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
157
+ # define SWIGUNUSED __attribute__ ((__unused__))
158
+ # else
159
+ # define SWIGUNUSED
160
+ # endif
161
+ # elif defined(__ICC)
162
+ # define SWIGUNUSED __attribute__ ((__unused__))
163
+ # else
164
+ # define SWIGUNUSED
165
+ # endif
166
+ #endif
167
+
168
+ #ifndef SWIGUNUSEDPARM
169
+ # ifdef __cplusplus
170
+ # define SWIGUNUSEDPARM(p)
171
+ # else
172
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
173
+ # endif
174
+ #endif
175
+
176
+ /* internal SWIG method */
177
+ #ifndef SWIGINTERN
178
+ # define SWIGINTERN static SWIGUNUSED
179
+ #endif
180
+
181
+ /* internal inline SWIG method */
182
+ #ifndef SWIGINTERNINLINE
183
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
184
+ #endif
185
+
186
+ /* exporting methods */
187
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
188
+ # ifndef GCC_HASCLASSVISIBILITY
189
+ # define GCC_HASCLASSVISIBILITY
190
+ # endif
191
+ #endif
192
+
193
+ #ifndef SWIGEXPORT
194
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
195
+ # if defined(STATIC_LINKED)
196
+ # define SWIGEXPORT
197
+ # else
198
+ # define SWIGEXPORT __declspec(dllexport)
199
+ # endif
200
+ # else
201
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
202
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
203
+ # else
204
+ # define SWIGEXPORT
205
+ # endif
206
+ # endif
207
+ #endif
208
+
209
+ /* calling conventions for Windows */
210
+ #ifndef SWIGSTDCALL
211
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
212
+ # define SWIGSTDCALL __stdcall
213
+ # else
214
+ # define SWIGSTDCALL
215
+ # endif
216
+ #endif
217
+
218
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
219
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
220
+ # define _CRT_SECURE_NO_DEPRECATE
221
+ #endif
222
+
223
+ /* -----------------------------------------------------------------------------
224
+ * swigrun.swg
225
+ *
226
+ * This file contains generic CAPI SWIG runtime support for pointer
227
+ * type checking.
228
+ * ----------------------------------------------------------------------------- */
229
+
230
+ /* This should only be incremented when either the layout of swig_type_info changes,
231
+ or for whatever reason, the runtime changes incompatibly */
232
+ #define SWIG_RUNTIME_VERSION "3"
233
+
234
+ /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
235
+ #ifdef SWIG_TYPE_TABLE
236
+ # define SWIG_QUOTE_STRING(x) #x
237
+ # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
238
+ # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
239
+ #else
240
+ # define SWIG_TYPE_TABLE_NAME
241
+ #endif
242
+
243
+ /*
244
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
245
+ creating a static or dynamic library from the swig runtime code.
246
+ In 99.9% of the cases, swig just needs to declare them as 'static'.
247
+
248
+ But only do this if is strictly necessary, ie, if you have problems
249
+ with your compiler or so.
250
+ */
251
+
252
+ #ifndef SWIGRUNTIME
253
+ # define SWIGRUNTIME SWIGINTERN
254
+ #endif
255
+
256
+ #ifndef SWIGRUNTIMEINLINE
257
+ # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
258
+ #endif
259
+
260
+ /* Generic buffer size */
261
+ #ifndef SWIG_BUFFER_SIZE
262
+ # define SWIG_BUFFER_SIZE 1024
263
+ #endif
264
+
265
+ /* Flags for pointer conversions */
266
+ #define SWIG_POINTER_DISOWN 0x1
267
+
268
+ /* Flags for new pointer objects */
269
+ #define SWIG_POINTER_OWN 0x1
270
+
271
+
272
+ /*
273
+ Flags/methods for returning states.
274
+
275
+ The swig conversion methods, as ConvertPtr, return and integer
276
+ that tells if the conversion was successful or not. And if not,
277
+ an error code can be returned (see swigerrors.swg for the codes).
278
+
279
+ Use the following macros/flags to set or process the returning
280
+ states.
281
+
282
+ In old swig versions, you usually write code as:
283
+
284
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
285
+ // success code
286
+ } else {
287
+ //fail code
288
+ }
289
+
290
+ Now you can be more explicit as:
291
+
292
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
293
+ if (SWIG_IsOK(res)) {
294
+ // success code
295
+ } else {
296
+ // fail code
297
+ }
298
+
299
+ that seems to be the same, but now you can also do
300
+
301
+ Type *ptr;
302
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
303
+ if (SWIG_IsOK(res)) {
304
+ // success code
305
+ if (SWIG_IsNewObj(res) {
306
+ ...
307
+ delete *ptr;
308
+ } else {
309
+ ...
310
+ }
311
+ } else {
312
+ // fail code
313
+ }
314
+
315
+ I.e., now SWIG_ConvertPtr can return new objects and you can
316
+ identify the case and take care of the deallocation. Of course that
317
+ requires also to SWIG_ConvertPtr to return new result values, as
318
+
319
+ int SWIG_ConvertPtr(obj, ptr,...) {
320
+ if (<obj is ok>) {
321
+ if (<need new object>) {
322
+ *ptr = <ptr to new allocated object>;
323
+ return SWIG_NEWOBJ;
324
+ } else {
325
+ *ptr = <ptr to old object>;
326
+ return SWIG_OLDOBJ;
327
+ }
328
+ } else {
329
+ return SWIG_BADOBJ;
330
+ }
331
+ }
332
+
333
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
334
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
335
+ swig errors code.
336
+
337
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
338
+ allows to return the 'cast rank', for example, if you have this
339
+
340
+ int food(double)
341
+ int fooi(int);
342
+
343
+ and you call
344
+
345
+ food(1) // cast rank '1' (1 -> 1.0)
346
+ fooi(1) // cast rank '0'
347
+
348
+ just use the SWIG_AddCast()/SWIG_CheckState()
349
+
350
+
351
+ */
352
+ #define SWIG_OK (0)
353
+ #define SWIG_ERROR (-1)
354
+ #define SWIG_IsOK(r) (r >= 0)
355
+ #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
356
+
357
+ /* The CastRankLimit says how many bits are used for the cast rank */
358
+ #define SWIG_CASTRANKLIMIT (1 << 8)
359
+ /* The NewMask denotes the object was created (using new/malloc) */
360
+ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
361
+ /* The TmpMask is for in/out typemaps that use temporal objects */
362
+ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
363
+ /* Simple returning values */
364
+ #define SWIG_BADOBJ (SWIG_ERROR)
365
+ #define SWIG_OLDOBJ (SWIG_OK)
366
+ #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
367
+ #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
368
+ /* Check, add and del mask methods */
369
+ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
370
+ #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
371
+ #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
372
+ #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
373
+ #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
374
+ #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
375
+
376
+
377
+ /* Cast-Rank Mode */
378
+ #if defined(SWIG_CASTRANK_MODE)
379
+ # ifndef SWIG_TypeRank
380
+ # define SWIG_TypeRank unsigned long
381
+ # endif
382
+ # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
383
+ # define SWIG_MAXCASTRANK (2)
384
+ # endif
385
+ # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
386
+ # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
387
+ SWIGINTERNINLINE int SWIG_AddCast(int r) {
388
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
389
+ }
390
+ SWIGINTERNINLINE int SWIG_CheckState(int r) {
391
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
392
+ }
393
+ #else /* no cast-rank mode */
394
+ # define SWIG_AddCast
395
+ # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
396
+ #endif
397
+
398
+
399
+
400
+
401
+ #include <string.h>
402
+
403
+ #ifdef __cplusplus
404
+ extern "C" {
405
+ #endif
406
+
407
+ typedef void *(*swig_converter_func)(void *);
408
+ typedef struct swig_type_info *(*swig_dycast_func)(void **);
409
+
410
+ /* Structure to store inforomation on one type */
411
+ typedef struct swig_type_info {
412
+ const char *name; /* mangled name of this type */
413
+ const char *str; /* human readable name of this type */
414
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
415
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
416
+ void *clientdata; /* language specific type data */
417
+ int owndata; /* flag if the structure owns the clientdata */
418
+ } swig_type_info;
419
+
420
+ /* Structure to store a type and conversion function used for casting */
421
+ typedef struct swig_cast_info {
422
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
423
+ swig_converter_func converter; /* function to cast the void pointers */
424
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
425
+ struct swig_cast_info *prev; /* pointer to the previous cast */
426
+ } swig_cast_info;
427
+
428
+ /* Structure used to store module information
429
+ * Each module generates one structure like this, and the runtime collects
430
+ * all of these structures and stores them in a circularly linked list.*/
431
+ typedef struct swig_module_info {
432
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
433
+ size_t size; /* Number of types in this module */
434
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
435
+ swig_type_info **type_initial; /* Array of initially generated type structures */
436
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
437
+ void *clientdata; /* Language specific module data */
438
+ } swig_module_info;
439
+
440
+ /*
441
+ Compare two type names skipping the space characters, therefore
442
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
443
+
444
+ Return 0 when the two name types are equivalent, as in
445
+ strncmp, but skipping ' '.
446
+ */
447
+ SWIGRUNTIME int
448
+ SWIG_TypeNameComp(const char *f1, const char *l1,
449
+ const char *f2, const char *l2) {
450
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
451
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
452
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
453
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
454
+ }
455
+ return (l1 - f1) - (l2 - f2);
456
+ }
457
+
458
+ /*
459
+ Check type equivalence in a name list like <name1>|<name2>|...
460
+ Return 0 if not equal, 1 if equal
461
+ */
462
+ SWIGRUNTIME int
463
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
464
+ int equiv = 0;
465
+ const char* te = tb + strlen(tb);
466
+ const char* ne = nb;
467
+ while (!equiv && *ne) {
468
+ for (nb = ne; *ne; ++ne) {
469
+ if (*ne == '|') break;
470
+ }
471
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
472
+ if (*ne) ++ne;
473
+ }
474
+ return equiv;
475
+ }
476
+
477
+ /*
478
+ Check type equivalence in a name list like <name1>|<name2>|...
479
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
480
+ */
481
+ SWIGRUNTIME int
482
+ SWIG_TypeCompare(const char *nb, const char *tb) {
483
+ int equiv = 0;
484
+ const char* te = tb + strlen(tb);
485
+ const char* ne = nb;
486
+ while (!equiv && *ne) {
487
+ for (nb = ne; *ne; ++ne) {
488
+ if (*ne == '|') break;
489
+ }
490
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
491
+ if (*ne) ++ne;
492
+ }
493
+ return equiv;
494
+ }
495
+
496
+
497
+ /* think of this as a c++ template<> or a scheme macro */
498
+ #define SWIG_TypeCheck_Template(comparison, ty) \
499
+ if (ty) { \
500
+ swig_cast_info *iter = ty->cast; \
501
+ while (iter) { \
502
+ if (comparison) { \
503
+ if (iter == ty->cast) return iter; \
504
+ /* Move iter to the top of the linked list */ \
505
+ iter->prev->next = iter->next; \
506
+ if (iter->next) \
507
+ iter->next->prev = iter->prev; \
508
+ iter->next = ty->cast; \
509
+ iter->prev = 0; \
510
+ if (ty->cast) ty->cast->prev = iter; \
511
+ ty->cast = iter; \
512
+ return iter; \
513
+ } \
514
+ iter = iter->next; \
515
+ } \
516
+ } \
517
+ return 0
518
+
519
+ /*
520
+ Check the typename
521
+ */
522
+ SWIGRUNTIME swig_cast_info *
523
+ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
524
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
525
+ }
526
+
527
+ /* Same as previous function, except strcmp is replaced with a pointer comparison */
528
+ SWIGRUNTIME swig_cast_info *
529
+ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
530
+ SWIG_TypeCheck_Template(iter->type == from, into);
531
+ }
532
+
533
+ /*
534
+ Cast a pointer up an inheritance hierarchy
535
+ */
536
+ SWIGRUNTIMEINLINE void *
537
+ SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
538
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
539
+ }
540
+
541
+ /*
542
+ Dynamic pointer casting. Down an inheritance hierarchy
543
+ */
544
+ SWIGRUNTIME swig_type_info *
545
+ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
546
+ swig_type_info *lastty = ty;
547
+ if (!ty || !ty->dcast) return ty;
548
+ while (ty && (ty->dcast)) {
549
+ ty = (*ty->dcast)(ptr);
550
+ if (ty) lastty = ty;
551
+ }
552
+ return lastty;
553
+ }
554
+
555
+ /*
556
+ Return the name associated with this type
557
+ */
558
+ SWIGRUNTIMEINLINE const char *
559
+ SWIG_TypeName(const swig_type_info *ty) {
560
+ return ty->name;
561
+ }
562
+
563
+ /*
564
+ Return the pretty name associated with this type,
565
+ that is an unmangled type name in a form presentable to the user.
566
+ */
567
+ SWIGRUNTIME const char *
568
+ SWIG_TypePrettyName(const swig_type_info *type) {
569
+ /* The "str" field contains the equivalent pretty names of the
570
+ type, separated by vertical-bar characters. We choose
571
+ to print the last name, as it is often (?) the most
572
+ specific. */
573
+ if (!type) return NULL;
574
+ if (type->str != NULL) {
575
+ const char *last_name = type->str;
576
+ const char *s;
577
+ for (s = type->str; *s; s++)
578
+ if (*s == '|') last_name = s+1;
579
+ return last_name;
580
+ }
581
+ else
582
+ return type->name;
583
+ }
584
+
585
+ /*
586
+ Set the clientdata field for a type
587
+ */
588
+ SWIGRUNTIME void
589
+ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
590
+ swig_cast_info *cast = ti->cast;
591
+ /* if (ti->clientdata == clientdata) return; */
592
+ ti->clientdata = clientdata;
593
+
594
+ while (cast) {
595
+ if (!cast->converter) {
596
+ swig_type_info *tc = cast->type;
597
+ if (!tc->clientdata) {
598
+ SWIG_TypeClientData(tc, clientdata);
599
+ }
600
+ }
601
+ cast = cast->next;
602
+ }
603
+ }
604
+ SWIGRUNTIME void
605
+ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
606
+ SWIG_TypeClientData(ti, clientdata);
607
+ ti->owndata = 1;
608
+ }
609
+
610
+ /*
611
+ Search for a swig_type_info structure only by mangled name
612
+ Search is a O(log #types)
613
+
614
+ We start searching at module start, and finish searching when start == end.
615
+ Note: if start == end at the beginning of the function, we go all the way around
616
+ the circular list.
617
+ */
618
+ SWIGRUNTIME swig_type_info *
619
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
620
+ swig_module_info *end,
621
+ const char *name) {
622
+ swig_module_info *iter = start;
623
+ do {
624
+ if (iter->size) {
625
+ register size_t l = 0;
626
+ register size_t r = iter->size - 1;
627
+ do {
628
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
629
+ register size_t i = (l + r) >> 1;
630
+ const char *iname = iter->types[i]->name;
631
+ if (iname) {
632
+ register int compare = strcmp(name, iname);
633
+ if (compare == 0) {
634
+ return iter->types[i];
635
+ } else if (compare < 0) {
636
+ if (i) {
637
+ r = i - 1;
638
+ } else {
639
+ break;
640
+ }
641
+ } else if (compare > 0) {
642
+ l = i + 1;
643
+ }
644
+ } else {
645
+ break; /* should never happen */
646
+ }
647
+ } while (l <= r);
648
+ }
649
+ iter = iter->next;
650
+ } while (iter != end);
651
+ return 0;
652
+ }
653
+
654
+ /*
655
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
656
+ It first searches the mangled names of the types, which is a O(log #types)
657
+ If a type is not found it then searches the human readable names, which is O(#types).
658
+
659
+ We start searching at module start, and finish searching when start == end.
660
+ Note: if start == end at the beginning of the function, we go all the way around
661
+ the circular list.
662
+ */
663
+ SWIGRUNTIME swig_type_info *
664
+ SWIG_TypeQueryModule(swig_module_info *start,
665
+ swig_module_info *end,
666
+ const char *name) {
667
+ /* STEP 1: Search the name field using binary search */
668
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
669
+ if (ret) {
670
+ return ret;
671
+ } else {
672
+ /* STEP 2: If the type hasn't been found, do a complete search
673
+ of the str field (the human readable name) */
674
+ swig_module_info *iter = start;
675
+ do {
676
+ register size_t i = 0;
677
+ for (; i < iter->size; ++i) {
678
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
679
+ return iter->types[i];
680
+ }
681
+ iter = iter->next;
682
+ } while (iter != end);
683
+ }
684
+
685
+ /* neither found a match */
686
+ return 0;
687
+ }
688
+
689
+ /*
690
+ Pack binary data into a string
691
+ */
692
+ SWIGRUNTIME char *
693
+ SWIG_PackData(char *c, void *ptr, size_t sz) {
694
+ static const char hex[17] = "0123456789abcdef";
695
+ register const unsigned char *u = (unsigned char *) ptr;
696
+ register const unsigned char *eu = u + sz;
697
+ for (; u != eu; ++u) {
698
+ register unsigned char uu = *u;
699
+ *(c++) = hex[(uu & 0xf0) >> 4];
700
+ *(c++) = hex[uu & 0xf];
701
+ }
702
+ return c;
703
+ }
704
+
705
+ /*
706
+ Unpack binary data from a string
707
+ */
708
+ SWIGRUNTIME const char *
709
+ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
710
+ register unsigned char *u = (unsigned char *) ptr;
711
+ register const unsigned char *eu = u + sz;
712
+ for (; u != eu; ++u) {
713
+ register char d = *(c++);
714
+ register unsigned char uu;
715
+ if ((d >= '0') && (d <= '9'))
716
+ uu = ((d - '0') << 4);
717
+ else if ((d >= 'a') && (d <= 'f'))
718
+ uu = ((d - ('a'-10)) << 4);
719
+ else
720
+ return (char *) 0;
721
+ d = *(c++);
722
+ if ((d >= '0') && (d <= '9'))
723
+ uu |= (d - '0');
724
+ else if ((d >= 'a') && (d <= 'f'))
725
+ uu |= (d - ('a'-10));
726
+ else
727
+ return (char *) 0;
728
+ *u = uu;
729
+ }
730
+ return c;
731
+ }
732
+
733
+ /*
734
+ Pack 'void *' into a string buffer.
735
+ */
736
+ SWIGRUNTIME char *
737
+ SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
738
+ char *r = buff;
739
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
740
+ *(r++) = '_';
741
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
742
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
743
+ strcpy(r,name);
744
+ return buff;
745
+ }
746
+
747
+ SWIGRUNTIME const char *
748
+ SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
749
+ if (*c != '_') {
750
+ if (strcmp(c,"NULL") == 0) {
751
+ *ptr = (void *) 0;
752
+ return name;
753
+ } else {
754
+ return 0;
755
+ }
756
+ }
757
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
758
+ }
759
+
760
+ SWIGRUNTIME char *
761
+ SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
762
+ char *r = buff;
763
+ size_t lname = (name ? strlen(name) : 0);
764
+ if ((2*sz + 2 + lname) > bsz) return 0;
765
+ *(r++) = '_';
766
+ r = SWIG_PackData(r,ptr,sz);
767
+ if (lname) {
768
+ strncpy(r,name,lname+1);
769
+ } else {
770
+ *r = 0;
771
+ }
772
+ return buff;
773
+ }
774
+
775
+ SWIGRUNTIME const char *
776
+ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
777
+ if (*c != '_') {
778
+ if (strcmp(c,"NULL") == 0) {
779
+ memset(ptr,0,sz);
780
+ return name;
781
+ } else {
782
+ return 0;
783
+ }
784
+ }
785
+ return SWIG_UnpackData(++c,ptr,sz);
786
+ }
787
+
788
+ #ifdef __cplusplus
789
+ }
790
+ #endif
791
+
792
+ /* Errors in SWIG */
793
+ #define SWIG_UnknownError -1
794
+ #define SWIG_IOError -2
795
+ #define SWIG_RuntimeError -3
796
+ #define SWIG_IndexError -4
797
+ #define SWIG_TypeError -5
798
+ #define SWIG_DivisionByZero -6
799
+ #define SWIG_OverflowError -7
800
+ #define SWIG_SyntaxError -8
801
+ #define SWIG_ValueError -9
802
+ #define SWIG_SystemError -10
803
+ #define SWIG_AttributeError -11
804
+ #define SWIG_MemoryError -12
805
+ #define SWIG_NullReferenceError -13
806
+
807
+
808
+
809
+ #include <ruby.h>
810
+
811
+ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
812
+ #ifndef NUM2LL
813
+ #define NUM2LL(x) NUM2LONG((x))
814
+ #endif
815
+ #ifndef LL2NUM
816
+ #define LL2NUM(x) INT2NUM((long) (x))
817
+ #endif
818
+ #ifndef ULL2NUM
819
+ #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
820
+ #endif
821
+
822
+ /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
823
+ #ifndef NUM2ULL
824
+ #ifdef HAVE_LONG_LONG
825
+ #define NUM2ULL(x) rb_num2ull((x))
826
+ #else
827
+ #define NUM2ULL(x) NUM2ULONG(x)
828
+ #endif
829
+ #endif
830
+
831
+ /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
832
+ /* Define these for older versions so we can just write code the new way */
833
+ #ifndef RSTRING_LEN
834
+ # define RSTRING_LEN(x) RSTRING(x)->len
835
+ #endif
836
+ #ifndef RSTRING_PTR
837
+ # define RSTRING_PTR(x) RSTRING(x)->ptr
838
+ #endif
839
+ #ifndef RARRAY_LEN
840
+ # define RARRAY_LEN(x) RARRAY(x)->len
841
+ #endif
842
+ #ifndef RARRAY_PTR
843
+ # define RARRAY_PTR(x) RARRAY(x)->ptr
844
+ #endif
845
+
846
+ /*
847
+ * Need to be very careful about how these macros are defined, especially
848
+ * when compiling C++ code or C code with an ANSI C compiler.
849
+ *
850
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
851
+ * a Ruby method so that it can be passed as an argument to API functions
852
+ * like rb_define_method() and rb_define_singleton_method().
853
+ *
854
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
855
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
856
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
857
+ * and Data_Make_Struct().
858
+ */
859
+
860
+ #ifdef __cplusplus
861
+ # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
862
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
863
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
864
+ # define VOIDFUNC(f) ((void (*)()) f)
865
+ # else
866
+ # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
867
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
868
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
869
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
870
+ # else /* These definitions should work for Ruby 1.7+ */
871
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
872
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
873
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
874
+ # endif
875
+ # endif
876
+ #else
877
+ # define VALUEFUNC(f) (f)
878
+ # define VOIDFUNC(f) (f)
879
+ #endif
880
+
881
+ /* Don't use for expressions have side effect */
882
+ #ifndef RB_STRING_VALUE
883
+ #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
884
+ #endif
885
+ #ifndef StringValue
886
+ #define StringValue(s) RB_STRING_VALUE(s)
887
+ #endif
888
+ #ifndef StringValuePtr
889
+ #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
890
+ #endif
891
+ #ifndef StringValueLen
892
+ #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
893
+ #endif
894
+ #ifndef SafeStringValue
895
+ #define SafeStringValue(v) do {\
896
+ StringValue(v);\
897
+ rb_check_safe_str(v);\
898
+ } while (0)
899
+ #endif
900
+
901
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
902
+ #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
903
+ #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
904
+ #endif
905
+
906
+
907
+ /* -----------------------------------------------------------------------------
908
+ * error manipulation
909
+ * ----------------------------------------------------------------------------- */
910
+
911
+
912
+ /* Define some additional error types */
913
+ #define SWIG_ObjectPreviouslyDeletedError -100
914
+
915
+
916
+ /* Define custom exceptions for errors that do not map to existing Ruby
917
+ exceptions. Note this only works for C++ since a global cannot be
918
+ initialized by a funtion in C. For C, fallback to rb_eRuntimeError.*/
919
+
920
+ SWIGINTERN VALUE
921
+ getNullReferenceError(void) {
922
+ static int init = 0;
923
+ static VALUE rb_eNullReferenceError ;
924
+ if (!init) {
925
+ init = 1;
926
+ rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
927
+ }
928
+ return rb_eNullReferenceError;
929
+ }
930
+
931
+ SWIGINTERN VALUE
932
+ getObjectPreviouslyDeletedError(void) {
933
+ static int init = 0;
934
+ static VALUE rb_eObjectPreviouslyDeleted ;
935
+ if (!init) {
936
+ init = 1;
937
+ rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
938
+ }
939
+ return rb_eObjectPreviouslyDeleted;
940
+ }
941
+
942
+
943
+ SWIGINTERN VALUE
944
+ SWIG_Ruby_ErrorType(int SWIG_code) {
945
+ VALUE type;
946
+ switch (SWIG_code) {
947
+ case SWIG_MemoryError:
948
+ type = rb_eNoMemError;
949
+ break;
950
+ case SWIG_IOError:
951
+ type = rb_eIOError;
952
+ break;
953
+ case SWIG_RuntimeError:
954
+ type = rb_eRuntimeError;
955
+ break;
956
+ case SWIG_IndexError:
957
+ type = rb_eIndexError;
958
+ break;
959
+ case SWIG_TypeError:
960
+ type = rb_eTypeError;
961
+ break;
962
+ case SWIG_DivisionByZero:
963
+ type = rb_eZeroDivError;
964
+ break;
965
+ case SWIG_OverflowError:
966
+ type = rb_eRangeError;
967
+ break;
968
+ case SWIG_SyntaxError:
969
+ type = rb_eSyntaxError;
970
+ break;
971
+ case SWIG_ValueError:
972
+ type = rb_eArgError;
973
+ break;
974
+ case SWIG_SystemError:
975
+ type = rb_eFatal;
976
+ break;
977
+ case SWIG_AttributeError:
978
+ type = rb_eRuntimeError;
979
+ break;
980
+ case SWIG_NullReferenceError:
981
+ type = getNullReferenceError();
982
+ break;
983
+ case SWIG_ObjectPreviouslyDeletedError:
984
+ type = getObjectPreviouslyDeletedError();
985
+ break;
986
+ case SWIG_UnknownError:
987
+ type = rb_eRuntimeError;
988
+ break;
989
+ default:
990
+ type = rb_eRuntimeError;
991
+ }
992
+ return type;
993
+ }
994
+
995
+
996
+
997
+
998
+ /* -----------------------------------------------------------------------------
999
+ * See the LICENSE file for information on copyright, usage and redistribution
1000
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1001
+ *
1002
+ * rubytracking.swg
1003
+ *
1004
+ * This file contains support for tracking mappings from
1005
+ * Ruby objects to C++ objects. This functionality is needed
1006
+ * to implement mark functions for Ruby's mark and sweep
1007
+ * garbage collector.
1008
+ * ----------------------------------------------------------------------------- */
1009
+
1010
+ #ifdef __cplusplus
1011
+ extern "C" {
1012
+ #endif
1013
+
1014
+
1015
+ /* Global Ruby hash table to store Trackings from C/C++
1016
+ structs to Ruby Objects. */
1017
+ static VALUE swig_ruby_trackings;
1018
+
1019
+ /* Global variable that stores a reference to the ruby
1020
+ hash table delete function. */
1021
+ static ID swig_ruby_hash_delete = 0;
1022
+
1023
+ /* Setup a Ruby hash table to store Trackings */
1024
+ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1025
+ /* Create a ruby hash table to store Trackings from C++
1026
+ objects to Ruby objects. Also make sure to tell
1027
+ the garabage collector about the hash table. */
1028
+ swig_ruby_trackings = rb_hash_new();
1029
+ rb_gc_register_address(&swig_ruby_trackings);
1030
+
1031
+ /* Now store a reference to the hash table delete function
1032
+ so that we only have to look it up once.*/
1033
+ swig_ruby_hash_delete = rb_intern("delete");
1034
+ }
1035
+
1036
+ /* Get a Ruby number to reference a pointer */
1037
+ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1038
+ /* We cast the pointer to an unsigned long
1039
+ and then store a reference to it using
1040
+ a Ruby number object. */
1041
+
1042
+ /* Convert the pointer to a Ruby number */
1043
+ unsigned long value = (unsigned long) ptr;
1044
+ return LONG2NUM(value);
1045
+ }
1046
+
1047
+ /* Get a Ruby number to reference an object */
1048
+ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1049
+ /* We cast the object to an unsigned long
1050
+ and then store a reference to it using
1051
+ a Ruby number object. */
1052
+
1053
+ /* Convert the Object to a Ruby number */
1054
+ unsigned long value = (unsigned long) object;
1055
+ return LONG2NUM(value);
1056
+ }
1057
+
1058
+ /* Get a Ruby object from a previously stored reference */
1059
+ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1060
+ /* The provided Ruby number object is a reference
1061
+ to the Ruby object we want.*/
1062
+
1063
+ /* First convert the Ruby number to a C number */
1064
+ unsigned long value = NUM2LONG(reference);
1065
+ return (VALUE) value;
1066
+ }
1067
+
1068
+ /* Add a Tracking from a C/C++ struct to a Ruby object */
1069
+ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1070
+ /* In a Ruby hash table we store the pointer and
1071
+ the associated Ruby object. The trick here is
1072
+ that we cannot store the Ruby object directly - if
1073
+ we do then it cannot be garbage collected. So
1074
+ instead we typecast it as a unsigned long and
1075
+ convert it to a Ruby number object.*/
1076
+
1077
+ /* Get a reference to the pointer as a Ruby number */
1078
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1079
+
1080
+ /* Get a reference to the Ruby object as a Ruby number */
1081
+ VALUE value = SWIG_RubyObjectToReference(object);
1082
+
1083
+ /* Store the mapping to the global hash table. */
1084
+ rb_hash_aset(swig_ruby_trackings, key, value);
1085
+ }
1086
+
1087
+ /* Get the Ruby object that owns the specified C/C++ struct */
1088
+ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1089
+ /* Get a reference to the pointer as a Ruby number */
1090
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1091
+
1092
+ /* Now lookup the value stored in the global hash table */
1093
+ VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1094
+
1095
+ if (value == Qnil) {
1096
+ /* No object exists - return nil. */
1097
+ return Qnil;
1098
+ }
1099
+ else {
1100
+ /* Convert this value to Ruby object */
1101
+ return SWIG_RubyReferenceToObject(value);
1102
+ }
1103
+ }
1104
+
1105
+ /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1106
+ is very important to remove objects once they are destroyed
1107
+ since the same memory address may be reused later to create
1108
+ a new object. */
1109
+ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1110
+ /* Get a reference to the pointer as a Ruby number */
1111
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1112
+
1113
+ /* Delete the object from the hash table by calling Ruby's
1114
+ do this we need to call the Hash.delete method.*/
1115
+ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1116
+ }
1117
+
1118
+ /* This is a helper method that unlinks a Ruby object from its
1119
+ underlying C++ object. This is needed if the lifetime of the
1120
+ Ruby object is longer than the C++ object */
1121
+ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1122
+ VALUE object = SWIG_RubyInstanceFor(ptr);
1123
+
1124
+ if (object != Qnil) {
1125
+ DATA_PTR(object) = 0;
1126
+ }
1127
+ }
1128
+
1129
+
1130
+ #ifdef __cplusplus
1131
+ }
1132
+ #endif
1133
+
1134
+ /* -----------------------------------------------------------------------------
1135
+ * Ruby API portion that goes into the runtime
1136
+ * ----------------------------------------------------------------------------- */
1137
+
1138
+ #ifdef __cplusplus
1139
+ extern "C" {
1140
+ #endif
1141
+
1142
+ SWIGINTERN VALUE
1143
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1144
+ if (NIL_P(target)) {
1145
+ target = o;
1146
+ } else {
1147
+ if (TYPE(target) != T_ARRAY) {
1148
+ VALUE o2 = target;
1149
+ target = rb_ary_new();
1150
+ rb_ary_push(target, o2);
1151
+ }
1152
+ rb_ary_push(target, o);
1153
+ }
1154
+ return target;
1155
+ }
1156
+
1157
+ #ifdef __cplusplus
1158
+ }
1159
+ #endif
1160
+
1161
+
1162
+ /* -----------------------------------------------------------------------------
1163
+ * See the LICENSE file for information on copyright, usage and redistribution
1164
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1165
+ *
1166
+ * rubyrun.swg
1167
+ *
1168
+ * This file contains the runtime support for Ruby modules
1169
+ * and includes code for managing global variables and pointer
1170
+ * type checking.
1171
+ * ----------------------------------------------------------------------------- */
1172
+
1173
+ /* For backward compatibility only */
1174
+ #define SWIG_POINTER_EXCEPTION 0
1175
+
1176
+ /* for raw pointers */
1177
+ #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1178
+ #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1179
+ #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1180
+ #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1181
+ #define swig_owntype ruby_owntype
1182
+
1183
+ /* for raw packed data */
1184
+ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1185
+ #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1186
+
1187
+ /* for class or struct pointers */
1188
+ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1189
+ #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1190
+
1191
+ /* for C or C++ function pointers */
1192
+ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1193
+ #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1194
+
1195
+ /* for C++ member pointers, ie, member methods */
1196
+ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1197
+ #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1198
+
1199
+
1200
+ /* Runtime API */
1201
+
1202
+ #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
1203
+ #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1204
+
1205
+
1206
+ /* Error manipulation */
1207
+
1208
+ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1209
+ #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg)
1210
+ #define SWIG_fail goto fail
1211
+
1212
+
1213
+ /* Ruby-specific SWIG API */
1214
+
1215
+ #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1216
+ #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1217
+ #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1218
+ #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1219
+ #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1220
+
1221
+
1222
+ /* -----------------------------------------------------------------------------
1223
+ * pointers/data manipulation
1224
+ * ----------------------------------------------------------------------------- */
1225
+
1226
+ #ifdef __cplusplus
1227
+ extern "C" {
1228
+ #if 0
1229
+ } /* cc-mode */
1230
+ #endif
1231
+ #endif
1232
+
1233
+ typedef struct {
1234
+ VALUE klass;
1235
+ VALUE mImpl;
1236
+ void (*mark)(void *);
1237
+ void (*destroy)(void *);
1238
+ int trackObjects;
1239
+ } swig_class;
1240
+
1241
+
1242
+ static VALUE _mSWIG = Qnil;
1243
+ static VALUE _cSWIG_Pointer = Qnil;
1244
+ static VALUE swig_runtime_data_type_pointer = Qnil;
1245
+
1246
+ SWIGRUNTIME VALUE
1247
+ getExceptionClass(void) {
1248
+ static int init = 0;
1249
+ static VALUE rubyExceptionClass ;
1250
+ if (!init) {
1251
+ init = 1;
1252
+ rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1253
+ }
1254
+ return rubyExceptionClass;
1255
+ }
1256
+
1257
+ /* This code checks to see if the Ruby object being raised as part
1258
+ of an exception inherits from the Ruby class Exception. If so,
1259
+ the object is simply returned. If not, then a new Ruby exception
1260
+ object is created and that will be returned to Ruby.*/
1261
+ SWIGRUNTIME VALUE
1262
+ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1263
+ VALUE exceptionClass = getExceptionClass();
1264
+ if (rb_obj_is_kind_of(obj, exceptionClass)) {
1265
+ return obj;
1266
+ } else {
1267
+ return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1268
+ }
1269
+ }
1270
+
1271
+ /* Initialize Ruby runtime support */
1272
+ SWIGRUNTIME void
1273
+ SWIG_Ruby_InitRuntime(void)
1274
+ {
1275
+ if (_mSWIG == Qnil) {
1276
+ _mSWIG = rb_define_module("SWIG");
1277
+ }
1278
+ }
1279
+
1280
+ /* Define Ruby class for C type */
1281
+ SWIGRUNTIME void
1282
+ SWIG_Ruby_define_class(swig_type_info *type)
1283
+ {
1284
+ VALUE klass;
1285
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1286
+ sprintf(klass_name, "TYPE%s", type->name);
1287
+ if (NIL_P(_cSWIG_Pointer)) {
1288
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1289
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1290
+ }
1291
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1292
+ free((void *) klass_name);
1293
+ }
1294
+
1295
+ /* Create a new pointer object */
1296
+ SWIGRUNTIME VALUE
1297
+ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1298
+ {
1299
+ int own = flags & SWIG_POINTER_OWN;
1300
+
1301
+ char *klass_name;
1302
+ swig_class *sklass;
1303
+ VALUE klass;
1304
+ VALUE obj;
1305
+
1306
+ if (!ptr)
1307
+ return Qnil;
1308
+
1309
+ if (type->clientdata) {
1310
+ sklass = (swig_class *) type->clientdata;
1311
+
1312
+ /* Are we tracking this class and have we already returned this Ruby object? */
1313
+ if (sklass->trackObjects) {
1314
+ obj = SWIG_RubyInstanceFor(ptr);
1315
+
1316
+ /* Check the object's type and make sure it has the correct type.
1317
+ It might not in cases where methods do things like
1318
+ downcast methods. */
1319
+ if (obj != Qnil) {
1320
+ VALUE value = rb_iv_get(obj, "__swigtype__");
1321
+ char* type_name = RSTRING_PTR(value);
1322
+
1323
+ if (strcmp(type->name, type_name) == 0) {
1324
+ return obj;
1325
+ }
1326
+ }
1327
+ }
1328
+
1329
+ /* Create a new Ruby object */
1330
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), (own ? VOIDFUNC(sklass->destroy) : 0), ptr);
1331
+
1332
+ /* If tracking is on for this class then track this object. */
1333
+ if (sklass->trackObjects) {
1334
+ SWIG_RubyAddTracking(ptr, obj);
1335
+ }
1336
+ } else {
1337
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1338
+ sprintf(klass_name, "TYPE%s", type->name);
1339
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1340
+ free((void *) klass_name);
1341
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1342
+ }
1343
+ rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
1344
+
1345
+ return obj;
1346
+ }
1347
+
1348
+ /* Create a new class instance (always owned) */
1349
+ SWIGRUNTIME VALUE
1350
+ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1351
+ {
1352
+ VALUE obj;
1353
+ swig_class *sklass = (swig_class *) type->clientdata;
1354
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1355
+ rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
1356
+ return obj;
1357
+ }
1358
+
1359
+ /* Get type mangle from class name */
1360
+ SWIGRUNTIMEINLINE char *
1361
+ SWIG_Ruby_MangleStr(VALUE obj)
1362
+ {
1363
+ VALUE stype = rb_iv_get(obj, "__swigtype__");
1364
+ return StringValuePtr(stype);
1365
+ }
1366
+
1367
+ /* Acquire a pointer value */
1368
+ typedef void (*ruby_owntype)(void*);
1369
+
1370
+ SWIGRUNTIME ruby_owntype
1371
+ SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1372
+ if (obj) {
1373
+ ruby_owntype oldown = RDATA(obj)->dfree;
1374
+ RDATA(obj)->dfree = own;
1375
+ return oldown;
1376
+ } else {
1377
+ return 0;
1378
+ }
1379
+ }
1380
+
1381
+ /* Convert a pointer value */
1382
+ SWIGRUNTIME int
1383
+ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1384
+ {
1385
+ char *c;
1386
+ swig_cast_info *tc;
1387
+ void *vptr = 0;
1388
+
1389
+ /* Grab the pointer */
1390
+ if (NIL_P(obj)) {
1391
+ *ptr = 0;
1392
+ return SWIG_OK;
1393
+ } else {
1394
+ if (TYPE(obj) != T_DATA) {
1395
+ return SWIG_ERROR;
1396
+ }
1397
+ Data_Get_Struct(obj, void, vptr);
1398
+ }
1399
+
1400
+ if (own) *own = RDATA(obj)->dfree;
1401
+
1402
+ /* Check to see if the input object is giving up ownership
1403
+ of the underlying C struct or C++ object. If so then we
1404
+ need to reset the destructor since the Ruby object no
1405
+ longer owns the underlying C++ object.*/
1406
+ if (flags & SWIG_POINTER_DISOWN) {
1407
+ /* Is tracking on for this class? */
1408
+ int track = 0;
1409
+ if (ty && ty->clientdata) {
1410
+ swig_class *sklass = (swig_class *) ty->clientdata;
1411
+ track = sklass->trackObjects;
1412
+ }
1413
+
1414
+ if (track) {
1415
+ /* We are tracking objects for this class. Thus we change the destructor
1416
+ * to SWIG_RubyRemoveTracking. This allows us to
1417
+ * remove the mapping from the C++ to Ruby object
1418
+ * when the Ruby object is garbage collected. If we don't
1419
+ * do this, then it is possible we will return a reference
1420
+ * to a Ruby object that no longer exists thereby crashing Ruby. */
1421
+ RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1422
+ } else {
1423
+ RDATA(obj)->dfree = 0;
1424
+ }
1425
+ }
1426
+
1427
+ /* Do type-checking if type info was provided */
1428
+ if (ty) {
1429
+ if (ty->clientdata) {
1430
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1431
+ if (vptr == 0) {
1432
+ /* The object has already been deleted */
1433
+ return SWIG_ObjectPreviouslyDeletedError;
1434
+ }
1435
+ *ptr = vptr;
1436
+ return SWIG_OK;
1437
+ }
1438
+ }
1439
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
1440
+ return SWIG_ERROR;
1441
+ }
1442
+ tc = SWIG_TypeCheck(c, ty);
1443
+ if (!tc) {
1444
+ return SWIG_ERROR;
1445
+ }
1446
+ *ptr = SWIG_TypeCast(tc, vptr);
1447
+ } else {
1448
+ *ptr = vptr;
1449
+ }
1450
+
1451
+ return SWIG_OK;
1452
+ }
1453
+
1454
+ /* Check convert */
1455
+ SWIGRUNTIMEINLINE int
1456
+ SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1457
+ {
1458
+ char *c = SWIG_MangleStr(obj);
1459
+ if (!c) return 0;
1460
+ return SWIG_TypeCheck(c,ty) != 0;
1461
+ }
1462
+
1463
+ SWIGRUNTIME VALUE
1464
+ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1465
+ char result[1024];
1466
+ char *r = result;
1467
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1468
+ *(r++) = '_';
1469
+ r = SWIG_PackData(r, ptr, sz);
1470
+ strcpy(r, type->name);
1471
+ return rb_str_new2(result);
1472
+ }
1473
+
1474
+ /* Convert a packed value value */
1475
+ SWIGRUNTIME int
1476
+ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1477
+ swig_cast_info *tc;
1478
+ const char *c;
1479
+
1480
+ if (TYPE(obj) != T_STRING) goto type_error;
1481
+ c = StringValuePtr(obj);
1482
+ /* Pointer values must start with leading underscore */
1483
+ if (*c != '_') goto type_error;
1484
+ c++;
1485
+ c = SWIG_UnpackData(c, ptr, sz);
1486
+ if (ty) {
1487
+ tc = SWIG_TypeCheck(c, ty);
1488
+ if (!tc) goto type_error;
1489
+ }
1490
+ return SWIG_OK;
1491
+
1492
+ type_error:
1493
+ return SWIG_ERROR;
1494
+ }
1495
+
1496
+ SWIGRUNTIME swig_module_info *
1497
+ SWIG_Ruby_GetModule(void)
1498
+ {
1499
+ VALUE pointer;
1500
+ swig_module_info *ret = 0;
1501
+ VALUE verbose = rb_gv_get("VERBOSE");
1502
+
1503
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1504
+ rb_gv_set("VERBOSE", Qfalse);
1505
+
1506
+ /* first check if pointer already created */
1507
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1508
+ if (pointer != Qnil) {
1509
+ Data_Get_Struct(pointer, swig_module_info, ret);
1510
+ }
1511
+
1512
+ /* reinstate warnings */
1513
+ rb_gv_set("VERBOSE", verbose);
1514
+ return ret;
1515
+ }
1516
+
1517
+ SWIGRUNTIME void
1518
+ SWIG_Ruby_SetModule(swig_module_info *pointer)
1519
+ {
1520
+ /* register a new class */
1521
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1522
+ /* create and store the structure pointer to a global variable */
1523
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1524
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1525
+ }
1526
+
1527
+ #ifdef __cplusplus
1528
+ #if 0
1529
+ { /* cc-mode */
1530
+ #endif
1531
+ }
1532
+ #endif
1533
+
1534
+
1535
+
1536
+ #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1537
+
1538
+ #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1539
+
1540
+
1541
+
1542
+ /* -------- TYPES TABLE (BEGIN) -------- */
1543
+
1544
+ #define SWIGTYPE_p_VersionProblem swig_types[0]
1545
+ #define SWIGTYPE_p_char swig_types[1]
1546
+ static swig_type_info *swig_types[3];
1547
+ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
1548
+ #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1549
+ #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1550
+
1551
+ /* -------- TYPES TABLE (END) -------- */
1552
+
1553
+ #define SWIG_init Init_dep_gecode
1554
+ #define SWIG_name "Dep_gecode"
1555
+
1556
+ static VALUE mDep_gecode;
1557
+
1558
+ #define SWIGVERSION 0x010331
1559
+ #define SWIG_VERSION SWIGVERSION
1560
+
1561
+
1562
+ #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
1563
+ #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
1564
+
1565
+
1566
+ #include <stdexcept>
1567
+
1568
+
1569
+ #include "dep_selector_to_gecode_interface.h"
1570
+
1571
+
1572
+ #include <limits.h>
1573
+ #ifndef LLONG_MIN
1574
+ # define LLONG_MIN LONG_LONG_MIN
1575
+ #endif
1576
+ #ifndef LLONG_MAX
1577
+ # define LLONG_MAX LONG_LONG_MAX
1578
+ #endif
1579
+ #ifndef ULLONG_MAX
1580
+ # define ULLONG_MAX ULONG_LONG_MAX
1581
+ #endif
1582
+
1583
+
1584
+ SWIGINTERN VALUE
1585
+ SWIG_ruby_failed(void)
1586
+ {
1587
+ return Qnil;
1588
+ }
1589
+
1590
+
1591
+ /*@SWIG:%ruby_aux_method@*/
1592
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1593
+ {
1594
+ VALUE obj = args[0];
1595
+ VALUE type = TYPE(obj);
1596
+ long *res = (long *)(args[1]);
1597
+ *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
1598
+ return obj;
1599
+ }
1600
+ /*@SWIG@*/
1601
+
1602
+ SWIGINTERN int
1603
+ SWIG_AsVal_long (VALUE obj, long* val)
1604
+ {
1605
+ VALUE type = TYPE(obj);
1606
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1607
+ long v;
1608
+ VALUE a[2];
1609
+ a[0] = obj;
1610
+ a[1] = (VALUE)(&v);
1611
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1612
+ if (val) *val = v;
1613
+ return SWIG_OK;
1614
+ }
1615
+ }
1616
+ return SWIG_TypeError;
1617
+ }
1618
+
1619
+
1620
+ SWIGINTERN int
1621
+ SWIG_AsVal_int (VALUE obj, int *val)
1622
+ {
1623
+ long v;
1624
+ int res = SWIG_AsVal_long (obj, &v);
1625
+ if (SWIG_IsOK(res)) {
1626
+ if ((v < INT_MIN || v > INT_MAX)) {
1627
+ return SWIG_OverflowError;
1628
+ } else {
1629
+ if (val) *val = static_cast< int >(v);
1630
+ }
1631
+ }
1632
+ return res;
1633
+ }
1634
+
1635
+
1636
+ #define SWIG_From_long LONG2NUM
1637
+
1638
+
1639
+ SWIGINTERNINLINE VALUE
1640
+ SWIG_From_int (int value)
1641
+ {
1642
+ return SWIG_From_long (value);
1643
+ }
1644
+
1645
+
1646
+ SWIGINTERNINLINE VALUE
1647
+ SWIG_From_bool (bool value)
1648
+ {
1649
+ return value ? Qtrue : Qfalse;
1650
+ }
1651
+
1652
+ SWIGINTERN VALUE
1653
+ _wrap_VersionProblemCreate(int argc, VALUE *argv, VALUE self) {
1654
+ int arg1 ;
1655
+ VersionProblem *result = 0 ;
1656
+ int val1 ;
1657
+ int ecode1 = 0 ;
1658
+ VALUE vresult = Qnil;
1659
+
1660
+ if ((argc < 1) || (argc > 1)) {
1661
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
1662
+ }
1663
+ ecode1 = SWIG_AsVal_int(argv[0], &val1);
1664
+ if (!SWIG_IsOK(ecode1)) {
1665
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VersionProblemCreate" "', argument " "1"" of type '" "int""'");
1666
+ }
1667
+ arg1 = static_cast< int >(val1);
1668
+ result = (VersionProblem *)VersionProblemCreate(arg1);
1669
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_VersionProblem, 0 | 0 );
1670
+ return vresult;
1671
+ fail:
1672
+ return Qnil;
1673
+ }
1674
+
1675
+
1676
+ SWIGINTERN VALUE
1677
+ _wrap_VersionProblemDestroy(int argc, VALUE *argv, VALUE self) {
1678
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1679
+ void *argp1 = 0 ;
1680
+ int res1 = 0 ;
1681
+
1682
+ if ((argc < 1) || (argc > 1)) {
1683
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
1684
+ }
1685
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1686
+ if (!SWIG_IsOK(res1)) {
1687
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VersionProblemDestroy" "', argument " "1"" of type '" "VersionProblem *""'");
1688
+ }
1689
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1690
+ VersionProblemDestroy(arg1);
1691
+ return Qnil;
1692
+ fail:
1693
+ return Qnil;
1694
+ }
1695
+
1696
+
1697
+ SWIGINTERN VALUE
1698
+ _wrap_VersionProblemSize(int argc, VALUE *argv, VALUE self) {
1699
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1700
+ int result;
1701
+ void *argp1 = 0 ;
1702
+ int res1 = 0 ;
1703
+ VALUE vresult = Qnil;
1704
+
1705
+ if ((argc < 1) || (argc > 1)) {
1706
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
1707
+ }
1708
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1709
+ if (!SWIG_IsOK(res1)) {
1710
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VersionProblemSize" "', argument " "1"" of type '" "VersionProblem *""'");
1711
+ }
1712
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1713
+ result = (int)VersionProblemSize(arg1);
1714
+ vresult = SWIG_From_int(static_cast< int >(result));
1715
+ return vresult;
1716
+ fail:
1717
+ return Qnil;
1718
+ }
1719
+
1720
+
1721
+ SWIGINTERN VALUE
1722
+ _wrap_VersionProblemPackageCount(int argc, VALUE *argv, VALUE self) {
1723
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1724
+ int result;
1725
+ void *argp1 = 0 ;
1726
+ int res1 = 0 ;
1727
+ VALUE vresult = Qnil;
1728
+
1729
+ if ((argc < 1) || (argc > 1)) {
1730
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
1731
+ }
1732
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1733
+ if (!SWIG_IsOK(res1)) {
1734
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VersionProblemPackageCount" "', argument " "1"" of type '" "VersionProblem *""'");
1735
+ }
1736
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1737
+ result = (int)VersionProblemPackageCount(arg1);
1738
+ vresult = SWIG_From_int(static_cast< int >(result));
1739
+ return vresult;
1740
+ fail:
1741
+ return Qnil;
1742
+ }
1743
+
1744
+
1745
+ SWIGINTERN VALUE
1746
+ _wrap_AddPackage(int argc, VALUE *argv, VALUE self) {
1747
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1748
+ int arg2 ;
1749
+ int arg3 ;
1750
+ int arg4 ;
1751
+ int result;
1752
+ void *argp1 = 0 ;
1753
+ int res1 = 0 ;
1754
+ int val2 ;
1755
+ int ecode2 = 0 ;
1756
+ int val3 ;
1757
+ int ecode3 = 0 ;
1758
+ int val4 ;
1759
+ int ecode4 = 0 ;
1760
+ VALUE vresult = Qnil;
1761
+
1762
+ if ((argc < 4) || (argc > 4)) {
1763
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
1764
+ }
1765
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1766
+ if (!SWIG_IsOK(res1)) {
1767
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AddPackage" "', argument " "1"" of type '" "VersionProblem *""'");
1768
+ }
1769
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1770
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
1771
+ if (!SWIG_IsOK(ecode2)) {
1772
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "AddPackage" "', argument " "2"" of type '" "int""'");
1773
+ }
1774
+ arg2 = static_cast< int >(val2);
1775
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
1776
+ if (!SWIG_IsOK(ecode3)) {
1777
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "AddPackage" "', argument " "3"" of type '" "int""'");
1778
+ }
1779
+ arg3 = static_cast< int >(val3);
1780
+ ecode4 = SWIG_AsVal_int(argv[3], &val4);
1781
+ if (!SWIG_IsOK(ecode4)) {
1782
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "AddPackage" "', argument " "4"" of type '" "int""'");
1783
+ }
1784
+ arg4 = static_cast< int >(val4);
1785
+ result = (int)AddPackage(arg1,arg2,arg3,arg4);
1786
+ vresult = SWIG_From_int(static_cast< int >(result));
1787
+ return vresult;
1788
+ fail:
1789
+ return Qnil;
1790
+ }
1791
+
1792
+
1793
+ SWIGINTERN VALUE
1794
+ _wrap_AddVersionConstraint(int argc, VALUE *argv, VALUE self) {
1795
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1796
+ int arg2 ;
1797
+ int arg3 ;
1798
+ int arg4 ;
1799
+ int arg5 ;
1800
+ int arg6 ;
1801
+ bool result;
1802
+ void *argp1 = 0 ;
1803
+ int res1 = 0 ;
1804
+ int val2 ;
1805
+ int ecode2 = 0 ;
1806
+ int val3 ;
1807
+ int ecode3 = 0 ;
1808
+ int val4 ;
1809
+ int ecode4 = 0 ;
1810
+ int val5 ;
1811
+ int ecode5 = 0 ;
1812
+ int val6 ;
1813
+ int ecode6 = 0 ;
1814
+ VALUE vresult = Qnil;
1815
+
1816
+ if ((argc < 6) || (argc > 6)) {
1817
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 6)",argc); SWIG_fail;
1818
+ }
1819
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1820
+ if (!SWIG_IsOK(res1)) {
1821
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AddVersionConstraint" "', argument " "1"" of type '" "VersionProblem *""'");
1822
+ }
1823
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1824
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
1825
+ if (!SWIG_IsOK(ecode2)) {
1826
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "AddVersionConstraint" "', argument " "2"" of type '" "int""'");
1827
+ }
1828
+ arg2 = static_cast< int >(val2);
1829
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
1830
+ if (!SWIG_IsOK(ecode3)) {
1831
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "AddVersionConstraint" "', argument " "3"" of type '" "int""'");
1832
+ }
1833
+ arg3 = static_cast< int >(val3);
1834
+ ecode4 = SWIG_AsVal_int(argv[3], &val4);
1835
+ if (!SWIG_IsOK(ecode4)) {
1836
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "AddVersionConstraint" "', argument " "4"" of type '" "int""'");
1837
+ }
1838
+ arg4 = static_cast< int >(val4);
1839
+ ecode5 = SWIG_AsVal_int(argv[4], &val5);
1840
+ if (!SWIG_IsOK(ecode5)) {
1841
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "AddVersionConstraint" "', argument " "5"" of type '" "int""'");
1842
+ }
1843
+ arg5 = static_cast< int >(val5);
1844
+ ecode6 = SWIG_AsVal_int(argv[5], &val6);
1845
+ if (!SWIG_IsOK(ecode6)) {
1846
+ SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "AddVersionConstraint" "', argument " "6"" of type '" "int""'");
1847
+ }
1848
+ arg6 = static_cast< int >(val6);
1849
+ result = (bool)AddVersionConstraint(arg1,arg2,arg3,arg4,arg5,arg6);
1850
+ vresult = SWIG_From_bool(static_cast< bool >(result));
1851
+ return vresult;
1852
+ fail:
1853
+ return Qnil;
1854
+ }
1855
+
1856
+
1857
+ SWIGINTERN VALUE
1858
+ _wrap_MarkPackageSuspicious(int argc, VALUE *argv, VALUE self) {
1859
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1860
+ int arg2 ;
1861
+ void *argp1 = 0 ;
1862
+ int res1 = 0 ;
1863
+ int val2 ;
1864
+ int ecode2 = 0 ;
1865
+
1866
+ if ((argc < 2) || (argc > 2)) {
1867
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
1868
+ }
1869
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1870
+ if (!SWIG_IsOK(res1)) {
1871
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MarkPackageSuspicious" "', argument " "1"" of type '" "VersionProblem *""'");
1872
+ }
1873
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1874
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
1875
+ if (!SWIG_IsOK(ecode2)) {
1876
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MarkPackageSuspicious" "', argument " "2"" of type '" "int""'");
1877
+ }
1878
+ arg2 = static_cast< int >(val2);
1879
+ MarkPackageSuspicious(arg1,arg2);
1880
+ return Qnil;
1881
+ fail:
1882
+ return Qnil;
1883
+ }
1884
+
1885
+
1886
+ SWIGINTERN VALUE
1887
+ _wrap_MarkPackageRequired(int argc, VALUE *argv, VALUE self) {
1888
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1889
+ int arg2 ;
1890
+ void *argp1 = 0 ;
1891
+ int res1 = 0 ;
1892
+ int val2 ;
1893
+ int ecode2 = 0 ;
1894
+
1895
+ if ((argc < 2) || (argc > 2)) {
1896
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
1897
+ }
1898
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1899
+ if (!SWIG_IsOK(res1)) {
1900
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MarkPackageRequired" "', argument " "1"" of type '" "VersionProblem *""'");
1901
+ }
1902
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1903
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
1904
+ if (!SWIG_IsOK(ecode2)) {
1905
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MarkPackageRequired" "', argument " "2"" of type '" "int""'");
1906
+ }
1907
+ arg2 = static_cast< int >(val2);
1908
+ MarkPackageRequired(arg1,arg2);
1909
+ return Qnil;
1910
+ fail:
1911
+ return Qnil;
1912
+ }
1913
+
1914
+
1915
+ SWIGINTERN VALUE
1916
+ _wrap_MarkPackagePreferredToBeAtLatest(int argc, VALUE *argv, VALUE self) {
1917
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1918
+ int arg2 ;
1919
+ int arg3 ;
1920
+ void *argp1 = 0 ;
1921
+ int res1 = 0 ;
1922
+ int val2 ;
1923
+ int ecode2 = 0 ;
1924
+ int val3 ;
1925
+ int ecode3 = 0 ;
1926
+
1927
+ if ((argc < 3) || (argc > 3)) {
1928
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
1929
+ }
1930
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1931
+ if (!SWIG_IsOK(res1)) {
1932
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MarkPackagePreferredToBeAtLatest" "', argument " "1"" of type '" "VersionProblem *""'");
1933
+ }
1934
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1935
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
1936
+ if (!SWIG_IsOK(ecode2)) {
1937
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MarkPackagePreferredToBeAtLatest" "', argument " "2"" of type '" "int""'");
1938
+ }
1939
+ arg2 = static_cast< int >(val2);
1940
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
1941
+ if (!SWIG_IsOK(ecode3)) {
1942
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "MarkPackagePreferredToBeAtLatest" "', argument " "3"" of type '" "int""'");
1943
+ }
1944
+ arg3 = static_cast< int >(val3);
1945
+ MarkPackagePreferredToBeAtLatest(arg1,arg2,arg3);
1946
+ return Qnil;
1947
+ fail:
1948
+ return Qnil;
1949
+ }
1950
+
1951
+
1952
+ SWIGINTERN VALUE
1953
+ _wrap_GetPackageVersion(int argc, VALUE *argv, VALUE self) {
1954
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1955
+ int arg2 ;
1956
+ int result;
1957
+ void *argp1 = 0 ;
1958
+ int res1 = 0 ;
1959
+ int val2 ;
1960
+ int ecode2 = 0 ;
1961
+ VALUE vresult = Qnil;
1962
+
1963
+ if ((argc < 2) || (argc > 2)) {
1964
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
1965
+ }
1966
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1967
+ if (!SWIG_IsOK(res1)) {
1968
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetPackageVersion" "', argument " "1"" of type '" "VersionProblem *""'");
1969
+ }
1970
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
1971
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
1972
+ if (!SWIG_IsOK(ecode2)) {
1973
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GetPackageVersion" "', argument " "2"" of type '" "int""'");
1974
+ }
1975
+ arg2 = static_cast< int >(val2);
1976
+ result = (int)GetPackageVersion(arg1,arg2);
1977
+ vresult = SWIG_From_int(static_cast< int >(result));
1978
+ return vresult;
1979
+ fail:
1980
+ return Qnil;
1981
+ }
1982
+
1983
+
1984
+ SWIGINTERN VALUE
1985
+ _wrap_GetPackageDisabledState(int argc, VALUE *argv, VALUE self) {
1986
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
1987
+ int arg2 ;
1988
+ bool result;
1989
+ void *argp1 = 0 ;
1990
+ int res1 = 0 ;
1991
+ int val2 ;
1992
+ int ecode2 = 0 ;
1993
+ VALUE vresult = Qnil;
1994
+
1995
+ if ((argc < 2) || (argc > 2)) {
1996
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
1997
+ }
1998
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
1999
+ if (!SWIG_IsOK(res1)) {
2000
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetPackageDisabledState" "', argument " "1"" of type '" "VersionProblem *""'");
2001
+ }
2002
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
2003
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2004
+ if (!SWIG_IsOK(ecode2)) {
2005
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GetPackageDisabledState" "', argument " "2"" of type '" "int""'");
2006
+ }
2007
+ arg2 = static_cast< int >(val2);
2008
+ result = (bool)GetPackageDisabledState(arg1,arg2);
2009
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2010
+ return vresult;
2011
+ fail:
2012
+ return Qnil;
2013
+ }
2014
+
2015
+
2016
+ SWIGINTERN VALUE
2017
+ _wrap_GetPackageMax(int argc, VALUE *argv, VALUE self) {
2018
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
2019
+ int arg2 ;
2020
+ int result;
2021
+ void *argp1 = 0 ;
2022
+ int res1 = 0 ;
2023
+ int val2 ;
2024
+ int ecode2 = 0 ;
2025
+ VALUE vresult = Qnil;
2026
+
2027
+ if ((argc < 2) || (argc > 2)) {
2028
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2029
+ }
2030
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
2031
+ if (!SWIG_IsOK(res1)) {
2032
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetPackageMax" "', argument " "1"" of type '" "VersionProblem *""'");
2033
+ }
2034
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
2035
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2036
+ if (!SWIG_IsOK(ecode2)) {
2037
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GetPackageMax" "', argument " "2"" of type '" "int""'");
2038
+ }
2039
+ arg2 = static_cast< int >(val2);
2040
+ result = (int)GetPackageMax(arg1,arg2);
2041
+ vresult = SWIG_From_int(static_cast< int >(result));
2042
+ return vresult;
2043
+ fail:
2044
+ return Qnil;
2045
+ }
2046
+
2047
+
2048
+ SWIGINTERN VALUE
2049
+ _wrap_GetPackageMin(int argc, VALUE *argv, VALUE self) {
2050
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
2051
+ int arg2 ;
2052
+ int result;
2053
+ void *argp1 = 0 ;
2054
+ int res1 = 0 ;
2055
+ int val2 ;
2056
+ int ecode2 = 0 ;
2057
+ VALUE vresult = Qnil;
2058
+
2059
+ if ((argc < 2) || (argc > 2)) {
2060
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2061
+ }
2062
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
2063
+ if (!SWIG_IsOK(res1)) {
2064
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetPackageMin" "', argument " "1"" of type '" "VersionProblem *""'");
2065
+ }
2066
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
2067
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2068
+ if (!SWIG_IsOK(ecode2)) {
2069
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GetPackageMin" "', argument " "2"" of type '" "int""'");
2070
+ }
2071
+ arg2 = static_cast< int >(val2);
2072
+ result = (int)GetPackageMin(arg1,arg2);
2073
+ vresult = SWIG_From_int(static_cast< int >(result));
2074
+ return vresult;
2075
+ fail:
2076
+ return Qnil;
2077
+ }
2078
+
2079
+
2080
+ SWIGINTERN VALUE
2081
+ _wrap_GetDisabledVariableCount(int argc, VALUE *argv, VALUE self) {
2082
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
2083
+ int result;
2084
+ void *argp1 = 0 ;
2085
+ int res1 = 0 ;
2086
+ VALUE vresult = Qnil;
2087
+
2088
+ if ((argc < 1) || (argc > 1)) {
2089
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2090
+ }
2091
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
2092
+ if (!SWIG_IsOK(res1)) {
2093
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetDisabledVariableCount" "', argument " "1"" of type '" "VersionProblem *""'");
2094
+ }
2095
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
2096
+ result = (int)GetDisabledVariableCount(arg1);
2097
+ vresult = SWIG_From_int(static_cast< int >(result));
2098
+ return vresult;
2099
+ fail:
2100
+ return Qnil;
2101
+ }
2102
+
2103
+
2104
+ SWIGINTERN VALUE
2105
+ _wrap_VersionProblemDump(int argc, VALUE *argv, VALUE self) {
2106
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
2107
+ void *argp1 = 0 ;
2108
+ int res1 = 0 ;
2109
+
2110
+ if ((argc < 1) || (argc > 1)) {
2111
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2112
+ }
2113
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
2114
+ if (!SWIG_IsOK(res1)) {
2115
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VersionProblemDump" "', argument " "1"" of type '" "VersionProblem *""'");
2116
+ }
2117
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
2118
+ VersionProblemDump(arg1);
2119
+ return Qnil;
2120
+ fail:
2121
+ return Qnil;
2122
+ }
2123
+
2124
+
2125
+ SWIGINTERN VALUE
2126
+ _wrap_VersionProblemPrintPackageVar(int argc, VALUE *argv, VALUE self) {
2127
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
2128
+ int arg2 ;
2129
+ void *argp1 = 0 ;
2130
+ int res1 = 0 ;
2131
+ int val2 ;
2132
+ int ecode2 = 0 ;
2133
+
2134
+ if ((argc < 2) || (argc > 2)) {
2135
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2136
+ }
2137
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
2138
+ if (!SWIG_IsOK(res1)) {
2139
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VersionProblemPrintPackageVar" "', argument " "1"" of type '" "VersionProblem *""'");
2140
+ }
2141
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
2142
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2143
+ if (!SWIG_IsOK(ecode2)) {
2144
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VersionProblemPrintPackageVar" "', argument " "2"" of type '" "int""'");
2145
+ }
2146
+ arg2 = static_cast< int >(val2);
2147
+ VersionProblemPrintPackageVar(arg1,arg2);
2148
+ return Qnil;
2149
+ fail:
2150
+ return Qnil;
2151
+ }
2152
+
2153
+
2154
+ SWIGINTERN VALUE
2155
+ _wrap_Solve(int argc, VALUE *argv, VALUE self) {
2156
+ VersionProblem *arg1 = (VersionProblem *) 0 ;
2157
+ VersionProblem *result = 0 ;
2158
+ void *argp1 = 0 ;
2159
+ int res1 = 0 ;
2160
+ VALUE vresult = Qnil;
2161
+
2162
+ if ((argc < 1) || (argc > 1)) {
2163
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2164
+ }
2165
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_VersionProblem, 0 | 0 );
2166
+ if (!SWIG_IsOK(res1)) {
2167
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Solve" "', argument " "1"" of type '" "VersionProblem *""'");
2168
+ }
2169
+ arg1 = reinterpret_cast< VersionProblem * >(argp1);
2170
+ result = (VersionProblem *)Solve(arg1);
2171
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_VersionProblem, 0 | 0 );
2172
+ return vresult;
2173
+ fail:
2174
+ return Qnil;
2175
+ }
2176
+
2177
+
2178
+
2179
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2180
+
2181
+ static swig_type_info _swigt__p_VersionProblem = {"_p_VersionProblem", "VersionProblem *", 0, 0, (void*)0, 0};
2182
+ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
2183
+
2184
+ static swig_type_info *swig_type_initial[] = {
2185
+ &_swigt__p_VersionProblem,
2186
+ &_swigt__p_char,
2187
+ };
2188
+
2189
+ static swig_cast_info _swigc__p_VersionProblem[] = { {&_swigt__p_VersionProblem, 0, 0, 0},{0, 0, 0, 0}};
2190
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2191
+
2192
+ static swig_cast_info *swig_cast_initial[] = {
2193
+ _swigc__p_VersionProblem,
2194
+ _swigc__p_char,
2195
+ };
2196
+
2197
+
2198
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2199
+
2200
+ /* -----------------------------------------------------------------------------
2201
+ * Type initialization:
2202
+ * This problem is tough by the requirement that no dynamic
2203
+ * memory is used. Also, since swig_type_info structures store pointers to
2204
+ * swig_cast_info structures and swig_cast_info structures store pointers back
2205
+ * to swig_type_info structures, we need some lookup code at initialization.
2206
+ * The idea is that swig generates all the structures that are needed.
2207
+ * The runtime then collects these partially filled structures.
2208
+ * The SWIG_InitializeModule function takes these initial arrays out of
2209
+ * swig_module, and does all the lookup, filling in the swig_module.types
2210
+ * array with the correct data and linking the correct swig_cast_info
2211
+ * structures together.
2212
+ *
2213
+ * The generated swig_type_info structures are assigned staticly to an initial
2214
+ * array. We just loop through that array, and handle each type individually.
2215
+ * First we lookup if this type has been already loaded, and if so, use the
2216
+ * loaded structure instead of the generated one. Then we have to fill in the
2217
+ * cast linked list. The cast data is initially stored in something like a
2218
+ * two-dimensional array. Each row corresponds to a type (there are the same
2219
+ * number of rows as there are in the swig_type_initial array). Each entry in
2220
+ * a column is one of the swig_cast_info structures for that type.
2221
+ * The cast_initial array is actually an array of arrays, because each row has
2222
+ * a variable number of columns. So to actually build the cast linked list,
2223
+ * we find the array of casts associated with the type, and loop through it
2224
+ * adding the casts to the list. The one last trick we need to do is making
2225
+ * sure the type pointer in the swig_cast_info struct is correct.
2226
+ *
2227
+ * First off, we lookup the cast->type name to see if it is already loaded.
2228
+ * There are three cases to handle:
2229
+ * 1) If the cast->type has already been loaded AND the type we are adding
2230
+ * casting info to has not been loaded (it is in this module), THEN we
2231
+ * replace the cast->type pointer with the type pointer that has already
2232
+ * been loaded.
2233
+ * 2) If BOTH types (the one we are adding casting info to, and the
2234
+ * cast->type) are loaded, THEN the cast info has already been loaded by
2235
+ * the previous module so we just ignore it.
2236
+ * 3) Finally, if cast->type has not already been loaded, then we add that
2237
+ * swig_cast_info to the linked list (because the cast->type) pointer will
2238
+ * be correct.
2239
+ * ----------------------------------------------------------------------------- */
2240
+
2241
+ #ifdef __cplusplus
2242
+ extern "C" {
2243
+ #if 0
2244
+ } /* c-mode */
2245
+ #endif
2246
+ #endif
2247
+
2248
+ #if 0
2249
+ #define SWIGRUNTIME_DEBUG
2250
+ #endif
2251
+
2252
+
2253
+ SWIGRUNTIME void
2254
+ SWIG_InitializeModule(void *clientdata) {
2255
+ size_t i;
2256
+ swig_module_info *module_head, *iter;
2257
+ int found;
2258
+
2259
+ clientdata = clientdata;
2260
+
2261
+ /* check to see if the circular list has been setup, if not, set it up */
2262
+ if (swig_module.next==0) {
2263
+ /* Initialize the swig_module */
2264
+ swig_module.type_initial = swig_type_initial;
2265
+ swig_module.cast_initial = swig_cast_initial;
2266
+ swig_module.next = &swig_module;
2267
+ }
2268
+
2269
+ /* Try and load any already created modules */
2270
+ module_head = SWIG_GetModule(clientdata);
2271
+ if (!module_head) {
2272
+ /* This is the first module loaded for this interpreter */
2273
+ /* so set the swig module into the interpreter */
2274
+ SWIG_SetModule(clientdata, &swig_module);
2275
+ module_head = &swig_module;
2276
+ } else {
2277
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2278
+ found=0;
2279
+ iter=module_head;
2280
+ do {
2281
+ if (iter==&swig_module) {
2282
+ found=1;
2283
+ break;
2284
+ }
2285
+ iter=iter->next;
2286
+ } while (iter!= module_head);
2287
+
2288
+ /* if the is found in the list, then all is done and we may leave */
2289
+ if (found) return;
2290
+ /* otherwise we must add out module into the list */
2291
+ swig_module.next = module_head->next;
2292
+ module_head->next = &swig_module;
2293
+ }
2294
+
2295
+ /* Now work on filling in swig_module.types */
2296
+ #ifdef SWIGRUNTIME_DEBUG
2297
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2298
+ #endif
2299
+ for (i = 0; i < swig_module.size; ++i) {
2300
+ swig_type_info *type = 0;
2301
+ swig_type_info *ret;
2302
+ swig_cast_info *cast;
2303
+
2304
+ #ifdef SWIGRUNTIME_DEBUG
2305
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2306
+ #endif
2307
+
2308
+ /* if there is another module already loaded */
2309
+ if (swig_module.next != &swig_module) {
2310
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2311
+ }
2312
+ if (type) {
2313
+ /* Overwrite clientdata field */
2314
+ #ifdef SWIGRUNTIME_DEBUG
2315
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
2316
+ #endif
2317
+ if (swig_module.type_initial[i]->clientdata) {
2318
+ type->clientdata = swig_module.type_initial[i]->clientdata;
2319
+ #ifdef SWIGRUNTIME_DEBUG
2320
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2321
+ #endif
2322
+ }
2323
+ } else {
2324
+ type = swig_module.type_initial[i];
2325
+ }
2326
+
2327
+ /* Insert casting types */
2328
+ cast = swig_module.cast_initial[i];
2329
+ while (cast->type) {
2330
+
2331
+ /* Don't need to add information already in the list */
2332
+ ret = 0;
2333
+ #ifdef SWIGRUNTIME_DEBUG
2334
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2335
+ #endif
2336
+ if (swig_module.next != &swig_module) {
2337
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2338
+ #ifdef SWIGRUNTIME_DEBUG
2339
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2340
+ #endif
2341
+ }
2342
+ if (ret) {
2343
+ if (type == swig_module.type_initial[i]) {
2344
+ #ifdef SWIGRUNTIME_DEBUG
2345
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2346
+ #endif
2347
+ cast->type = ret;
2348
+ ret = 0;
2349
+ } else {
2350
+ /* Check for casting already in the list */
2351
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2352
+ #ifdef SWIGRUNTIME_DEBUG
2353
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2354
+ #endif
2355
+ if (!ocast) ret = 0;
2356
+ }
2357
+ }
2358
+
2359
+ if (!ret) {
2360
+ #ifdef SWIGRUNTIME_DEBUG
2361
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2362
+ #endif
2363
+ if (type->cast) {
2364
+ type->cast->prev = cast;
2365
+ cast->next = type->cast;
2366
+ }
2367
+ type->cast = cast;
2368
+ }
2369
+ cast++;
2370
+ }
2371
+ /* Set entry in modules->types array equal to the type */
2372
+ swig_module.types[i] = type;
2373
+ }
2374
+ swig_module.types[i] = 0;
2375
+
2376
+ #ifdef SWIGRUNTIME_DEBUG
2377
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2378
+ for (i = 0; i < swig_module.size; ++i) {
2379
+ int j = 0;
2380
+ swig_cast_info *cast = swig_module.cast_initial[i];
2381
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2382
+ while (cast->type) {
2383
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2384
+ cast++;
2385
+ ++j;
2386
+ }
2387
+ printf("---- Total casts: %d\n",j);
2388
+ }
2389
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2390
+ #endif
2391
+ }
2392
+
2393
+ /* This function will propagate the clientdata field of type to
2394
+ * any new swig_type_info structures that have been added into the list
2395
+ * of equivalent types. It is like calling
2396
+ * SWIG_TypeClientData(type, clientdata) a second time.
2397
+ */
2398
+ SWIGRUNTIME void
2399
+ SWIG_PropagateClientData(void) {
2400
+ size_t i;
2401
+ swig_cast_info *equiv;
2402
+ static int init_run = 0;
2403
+
2404
+ if (init_run) return;
2405
+ init_run = 1;
2406
+
2407
+ for (i = 0; i < swig_module.size; i++) {
2408
+ if (swig_module.types[i]->clientdata) {
2409
+ equiv = swig_module.types[i]->cast;
2410
+ while (equiv) {
2411
+ if (!equiv->converter) {
2412
+ if (equiv->type && !equiv->type->clientdata)
2413
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2414
+ }
2415
+ equiv = equiv->next;
2416
+ }
2417
+ }
2418
+ }
2419
+ }
2420
+
2421
+ #ifdef __cplusplus
2422
+ #if 0
2423
+ { /* c-mode */
2424
+ #endif
2425
+ }
2426
+ #endif
2427
+
2428
+
2429
+ #ifdef __cplusplus
2430
+ extern "C"
2431
+ #endif
2432
+ SWIGEXPORT void Init_dep_gecode(void) {
2433
+ size_t i;
2434
+
2435
+ SWIG_InitRuntime();
2436
+ mDep_gecode = rb_define_module("Dep_gecode");
2437
+
2438
+ SWIG_InitializeModule(0);
2439
+ for (i = 0; i < swig_module.size; i++) {
2440
+ SWIG_define_class(swig_module.types[i]);
2441
+ }
2442
+
2443
+ SWIG_RubyInitializeTrackings();
2444
+ rb_define_module_function(mDep_gecode, "VersionProblemCreate", VALUEFUNC(_wrap_VersionProblemCreate), -1);
2445
+ rb_define_module_function(mDep_gecode, "VersionProblemDestroy", VALUEFUNC(_wrap_VersionProblemDestroy), -1);
2446
+ rb_define_module_function(mDep_gecode, "VersionProblemSize", VALUEFUNC(_wrap_VersionProblemSize), -1);
2447
+ rb_define_module_function(mDep_gecode, "VersionProblemPackageCount", VALUEFUNC(_wrap_VersionProblemPackageCount), -1);
2448
+ rb_define_module_function(mDep_gecode, "AddPackage", VALUEFUNC(_wrap_AddPackage), -1);
2449
+ rb_define_module_function(mDep_gecode, "AddVersionConstraint", VALUEFUNC(_wrap_AddVersionConstraint), -1);
2450
+ rb_define_module_function(mDep_gecode, "MarkPackageSuspicious", VALUEFUNC(_wrap_MarkPackageSuspicious), -1);
2451
+ rb_define_module_function(mDep_gecode, "MarkPackageRequired", VALUEFUNC(_wrap_MarkPackageRequired), -1);
2452
+ rb_define_module_function(mDep_gecode, "MarkPackagePreferredToBeAtLatest", VALUEFUNC(_wrap_MarkPackagePreferredToBeAtLatest), -1);
2453
+ rb_define_module_function(mDep_gecode, "GetPackageVersion", VALUEFUNC(_wrap_GetPackageVersion), -1);
2454
+ rb_define_module_function(mDep_gecode, "GetPackageDisabledState", VALUEFUNC(_wrap_GetPackageDisabledState), -1);
2455
+ rb_define_module_function(mDep_gecode, "GetPackageMax", VALUEFUNC(_wrap_GetPackageMax), -1);
2456
+ rb_define_module_function(mDep_gecode, "GetPackageMin", VALUEFUNC(_wrap_GetPackageMin), -1);
2457
+ rb_define_module_function(mDep_gecode, "GetDisabledVariableCount", VALUEFUNC(_wrap_GetDisabledVariableCount), -1);
2458
+ rb_define_module_function(mDep_gecode, "VersionProblemDump", VALUEFUNC(_wrap_VersionProblemDump), -1);
2459
+ rb_define_module_function(mDep_gecode, "VersionProblemPrintPackageVar", VALUEFUNC(_wrap_VersionProblemPrintPackageVar), -1);
2460
+ rb_define_module_function(mDep_gecode, "Solve", VALUEFUNC(_wrap_Solve), -1);
2461
+ }
2462
+