PageRenderTime 28ms CodeModel.GetById 24ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/li_typemaps.i

#
Swig | 109 lines | 92 code | 16 blank | 1 comment | 0 complexity | 9e3e29f0196487f3a176ed3e43f19c3a MD5 | raw file
  1%module li_typemaps
  2
  3%include "typemaps.i"
  4
  5%apply int &INOUT { int &INOUT2 };
  6%newobject out_foo;
  7%inline %{
  8
  9struct Foo { int a; };
 10
 11bool in_bool(bool *INPUT) { return *INPUT; }
 12int in_int(int *INPUT) { return *INPUT; }
 13long in_long(long *INPUT) { return *INPUT; }
 14short in_short(short *INPUT) { return *INPUT; }
 15unsigned int in_uint(unsigned int *INPUT) { return *INPUT; }
 16unsigned short in_ushort(unsigned short *INPUT) { return *INPUT; }
 17unsigned long in_ulong(unsigned long *INPUT) { return *INPUT; }
 18unsigned char in_uchar(unsigned char *INPUT) { return *INPUT; }
 19signed char in_schar(signed char *INPUT) { return *INPUT; }
 20float in_float(float *INPUT) { return *INPUT; }
 21double in_double(double *INPUT) { return *INPUT; }
 22long long in_longlong(long long *INPUT) { return *INPUT; }
 23unsigned long long in_ulonglong(unsigned long long *INPUT) { return *INPUT; }
 24
 25bool inr_bool(bool &INPUT) { return INPUT; }
 26int inr_int(int &INPUT) { return INPUT; }
 27long inr_long(long &INPUT) { return INPUT; }
 28short inr_short(short &INPUT) { return INPUT; }
 29unsigned int inr_uint(unsigned int &INPUT) { return INPUT; }
 30unsigned short inr_ushort(unsigned short &INPUT) { return INPUT; }
 31unsigned long inr_ulong(unsigned long &INPUT) { return INPUT; }
 32unsigned char inr_uchar(unsigned char &INPUT) { return INPUT; }
 33signed char inr_schar(signed char &INPUT) { return INPUT; }
 34float inr_float(float &INPUT) { return INPUT; }
 35double inr_double(double &INPUT) { return INPUT; }
 36long long inr_longlong(long long &INPUT) { return INPUT; }
 37unsigned long long inr_ulonglong(unsigned long long &INPUT) { return INPUT; }
 38
 39void out_bool(bool x, bool *OUTPUT) {  *OUTPUT = x; }
 40void out_int(int x, int *OUTPUT) {  *OUTPUT = x; }
 41void out_short(short x, short *OUTPUT) {  *OUTPUT = x; }
 42void out_long(long x, long *OUTPUT) {  *OUTPUT = x; }
 43void out_uint(unsigned int x, unsigned int *OUTPUT) {  *OUTPUT = x; }
 44void out_ushort(unsigned short x, unsigned short *OUTPUT) {  *OUTPUT = x; }
 45void out_ulong(unsigned long x, unsigned long *OUTPUT) {  *OUTPUT = x; }
 46void out_uchar(unsigned char x, unsigned char *OUTPUT) {  *OUTPUT = x; }
 47void out_schar(signed char x, signed char *OUTPUT) {  *OUTPUT = x; }
 48void out_float(float x, float *OUTPUT) {  *OUTPUT = x; }
 49void out_double(double x, double *OUTPUT) {  *OUTPUT = x; }
 50void out_longlong(long long x, long long *OUTPUT) {  *OUTPUT = x; }
 51void out_ulonglong(unsigned long long x, unsigned long long *OUTPUT) {  *OUTPUT = x; }
 52
 53/* Tests a returning a wrapped pointer and an output argument */
 54struct Foo *out_foo(int a, int *OUTPUT) {
 55  struct Foo *f = new struct Foo();
 56  f->a = a;
 57  *OUTPUT = a * 2;
 58  return f;
 59}
 60
 61void outr_bool(bool x, bool &OUTPUT) {  OUTPUT = x; }
 62void outr_int(int x, int &OUTPUT) {  OUTPUT = x; }
 63void outr_short(short x, short &OUTPUT) {  OUTPUT = x; }
 64void outr_long(long x, long &OUTPUT) {  OUTPUT = x; }
 65void outr_uint(unsigned int x, unsigned int &OUTPUT) {  OUTPUT = x; }
 66void outr_ushort(unsigned short x, unsigned short &OUTPUT) {  OUTPUT = x; }
 67void outr_ulong(unsigned long x, unsigned long &OUTPUT) {  OUTPUT = x; }
 68void outr_uchar(unsigned char x, unsigned char &OUTPUT) {  OUTPUT = x; }
 69void outr_schar(signed char x, signed char &OUTPUT) {  OUTPUT = x; }
 70void outr_float(float x, float &OUTPUT) {  OUTPUT = x; }
 71void outr_double(double x, double &OUTPUT) {  OUTPUT = x; }
 72void outr_longlong(long long x, long long &OUTPUT) {  OUTPUT = x; }
 73void outr_ulonglong(unsigned long long x, unsigned long long &OUTPUT) {  OUTPUT = x; }
 74
 75void inout_bool(bool *INOUT) {  *INOUT = *INOUT; }
 76void inout_int(int *INOUT) {  *INOUT = *INOUT; }
 77void inout_short(short *INOUT) {  *INOUT = *INOUT; }
 78void inout_long(long *INOUT) {  *INOUT = *INOUT; }
 79void inout_uint(unsigned int *INOUT) {  *INOUT = *INOUT; }
 80void inout_ushort(unsigned short *INOUT) {  *INOUT = *INOUT; }
 81void inout_ulong(unsigned long *INOUT) {  *INOUT = *INOUT; }
 82void inout_uchar(unsigned char *INOUT) {  *INOUT = *INOUT; }
 83void inout_schar(signed char *INOUT) {  *INOUT = *INOUT; }
 84void inout_float(float *INOUT) {  *INOUT = *INOUT; }
 85void inout_double(double *INOUT) {  *INOUT = *INOUT; }
 86void inout_longlong(long long *INOUT) {  *INOUT = *INOUT; }
 87void inout_ulonglong(unsigned long long *INOUT) {  *INOUT = *INOUT; }
 88
 89void inoutr_bool(bool &INOUT) {  INOUT = INOUT; }
 90void inoutr_int(int &INOUT) {  INOUT = INOUT; }
 91void inoutr_short(short &INOUT) {  INOUT = INOUT; }
 92void inoutr_long(long &INOUT) {  INOUT = INOUT; }
 93void inoutr_uint(unsigned int &INOUT) {  INOUT = INOUT; }
 94void inoutr_ushort(unsigned short &INOUT) {  INOUT = INOUT; }
 95void inoutr_ulong(unsigned long &INOUT) {  INOUT = INOUT; }
 96void inoutr_uchar(unsigned char &INOUT) {  INOUT = INOUT; }
 97void inoutr_schar(signed char &INOUT) {  INOUT = INOUT; }
 98void inoutr_float(float &INOUT) {  INOUT = INOUT; }
 99void inoutr_double(double &INOUT) {  INOUT = INOUT; }
100void inoutr_longlong(long long &INOUT) {  INOUT = INOUT; }
101void inoutr_ulonglong(unsigned long long &INOUT) {  INOUT = INOUT; }
102
103void inoutr_int2(int &INOUT, int &INOUT2) {  INOUT = INOUT; INOUT2 = INOUT2;}
104
105%}
106
107
108
109