annotate lib/swig/swigwin-2.0.11/Lib/constraints.i @ 1983:5cd26f2c6904

small fix
author Ritor1
date Fri, 01 Nov 2013 17:29:49 +0600
parents b3009adc0e2f
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 /* -----------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2 * constraints.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 *
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4 * SWIG constraints library.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5 *
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6 * SWIG library file containing typemaps for implementing various kinds of
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7 * constraints. Depends upon the SWIG exception library for generating
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8 * errors in a language-independent manner.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 * ----------------------------------------------------------------------------- */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11 #ifdef AUTODOC
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 %text %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13 %include <constraints.i>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 This library provides support for applying constraints to function
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16 arguments. Using a constraint, you can restrict arguments to be
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17 positive numbers, non-NULL pointers, and so on. The following
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18 constraints are available :
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20 Number POSITIVE - Positive number (not zero)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21 Number NEGATIVE - Negative number (not zero)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22 Number NONZERO - Nonzero number
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 Number NONNEGATIVE - Positive number (including zero)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24 Number NONPOSITIVE - Negative number (including zero)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25 Pointer NONNULL - Non-NULL pointer
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26 Pointer ALIGN8 - 8-byte aligned pointer
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27 Pointer ALIGN4 - 4-byte aligned pointer
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 Pointer ALIGN2 - 2-byte aligned pointer
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30 To use the constraints, you need to "apply" them to specific
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31 function arguments in your code. This is done using the %apply
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32 directive. For example :
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 %apply Number NONNEGATIVE { double nonneg };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 double sqrt(double nonneg); // Name of argument must match
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37 %apply Pointer NONNULL { void *ptr };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38 void *malloc(int POSITIVE); // May return a NULL pointer
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 void free(void *ptr); // May not accept a NULL pointer
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41 Any function argument of the type you specify with the %apply directive
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42 will be checked with the appropriate constraint. Multiple types may
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 be specified as follows :
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 %apply Pointer NONNULL { void *, Vector *, List *, double *};
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 In this case, all of the types listed would be checked for non-NULL
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48 pointers.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50 The common datatypes of int, short, long, unsigned int, unsigned long,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51 unsigned short, unsigned char, signed char, float, and double can be
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52 checked without using the %apply directive by simply using the
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53 constraint name as the parameter name. For example :
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55 double sqrt(double NONNEGATIVE);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56 double log(double POSITIVE);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 If you have used typedef to change type-names, you can also do this :
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 %apply double { Real }; // Make everything defined for doubles
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61 // work for Reals.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 Real sqrt(Real NONNEGATIVE);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63 Real log(Real POSITIVE);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 %include <exception.i>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70 #ifdef SWIGCSHARP
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 // Required attribute for C# exception handling
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72 #define SWIGCSHARPCANTHROW , canthrow=1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74 #define SWIGCSHARPCANTHROW
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78 // Positive numbers
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81 int POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
82 short POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
83 long POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
84 unsigned int POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
85 unsigned short POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
86 unsigned long POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
87 signed char POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
88 unsigned char POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
89 float POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
90 double POSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
91 Number POSITIVE
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
92 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
93 if ($1 <= 0) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
94 SWIG_exception(SWIG_ValueError,"Expected a positive value.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
95 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
96 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
97
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
98 // Negative numbers
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
99
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
100 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
101 int NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
102 short NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
103 long NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
104 unsigned int NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
105 unsigned short NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
106 unsigned long NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
107 signed char NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
108 unsigned char NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
109 float NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
110 double NEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
111 Number NEGATIVE
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
112 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
113 if ($1 >= 0) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
114 SWIG_exception(SWIG_ValueError,"Expected a negative value.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
115 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
116 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
117
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
118 // Nonzero numbers
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
119
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
120 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
121 int NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
122 short NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
123 long NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
124 unsigned int NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
125 unsigned short NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
126 unsigned long NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
127 signed char NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
128 unsigned char NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
129 float NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
130 double NONZERO,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
131 Number NONZERO
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
132 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
133 if ($1 == 0) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
134 SWIG_exception(SWIG_ValueError,"Expected a nonzero value.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
135 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
136 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
137
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
138 // Nonnegative numbers
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
139
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
140 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
141 int NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
142 short NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
143 long NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
144 unsigned int NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
145 unsigned short NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
146 unsigned long NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
147 signed char NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
148 unsigned char NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
149 float NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
150 double NONNEGATIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
151 Number NONNEGATIVE
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
152 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
153 if ($1 < 0) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
154 SWIG_exception(SWIG_ValueError,"Expected a non-negative value.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
155 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
156 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
157
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
158 // Nonpositive numbers
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
159
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
160 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
161 int NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
162 short NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
163 long NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
164 unsigned int NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
165 unsigned short NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
166 unsigned long NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
167 signed char NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
168 unsigned char NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
169 float NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
170 double NONPOSITIVE,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
171 Number NONPOSITIVE
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
172 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
173 if ($1 > 0) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
174 SWIG_exception(SWIG_ValueError,"Expected a non-positive value.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
175 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
176 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
177
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
178 // Non-NULL pointer
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
179
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
180 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
181 void * NONNULL,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
182 Pointer NONNULL
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
183 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
184 if (!$1) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
185 SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
186 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
187 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
188
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
189 // Aligned pointers
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
190
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
191 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
192 void * ALIGN8,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
193 Pointer ALIGN8
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
194 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
195 unsigned long long tmp;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
196 tmp = (unsigned long long) $1;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
197 if (tmp & 7) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
198 SWIG_exception(SWIG_ValueError,"Pointer must be 8-byte aligned.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
199 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
200 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
201
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
202 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
203 void * ALIGN4,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
204 Pointer ALIGN4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
205 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
206 unsigned long long tmp;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
207 tmp = (unsigned long long) $1;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
208 if (tmp & 3) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
209 SWIG_exception(SWIG_ValueError,"Pointer must be 4-byte aligned.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
210 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
211 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
212
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
213 %typemap(check SWIGCSHARPCANTHROW)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
214 void * ALIGN2,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
215 Pointer ALIGN2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
216 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
217 unsigned long long tmp;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
218 tmp = (unsigned long long) $1;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
219 if (tmp & 1) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
220 SWIG_exception(SWIG_ValueError,"Pointer must be 2-byte aligned.");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
221 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
222 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
223
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
224