swig/Examples/test-suite/r/legacy.i
Joseph Wang 0218fdeb27 add missing files from initial check in
change camel case to match SWIG conventions


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9182 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-06-30 05:48:54 +00:00

95 lines
1 KiB
OpenEdge ABL

%module legacy
%inline %{
typedef char *String;
typedef struct {
int i;
double d;
char *str;
String s;
} Obj;
Obj *getObject(int i, double d);
#include <string.h>
Obj *
getObject(int i, double d)
{
Obj *obj;
obj = (Obj *) calloc(1, sizeof(Obj));
obj->i = i;
obj->d = d;
obj->str = strdup("a test string");
return(obj);
}
%}
char *getString();
int getInt();
double getDouble();
float getFloat();
long getLong();
unsigned long getUnsignedLong();
char getChar();
extern unsigned long MyULong;
extern const double PiSquared;
#if 0
extern float *MyFloatRef;
#endif
%inline %{
#define PI 3.14159265358979
unsigned long MyULong = 20;
static float MyFloat = 1.05;
float *MyFloatRef = &MyFloat;
const double PiSquared = PI * PI;
char *getString()
{
return "This is a literal string";
}
int
getInt()
{
return 42;
}
double
getDouble()
{
return PI;
}
float
getFloat()
{
return PI/2;
}
long getLong()
{
return -321313L;
}
unsigned long
getUnsignedLong()
{
return 23123L;
}
char
getChar()
{
return('A');
}
%}