git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@103 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-01-18 21:54:05 +00:00
commit 4dda9f6ce3
23 changed files with 419 additions and 419 deletions

View file

@ -15,7 +15,7 @@
static char cvsroot[] = "$Header$";
#include "swigcore.h"
#include "swig.h"
/*******************************************************************************
* $Header$
@ -31,13 +31,13 @@ static int numargs;
static int *marked;
/* -----------------------------------------------------------------------------
* void SWIG_init_args(int argc, char **argv)
* void Swig_init_args(int argc, char **argv)
*
* Initializes the argument list.
* ----------------------------------------------------------------------------- */
void
SWIG_init_args(int argc, char **argv)
Swig_init_args(int argc, char **argv)
{
int i;
assert(argc > 0);
@ -53,26 +53,26 @@ SWIG_init_args(int argc, char **argv)
}
/* -----------------------------------------------------------------------------
* void SWIG_mark_arg(int n)
* void Swig_mark_arg(int n)
*
* Marks an argument as being parsed. All modules should do this whenever they
* parse a command line option.
* ----------------------------------------------------------------------------- */
void
SWIG_mark_arg(int n) {
Swig_mark_arg(int n) {
assert(marked);
assert((n >= 0) && (n < numargs));
marked[n] = 1;
}
/* -----------------------------------------------------------------------------
* void SWIG_check_options()
* void Swig_check_options()
*
* Checks for unparsed command line options. If so, issues an error and exits.
* ----------------------------------------------------------------------------- */
void SWIG_check_options() {
void Swig_check_options() {
int error = 0;
int i;
assert(marked);
@ -94,12 +94,12 @@ void SWIG_check_options() {
}
/* -----------------------------------------------------------------------------
* void SWIG_arg_error()
* void Swig_arg_error()
*
* Generates a generic error message and exits.
* ----------------------------------------------------------------------------- */
void SWIG_arg_error() {
void Swig_arg_error() {
Printf(stderr,"SWIG : Unable to parse command line options.\n");
Printf(stderr,"Use 'swig -help' for available options.\n");
exit(1);

View file

@ -15,7 +15,7 @@
static char cvsroot[] = "$Header$";
#include "swigcore.h"
#include "swig.h"
/*******************************************************************************
* $Header$
@ -33,13 +33,13 @@ static DOH *lastpath = 0; /* Last file that was included */
static int bytes_read = 0; /* Bytes read */
/* -----------------------------------------------------------------------------
* void SWIG_add_directory( DOH *dirname)
* void Swig_add_directory( DOH *dirname)
*
* Adds a directory to the SWIG search path.
* ----------------------------------------------------------------------------- */
void
SWIG_add_directory(DOH *dirname)
Swig_add_directory(DOH *dirname)
{
if (!directories) directories = NewList();
assert(directories);
@ -51,13 +51,13 @@ SWIG_add_directory(DOH *dirname)
}
/* -----------------------------------------------------------------------------
* void SWIG_set_library(DOH *libname)
* void Swig_set_library(DOH *libname)
*
* Sets the language specific library name like 'tcl', 'perl5', 'python', etc...
* ----------------------------------------------------------------------------- */
void
SWIG_set_library(DOH *libname)
Swig_set_library(DOH *libname)
{
Delete(libdir);
if (!String_check(libname)) {
@ -68,35 +68,35 @@ SWIG_set_library(DOH *libname)
}
/* -----------------------------------------------------------------------------
* DOH *SWIG_get_library()
* DOH *Swig_get_library()
*
* Gets the language specific name like 'tcl', 'perl5', etc...
* ----------------------------------------------------------------------------- */
DOH *
SWIG_get_library() {
Swig_get_library() {
assert(libdir);
return libdir;
}
/* -----------------------------------------------------------------------------
* DOH *SWIG_last_file()
* DOH *Swig_last_file()
*
* Returns the full pathname of the last file opened.
* ----------------------------------------------------------------------------- */
DOH *
SWIG_last_file() {
Swig_last_file() {
assert(lastpath);
return lastpath;
}
/* -----------------------------------------------------------------------------
* DOH *SWIG_search_path()
* DOH *Swig_search_path()
*
* Returns a list of the current search paths.
* ----------------------------------------------------------------------------- */
DOH *SWIG_search_path()
DOH *Swig_search_path()
{
DOH *filename;
DOH *dirname;
@ -107,32 +107,32 @@ DOH *SWIG_search_path()
assert(slist);
filename = NewString("");
assert(filename);
Printf(filename,".%s", FILE_DELIMETER);
Printf(filename,".%s", SWIG_FILE_DELIMETER);
Append(slist,filename);
for (i = 0; i < Len(directories); i++) {
dirname = Getitem(directories,i);
if (libdir) {
filename = NewString("");
assert(filename);
Printf(filename,"%s%s%s%s", dirname, FILE_DELIMETER, libdir, FILE_DELIMETER);
Printf(filename,"%s%s%s%s", dirname, SWIG_FILE_DELIMETER, libdir, SWIG_FILE_DELIMETER);
Append(slist,filename);
}
filename = NewString("");
assert(filename);
Printf(filename, "%s%s", dirname, FILE_DELIMETER);
Printf(filename, "%s%s", dirname, SWIG_FILE_DELIMETER);
Append(slist,filename);
}
return slist;
}
/* -----------------------------------------------------------------------------
* FILE *SWIG_open( DOH *name)
* FILE *Swig_open( DOH *name)
*
* Looks for a file and open it.
* ----------------------------------------------------------------------------- */
FILE *
SWIG_open(DOH *name)
Swig_open(DOH *name)
{
FILE *f;
DOH *filename;
@ -148,7 +148,7 @@ SWIG_open(DOH *name)
assert(filename);
f = fopen(Char(filename),"r");
if (!f) {
spath = SWIG_search_path();
spath = Swig_search_path();
for (i = 0; i < Len(spath); i++) {
Clear(filename);
Printf(filename,"%s%s", Getitem(spath,i), cname);
@ -166,12 +166,12 @@ SWIG_open(DOH *name)
}
/* -----------------------------------------------------------------------------
* DOH *SWIG_read_file(FILE *f)
* DOH *Swig_read_file(FILE *f)
*
* Reads data from f and returns as a new string
* ----------------------------------------------------------------------------- */
DOH *SWIG_read_file(FILE *f) {
DOH *Swig_read_file(FILE *f) {
char buffer[4096];
DOH *str = NewString("");
assert(str);
@ -183,19 +183,19 @@ DOH *SWIG_read_file(FILE *f) {
}
/* -----------------------------------------------------------------------------
* DOH *SWIG_include(DOH *name)
* DOH *Swig_include(DOH *name)
*
* Open a file and return it as a string.
* ----------------------------------------------------------------------------- */
DOH *
SWIG_include(DOH *name)
Swig_include(DOH *name)
{
FILE *f;
DOH *str;
f = SWIG_open(name);
f = Swig_open(name);
if (!f) return 0;
str = SWIG_read_file(f);
str = Swig_read_file(f);
bytes_read = bytes_read + Len(str);
fclose(f);
Seek(str,0,SEEK_SET);

View file

@ -15,7 +15,7 @@
static char cvsroot[] = "$Header$";
#include "swigcore.h"
#include "swig.h"
/* -----------------------------------------------------------------------------
* $Header$

View file

@ -15,9 +15,9 @@
static char cvsroot[] = "$Header$";
#include "swigcore.h"
#include "swig.h"
struct Scanner {
struct SwigScanner {
DOH *text; /* Current token value */
DOH *scanobjs; /* Objects being scanned */
DOH *str; /* Current object being scanned */
@ -41,12 +41,12 @@ struct Scanner {
* ----------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
* Scanner *NewScanner() - Create a new scanner object.
* SwigScanner *NewSwigScanner() - Create a new scanner object.
* ----------------------------------------------------------------------------- */
Scanner *NewScanner()
SwigScanner *NewSwigScanner()
{
Scanner *s;
s = (Scanner *) malloc(sizeof(Scanner));
SwigScanner *s;
s = (SwigScanner *) malloc(sizeof(SwigScanner));
s->line = 1;
s->file = 0;
s->nexttoken = -1;
@ -61,9 +61,9 @@ Scanner *NewScanner()
}
/* -----------------------------------------------------------------------------
* DelScanner(Scanner *s) - Delete a Scanner object
* DelSwigScanner(SwigScanner *s) - Delete a SwigScanner object
* ----------------------------------------------------------------------------- */
void DelScanner(Scanner *s)
void DelSwigScanner(SwigScanner *s)
{
assert(s);
Delete(s->scanobjs);
@ -73,9 +73,9 @@ void DelScanner(Scanner *s)
}
/* -----------------------------------------------------------------------------
* Scanner_clear(Scanner *s) - Clear a scanner object
* SwigScanner_clear(SwigScanner *s) - Clear a scanner object
* ----------------------------------------------------------------------------- */
void Scanner_clear(Scanner *s) {
void SwigScanner_clear(SwigScanner *s) {
assert(s);
Delete(s->str);
Clear(s->text);
@ -88,10 +88,10 @@ void Scanner_clear(Scanner *s) {
}
/* -----------------------------------------------------------------------------
* Scanner_push(Scanner *s, DOH *txt) - Push text into the scanner
* SwigScanner_push(SwigScanner *s, DOH *txt) - Push text into the scanner
* ----------------------------------------------------------------------------- */
void Scanner_push(Scanner *s, DOH *txt)
void SwigScanner_push(SwigScanner *s, DOH *txt)
{
assert(s && txt);
Push(s->scanobjs,txt);
@ -101,48 +101,48 @@ void Scanner_push(Scanner *s, DOH *txt)
s->line = Getline(txt);
}
/* -----------------------------------------------------------------------------
* Scanner_pushtoken(Scanner *s, int nt)
* SwigScanner_pushtoken(SwigScanner *s, int nt)
*
* Set the next processing token.
* ----------------------------------------------------------------------------- */
void Scanner_pushtoken(Scanner *s, int nt) {
void SwigScanner_pushtoken(SwigScanner *s, int nt) {
assert(s);
assert((nt >= 0) && (nt < MAXTOKENS));
assert((nt >= 0) && (nt < SWIG_MAXTOKENS));
s->nexttoken = nt;
}
/* -----------------------------------------------------------------------------
* Scanner_set_location(Scanner *s, DOH *file, int line)
* SwigScanner_set_location(SwigScanner *s, DOH *file, int line)
* ----------------------------------------------------------------------------- */
void
Scanner_set_location(Scanner *s, DOH *file, int line)
SwigScanner_set_location(SwigScanner *s, DOH *file, int line)
{
Setline(s->str,line);
Setfile(s->str,file);
}
/* -----------------------------------------------------------------------------
* Scanner_get_file(Scanner *s) - Get current file
* SwigScanner_get_file(SwigScanner *s) - Get current file
* ----------------------------------------------------------------------------- */
DOH *
Scanner_get_file(Scanner *s) {
SwigScanner_get_file(SwigScanner *s) {
return Getfile(s->str);
}
int
Scanner_get_line(Scanner *s) {
SwigScanner_get_line(SwigScanner *s) {
return Getline(s->str);
}
/* -----------------------------------------------------------------------------
* char nextchar(Scanner *s)
* char nextchar(SwigScanner *s)
*
* Returns the next character from the scanner or 0 if end of the string.
* ----------------------------------------------------------------------------- */
static char
nextchar(Scanner *s)
nextchar(SwigScanner *s)
{
char c[2] = {0,0};
int nc;
@ -165,12 +165,12 @@ nextchar(Scanner *s)
}
/* -----------------------------------------------------------------------------
* void retract(Scanner *s, int n)
* void retract(SwigScanner *s, int n)
*
* Retract n characters
* ----------------------------------------------------------------------------- */
static void
retract(Scanner *s, int n) {
retract(SwigScanner *s, int n) {
int i, l;
char *str;
@ -188,13 +188,13 @@ retract(Scanner *s, int n) {
}
/* -----------------------------------------------------------------------------
* int look(Scanner *s)
* int look(SwigScanner *s)
*
* Get the next token.
* ----------------------------------------------------------------------------- */
static int
look(Scanner *s)
look(SwigScanner *s)
{
int state;
char c = 0;
@ -211,7 +211,7 @@ look(Scanner *s)
/* Process delimeters */
if (c == '\n') {
return TOKEN_ENDLINE;
return SWIG_TOKEN_ENDLINE;
} else if (!isspace(c)) {
retract(s,1);
state = 1000;
@ -231,29 +231,29 @@ look(Scanner *s)
/* Look for single character symbols */
else if (c == '(') return TOKEN_LPAREN;
else if (c == ')') return TOKEN_RPAREN;
else if (c == ';') return TOKEN_SEMI;
else if (c == ',') return TOKEN_COMMA;
else if (c == '*') return TOKEN_STAR;
else if (c == '}') return TOKEN_RBRACE;
else if (c == '{') return TOKEN_LBRACE;
else if (c == '(') return SWIG_TOKEN_LPAREN;
else if (c == ')') return SWIG_TOKEN_RPAREN;
else if (c == ';') return SWIG_TOKEN_SEMI;
else if (c == ',') return SWIG_TOKEN_COMMA;
else if (c == '*') return SWIG_TOKEN_STAR;
else if (c == '}') return SWIG_TOKEN_RBRACE;
else if (c == '{') return SWIG_TOKEN_LBRACE;
else if (c == '=') state = 33;
else if (c == '+') return TOKEN_PLUS;
else if (c == '-') return TOKEN_MINUS;
else if (c == '+') return SWIG_TOKEN_PLUS;
else if (c == '-') return SWIG_TOKEN_MINUS;
else if (c == '&') state = 31;
else if (c == '|') state = 32;
else if (c == '^') return TOKEN_XOR;
else if (c == '^') return SWIG_TOKEN_XOR;
else if (c == '<') state = 60;
else if (c == '>') state = 61;
else if (c == '~') return TOKEN_NOT;
else if (c == '~') return SWIG_TOKEN_NOT;
else if (c == '!') state = 3;
else if (c == '\\') return TOKEN_BACKSLASH;
else if (c == '[') return TOKEN_LBRACKET;
else if (c == ']') return TOKEN_RBRACKET;
else if (c == '@') return TOKEN_AT;
else if (c == '$') return TOKEN_DOLLAR;
else if (c == '#') return TOKEN_POUND;
else if (c == '\\') return SWIG_TOKEN_BACKSLASH;
else if (c == '[') return SWIG_TOKEN_LBRACKET;
else if (c == ']') return SWIG_TOKEN_RBRACKET;
else if (c == '@') return SWIG_TOKEN_AT;
else if (c == '$') return SWIG_TOKEN_DOLLAR;
else if (c == '#') return SWIG_TOKEN_POUND;
/* Look for multi-character sequences */
@ -291,7 +291,7 @@ look(Scanner *s)
Append(s->text," ");
} else {
retract(s,1);
return TOKEN_SLASH;
return SWIG_TOKEN_SLASH;
}
break;
case 10: /* C++ style comment */
@ -300,7 +300,7 @@ look(Scanner *s)
return 0;
}
if (c == '\n') {
return TOKEN_ENDLINE;
return SWIG_TOKEN_ENDLINE;
} else {
state = 10;
}
@ -337,7 +337,7 @@ look(Scanner *s)
return 0;
}
if (c == '\"') {
return TOKEN_STRING;
return SWIG_TOKEN_STRING;
} else if (c == '\\') {
state = 21; /* Possibly an escape sequence. */
break;
@ -350,43 +350,43 @@ look(Scanner *s)
break;
case 3: /* Maybe a not equals */
if ((c = nextchar(s)) == 0) return TOKEN_LNOT;
else if (c == '=') return TOKEN_NOTEQUAL;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_LNOT;
else if (c == '=') return SWIG_TOKEN_NOTEQUAL;
else {
retract(s,1);
return TOKEN_LNOT;
return SWIG_TOKEN_LNOT;
}
break;
case 31: /* AND or Logical AND */
if ((c = nextchar(s)) == 0) return TOKEN_AND;
else if (c == '&') return TOKEN_LAND;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_AND;
else if (c == '&') return SWIG_TOKEN_LAND;
else {
retract(s,1);
return TOKEN_AND;
return SWIG_TOKEN_AND;
}
break;
case 32: /* OR or Logical OR */
if ((c = nextchar(s)) == 0) return TOKEN_OR;
else if (c == '|') return TOKEN_LOR;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_OR;
else if (c == '|') return SWIG_TOKEN_LOR;
else {
retract(s,1);
return TOKEN_OR;
return SWIG_TOKEN_OR;
}
break;
case 33: /* EQUAL or EQUALTO */
if ((c = nextchar(s)) == 0) return TOKEN_EQUAL;
else if (c == '=') return TOKEN_EQUALTO;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_EQUAL;
else if (c == '=') return SWIG_TOKEN_EQUALTO;
else {
retract(s,1);
return TOKEN_EQUAL;
return SWIG_TOKEN_EQUAL;
}
break;
case 4: /* A wrapper generator directive (maybe) */
if (( c= nextchar(s)) == 0) return TOKEN_PERCENT;
if (( c= nextchar(s)) == 0) return SWIG_TOKEN_PERCENT;
if (c == '{') {
state = 40; /* Include block */
Clear(s->text);
@ -397,7 +397,7 @@ look(Scanner *s)
else if (strchr(s->idstart,'%') && ((isalpha(c)) || (c == '_'))) state = 7;
else {
retract(s,1);
return TOKEN_PERCENT;
return SWIG_TOKEN_PERCENT;
}
break;
@ -416,7 +416,7 @@ look(Scanner *s)
if (c == '}') {
Delitem(s->text,DOH_END);
Delitem(s->text,DOH_END);
return TOKEN_CODEBLOCK;
return SWIG_TOKEN_CODEBLOCK;
} else {
state = 40;
}
@ -424,48 +424,48 @@ look(Scanner *s)
case 5: /* Maybe a double colon */
if (( c = nextchar(s)) == 0) return TOKEN_COLON;
if ( c == ':') return TOKEN_DCOLON;
if (( c = nextchar(s)) == 0) return SWIG_TOKEN_COLON;
if ( c == ':') return SWIG_TOKEN_DCOLON;
else {
retract(s,1);
return TOKEN_COLON;
return SWIG_TOKEN_COLON;
}
break;
case 60: /* shift operators */
if ((c = nextchar(s)) == 0) return TOKEN_LESSTHAN;
if (c == '<') return TOKEN_LSHIFT;
else if (c == '=') return TOKEN_LTEQUAL;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_LESSTHAN;
if (c == '<') return SWIG_TOKEN_LSHIFT;
else if (c == '=') return SWIG_TOKEN_LTEQUAL;
else {
retract(s,1);
return TOKEN_LESSTHAN;
return SWIG_TOKEN_LESSTHAN;
}
break;
case 61:
if ((c = nextchar(s)) == 0) return TOKEN_GREATERTHAN;
if (c == '>') return TOKEN_RSHIFT;
else if (c == '=') return TOKEN_GTEQUAL;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_GREATERTHAN;
if (c == '>') return SWIG_TOKEN_RSHIFT;
else if (c == '=') return SWIG_TOKEN_GTEQUAL;
else {
retract(s,1);
return TOKEN_GREATERTHAN;
return SWIG_TOKEN_GREATERTHAN;
}
break;
case 7: /* Identifier */
if ((c = nextchar(s)) == 0) return TOKEN_ID;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_ID;
if (isalnum(c) || (c == '_') || (c == '$')) {
state = 7;
} else {
retract(s,1);
return TOKEN_ID;
return SWIG_TOKEN_ID;
}
break;
case 8: /* A numerical digit */
if ((c = nextchar(s)) == 0) return TOKEN_INT;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_INT;
if (c == '.') {state = 81;}
else if ((c == 'e') || (c == 'E')) {state = 86;}
else if ((c == 'f') || (c == 'F')) {
Delitem(s->text,DOH_END);
return TOKEN_FLOAT;
return SWIG_TOKEN_FLOAT;
} else if (isdigit(c)) { state = 8;}
else if ((c == 'l') || (c == 'L')) {
state = 87;
@ -473,35 +473,35 @@ look(Scanner *s)
state = 88;
} else {
retract(s,1);
return TOKEN_INT;
return SWIG_TOKEN_INT;
}
break;
case 81: /* A floating pointer number of some sort */
if ((c = nextchar(s)) == 0) return TOKEN_DOUBLE;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_DOUBLE;
if (isdigit(c)) state = 81;
else if ((c == 'e') || (c == 'E')) state = 82;
else if ((c == 'f') || (c == 'F') || (c == 'l') || (c == 'L')) {
Delitem(s->text,DOH_END);
return TOKEN_FLOAT;
return SWIG_TOKEN_FLOAT;
} else {
retract(s,1);
return(TOKEN_DOUBLE);
return(SWIG_TOKEN_DOUBLE);
}
break;
case 82:
if ((c = nextchar(s)) == 0) {
retract(s,1);
return TOKEN_INT;
return SWIG_TOKEN_INT;
}
if ((isdigit(c)) || (c == '-') || (c == '+')) state = 86;
else {
retract(s,2);
return(TOKEN_INT);
return(SWIG_TOKEN_INT);
}
break;
case 83:
/* Might be a hexidecimal or octal number */
if ((c = nextchar(s)) == 0) return TOKEN_INT;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_INT;
if (isdigit(c)) state = 84;
else if ((c == 'x') || (c == 'X')) state = 85;
else if (c == '.') state = 81;
@ -511,12 +511,12 @@ look(Scanner *s)
state = 88;
} else {
retract(s,1);
return TOKEN_INT;
return SWIG_TOKEN_INT;
}
break;
case 84:
/* This is an octal number */
if ((c = nextchar(s)) == 0) return TOKEN_INT;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_INT;
if (isdigit(c)) state = 84;
else if ((c == 'l') || (c == 'L')) {
state = 87;
@ -524,12 +524,12 @@ look(Scanner *s)
state = 88;
} else {
retract(s,1);
return TOKEN_INT;
return SWIG_TOKEN_INT;
}
break;
case 85:
/* This is an hex number */
if ((c = nextchar(s)) == 0) return TOKEN_INT;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_INT;
if ((isdigit(c)) || (c=='a') || (c=='b') || (c=='c') ||
(c=='d') || (c=='e') || (c=='f') || (c=='A') ||
(c=='B') || (c=='C') || (c=='D') || (c=='E') ||
@ -541,46 +541,46 @@ look(Scanner *s)
state = 88;
} else {
retract(s,1);
return TOKEN_INT;
return SWIG_TOKEN_INT;
}
break;
case 86:
/* Rest of floating point number */
if ((c = nextchar(s)) == 0) return TOKEN_DOUBLE;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_DOUBLE;
if (isdigit(c)) state = 86;
else if ((c == 'f') || (c == 'F')) {
Delitem(s->text,DOH_END);
return TOKEN_FLOAT;
return SWIG_TOKEN_FLOAT;
} else if ((c == 'l') || (c == 'L')) {
Delitem(s->text,DOH_END);
return TOKEN_DOUBLE;
return SWIG_TOKEN_DOUBLE;
} else {
retract(s,1);
return TOKEN_DOUBLE;
return SWIG_TOKEN_DOUBLE;
}
break;
case 87 :
/* A long integer of some sort */
if ((c = nextchar(s)) == 0) return TOKEN_LONG;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_LONG;
if ((c == 'u') || (c == 'U')) {
return TOKEN_ULONG;
return SWIG_TOKEN_ULONG;
} else {
retract(s,1);
return TOKEN_LONG;
return SWIG_TOKEN_LONG;
}
/* An unsigned number */
case 88:
if ((c = nextchar(s)) == 0) return TOKEN_UINT;
if ((c = nextchar(s)) == 0) return SWIG_TOKEN_UINT;
if ((c == 'l') || (c == 'L')) {
return TOKEN_ULONG;
return SWIG_TOKEN_ULONG;
} else {
retract(s,1);
return TOKEN_UINT;
return SWIG_TOKEN_UINT;
}
/* A character constant */
@ -590,7 +590,7 @@ look(Scanner *s)
return 0;
}
if (c == '\'') {
return(TOKEN_CHAR);
return(SWIG_TOKEN_CHAR);
} else if (c == '\\') state = 91;
break;
@ -609,25 +609,25 @@ look(Scanner *s)
if (isdigit(c)) state = 81;
else {
retract(s,1);
return TOKEN_PERIOD;
return SWIG_TOKEN_PERIOD;
}
break;
/* An illegal character */
default:
return TOKEN_ILLEGAL;
return SWIG_TOKEN_ILLEGAL;
}
}
}
/* -----------------------------------------------------------------------------
* int Scanner_token(Scanner *s)
* int SwigScanner_token(SwigScanner *s)
*
* Return the next token or 0 if at the end of the string
* ----------------------------------------------------------------------------- */
int
Scanner_token(Scanner *s)
SwigScanner_token(SwigScanner *s)
{
int t;
Clear(s->text);
@ -641,24 +641,24 @@ Scanner_token(Scanner *s)
}
/* -----------------------------------------------------------------------------
* DOH *Scanner_text(Scanner *s)
* DOH *SwigScanner_text(SwigScanner *s)
*
* Return the text associated with the last token returned.
* ----------------------------------------------------------------------------- */
DOH *
Scanner_text(Scanner *s)
SwigScanner_text(SwigScanner *s)
{
return s->text;
}
/* -----------------------------------------------------------------------------
* void Scanner_skip_line(Scanner *s)
* void SwigScanner_skip_line(SwigScanner *s)
*
* Skips to the end of a line
* ----------------------------------------------------------------------------- */
void
Scanner_skip_line(Scanner *s)
SwigScanner_skip_line(SwigScanner *s)
{
char c;
int done = 0;
@ -674,14 +674,14 @@ Scanner_skip_line(Scanner *s)
}
/* -----------------------------------------------------------------------------
* void Scanner_skip_balanced(Scanner *s, int start, int end)
* void SwigScanner_skip_balanced(SwigScanner *s, int start, int end)
*
* Skips a piece of code enclosed in begin/end symbols such as '{...}' or
* (...). Ignores symbols inside comments or strings.
* ----------------------------------------------------------------------------- */
int
Scanner_skip_balanced(Scanner *s, int startchar, int endchar)
SwigScanner_skip_balanced(SwigScanner *s, int startchar, int endchar)
{
char c;
int num_levels = 1;

130
SWIG/Source/Swig/swig.h Normal file
View file

@ -0,0 +1,130 @@
/****************************************************************************
* Simplified Wrapper and Interface Generator (SWIG)
*
* Author : David Beazley
*
* Department of Computer Science
* University of Chicago
* 1100 E 58th Street
* Chicago, IL 60637
* beazley@cs.uchicago.edu
*
* Please read the file LICENSE for the copyright and terms by which Swig
* can be used and distributed.
****************************************************************************/
#ifndef _SWIGCORE_H
#define _SWIGCORE_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "doh.h"
#ifdef __cplusplus
extern "C" {
#endif
/* --- File interface --- */
extern void Swig_add_directory(DOH *dirname);
extern void Swig_set_library(DOH *libname);
extern DOH *Swig_get_library();
extern DOH *Swig_last_file();
extern DOH *Swig_search_path();
extern FILE *Swig_open(DOH *name);
extern DOH *Swig_read_file(FILE *f);
extern DOH *Swig_include(DOH *name);
#define SWIG_FILE_DELIMETER "/"
/* --- Command line parsing --- */
extern void Swig_init_args(int argc, char **argv);
extern void Swig_mark_arg(int n);
extern void Swig_check_options();
extern void Swig_arg_error();
/* --- Scanner Interface --- */
typedef struct SwigScanner SwigScanner;
extern SwigScanner *NewSwigScanner();
extern void DelSwigScanner(SwigScanner *);
extern void SwigScanner_clear(SwigScanner *);
extern void SwigScanner_push(SwigScanner *, DOH *);
extern void SwigScanner_pushtoken(SwigScanner *, int);
extern int SwigScanner_token(SwigScanner *);
extern DOH *SwigScanner_text(SwigScanner *);
extern void SwigScanner_skip_line(SwigScanner *);
extern int SwigScanner_skip_balanced(SwigScanner *, int startchar, int endchar);
extern void SwigScanner_set_location(SwigScanner *, DOH *file, int line);
extern DOH *SwigScanner_get_file(SwigScanner *);
extern int SwigScanner_get_line(SwigScanner *);
#define SWIG_MAXTOKENS 512
#define SWIG_TOKEN_LPAREN 1
#define SWIG_TOKEN_RPAREN 2
#define SWIG_TOKEN_SEMI 3
#define SWIG_TOKEN_COMMA 4
#define SWIG_TOKEN_STAR 5
#define SWIG_TOKEN_LBRACE 6
#define SWIG_TOKEN_RBRACE 7
#define SWIG_TOKEN_EQUAL 8
#define SWIG_TOKEN_EQUALTO 9
#define SWIG_TOKEN_NOTEQUAL 10
#define SWIG_TOKEN_PLUS 11
#define SWIG_TOKEN_MINUS 12
#define SWIG_TOKEN_AND 13
#define SWIG_TOKEN_LAND 14
#define SWIG_TOKEN_OR 15
#define SWIG_TOKEN_LOR 16
#define SWIG_TOKEN_XOR 17
#define SWIG_TOKEN_LESSTHAN 18
#define SWIG_TOKEN_GREATERTHAN 19
#define SWIG_TOKEN_LTEQUAL 20
#define SWIG_TOKEN_GTEQUAL 21
#define SWIG_TOKEN_NOT 22
#define SWIG_TOKEN_LNOT 23
#define SWIG_TOKEN_LBRACKET 24
#define SWIG_TOKEN_RBRACKET 25
#define SWIG_TOKEN_SLASH 26
#define SWIG_TOKEN_BACKSLASH 27
#define SWIG_TOKEN_ENDLINE 28
#define SWIG_TOKEN_STRING 29
#define SWIG_TOKEN_POUND 30
#define SWIG_TOKEN_PERCENT 31
#define SWIG_TOKEN_COLON 32
#define SWIG_TOKEN_DCOLON 33
#define SWIG_TOKEN_LSHIFT 34
#define SWIG_TOKEN_RSHIFT 35
#define SWIG_TOKEN_ID 36
#define SWIG_TOKEN_FLOAT 37
#define SWIG_TOKEN_DOUBLE 38
#define SWIG_TOKEN_INT 39
#define SWIG_TOKEN_UINT 40
#define SWIG_TOKEN_LONG 41
#define SWIG_TOKEN_ULONG 42
#define SWIG_TOKEN_CHAR 43
#define SWIG_TOKEN_PERIOD 44
#define SWIG_TOKEN_AT 45
#define SWIG_TOKEN_DOLLAR 46
#define SWIG_TOKEN_CODEBLOCK 47
#define SWIG_TOKEN_ILLEGAL 98
#define SWIG_TOKEN_LAST 99
/* --- Misc --- */
extern char *copy_string(const char *c);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,129 +0,0 @@
/****************************************************************************
* Simplified Wrapper and Interface Generator (SWIG)
*
* Author : David Beazley
*
* Department of Computer Science
* University of Chicago
* 1100 E 58th Street
* Chicago, IL 60637
* beazley@cs.uchicago.edu
*
* Please read the file LICENSE for the copyright and terms by which SWIG
* can be used and distributed.
****************************************************************************/
#ifndef _SWIGCORE_H
#define _SWIGCORE_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "doh.h"
#ifdef __cplusplus
extern "C" {
#endif
/* --- File interface --- */
extern void SWIG_add_directory(DOH *dirname);
extern void SWIG_set_library(DOH *libname);
extern DOH *SWIG_get_library();
extern DOH *SWIG_last_file();
extern DOH *SWIG_search_path();
extern FILE *SWIG_open(DOH *name);
extern DOH *SWIG_read_file(FILE *f);
extern DOH *SWIG_include(DOH *name);
#define FILE_DELIMETER "/"
/* --- Command line parsing --- */
extern void SWIG_init_args(int argc, char **argv);
extern void SWIG_mark_arg(int n);
extern void SWIG_check_options();
extern void SWIG_arg_error();
/* --- Scanner Interface --- */
typedef struct Scanner Scanner;
extern Scanner *NewScanner();
extern void DelScanner(Scanner *);
extern void Scanner_clear(Scanner *);
extern void Scanner_push(Scanner *, DOH *);
extern void Scanner_pushtoken(Scanner *, int);
extern int Scanner_token(Scanner *);
extern DOH *Scanner_text(Scanner *);
extern void Scanner_skip_line(Scanner *);
extern int Scanner_skip_balanced(Scanner *, int startchar, int endchar);
extern void Scanner_set_location(Scanner *, DOH *file, int line);
extern DOH *Scanner_get_file(Scanner *);
extern int Scanner_get_line(Scanner *);
#define MAXTOKENS 512
#define TOKEN_LPAREN 1
#define TOKEN_RPAREN 2
#define TOKEN_SEMI 3
#define TOKEN_COMMA 4
#define TOKEN_STAR 5
#define TOKEN_LBRACE 6
#define TOKEN_RBRACE 7
#define TOKEN_EQUAL 8
#define TOKEN_EQUALTO 9
#define TOKEN_NOTEQUAL 10
#define TOKEN_PLUS 11
#define TOKEN_MINUS 12
#define TOKEN_AND 13
#define TOKEN_LAND 14
#define TOKEN_OR 15
#define TOKEN_LOR 16
#define TOKEN_XOR 17
#define TOKEN_LESSTHAN 18
#define TOKEN_GREATERTHAN 19
#define TOKEN_LTEQUAL 20
#define TOKEN_GTEQUAL 21
#define TOKEN_NOT 22
#define TOKEN_LNOT 23
#define TOKEN_LBRACKET 24
#define TOKEN_RBRACKET 25
#define TOKEN_SLASH 26
#define TOKEN_BACKSLASH 27
#define TOKEN_ENDLINE 28
#define TOKEN_STRING 29
#define TOKEN_POUND 30
#define TOKEN_PERCENT 31
#define TOKEN_COLON 32
#define TOKEN_DCOLON 33
#define TOKEN_LSHIFT 34
#define TOKEN_RSHIFT 35
#define TOKEN_ID 36
#define TOKEN_FLOAT 37
#define TOKEN_DOUBLE 38
#define TOKEN_INT 39
#define TOKEN_UINT 40
#define TOKEN_LONG 41
#define TOKEN_ULONG 42
#define TOKEN_CHAR 43
#define TOKEN_PERIOD 44
#define TOKEN_AT 45
#define TOKEN_DOLLAR 46
#define TOKEN_CODEBLOCK 47
#define TOKEN_ILLEGAL 98
#define TOKEN_LAST 99
/* --- Misc --- */
extern char *copy_string(const char *c);
#ifdef __cplusplus
}
#endif
#endif