2 * ====================================================================
3 * Copyright (c) 2005-2006 CollabNet. All rights reserved.
5 * This software is licensed as described in the file COPYING, which
6 * you should have received as part of this distribution. The terms
7 * are also available at http://subversion.tigris.org/license-1.html.
8 * If newer versions of this license are posted there, you may use a
9 * newer version instead, at your option.
11 * This software consists of voluntary contributions made by many
12 * individuals. For exact contribution history, see the revision
13 * history and logs, available at http://subversion.tigris.org/.
14 * ====================================================================
16 * svn_global.swg: Central point for global definitions to be used in
17 * every bindings module. This file is %included before anything
18 * else, in every Subversion .i file.
22 %include constraints.i
25 /* Include this early, so it can redefine typemaps included from the
26 SWIG standard library before they get %apply-ed anywhere. */
27 %include svn_swigcompat.swg
29 /* SWIG can't understand __attribute__(x), so we make it go away */
30 #define __attribute__(x)
32 /* SWIG doesn't handle variadic parameters well */
33 %ignore svn_string_createv;
34 %ignore svn_stringbuf_createv;
38 #include "svn_pools.h"
43 #include "swigutil_py.h"
48 #include "swigutil_pl.h"
53 #include "swigutil_rb.h"
59 %feature("autodoc",1);
62 static PyObject * _global_py_pool = NULL;
65 /* The SWIG $argnum variable reports the current argument number
66 in the underlying C code. This is a bit counterintuitive for
67 Python programmers, because the underlying C function may have
68 very different argument numbers than the wrapper Python function.
70 SWIG doesn't provide any good way of getting Python argument
71 numbers, so we extract the argument number using macros. This
72 isn't a perfect solution, but it does the job. */
73 #define $svn_argnum svn_argnum_$input
75 /* We assume here that Subversion functions have no more than
76 20 fixed parameters. If you want to wrap a function that has
77 more fixed parameters, you'll need to add more #define
80 #define svn_argnum_obj0 1
81 #define svn_argnum_obj1 2
82 #define svn_argnum_obj2 3
83 #define svn_argnum_obj3 4
84 #define svn_argnum_obj4 5
85 #define svn_argnum_obj5 6
86 #define svn_argnum_obj6 7
87 #define svn_argnum_obj7 8
88 #define svn_argnum_obj8 9
89 #define svn_argnum_obj9 10
90 #define svn_argnum_obj10 11
91 #define svn_argnum_obj11 12
92 #define svn_argnum_obj12 13
93 #define svn_argnum_obj13 14
94 #define svn_argnum_obj14 15
95 #define svn_argnum_obj15 16
96 #define svn_argnum_obj16 17
97 #define svn_argnum_obj17 18
98 #define svn_argnum_obj18 19
99 #define svn_argnum_obj19 20
102 /* Python format specifiers. Use Python instead of SWIG to parse
103 these basic types, because Python reports better error messages
104 (with correct argument numbers). */
105 %typemap (in, parse="s")
106 char *, char const *, char * const, char const * const "";
107 %typemap (in, parse="c") char "";
108 %typemap (in, fragment=SWIG_As_frag(long)) long
110 $1 = ($1_ltype)SWIG_As(long)($input);
111 if (SWIG_arg_fail($svn_argnum)) {
115 %typemap (in, fragment=SWIG_As_frag(unsigned long)) unsigned long
117 $1 = ($1_ltype)SWIG_As(unsigned long)($input);
118 if (SWIG_arg_fail($svn_argnum)) {
122 %apply long { short, int, ssize_t, enum SWIGTYPE, svn_boolean_t,
123 apr_seek_where_t, apr_fileperms_t }
124 %apply unsigned long { unsigned char, unsigned short, unsigned int, size_t }
127 %clear unsigned long long;
129 /* These typemaps use apr_int64_t so that they will work on Win32 and Unix */
130 %typemap (in) long long
131 " $1 = ($1_ltype) PyLong_AsLongLong($input); ";
133 %typemap (in) unsigned long long
134 " $1 = ($1_ltype) PyLong_AsUnsignedLongLong($input); ";
136 %typemap (out) apr_time_t, apr_int64_t, long long, __int64
137 " $result = PyLong_FromLongLong((apr_int64_t)($1)); ";
139 %typemap (out) apr_uint64_t, unsigned long long, unsigned __int64
140 " $result = PyLong_FromUnsignedLongLong((apr_uint64_t)($1)); ";
142 %typemap(in,numinputs=0) long long *OUTPUT (apr_int64_t temp)
144 %typemap(argout) long long *OUTPUT {
145 %append_output(PyLong_FromLongLong(*$1));
154 %typemap (in) long long
156 $1 = ($1_ltype)NUM2LL($input);
159 %typemap (out) long long
161 $result = LL2NUM(($1_ltype)($1));
164 %typemap(argout) long long *OUTPUT
166 %append_output(LL2NUM(*$1));
169 %clear unsigned long long;
171 %typemap (in) unsigned long long
173 $1 = ($1_ltype)NUM2ULL($input);
176 %typemap (out) unsigned long long
178 $result = ULL2NUM(($1_ltype)($1));
181 %typemap(argout) unsigned long long *OUTPUT
183 %append_output(ULL2NUM(*$1));
190 /* Ruby has strict capitalization conventions -
191 tell SWIG to not warn as it renames things to follow these. */
192 #pragma SWIG nowarn=801
195 static VALUE _global_svn_swig_rb_pool = Qnil;
196 static apr_pool_t *_global_pool = NULL;
197 static VALUE vresult = Qnil;
198 static VALUE *_global_vresult_address = &vresult;
203 /* Now, include the main Subversion typemap library. */
204 %include svn_types.swg