Paste: Swig test file

Author: ceninan
Mode: c
Date: Wed, 16 Jun 2010 14:07:44
Plain Text |
/* comment */

%module mytest

#define myconst (4L >> 2)

const char const * myconstcharconst = ";)";

/* Arrays */
struct marr {
 const char sa[255][50];
 int ia[333][][];
 int (*fa[10])(float, char, char);
};

/* Function pointers */
int (*foo(int,int (*)(int)))(char*, double);
void (*bar(int,int (*)(int)))();

int (*funcArr[4])(char,char)(float, char, char);

void funcArr2(int (*pt2Func[3])(float, char, char));

int (*funcArr3(char,char))(float, char, char)[6];

char *(*baz(double (*)(int,int))[19])(char, char);

/* Forward declare */
struct myStruct;
myStruct myStructTest(MyStruct*** s);


/* Typedefs - need to figure out if there's a way to hook into these */
typedef struct myOpaque myOpaque;
typedef int (*td1)(float, char, char);
td1** td1t(pt2function[5]);


/* Unions */
union u {
  uint64_t a;
  uint32_t b;
};

test* ut(test,test t,test);


/* Enums */
enum { a, b, c };
enum e1 { d, e, f };

enum e2 {
 g = 72,
 h = 1,
 h2 = 2 << 3,
 i
};

enum e3 {
 k = 1,
 l = 2,
 m = 3
};

enum e4 {
 o = 0,
 p = 1,
 q = 2
};

e1 e1t();
e2 e2t();
e3 e3t();
e4 e4t();

Annotation: swig test file, fix

Author: ceninan
Mode: c
Date: Wed, 16 Jun 2010 14:45:55
Plain Text |
/* comment */

%module mytest

/* FIX constants will have to be parsed a bit */
#define myconst (4L >> 2)

const char const * myconstcharconst = ";)";

/* Arrays */
struct marr {
 const char sa[255][50];
 int ia[333][][];
 int (*fa[10])(float, char, char);
};

/* Function pointers */
int (*foo(int,int (*)(int)))(char*, double);
void (*bar(int,int (*)(int)))();

int (*funcArr[4])(char,char)(float, char, char);

void funcArr2(int (*pt2Func[3])(float, char, char));

int (*funcArr3(char,char))(float, char, char)[6];

char *(*baz(double (*)(int,int))[19])(char, char);

/* Forward declare */
struct myStruct;
myStruct myStructTest(MyStruct*** s);


/* Typedefs */
/* FIX: need to figure out if there's a way to hook into these */
/*      ...and look into extending the typemap system some */
typedef struct myOpaque myOpaque;
typedef int (*td1)(float, char, char);
td1** td1t(td1[]); /* FIX: Can't handle a sized array here */


/* Unions */
union u {
  uint64_t a;
  uint32_t b;
};

test* ut(test,test t,test);


/* Enums */
enum { a, b, c };
enum e1 { d, e, f };

enum e2 {
 g = 72,
 h = 1,
 h2 = 2 << 3,
 i
};

enum e3 {
 k = 1,
 l = 2,
 m = 3
};

enum e4 {
 o = 0,
 p = 1,
 q = 2
};

e1 e1t();
e2 e2t();
e3 e3t();
e4 e4t();

Annotation: clay result; see FIX tags above for know problems

Author: ceninan
Mode: factor
Date: Wed, 16 Jun 2010 14:48:20
Plain Text |
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.1
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG 
 * interface file instead. 
 * ----------------------------------------------------------------------------- */

private alias Opaque = Int;

alias myconst = (4L >> 2);

external myconstcharconst : Pointer[CChar];

record marr {
  sa : Array[Array[CChar, 50], 255];
  ia : Array[Pointer[Pointer[Int]], 333];
  fa : Array[CCodePointer[Float, CChar, CChar, Int], 10];
}

external foo(
  argument0 : Int, 
  argument1 : CCodePointer[Int, Int]) CCodePointer[Pointer[CChar], Double, Int];



external bar(
  argument0 : Int, 
  argument1 : CCodePointer[Int, Int]) CCodePointer[Void];



external funcArr : Array[CCodePointer[CChar, CChar, CCodePointer[Float, CChar, CChar, Int]], 4];

external funcArr2(
  pt2Func : Array[CCodePointer[Float, CChar, CChar, Int], 3]) ;



external funcArr3(
  argument0 : CChar, 
  argument1 : CChar) CCodePointer[Float, CChar, CChar, Array[Int, 6]];



external baz(
  argument0 : CCodePointer[Int, Int, Double]) Array[CCodePointer[CChar, CChar, Pointer[CChar]], 19];



alias myStruct = Opaque;

external myStructTest(
  s : Pointer[Pointer[Pointer[MyStruct]]]) myStruct;



external td1t(
  argument0 : Pointer[CCodePointer]) Pointer[Pointer[CCodePointer]];



// union u
alias u = Opaque;

external ut(
  argument0 : test, 
  t : test, 
  argument2 : test) Pointer[test];



alias a = 0;
alias b = a + 1;
alias c = b + 1;

enum e1 {
  d,
  e,
  f
}

alias g = 72;
alias h = 1;
alias h2 = 2 << 3;
alias i = h2 + 1;

alias k = 1;
alias l = 2;
alias m = 3;

enum e4 {
  o,
  p,
  q
}

external e1t() e1;



external e2t() Int;



external e3t() Int;



external e4t() e4;


New Annotation

Summary:
Author:
Mode:
Body: