Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / share / swig / 1.3.26 / csharp / csharp.swg
CommitLineData
920dae64
AT
1/* -----------------------------------------------------------------------------
2 * csharp.swg
3 *
4 * CSharp typemaps
5 * ----------------------------------------------------------------------------- */
6
7%include "csharphead.swg"
8
9/* The ctype, imtype and cstype typemaps work together and so there should be one of each.
10 * The ctype typemap contains the PInvoke type used in the PInvoke (C/C++) code.
11 * The imtype typemap contains the C# type used in the intermediary class.
12 * The cstype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */
13
14/* Primitive types */
15%typemap(ctype) bool, const bool & "unsigned int"
16%typemap(ctype) char, const char & "char"
17%typemap(ctype) signed char, const signed char & "signed char"
18%typemap(ctype) unsigned char, const unsigned char & "unsigned char"
19%typemap(ctype) short, const short & "short"
20%typemap(ctype) unsigned short, const unsigned short & "unsigned short"
21%typemap(ctype) int, const int & "int"
22%typemap(ctype) unsigned int, const unsigned int & "unsigned int"
23%typemap(ctype) long, const long & "long"
24%typemap(ctype) unsigned long, const unsigned long & "unsigned long"
25%typemap(ctype) long long, const long long & "long long"
26%typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
27%typemap(ctype) float, const float & "float"
28%typemap(ctype) double, const double & "double"
29%typemap(ctype) void "void"
30
31%typemap(imtype) bool, const bool & "bool"
32%typemap(imtype) char, const char & "char"
33%typemap(imtype) signed char, const signed char & "sbyte"
34%typemap(imtype) unsigned char, const unsigned char & "byte"
35%typemap(imtype) short, const short & "short"
36%typemap(imtype) unsigned short, const unsigned short & "ushort"
37%typemap(imtype) int, const int & "int"
38%typemap(imtype) unsigned int, const unsigned int & "uint"
39%typemap(imtype) long, const long & "int"
40%typemap(imtype) unsigned long, const unsigned long & "uint"
41%typemap(imtype) long long, const long long & "long"
42%typemap(imtype) unsigned long long, const unsigned long long & "ulong"
43%typemap(imtype) float, const float & "float"
44%typemap(imtype) double, const double & "double"
45%typemap(imtype) void "void"
46
47%typemap(cstype) bool, const bool & "bool"
48%typemap(cstype) char, const char & "char"
49%typemap(cstype) signed char, const signed char & "sbyte"
50%typemap(cstype) unsigned char, const unsigned char & "byte"
51%typemap(cstype) short, const short & "short"
52%typemap(cstype) unsigned short, const unsigned short & "ushort"
53%typemap(cstype) int, const int & "int"
54%typemap(cstype) unsigned int, const unsigned int & "uint"
55%typemap(cstype) long, const long & "int"
56%typemap(cstype) unsigned long, const unsigned long & "uint"
57%typemap(cstype) long long, const long long & "long"
58%typemap(cstype) unsigned long long, const unsigned long long & "ulong"
59%typemap(cstype) float, const float & "float"
60%typemap(cstype) double, const double & "double"
61%typemap(cstype) void "void"
62
63%typemap(ctype) char *, char[ANY], char[] "char *"
64%typemap(imtype) char *, char[ANY], char[] "string"
65%typemap(cstype) char *, char[ANY], char[] "string"
66
67/* Non primitive types */
68%typemap(ctype) SWIGTYPE "void *"
69%typemap(imtype, out="IntPtr") SWIGTYPE "HandleRef"
70%typemap(cstype) SWIGTYPE "$&csclassname"
71
72%typemap(ctype) SWIGTYPE [] "void *"
73%typemap(imtype, out="IntPtr") SWIGTYPE [] "HandleRef"
74%typemap(cstype) SWIGTYPE [] "$csclassname"
75
76%typemap(ctype) SWIGTYPE * "void *"
77%typemap(imtype, out="IntPtr") SWIGTYPE * "HandleRef"
78%typemap(cstype) SWIGTYPE * "$csclassname"
79
80%typemap(ctype) SWIGTYPE & "void *"
81%typemap(imtype, out="IntPtr") SWIGTYPE & "HandleRef"
82%typemap(cstype) SWIGTYPE & "$csclassname"
83
84/* pointer to a class member */
85%typemap(ctype) SWIGTYPE (CLASS::*) "int"
86%typemap(imtype, out="IntPtr") SWIGTYPE (CLASS::*) "HandleRef"
87%typemap(cstype) SWIGTYPE (CLASS::*) "$csclassname"
88
89/* The following are the in and out typemaps. These are the PInvoke code generating typemaps for converting from C# to C and visa versa. */
90
91/* primitive types */
92%typemap(in) bool
93%{ $1 = $input ? true : false; %}
94
95%typemap(in) char,
96 signed char,
97 unsigned char,
98 short,
99 unsigned short,
100 int,
101 unsigned int,
102 long,
103 unsigned long,
104 long long,
105 unsigned long long,
106 float,
107 double
108%{ $1 = ($1_ltype)$input; %}
109
110%typemap(out) bool %{ $result = $1; %}
111%typemap(out) char %{ $result = $1; %}
112%typemap(out) signed char %{ $result = $1; %}
113%typemap(out) unsigned char %{ $result = $1; %}
114%typemap(out) short %{ $result = $1; %}
115%typemap(out) unsigned short %{ $result = $1; %}
116%typemap(out) int %{ $result = $1; %}
117%typemap(out) unsigned int %{ $result = $1; %}
118%typemap(out) long %{ $result = $1; %}
119%typemap(out) unsigned long %{ $result = $1; %}
120%typemap(out) long long %{ $result = $1; %}
121%typemap(out) unsigned long long %{ $result = $1; %}
122%typemap(out) float %{ $result = $1; %}
123%typemap(out) double %{ $result = $1; %}
124
125/* char * - treat as String */
126%typemap(in) char * %{ $1 = $input; %}
127%typemap(out) char * %{ $result = SWIG_csharp_string_callback($1); %}
128
129%typemap(out, null="") void ""
130
131/* primitive types by const reference */
132%typemap(in) const bool & (bool temp)
133%{ temp = $input ? true : false;
134 $1 = &temp; %}
135
136%typemap(in) const char & (char temp),
137 const signed char & (signed char temp),
138 const unsigned char & (unsigned char temp),
139 const short & (short temp),
140 const unsigned short & (unsigned short temp),
141 const int & (int temp),
142 const unsigned int & (unsigned int temp),
143 const long & (long temp),
144 const unsigned long & (unsigned long temp),
145 const long long & ($*1_ltype temp),
146 const unsigned long long & ($*1_ltype temp),
147 const float & (float temp),
148 const double & (double temp)
149%{ temp = ($*1_ltype)$input;
150$1 = &temp; %}
151
152%typemap(out) const bool & %{ $result = *$1; %}
153%typemap(out) const char & %{ $result = *$1; %}
154%typemap(out) const signed char & %{ $result = *$1; %}
155%typemap(out) const unsigned char & %{ $result = *$1; %}
156%typemap(out) const short & %{ $result = *$1; %}
157%typemap(out) const unsigned short & %{ $result = *$1; %}
158%typemap(out) const int & %{ $result = *$1; %}
159%typemap(out) const unsigned int & %{ $result = *$1; %}
160%typemap(out) const long & %{ $result = *$1; %}
161%typemap(out) const unsigned long & %{ $result = *$1; %}
162%typemap(out) const long long & %{ $result = *$1; %}
163%typemap(out) const unsigned long long & %{ $result = *$1; %}
164%typemap(out) const float & %{ $result = *$1; %}
165%typemap(out) const double & %{ $result = *$1; %}
166
167/* Default handling. Object passed by value. Convert to a pointer */
168%typemap(in, canthrow=1) SWIGTYPE ($&1_type argp)
169%{ argp = ($&1_ltype)$input;
170 if (!argp) {
171 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
172 return $null;
173 }
174 $1 = *argp; %}
175%typemap(out) SWIGTYPE
176#ifdef __cplusplus
177%{$result = new $1_ltype(($1_ltype &)$1); %}
178#else
179{
180 $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
181 memmove($1ptr, &$1, sizeof($1_type));
182 $result = $1ptr;
183}
184#endif
185
186/* Generic pointers and references */
187%typemap(in) SWIGTYPE * %{ $1 = ($1_ltype)$input; %}
188%typemap(in) SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
189%typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input;
190 if(!$1) {
191 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
192 return $null;
193 } %}
194%typemap(out) SWIGTYPE *, SWIGTYPE & %{ $result = (void *)$1; %}
195%typemap(out) SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %}
196
197
198/* Default array handling */
199%typemap(in) SWIGTYPE [] %{ $1 = ($1_ltype)$input; %}
200%typemap(out) SWIGTYPE [] %{ $result = $1; %}
201
202/* char arrays - treat as String */
203%typemap(in) char[ANY], char[] %{ $1 = $input; %}
204%typemap(out) char[ANY], char[] %{ $result = SWIG_csharp_string_callback($1); %}
205
206
207/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
208 * that cannot be overloaded in C# as more than one C++ type maps to a single C# type */
209
210%typecheck(SWIG_TYPECHECK_BOOL)
211 bool,
212 const bool &
213 ""
214
215%typecheck(SWIG_TYPECHECK_CHAR)
216 char,
217 const char &
218 ""
219
220%typecheck(SWIG_TYPECHECK_INT8)
221 signed char,
222 const signed char &
223 ""
224
225%typecheck(SWIG_TYPECHECK_UINT8)
226 unsigned char,
227 const unsigned char &
228 ""
229
230%typecheck(SWIG_TYPECHECK_INT16)
231 short,
232 const short &
233 ""
234
235%typecheck(SWIG_TYPECHECK_UINT16)
236 unsigned short,
237 const unsigned short &
238 ""
239
240%typecheck(SWIG_TYPECHECK_INT32)
241 int,
242 long,
243 const int &,
244 const long &
245 ""
246
247%typecheck(SWIG_TYPECHECK_UINT32)
248 unsigned int,
249 unsigned long,
250 const unsigned int &,
251 const unsigned long &
252 ""
253
254%typecheck(SWIG_TYPECHECK_INT64)
255 long long,
256 const long long &
257 ""
258
259%typecheck(SWIG_TYPECHECK_UINT64)
260 unsigned long long,
261 const unsigned long long &
262 ""
263
264%typecheck(SWIG_TYPECHECK_FLOAT)
265 float,
266 const float &
267 ""
268
269%typecheck(SWIG_TYPECHECK_DOUBLE)
270 double,
271 const double &
272 ""
273
274%typecheck(SWIG_TYPECHECK_STRING)
275 char *,
276 char[ANY],
277 char[]
278 ""
279
280%typecheck(SWIG_TYPECHECK_POINTER)
281 SWIGTYPE,
282 SWIGTYPE *,
283 SWIGTYPE &,
284 SWIGTYPE [],
285 SWIGTYPE (CLASS::*)
286 ""
287
288/* Exception handling */
289
290%typemap(throws, canthrow=1) int,
291 long,
292 short,
293 unsigned int,
294 unsigned long,
295 unsigned short {
296 char error_msg[256];
297 sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
298 SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, error_msg);
299 return $null;
300}
301
302%typemap(throws, canthrow=1) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [ANY] %{
303 (void)$1;
304 SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
305 return $null;
306%}
307
308%typemap(throws, canthrow=1) char * %{
309 SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1);
310 return $null;
311%}
312
313
314/* Typemaps for code generation in proxy classes and C# type wrapper classes */
315
316/* The csin typemap is used for converting function parameter types from the type
317 * used in the proxy, module or type wrapper class to the type used in the PInvoke class. */
318%typemap(csin) bool, const bool &,
319 char, const char &,
320 signed char, const signed char &,
321 unsigned char, const unsigned char &,
322 short, const short &,
323 unsigned short, const unsigned short &,
324 int, const int &,
325 unsigned int, const unsigned int &,
326 long, const long &,
327 unsigned long, const unsigned long &,
328 long long, const long long &,
329 unsigned long long, const unsigned long long &,
330 float, const float &,
331 double, const double &
332 "$csinput"
333%typemap(csin) char *, char[ANY], char[] "$csinput"
334%typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)"
335%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "$csclassname.getCPtr($csinput)"
336
337/* The csout typemap is used for converting function return types from the return type
338 * used in the PInvoke class to the type returned by the proxy, module or type wrapper class.
339 * The $excode special variable is replaced by the excode typemap attribute code if the
340 * method can throw any exceptions from unmanaged code, otherwise replaced by nothing. */
341
342// Macro used by the $excode special variable
343%define SWIGEXCODE "\n if ($modulePINVOKE.SWIGPendingException.Pending) throw $modulePINVOKE.SWIGPendingException.Retrieve();" %enddef
344%define SWIGEXCODE2 "\n if ($modulePINVOKE.SWIGPendingException.Pending) throw $modulePINVOKE.SWIGPendingException.Retrieve();" %enddef
345
346%typemap(csout, excode=SWIGEXCODE) bool, const bool & {
347 bool ret = $imcall;$excode
348 return ret;
349 }
350%typemap(csout, excode=SWIGEXCODE) char, const char & {
351 char ret = $imcall;$excode
352 return ret;
353 }
354%typemap(csout, excode=SWIGEXCODE) signed char, const signed char & {
355 sbyte ret = $imcall;$excode
356 return ret;
357 }
358%typemap(csout, excode=SWIGEXCODE) unsigned char, const unsigned char & {
359 byte ret = $imcall;$excode
360 return ret;
361 }
362%typemap(csout, excode=SWIGEXCODE) short, const short & {
363 short ret = $imcall;$excode
364 return ret;
365 }
366%typemap(csout, excode=SWIGEXCODE) unsigned short, const unsigned short & {
367 ushort ret = $imcall;$excode
368 return ret;
369 }
370%typemap(csout, excode=SWIGEXCODE) int, const int & {
371 int ret = $imcall;$excode
372 return ret;
373 }
374%typemap(csout, excode=SWIGEXCODE) unsigned int, const unsigned int & {
375 uint ret = $imcall;$excode
376 return ret;
377 }
378%typemap(csout, excode=SWIGEXCODE) long, const long & {
379 int ret = $imcall;$excode
380 return ret;
381 }
382%typemap(csout, excode=SWIGEXCODE) unsigned long, const unsigned long & {
383 uint ret = $imcall;$excode
384 return ret;
385 }
386%typemap(csout, excode=SWIGEXCODE) long long, const long long & {
387 long ret = $imcall;$excode
388 return ret;
389 }
390%typemap(csout, excode=SWIGEXCODE) unsigned long long, const unsigned long long & {
391 ulong ret = $imcall;$excode
392 return ret;
393 }
394%typemap(csout, excode=SWIGEXCODE) float, const float & {
395 float ret = $imcall;$excode
396 return ret;
397 }
398%typemap(csout, excode=SWIGEXCODE) double, const double & {
399 double ret = $imcall;$excode
400 return ret;
401 }
402%typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
403 string ret = $imcall;$excode
404 return ret;
405 }
406%typemap(csout, excode=SWIGEXCODE) void {
407 $imcall;$excode
408 }
409%typemap(csout, excode=SWIGEXCODE) SWIGTYPE {
410 $&csclassname ret = new $&csclassname($imcall, true);$excode
411 return ret;
412 }
413%typemap(csout, excode=SWIGEXCODE) SWIGTYPE & {
414 $csclassname ret = new $csclassname($imcall, $owner);$excode
415 return ret;
416 }
417%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) {
418 IntPtr cPtr = $imcall;
419 $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
420 return ret;
421 }
422
423
424/* Properties */
425%typemap(csvarin, excode=SWIGEXCODE2) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
426 set {
427 $imcall;$excode
428 } %}
429
430%typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
431 set {
432 $imcall;$excode
433 } %}
434
435%typemap(csvarout, excode=SWIGEXCODE2) bool, const bool & %{
436 get {
437 bool ret = $imcall;$excode
438 return ret;
439 } %}
440%typemap(csvarout, excode=SWIGEXCODE2) char, const char & %{
441 get {
442 char ret = $imcall;$excode
443 return ret;
444 } %}
445%typemap(csvarout, excode=SWIGEXCODE2) signed char, const signed char & %{
446 get {
447 sbyte ret = $imcall;$excode
448 return ret;
449 } %}
450%typemap(csvarout, excode=SWIGEXCODE2) unsigned char, const unsigned char & %{
451 get {
452 byte ret = $imcall;$excode
453 return ret;
454 } %}
455%typemap(csvarout, excode=SWIGEXCODE2) short, const short & %{
456 get {
457 short ret = $imcall;$excode
458 return ret;
459 } %}
460%typemap(csvarout, excode=SWIGEXCODE2) unsigned short, const unsigned short & %{
461 get {
462 ushort ret = $imcall;$excode
463 return ret;
464 } %}
465%typemap(csvarout, excode=SWIGEXCODE2) int, const int & %{
466 get {
467 int ret = $imcall;$excode
468 return ret;
469 } %}
470%typemap(csvarout, excode=SWIGEXCODE2) unsigned int, const unsigned int & %{
471 get {
472 uint ret = $imcall;$excode
473 return ret;
474 } %}
475%typemap(csvarout, excode=SWIGEXCODE2) long, const long & %{
476 get {
477 int ret = $imcall;$excode
478 return ret;
479 } %}
480%typemap(csvarout, excode=SWIGEXCODE2) unsigned long, const unsigned long & %{
481 get {
482 uint ret = $imcall;$excode
483 return ret;
484 } %}
485%typemap(csvarout, excode=SWIGEXCODE2) long long, const long long & %{
486 get {
487 long ret = $imcall;$excode
488 return ret;
489 } %}
490%typemap(csvarout, excode=SWIGEXCODE2) unsigned long long, const unsigned long long & %{
491 get {
492 ulong ret = $imcall;$excode
493 return ret;
494 } %}
495%typemap(csvarout, excode=SWIGEXCODE2) float, const float & %{
496 get {
497 float ret = $imcall;$excode
498 return ret;
499 } %}
500%typemap(csvarout, excode=SWIGEXCODE2) double, const double & %{
501 get {
502 double ret = $imcall;$excode
503 return ret;
504 } %}
505
506
507%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
508 get {
509 string ret = $imcall;$excode
510 return ret;
511 } %}
512%typemap(csvarout, excode=SWIGEXCODE2) void %{
513 get {
514 $imcall;$excode
515 } %}
516%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE %{
517 get {
518 $&csclassname ret = new $&csclassname($imcall, true);$excode
519 return ret;
520 } %}
521%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE & %{
522 get {
523 $csclassname ret = new $csclassname($imcall, $owner);$excode
524 return ret;
525 } %}
526%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
527 get {
528 IntPtr cPtr = $imcall;
529 $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
530 return ret;
531 } %}
532
533/* Typemaps used for the generation of proxy and type wrapper class code */
534%typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
535%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
536%typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
537%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing System;\nusing System.Runtime.InteropServices;\n"
538%typemap(csinterfaces) SWIGTYPE "IDisposable"
539%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
540%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
541
542// Proxy classes (base classes, ie, not derived classes)
543%typemap(csbody) SWIGTYPE %{
544 private HandleRef swigCPtr;
545 protected bool swigCMemOwn;
546
547 internal $csclassname(IntPtr cPtr, bool cMemoryOwn) {
548 swigCMemOwn = cMemoryOwn;
549 swigCPtr = new HandleRef(this, cPtr);
550 }
551
552 internal static HandleRef getCPtr($csclassname obj) {
553 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
554 }
555%}
556
557// Derived proxy classes
558%typemap(csbody_derived) SWIGTYPE %{
559 private HandleRef swigCPtr;
560
561 internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($modulePINVOKE.$csclassnameUpcast(cPtr), cMemoryOwn) {
562 swigCPtr = new HandleRef(this, cPtr);
563 }
564
565 internal static HandleRef getCPtr($csclassname obj) {
566 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
567 }
568%}
569
570// Typewrapper classes
571%typemap(csbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
572 private HandleRef swigCPtr;
573
574 internal $csclassname(IntPtr cPtr, bool futureUse) {
575 swigCPtr = new HandleRef(this, cPtr);
576 }
577
578 protected $csclassname() {
579 swigCPtr = new HandleRef(null, IntPtr.Zero);
580 }
581
582 internal static HandleRef getCPtr($csclassname obj) {
583 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
584 }
585%}
586
587%typemap(csfinalize) SWIGTYPE %{
588 ~$csclassname() {
589 Dispose();
590 }
591%}
592
593%typemap(csconstruct, excode=SWIGEXCODE) SWIGTYPE %{: this($imcall, true) {$excode
594 }
595%}
596
597%typemap(csdestruct, methodname="Dispose") SWIGTYPE {
598 if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
599 swigCMemOwn = false;
600 $imcall;
601 }
602 swigCPtr = new HandleRef(null, IntPtr.Zero);
603 GC.SuppressFinalize(this);
604 }
605
606%typemap(csdestruct_derived, methodname="Dispose") SWIGTYPE {
607 if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
608 swigCMemOwn = false;
609 $imcall;
610 }
611 swigCPtr = new HandleRef(null, IntPtr.Zero);
612 GC.SuppressFinalize(this);
613 base.Dispose();
614 }
615
616
617/* C# specific directives */
618#define %csconst(flag) %feature("cs:const","flag")
619#define %csconstvalue(value) %feature("cs:constvalue",value)
620#define %csenum(wrapapproach) %feature("cs:enum","wrapapproach")
621#define %csmethodmodifiers %feature("cs:methodmodifiers")
622#define %csnothrowexception %feature("except")
623#define %csattributes %feature("cs:attributes")
624
625%pragma(csharp) imclassclassmodifiers="class"
626%pragma(csharp) moduleclassmodifiers="public class"
627
628%pragma(csharp) moduleimports=%{
629using System;
630using System.Runtime.InteropServices;
631%}
632
633%pragma(csharp) imclassimports=%{
634using System;
635using System.Runtime.InteropServices;
636%}
637
638/* Some ANSI C typemaps */
639
640%apply unsigned long { size_t };
641
642/* csharp keywords */
643/* please test and activate */
644//%include "csharpkw.swg"
645
646// Default enum handling
647%include "enums.swg"
648
649/*
650// Alternative char * typemaps.
651%pragma(csharp) imclasscode=%{
652 public class SWIGStringMarshal : IDisposable {
653 public readonly HandleRef swigCPtr;
654 public SWIGStringMarshal(string str) {
655 swigCPtr = new HandleRef(this, System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str));
656 }
657 public virtual void Dispose() {
658 System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle);
659 GC.SuppressFinalize(this);
660 }
661 }
662%}
663
664%typemap(imtype, out="IntPtr") char *, char[ANY], char[] "HandleRef"
665%typemap(out) char *, char[ANY], char[] %{ $result = $1; %}
666%typemap(csin) char *, char[ANY], char[] "new $modulePINVOKE.SWIGStringMarshal($csinput).swigCPtr"
667%typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
668 string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
669 return ret;
670 }
671%typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
672 set {
673 $imcall;$excode
674 } %}
675%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
676 get {
677 string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
678 return ret;
679 } %}
680*/
681