1 /* -----------------------------------------------------------------------------
2 * See the LICENSE file for information on copyright, usage and redistribution
3 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
8 * ----------------------------------------------------------------------------- */
10 %include <csharphead.swg>
12 /* The ctype, imtype and cstype typemaps work together and so there should be one of each.
13 * The ctype typemap contains the PInvoke type used in the PInvoke (C/C++) code.
14 * The imtype typemap contains the C# type used in the intermediary class.
15 * The cstype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */
19 %fragment("SWIG_PackData", "header") {
20 /* Pack binary data into a string */
21 SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
22 static const char hex[17] = "0123456789abcdef";
23 register const unsigned char *u = (unsigned char *) ptr;
24 register const unsigned char *eu = u + sz;
25 for (; u != eu; ++u) {
26 register unsigned char uu = *u;
27 *(c++) = hex[(uu & 0xf0) >> 4];
28 *(c++) = hex[uu & 0xf];
34 %fragment("SWIG_UnPackData", "header") {
35 /* Unpack binary data from a string */
36 SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
37 register unsigned char *u = (unsigned char *) ptr;
38 register const unsigned char *eu = u + sz;
39 for (; u != eu; ++u) {
40 register char d = *(c++);
41 register unsigned char uu;
42 if ((d >= '0') && (d <= '9'))
43 uu = ((d - '0') << 4);
44 else if ((d >= 'a') && (d <= 'f'))
45 uu = ((d - ('a'-10)) << 4);
49 if ((d >= '0') && (d <= '9'))
51 else if ((d >= 'a') && (d <= 'f'))
62 %typemap(ctype) bool, const bool & "unsigned int"
63 %typemap(ctype) char, const char & "char"
64 %typemap(ctype) signed char, const signed char & "signed char"
65 %typemap(ctype) unsigned char, const unsigned char & "unsigned char"
66 %typemap(ctype) short, const short & "short"
67 %typemap(ctype) unsigned short, const unsigned short & "unsigned short"
68 %typemap(ctype) int, const int & "int"
69 %typemap(ctype) unsigned int, const unsigned int & "unsigned int"
70 %typemap(ctype) long, const long & "long"
71 %typemap(ctype) unsigned long, const unsigned long & "unsigned long"
72 %typemap(ctype) long long, const long long & "long long"
73 %typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
74 %typemap(ctype) float, const float & "float"
75 %typemap(ctype) double, const double & "double"
76 %typemap(ctype) void "void"
78 %typemap(imtype) bool, const bool & "bool"
79 %typemap(imtype) char, const char & "char"
80 %typemap(imtype) signed char, const signed char & "sbyte"
81 %typemap(imtype) unsigned char, const unsigned char & "byte"
82 %typemap(imtype) short, const short & "short"
83 %typemap(imtype) unsigned short, const unsigned short & "ushort"
84 %typemap(imtype) int, const int & "int"
85 %typemap(imtype) unsigned int, const unsigned int & "uint"
86 %typemap(imtype) long, const long & "int"
87 %typemap(imtype) unsigned long, const unsigned long & "uint"
88 %typemap(imtype) long long, const long long & "long"
89 %typemap(imtype) unsigned long long, const unsigned long long & "ulong"
90 %typemap(imtype) float, const float & "float"
91 %typemap(imtype) double, const double & "double"
92 %typemap(imtype) void "void"
94 %typemap(cstype) bool, const bool & "bool"
95 %typemap(cstype) char, const char & "char"
96 %typemap(cstype) signed char, const signed char & "sbyte"
97 %typemap(cstype) unsigned char, const unsigned char & "byte"
98 %typemap(cstype) short, const short & "short"
99 %typemap(cstype) unsigned short, const unsigned short & "ushort"
100 %typemap(cstype) int, const int & "int"
101 %typemap(cstype) unsigned int, const unsigned int & "uint"
102 %typemap(cstype) long, const long & "int"
103 %typemap(cstype) unsigned long, const unsigned long & "uint"
104 %typemap(cstype) long long, const long long & "long"
105 %typemap(cstype) unsigned long long, const unsigned long long & "ulong"
106 %typemap(cstype) float, const float & "float"
107 %typemap(cstype) double, const double & "double"
108 %typemap(cstype) void "void"
110 %typemap(ctype) char *, char *&, char[ANY], char[] "char *"
111 %typemap(imtype) char *, char *&, char[ANY], char[] "string"
112 %typemap(cstype) char *, char *&, char[ANY], char[] "string"
114 /* Non primitive types */
115 %typemap(ctype) SWIGTYPE "void *"
116 %typemap(imtype, out="IntPtr") SWIGTYPE "HandleRef"
117 %typemap(cstype) SWIGTYPE "$&csclassname"
119 %typemap(ctype) SWIGTYPE [] "void *"
120 %typemap(imtype, out="IntPtr") SWIGTYPE [] "HandleRef"
121 %typemap(cstype) SWIGTYPE [] "$csclassname"
123 %typemap(ctype) SWIGTYPE * "void *"
124 %typemap(imtype, out="IntPtr") SWIGTYPE * "HandleRef"
125 %typemap(cstype) SWIGTYPE * "$csclassname"
127 %typemap(ctype) SWIGTYPE & "void *"
128 %typemap(imtype, out="IntPtr") SWIGTYPE & "HandleRef"
129 %typemap(cstype) SWIGTYPE & "$csclassname"
131 /* pointer to a class member */
132 %typemap(ctype) SWIGTYPE (CLASS::*) "char *"
133 %typemap(imtype) SWIGTYPE (CLASS::*) "string"
134 %typemap(cstype) SWIGTYPE (CLASS::*) "$csclassname"
136 /* The following are the in and out typemaps. These are the PInvoke code generating typemaps for converting from C# to C and visa versa. */
138 /* primitive types */
140 %{ $1 = $input ? true : false; %}
142 %typemap(directorout) bool
143 %{ $result = $input ? true : false; %}
145 %typemap(csdirectorin) bool "$iminput"
146 %typemap(csdirectorout) bool "$cscall"
161 %{ $1 = ($1_ltype)$input; %}
163 %typemap(directorout) char,
176 %{ $result = ($1_ltype)$input; %}
178 %typemap(directorin) bool "$input = $1;"
179 %typemap(directorin) char "$input = $1;"
180 %typemap(directorin) signed char "$input = $1;"
181 %typemap(directorin) unsigned char "$input = $1;"
182 %typemap(directorin) short "$input = $1;"
183 %typemap(directorin) unsigned short "$input = $1;"
184 %typemap(directorin) int "$input = $1;"
185 %typemap(directorin) unsigned int "$input = $1;"
186 %typemap(directorin) long "$input = $1;"
187 %typemap(directorin) unsigned long "$input = $1;"
188 %typemap(directorin) long long "$input = $1;"
189 %typemap(directorin) unsigned long long "$input = $1;"
190 %typemap(directorin) float "$input = $1;"
191 %typemap(directorin) double "$input = $1;"
193 %typemap(csdirectorin) char,
208 %typemap(csdirectorout) char,
223 %typemap(out) bool %{ $result = $1; %}
224 %typemap(out) char %{ $result = $1; %}
225 %typemap(out) signed char %{ $result = $1; %}
226 %typemap(out) unsigned char %{ $result = $1; %}
227 %typemap(out) short %{ $result = $1; %}
228 %typemap(out) unsigned short %{ $result = $1; %}
229 %typemap(out) int %{ $result = $1; %}
230 %typemap(out) unsigned int %{ $result = $1; %}
231 %typemap(out) long %{ $result = $1; %}
232 %typemap(out) unsigned long %{ $result = (unsigned long)$1; %}
233 %typemap(out) long long %{ $result = $1; %}
234 %typemap(out) unsigned long long %{ $result = $1; %}
235 %typemap(out) float %{ $result = $1; %}
236 %typemap(out) double %{ $result = $1; %}
238 /* char * - treat as String */
239 %typemap(in) char * %{ $1 = ($1_ltype)$input; %}
240 %typemap(out) char * %{ $result = SWIG_csharp_string_callback((const char *)$1); %}
241 %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) char * %{ $result = ($1_ltype)$input; %}
242 %typemap(directorin) char * %{ $input = SWIG_csharp_string_callback((const char *)$1); %}
243 %typemap(csdirectorin) char * "$iminput"
244 %typemap(csdirectorout) char * "$cscall"
246 /* char *& - treat as String */
247 %typemap(in) char *& ($*1_ltype temp = 0) %{
248 temp = ($*1_ltype)$input;
251 %typemap(out) char *& %{ if ($1) $result = SWIG_csharp_string_callback((const char *)*$1); %}
253 %typemap(out, null="") void ""
254 %typemap(csdirectorin) void "$iminput"
255 %typemap(csdirectorout) void "$cscall"
256 %typemap(directorin) void ""
258 /* primitive types by const reference */
259 %typemap(in) const bool & ($*1_ltype temp)
260 %{ temp = $input ? true : false;
263 %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const bool &
264 %{ static $*1_ltype temp;
265 temp = $input ? true : false;
268 %typemap(csdirectorin) const bool & "$iminput"
269 %typemap(csdirectorout) const bool & "$cscall"
271 %typemap(in) const char & ($*1_ltype temp),
272 const signed char & ($*1_ltype temp),
273 const unsigned char & ($*1_ltype temp),
274 const short & ($*1_ltype temp),
275 const unsigned short & ($*1_ltype temp),
276 const int & ($*1_ltype temp),
277 const unsigned int & ($*1_ltype temp),
278 const long & ($*1_ltype temp),
279 const unsigned long & ($*1_ltype temp),
280 const long long & ($*1_ltype temp),
281 const unsigned long long & ($*1_ltype temp),
282 const float & ($*1_ltype temp),
283 const double & ($*1_ltype temp)
284 %{ temp = ($*1_ltype)$input;
287 %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const char &,
289 const unsigned char &,
291 const unsigned short &,
293 const unsigned int &,
295 const unsigned long &,
299 %{ static $*1_ltype temp;
300 temp = ($*1_ltype)$input;
303 %typemap(directorin) const bool & "$input = $1_name;"
304 %typemap(directorin) const char & "$input = $1_name;"
305 %typemap(directorin) const signed char & "$input = $1_name;"
306 %typemap(directorin) const unsigned char & "$input = $1_name;"
307 %typemap(directorin) const short & "$input = $1_name;"
308 %typemap(directorin) const unsigned short & "$input = $1_name;"
309 %typemap(directorin) const int & "$input = $1_name;"
310 %typemap(directorin) const unsigned int & "$input = $1_name;"
311 %typemap(directorin) const long & "$input = $1_name;"
312 %typemap(directorin) const unsigned long & "$input = $1_name;"
313 %typemap(directorin) const long long & "$input = $1_name;"
314 %typemap(directorin) const float & "$input = $1_name;"
315 %typemap(directorin) const double & "$input = $1_name;"
317 %typemap(csdirectorin) const char & ($*1_ltype temp),
318 const signed char & ($*1_ltype temp),
319 const unsigned char & ($*1_ltype temp),
320 const short & ($*1_ltype temp),
321 const unsigned short & ($*1_ltype temp),
322 const int & ($*1_ltype temp),
323 const unsigned int & ($*1_ltype temp),
324 const long & ($*1_ltype temp),
325 const unsigned long & ($*1_ltype temp),
326 const long long & ($*1_ltype temp),
327 const float & ($*1_ltype temp),
328 const double & ($*1_ltype temp)
331 %typemap(csdirectorout) const char & ($*1_ltype temp),
332 const signed char & ($*1_ltype temp),
333 const unsigned char & ($*1_ltype temp),
334 const short & ($*1_ltype temp),
335 const unsigned short & ($*1_ltype temp),
336 const int & ($*1_ltype temp),
337 const unsigned int & ($*1_ltype temp),
338 const long & ($*1_ltype temp),
339 const unsigned long & ($*1_ltype temp),
340 const long long & ($*1_ltype temp),
341 const float & ($*1_ltype temp),
342 const double & ($*1_ltype temp)
346 %typemap(out) const bool & %{ $result = *$1; %}
347 %typemap(out) const char & %{ $result = *$1; %}
348 %typemap(out) const signed char & %{ $result = *$1; %}
349 %typemap(out) const unsigned char & %{ $result = *$1; %}
350 %typemap(out) const short & %{ $result = *$1; %}
351 %typemap(out) const unsigned short & %{ $result = *$1; %}
352 %typemap(out) const int & %{ $result = *$1; %}
353 %typemap(out) const unsigned int & %{ $result = *$1; %}
354 %typemap(out) const long & %{ $result = *$1; %}
355 %typemap(out) const unsigned long & %{ $result = (unsigned long)*$1; %}
356 %typemap(out) const long long & %{ $result = *$1; %}
357 %typemap(out) const unsigned long long & %{ $result = *$1; %}
358 %typemap(out) const float & %{ $result = *$1; %}
359 %typemap(out) const double & %{ $result = *$1; %}
361 /* Default handling. Object passed by value. Convert to a pointer */
362 %typemap(in, canthrow=1) SWIGTYPE ($&1_type argp)
363 %{ argp = ($&1_ltype)$input;
365 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
370 %typemap(directorout) SWIGTYPE
372 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0);
375 $result = *($&1_ltype)$input; %}
377 %typemap(out) SWIGTYPE
379 %{ $result = new $1_ltype((const $1_ltype &)$1); %}
382 $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
383 memmove($1ptr, &$1, sizeof($1_type));
388 %typemap(directorin) SWIGTYPE
389 %{ $input = (void *)&$1; %}
390 %typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, false)"
391 %typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle"
393 /* Generic pointers and references */
394 %typemap(in) SWIGTYPE * %{ $1 = ($1_ltype)$input; %}
395 %typemap(in, fragment="SWIG_UnPackData") SWIGTYPE (CLASS::*) %{
396 SWIG_UnpackData($input, (void *)&$1, sizeof($1));
398 %typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input;
400 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
403 %typemap(out) SWIGTYPE * %{ $result = (void *)$1; %}
404 %typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{
406 char *data = SWIG_PackData(buf, (void *)&$1, sizeof($1));
408 $result = SWIG_csharp_string_callback(buf);
410 %typemap(out) SWIGTYPE & %{ $result = (void *)$1; %}
412 %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *
413 %{ $result = ($1_ltype)$input; %}
414 %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE (CLASS::*)
415 %{ $result = ($1_ltype)$input; %}
417 %typemap(directorin) SWIGTYPE *
418 %{ $input = (void *) $1; %}
419 %typemap(directorin) SWIGTYPE (CLASS::*)
420 %{ $input = (void *) $1; %}
422 %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &
424 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0);
427 $result = ($1_ltype)$input; %}
428 %typemap(directorin) SWIGTYPE &
429 %{ $input = ($1_ltype) &$1; %}
431 %typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($iminput == IntPtr.Zero) ? null : new $csclassname($iminput, false)"
432 %typemap(csdirectorin) SWIGTYPE & "new $csclassname($iminput, false)"
433 %typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$csclassname.getCPtr($cscall).Handle"
435 /* Default array handling */
436 %typemap(in) SWIGTYPE [] %{ $1 = ($1_ltype)$input; %}
437 %typemap(out) SWIGTYPE [] %{ $result = $1; %}
439 /* char arrays - treat as String */
440 %typemap(in) char[ANY], char[] %{ $1 = ($1_ltype)$input; %}
441 %typemap(out) char[ANY], char[] %{ $result = SWIG_csharp_string_callback((const char *)$1); %}
443 %typemap(directorout) char[ANY], char[] %{ $result = ($1_ltype)$input; %}
444 %typemap(directorin) char[ANY], char[] %{ $input = SWIG_csharp_string_callback((const char *)$1); %}
446 %typemap(csdirectorin) char[ANY], char[] "$iminput"
447 %typemap(csdirectorout) char[ANY], char[] "$cscall"
450 /* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
451 * that cannot be overloaded in C# as more than one C++ type maps to a single C# type */
453 %typecheck(SWIG_TYPECHECK_BOOL)
458 %typecheck(SWIG_TYPECHECK_CHAR)
463 %typecheck(SWIG_TYPECHECK_INT8)
468 %typecheck(SWIG_TYPECHECK_UINT8)
470 const unsigned char &
473 %typecheck(SWIG_TYPECHECK_INT16)
478 %typecheck(SWIG_TYPECHECK_UINT16)
480 const unsigned short &
483 %typecheck(SWIG_TYPECHECK_INT32)
490 %typecheck(SWIG_TYPECHECK_UINT32)
493 const unsigned int &,
494 const unsigned long &
497 %typecheck(SWIG_TYPECHECK_INT64)
502 %typecheck(SWIG_TYPECHECK_UINT64)
504 const unsigned long long &
507 %typecheck(SWIG_TYPECHECK_FLOAT)
512 %typecheck(SWIG_TYPECHECK_DOUBLE)
517 %typecheck(SWIG_TYPECHECK_STRING)
524 %typecheck(SWIG_TYPECHECK_POINTER)
532 /* Exception handling */
534 %typemap(throws, canthrow=1) int,
540 %{ char error_msg[256];
541 sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
542 SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, error_msg);
545 %typemap(throws, canthrow=1) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [ANY]
547 SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
550 %typemap(throws, canthrow=1) char *
551 %{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1);
555 /* Typemaps for code generation in proxy classes and C# type wrapper classes */
557 /* The csin typemap is used for converting function parameter types from the type
558 * used in the proxy, module or type wrapper class to the type used in the PInvoke class. */
559 %typemap(csin) bool, const bool &,
561 signed char, const signed char &,
562 unsigned char, const unsigned char &,
563 short, const short &,
564 unsigned short, const unsigned short &,
566 unsigned int, const unsigned int &,
568 unsigned long, const unsigned long &,
569 long long, const long long &,
570 unsigned long long, const unsigned long long &,
571 float, const float &,
572 double, const double &
574 %typemap(csin) char *, char *&, char[ANY], char[] "$csinput"
575 %typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)"
576 %typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
577 %typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)"
579 /* The csout typemap is used for converting function return types from the return type
580 * used in the PInvoke class to the type returned by the proxy, module or type wrapper class.
581 * The $excode special variable is replaced by the excode typemap attribute code if the
582 * method can throw any exceptions from unmanaged code, otherwise replaced by nothing. */
584 // Macro used by the $excode special variable
585 %define SWIGEXCODE "\n if ($imclassname.SWIGPendingException.Pending) throw $imclassname.SWIGPendingException.Retrieve();" %enddef
586 %define SWIGEXCODE2 "\n if ($imclassname.SWIGPendingException.Pending) throw $imclassname.SWIGPendingException.Retrieve();" %enddef
588 %typemap(csout, excode=SWIGEXCODE) bool, const bool & {
589 bool ret = $imcall;$excode
592 %typemap(csout, excode=SWIGEXCODE) char, const char & {
593 char ret = $imcall;$excode
596 %typemap(csout, excode=SWIGEXCODE) signed char, const signed char & {
597 sbyte ret = $imcall;$excode
600 %typemap(csout, excode=SWIGEXCODE) unsigned char, const unsigned char & {
601 byte ret = $imcall;$excode
604 %typemap(csout, excode=SWIGEXCODE) short, const short & {
605 short ret = $imcall;$excode
608 %typemap(csout, excode=SWIGEXCODE) unsigned short, const unsigned short & {
609 ushort ret = $imcall;$excode
612 %typemap(csout, excode=SWIGEXCODE) int, const int & {
613 int ret = $imcall;$excode
616 %typemap(csout, excode=SWIGEXCODE) unsigned int, const unsigned int & {
617 uint ret = $imcall;$excode
620 %typemap(csout, excode=SWIGEXCODE) long, const long & {
621 int ret = $imcall;$excode
624 %typemap(csout, excode=SWIGEXCODE) unsigned long, const unsigned long & {
625 uint ret = $imcall;$excode
628 %typemap(csout, excode=SWIGEXCODE) long long, const long long & {
629 long ret = $imcall;$excode
632 %typemap(csout, excode=SWIGEXCODE) unsigned long long, const unsigned long long & {
633 ulong ret = $imcall;$excode
636 %typemap(csout, excode=SWIGEXCODE) float, const float & {
637 float ret = $imcall;$excode
640 %typemap(csout, excode=SWIGEXCODE) double, const double & {
641 double ret = $imcall;$excode
644 %typemap(csout, excode=SWIGEXCODE) char *, char *&, char[ANY], char[] {
645 string ret = $imcall;$excode
648 %typemap(csout, excode=SWIGEXCODE) void {
651 %typemap(csout, excode=SWIGEXCODE) SWIGTYPE {
652 $&csclassname ret = new $&csclassname($imcall, true);$excode
655 %typemap(csout, excode=SWIGEXCODE) SWIGTYPE & {
656 $csclassname ret = new $csclassname($imcall, $owner);$excode
659 %typemap(csout, excode=SWIGEXCODE) SWIGTYPE *, SWIGTYPE [] {
660 IntPtr cPtr = $imcall;
661 $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
664 %typemap(csout, excode=SWIGEXCODE) SWIGTYPE (CLASS::*) {
665 string cMemberPtr = $imcall;
666 $csclassname ret = (cMemberPtr == null) ? null : new $csclassname(cMemberPtr, $owner);$excode
672 %typemap(csvarin, excode=SWIGEXCODE2) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
677 %typemap(csvarin, excode=SWIGEXCODE2) char *, char *&, char[ANY], char[] %{
682 %typemap(csvarout, excode=SWIGEXCODE2) bool, const bool & %{
684 bool ret = $imcall;$excode
687 %typemap(csvarout, excode=SWIGEXCODE2) char, const char & %{
689 char ret = $imcall;$excode
692 %typemap(csvarout, excode=SWIGEXCODE2) signed char, const signed char & %{
694 sbyte ret = $imcall;$excode
697 %typemap(csvarout, excode=SWIGEXCODE2) unsigned char, const unsigned char & %{
699 byte ret = $imcall;$excode
702 %typemap(csvarout, excode=SWIGEXCODE2) short, const short & %{
704 short ret = $imcall;$excode
707 %typemap(csvarout, excode=SWIGEXCODE2) unsigned short, const unsigned short & %{
709 ushort ret = $imcall;$excode
712 %typemap(csvarout, excode=SWIGEXCODE2) int, const int & %{
714 int ret = $imcall;$excode
717 %typemap(csvarout, excode=SWIGEXCODE2) unsigned int, const unsigned int & %{
719 uint ret = $imcall;$excode
722 %typemap(csvarout, excode=SWIGEXCODE2) long, const long & %{
724 int ret = $imcall;$excode
727 %typemap(csvarout, excode=SWIGEXCODE2) unsigned long, const unsigned long & %{
729 uint ret = $imcall;$excode
732 %typemap(csvarout, excode=SWIGEXCODE2) long long, const long long & %{
734 long ret = $imcall;$excode
737 %typemap(csvarout, excode=SWIGEXCODE2) unsigned long long, const unsigned long long & %{
739 ulong ret = $imcall;$excode
742 %typemap(csvarout, excode=SWIGEXCODE2) float, const float & %{
744 float ret = $imcall;$excode
747 %typemap(csvarout, excode=SWIGEXCODE2) double, const double & %{
749 double ret = $imcall;$excode
754 %typemap(csvarout, excode=SWIGEXCODE2) char *, char *&, char[ANY], char[] %{
756 string ret = $imcall;$excode
759 %typemap(csvarout, excode=SWIGEXCODE2) void %{
763 %typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE %{
765 $&csclassname ret = new $&csclassname($imcall, true);$excode
768 %typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE & %{
770 $csclassname ret = new $csclassname($imcall, $owner);$excode
773 %typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [] %{
775 IntPtr cPtr = $imcall;
776 $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
780 %typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE (CLASS::*) %{
782 string cMemberPtr = $imcall;
783 $csclassname ret = (cMemberPtr == null) ? null : new $csclassname(cMemberPtr, $owner);$excode
787 /* Pointer reference typemaps */
788 %typemap(ctype) SWIGTYPE *& "void *"
789 %typemap(imtype, out="IntPtr") SWIGTYPE *& "HandleRef"
790 %typemap(cstype) SWIGTYPE *& "$*csclassname"
791 %typemap(csin) SWIGTYPE *& "$*csclassname.getCPtr($csinput)"
792 %typemap(csout, excode=SWIGEXCODE) SWIGTYPE *& {
793 IntPtr cPtr = $imcall;
794 $*csclassname ret = (cPtr == IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
797 %typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
798 %{ temp = ($*1_ltype)$input;
800 %typemap(out) SWIGTYPE *&
801 %{ $result = (void *)*$1; %}
803 /* Array reference typemaps */
804 %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
806 /* Marshal C/C++ pointer to IntPtr */
807 %typemap(ctype) void *VOID_INT_PTR "void *"
808 %typemap(imtype) void *VOID_INT_PTR "IntPtr"
809 %typemap(cstype) void *VOID_INT_PTR "IntPtr"
810 %typemap(in) void *VOID_INT_PTR %{ $1 = ($1_ltype)$input; %}
811 %typemap(out) void *VOID_INT_PTR %{ $result = (void *)$1; %}
812 %typemap(csin) void *VOID_INT_PTR "$csinput"
813 %typemap(csout, excode=SWIGEXCODE) void *VOID_INT_PTR {
814 IntPtr ret = $imcall;$excode
819 /* Typemaps used for the generation of proxy and type wrapper class code */
820 %typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
821 %typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
822 %typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
823 %typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing System;\nusing System.Runtime.InteropServices;\n"
824 %typemap(csinterfaces) SWIGTYPE "IDisposable"
825 %typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
826 %typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
828 // Proxy classes (base classes, ie, not derived classes)
829 %typemap(csbody) SWIGTYPE %{
830 private HandleRef swigCPtr;
831 protected bool swigCMemOwn;
833 internal $csclassname(IntPtr cPtr, bool cMemoryOwn) {
834 swigCMemOwn = cMemoryOwn;
835 swigCPtr = new HandleRef(this, cPtr);
838 internal static HandleRef getCPtr($csclassname obj) {
839 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
843 // Derived proxy classes
844 %typemap(csbody_derived) SWIGTYPE %{
845 private HandleRef swigCPtr;
847 internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclassnameUpcast(cPtr), cMemoryOwn) {
848 swigCPtr = new HandleRef(this, cPtr);
851 internal static HandleRef getCPtr($csclassname obj) {
852 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
856 // Typewrapper classes
857 %typemap(csbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
858 private HandleRef swigCPtr;
860 internal $csclassname(IntPtr cPtr, bool futureUse) {
861 swigCPtr = new HandleRef(this, cPtr);
864 protected $csclassname() {
865 swigCPtr = new HandleRef(null, IntPtr.Zero);
868 internal static HandleRef getCPtr($csclassname obj) {
869 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
873 %typemap(csbody) SWIGTYPE (CLASS::*) %{
874 private string swigCMemberPtr;
876 internal $csclassname(string cMemberPtr, bool futureUse) {
877 swigCMemberPtr = cMemberPtr;
880 protected $csclassname() {
881 swigCMemberPtr = null;
884 internal static string getCMemberPtr($csclassname obj) {
885 return obj.swigCMemberPtr;
889 %typemap(csfinalize) SWIGTYPE %{
895 %typemap(csconstruct, excode=SWIGEXCODE,directorconnect="\n SwigDirectorConnect();") SWIGTYPE %{: this($imcall, true) {$excode$directorconnect
899 %typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
901 if (swigCPtr.Handle != IntPtr.Zero) {
906 swigCPtr = new HandleRef(null, IntPtr.Zero);
908 GC.SuppressFinalize(this);
912 %typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
914 if (swigCPtr.Handle != IntPtr.Zero) {
919 swigCPtr = new HandleRef(null, IntPtr.Zero);
921 GC.SuppressFinalize(this);
926 %typemap(directordisconnect, methodname="swigDirectorDisconnect") SWIGTYPE %{
927 protected void $methodname() {
933 /* C# specific directives */
934 #define %csconst(flag) %feature("cs:const","flag")
935 #define %csconstvalue(value) %feature("cs:constvalue",value)
936 #define %csenum(wrapapproach) %feature("cs:enum","wrapapproach")
937 #define %csmethodmodifiers %feature("cs:methodmodifiers")
938 #define %csnothrowexception %feature("except")
939 #define %csattributes %feature("cs:attributes")
941 %pragma(csharp) imclassclassmodifiers="class"
942 %pragma(csharp) moduleclassmodifiers="public class"
944 %pragma(csharp) moduleimports=%{
946 using System.Runtime.InteropServices;
949 %pragma(csharp) imclassimports=%{
951 using System.Runtime.InteropServices;
954 /* Some ANSI C typemaps */
956 %apply unsigned long { size_t };
957 %apply const unsigned long & { const size_t & };
959 /* csharp keywords */
960 %include <csharpkw.swg>
962 // Default enum handling
966 // Alternative char * typemaps.
967 %pragma(csharp) imclasscode=%{
968 public class SWIGStringMarshal : IDisposable {
969 public readonly HandleRef swigCPtr;
970 public SWIGStringMarshal(string str) {
971 swigCPtr = new HandleRef(this, System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str));
973 public virtual void Dispose() {
974 System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle);
975 GC.SuppressFinalize(this);
980 %typemap(imtype, out="IntPtr") char *, char[ANY], char[] "HandleRef"
981 %typemap(out) char *, char[ANY], char[] %{ $result = $1; %}
982 %typemap(csin) char *, char[ANY], char[] "new $imclassname.SWIGStringMarshal($csinput).swigCPtr"
983 %typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
984 string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
987 %typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
991 %typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
993 string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode