~ubuntu-branches/ubuntu/maverick/swig1.3/maverick

« back to all changes in this revision

Viewing changes to Lib/csharp/csharp.swg

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2006-12-20 14:43:24 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20061220144324-bps3kb06xp5oy9w1
Tags: 1.3.31-1ubuntu1
* Merge from debian unstable, remaining changes:
  - drop support for pike
  - use php5 instead of php4
  - clean Runtime/ as well
  - force a few environment variables

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
%typemap(cstype) SWIGTYPE & "$csclassname"
86
86
 
87
87
/* pointer to a class member */
88
 
%typemap(ctype) SWIGTYPE (CLASS::*) "int"
 
88
%typemap(ctype) SWIGTYPE (CLASS::*) "void *"
89
89
%typemap(imtype, out="IntPtr") SWIGTYPE (CLASS::*) "HandleRef"
90
90
%typemap(cstype) SWIGTYPE (CLASS::*) "$csclassname"
91
91
 
95
95
%typemap(in) bool
96
96
%{ $1 = $input ? true : false; %}
97
97
 
 
98
%typemap(directorout) bool
 
99
%{ $result = $input ? true : false; %}
 
100
 
 
101
%typemap(csdirectorin) bool "$iminput"
 
102
%typemap(csdirectorout) bool "$cscall"
 
103
 
98
104
%typemap(in) char, 
99
105
             signed char, 
100
106
             unsigned char, 
110
116
             double
111
117
%{ $1 = ($1_ltype)$input; %}
112
118
 
 
119
%typemap(directorout) char, 
 
120
             signed char, 
 
121
             unsigned char, 
 
122
             short, 
 
123
             unsigned short, 
 
124
             int, 
 
125
             unsigned int, 
 
126
             long, 
 
127
             unsigned long, 
 
128
             long long, 
 
129
             unsigned long long, 
 
130
             float, 
 
131
             double
 
132
%{ $result = ($1_ltype)$input; %}
 
133
 
 
134
%typemap(directorin) bool               "$input = $1;"
 
135
%typemap(directorin) char               "$input = $1;"
 
136
%typemap(directorin) signed char        "$input = $1;"
 
137
%typemap(directorin) unsigned char      "$input = $1;"
 
138
%typemap(directorin) short              "$input = $1;"
 
139
%typemap(directorin) unsigned short     "$input = $1;"
 
140
%typemap(directorin) int                "$input = $1;"
 
141
%typemap(directorin) unsigned int       "$input = $1;"
 
142
%typemap(directorin) long               "$input = $1;"
 
143
%typemap(directorin) unsigned long      "$input = $1;"
 
144
%typemap(directorin) long long          "$input = $1;"
 
145
%typemap(directorin) unsigned long long "$input = $1;"
 
146
%typemap(directorin) float              "$input = $1;"
 
147
%typemap(directorin) double             "$input = $1;"
 
148
 
 
149
%typemap(csdirectorin) char, 
 
150
                       signed char, 
 
151
                       unsigned char, 
 
152
                       short, 
 
153
                       unsigned short, 
 
154
                       int, 
 
155
                       unsigned int, 
 
156
                       long, 
 
157
                       unsigned long, 
 
158
                       long long, 
 
159
                       unsigned long long, 
 
160
                       float, 
 
161
                       double
 
162
  "$iminput"
 
163
 
 
164
%typemap(csdirectorout) char, 
 
165
                        signed char, 
 
166
                        unsigned char, 
 
167
                        short, 
 
168
                        unsigned short, 
 
169
                        int, 
 
170
                        unsigned int, 
 
171
                        long, 
 
172
                        unsigned long, 
 
173
                        long long, 
 
174
                        unsigned long long, 
 
175
                        float, 
 
176
                        double
 
177
  "$cscall"
 
178
 
113
179
%typemap(out) bool               %{ $result = $1; %}
114
180
%typemap(out) char               %{ $result = $1; %}
115
181
%typemap(out) signed char        %{ $result = $1; %}
126
192
%typemap(out) double             %{ $result = $1; %}
127
193
 
128
194
/* char * - treat as String */
129
 
%typemap(in) char * %{ $1 = $input; %}
130
 
%typemap(out) char * %{ $result = SWIG_csharp_string_callback($1); %}
 
195
%typemap(in) char * %{ $1 = ($1_ltype)$input; %}
 
196
%typemap(out) char * %{ $result = SWIG_csharp_string_callback((const char *)$1); %}
 
197
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) char * %{ $result = ($1_ltype)$input; %}
 
198
%typemap(directorin) char * %{ $input = SWIG_csharp_string_callback((const char *)$1); %}
 
199
%typemap(csdirectorin) char * "$iminput"
 
200
%typemap(csdirectorout) char * "$cscall"
131
201
 
132
202
%typemap(out, null="") void ""
 
203
%typemap(csdirectorin) void "$iminput"
 
204
%typemap(csdirectorout) void "$cscall"
 
205
%typemap(directorin) void ""
133
206
 
134
207
/* primitive types by const reference */
135
208
%typemap(in) const bool & ($*1_ltype temp)
136
209
%{ temp = $input ? true : false; 
137
210
   $1 = &temp; %}
138
211
 
 
212
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const bool &
 
213
%{ static $*1_ltype temp;
 
214
   temp = $input ? true : false; 
 
215
   $result = &temp; %}
 
216
 
 
217
%typemap(csdirectorin) const bool & "$iminput"
 
218
%typemap(csdirectorout) const bool & "$cscall"
 
219
 
139
220
%typemap(in) const char & ($*1_ltype temp), 
140
221
             const signed char & ($*1_ltype temp), 
141
222
             const unsigned char & ($*1_ltype temp), 
152
233
%{ temp = ($*1_ltype)$input; 
153
234
   $1 = &temp; %}
154
235
 
 
236
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const char &,
 
237
             const signed char &,
 
238
             const unsigned char &,
 
239
             const short &,
 
240
             const unsigned short &,
 
241
             const int &,
 
242
             const unsigned int &,
 
243
             const long &,
 
244
             const unsigned long &,
 
245
             const long long &,
 
246
             const float &,
 
247
             const double &
 
248
%{ static $*1_ltype temp;
 
249
   temp = ($*1_ltype)$input; 
 
250
   $result = &temp; %}
 
251
 
 
252
%typemap(directorin) const bool &           "$input = $1_name;"
 
253
%typemap(directorin) const char &           "$input = $1_name;"
 
254
%typemap(directorin) const signed char &    "$input = $1_name;"
 
255
%typemap(directorin) const unsigned char &  "$input = $1_name;"
 
256
%typemap(directorin) const short &          "$input = $1_name;"
 
257
%typemap(directorin) const unsigned short & "$input = $1_name;"
 
258
%typemap(directorin) const int &            "$input = $1_name;"
 
259
%typemap(directorin) const unsigned int &   "$input = $1_name;"
 
260
%typemap(directorin) const long &           "$input = $1_name;"
 
261
%typemap(directorin) const unsigned long &  "$input = $1_name;"
 
262
%typemap(directorin) const long long &      "$input = $1_name;"
 
263
%typemap(directorin) const float &          "$input = $1_name;"
 
264
%typemap(directorin) const double &         "$input = $1_name;"
 
265
 
 
266
%typemap(csdirectorin) const char & ($*1_ltype temp), 
 
267
                       const signed char & ($*1_ltype temp), 
 
268
                       const unsigned char & ($*1_ltype temp), 
 
269
                       const short & ($*1_ltype temp), 
 
270
                       const unsigned short & ($*1_ltype temp), 
 
271
                       const int & ($*1_ltype temp), 
 
272
                       const unsigned int & ($*1_ltype temp), 
 
273
                       const long & ($*1_ltype temp), 
 
274
                       const unsigned long & ($*1_ltype temp), 
 
275
                       const long long & ($*1_ltype temp), 
 
276
                       const float & ($*1_ltype temp), 
 
277
                       const double & ($*1_ltype temp)
 
278
  "$iminput"
 
279
 
 
280
%typemap(csdirectorout) const char & ($*1_ltype temp), 
 
281
                        const signed char & ($*1_ltype temp), 
 
282
                        const unsigned char & ($*1_ltype temp), 
 
283
                        const short & ($*1_ltype temp), 
 
284
                        const unsigned short & ($*1_ltype temp), 
 
285
                        const int & ($*1_ltype temp), 
 
286
                        const unsigned int & ($*1_ltype temp), 
 
287
                        const long & ($*1_ltype temp), 
 
288
                        const unsigned long & ($*1_ltype temp), 
 
289
                        const long long & ($*1_ltype temp), 
 
290
                        const float & ($*1_ltype temp), 
 
291
                        const double & ($*1_ltype temp)
 
292
  "$cscall"
 
293
 
 
294
 
155
295
%typemap(out) const bool &               %{ $result = *$1; %}
156
296
%typemap(out) const char &               %{ $result = *$1; %}
157
297
%typemap(out) const signed char &        %{ $result = *$1; %}
175
315
     return $null;
176
316
   }
177
317
   $1 = *argp; %}
 
318
 
 
319
%typemap(directorout) SWIGTYPE
 
320
%{ if (!$input) {
 
321
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0);
 
322
     return $null;
 
323
   }
 
324
   $result = *($&1_ltype)$input; %}
 
325
 
178
326
%typemap(out) SWIGTYPE 
179
327
#ifdef __cplusplus
180
328
%{ $result = new $1_ltype(($1_ltype &)$1); %}
186
334
}
187
335
#endif
188
336
 
 
337
%typemap(directorin) SWIGTYPE 
 
338
%{ $input = (void *)&$1; %}
 
339
%typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, false)"
 
340
%typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle"
 
341
 
189
342
/* Generic pointers and references */
190
343
%typemap(in) SWIGTYPE * %{ $1 = ($1_ltype)$input; %}
191
344
%typemap(in) SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
195
348
    return $null;
196
349
  } %}
197
350
%typemap(out) SWIGTYPE *, SWIGTYPE & %{ $result = (void *)$1; %} 
198
 
%typemap(out) SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %} 
199
 
 
 
351
%typemap(out) SWIGTYPE (CLASS::*) %{ $result = (void *)&$1; %} 
 
352
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *, SWIGTYPE (CLASS::*)
 
353
%{ $result = ($1_ltype)$input; %}
 
354
%typemap(directorin) SWIGTYPE *, SWIGTYPE (CLASS::*)
 
355
%{ $input = (void *) $1; %}
 
356
 
 
357
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &
 
358
%{ if (!$input) {
 
359
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0);
 
360
     return $null;
 
361
   }
 
362
   $result = ($1_ltype)$input; %}
 
363
%typemap(directorin) SWIGTYPE &
 
364
%{ $input = ($1_ltype) &$1; %}
 
365
 
 
366
%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "new $csclassname($iminput, false)"
 
367
%typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$csclassname.getCPtr($cscall).Handle"
200
368
 
201
369
/* Default array handling */
202
370
%typemap(in) SWIGTYPE [] %{ $1 = ($1_ltype)$input; %}
203
371
%typemap(out) SWIGTYPE [] %{ $result = $1; %} 
204
372
 
205
373
/* char arrays - treat as String */
206
 
%typemap(in) char[ANY], char[] %{ $1 = $input; %}
207
 
%typemap(out) char[ANY], char[] %{ $result = SWIG_csharp_string_callback($1); %}
 
374
%typemap(in) char[ANY], char[] %{ $1 = ($1_ltype)$input; %}
 
375
%typemap(out) char[ANY], char[] %{ $result = SWIG_csharp_string_callback((const char *)$1); %}
 
376
 
 
377
%typemap(directorout) char[ANY], char[] %{ $result = ($1_ltype)$input; %}
 
378
%typemap(directorin) char[ANY], char[] %{ $input = SWIG_csharp_string_callback((const char *)$1); %}
 
379
 
 
380
%typemap(csdirectorin) char[ANY], char[] "$iminput"
 
381
%typemap(csdirectorout) char[ANY], char[] "$cscall"
208
382
 
209
383
 
210
384
/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions 
609
783
  }
610
784
%}
611
785
 
612
 
%typemap(csconstruct, excode=SWIGEXCODE) SWIGTYPE %{: this($imcall, true) {$excode
613
 
  }
614
 
%}
615
 
 
616
 
%typemap(csdestruct, methodname="Dispose") SWIGTYPE {
617
 
    if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
618
 
      swigCMemOwn = false;
619
 
      $imcall;
620
 
    }
621
 
    swigCPtr = new HandleRef(null, IntPtr.Zero);
622
 
    GC.SuppressFinalize(this);
623
 
  }
624
 
 
625
 
%typemap(csdestruct_derived, methodname="Dispose") SWIGTYPE {
626
 
    if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
627
 
      swigCMemOwn = false;
628
 
      $imcall;
629
 
    }
630
 
    swigCPtr = new HandleRef(null, IntPtr.Zero);
631
 
    GC.SuppressFinalize(this);
632
 
    base.Dispose();
633
 
  }
634
 
 
 
786
%typemap(csconstruct, excode=SWIGEXCODE,directorconnect="\n    SwigDirectorConnect();") SWIGTYPE %{: this($imcall, true) {$excode$directorconnect
 
787
  }
 
788
%}
 
789
 
 
790
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
 
791
    lock(this) {
 
792
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
 
793
        swigCMemOwn = false;
 
794
        $imcall;
 
795
      }
 
796
      swigCPtr = new HandleRef(null, IntPtr.Zero);
 
797
      GC.SuppressFinalize(this);
 
798
    }
 
799
  }
 
800
 
 
801
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
 
802
    lock(this) {
 
803
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
 
804
        swigCMemOwn = false;
 
805
        $imcall;
 
806
      }
 
807
      swigCPtr = new HandleRef(null, IntPtr.Zero);
 
808
      GC.SuppressFinalize(this);
 
809
      base.Dispose();
 
810
    }
 
811
  }
 
812
 
 
813
%typemap(directordisconnect, methodname="swigDirectorDisconnect") SWIGTYPE %{
 
814
  protected void $methodname() {
 
815
    swigCMemOwn = false;
 
816
    $imcall;
 
817
  }
 
818
%}
635
819
 
636
820
/* C# specific directives */
637
821
#define %csconst(flag)              %feature("cs:const","flag")
657
841
/* Some ANSI C typemaps */
658
842
 
659
843
%apply unsigned long { size_t };
 
844
%apply const unsigned long & { const size_t & };
660
845
 
661
846
/* csharp keywords */
662
847
%include <csharpkw.swg>