*** empty log message ***
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4143 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d4d33f06d5
commit
b0941de80a
15 changed files with 0 additions and 3710 deletions
|
|
@ -1,7 +0,0 @@
|
|||
/* This file tells SWIG we are compiling the Mac version */
|
||||
|
||||
#define MACSWIG
|
||||
#define NEED_ALLOC
|
||||
#define SWIG_LIB ":Lib"
|
||||
#define SWIG_CC "Metrowerks CodeWarrior"
|
||||
#define SWIG_LANG TCL8
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
Makefile
|
||||
.deps
|
||||
parser.h
|
||||
parser.c
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
#####################################################################
|
||||
# $Header$
|
||||
#
|
||||
# LParse
|
||||
#####################################################################
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
YACC = @YACC@
|
||||
|
||||
INCLUDE = -I$(srcdir)/. \
|
||||
-I$(srcdir)/../Swig \
|
||||
-I$(srcdir)/../DOH/Include \
|
||||
-I$(srcdir)/../Preprocessor
|
||||
|
||||
SRCS = cscanner.c
|
||||
OBJS = parser.o cscanner.o
|
||||
TARGET = liblparse.a
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(AR) cr $(TARGET) $(OBJS)
|
||||
$(RANLIB) $(TARGET)
|
||||
|
||||
parser.o: parser.c
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
|
||||
|
||||
parser.c: parser.y
|
||||
$(YACC) @YFLAGS@ parser.y
|
||||
@cp y.tab.h lyacc.h
|
||||
@cp y.tab.c parser.c
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ core *.so *.a y.tab*
|
||||
|
|
@ -1,443 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* cscanner.c
|
||||
*
|
||||
* C Scanner that is roughly compatible with the SWIG1.1 scanner.
|
||||
*
|
||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (C) 1999-2000. The University of Chicago
|
||||
* See the file LICENSE for information on usage and redistribution.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static char cvsroot[] = "$Header$";
|
||||
|
||||
#include "lparse.h"
|
||||
|
||||
#define yylval lparse_yylval
|
||||
|
||||
#include "lyacc.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
static int map[][2] = {
|
||||
{ SWIG_TOKEN_LPAREN, LPAREN },
|
||||
{ SWIG_TOKEN_RPAREN, RPAREN },
|
||||
{ SWIG_TOKEN_SEMI, SEMI },
|
||||
{ SWIG_TOKEN_COMMA, COMMA },
|
||||
{ SWIG_TOKEN_STAR, STAR },
|
||||
{ SWIG_TOKEN_LBRACE, LBRACE },
|
||||
{ SWIG_TOKEN_RBRACE, RBRACE },
|
||||
{ SWIG_TOKEN_EQUAL, EQUAL },
|
||||
{ SWIG_TOKEN_EQUALTO, EQUALTO },
|
||||
{ SWIG_TOKEN_NOTEQUAL, NOTEQUAL },
|
||||
{ SWIG_TOKEN_PLUS, PLUS },
|
||||
{ SWIG_TOKEN_MINUS, MINUS },
|
||||
{ SWIG_TOKEN_AND, AND },
|
||||
{ SWIG_TOKEN_LAND, LAND },
|
||||
{ SWIG_TOKEN_OR, OR},
|
||||
{ SWIG_TOKEN_LOR, LOR},
|
||||
{ SWIG_TOKEN_XOR, XOR},
|
||||
{ SWIG_TOKEN_LESSTHAN, LESSTHAN },
|
||||
{ SWIG_TOKEN_GREATERTHAN, GREATERTHAN },
|
||||
{ SWIG_TOKEN_LTEQUAL, LTEQUAL},
|
||||
{ SWIG_TOKEN_GTEQUAL, GTEQUAL},
|
||||
{ SWIG_TOKEN_NOT, NOT },
|
||||
{ SWIG_TOKEN_LNOT, LNOT },
|
||||
{ SWIG_TOKEN_LBRACKET, LBRACKET },
|
||||
{ SWIG_TOKEN_RBRACKET, RBRACKET },
|
||||
{ SWIG_TOKEN_SLASH, SLASH },
|
||||
{ SWIG_TOKEN_BACKSLASH, -1 },
|
||||
{ SWIG_TOKEN_ENDLINE, -1},
|
||||
{ SWIG_TOKEN_STRING, STRING },
|
||||
{ SWIG_TOKEN_POUND, -1 },
|
||||
{ SWIG_TOKEN_PERCENT, -1 },
|
||||
{ SWIG_TOKEN_COLON, COLON },
|
||||
{ SWIG_TOKEN_DCOLON, DCOLON },
|
||||
{ SWIG_TOKEN_LSHIFT, LSHIFT },
|
||||
{ SWIG_TOKEN_RSHIFT, RSHIFT },
|
||||
{ SWIG_TOKEN_ID, ID},
|
||||
{ SWIG_TOKEN_FLOAT, NUM_FLOAT},
|
||||
{ SWIG_TOKEN_DOUBLE, NUM_FLOAT},
|
||||
{ SWIG_TOKEN_INT, NUM_INT},
|
||||
{ SWIG_TOKEN_UINT, NUM_UNSIGNED},
|
||||
{ SWIG_TOKEN_LONG, NUM_LONG},
|
||||
{ SWIG_TOKEN_ULONG, NUM_ULONG},
|
||||
{ SWIG_TOKEN_CHAR, CHARCONST},
|
||||
{ SWIG_TOKEN_PERIOD, PERIOD},
|
||||
{ SWIG_TOKEN_AT, -1},
|
||||
{ SWIG_TOKEN_DOLLAR, -1},
|
||||
{ SWIG_TOKEN_CODEBLOCK, HBLOCK},
|
||||
{ SWIG_TOKEN_ILLEGAL, SWIG_TOKEN_ILLEGAL},
|
||||
{ SWIG_TOKEN_RSTRING, SWIG_TOKEN_RSTRING},
|
||||
{ SWIG_TOKEN_LAST, -1},
|
||||
{0,0},
|
||||
};
|
||||
|
||||
static int remap[SWIG_MAXTOKENS];
|
||||
static int cscan_init = 0;
|
||||
static int cplusplus_mode = 1;
|
||||
static int objc_mode = 0;
|
||||
static int strict_type = 0;
|
||||
|
||||
static SwigScanner *cscanner = 0;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* lparse_init()
|
||||
*
|
||||
* Initialize the parser
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
lparse_init() {
|
||||
int i = 0;
|
||||
if (cscan_init) return;
|
||||
while (map[i][0]) {
|
||||
remap[map[i][0]] = map[i][1];
|
||||
i++;
|
||||
}
|
||||
cscanner = NewSwigScanner();
|
||||
SwigScanner_idstart(cscanner,"$%@");
|
||||
cscan_init = 1;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_push()
|
||||
*
|
||||
* Push some text into the scanner.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
void
|
||||
LParse_push(DOH *str) {
|
||||
assert(str);
|
||||
lparse_init();
|
||||
SwigScanner_push(cscanner, str);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_file()
|
||||
*
|
||||
* Return the current filename
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
DOH *
|
||||
LParse_file() {
|
||||
return SwigScanner_get_file(cscanner);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_line()
|
||||
*
|
||||
* Return the current line number
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
LParse_line() {
|
||||
return SwigScanner_get_line(cscanner);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_set_location()
|
||||
*
|
||||
* Set the file and line number of the scanner.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
LParse_set_location(DOH *file, int line) {
|
||||
SwigScanner_set_location(cscanner,file,line);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_strict_type()
|
||||
*
|
||||
* Set the value of the strict type handling flag.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
LParse_strict_type(int i) {
|
||||
int old = strict_type;
|
||||
strict_type = i;
|
||||
return old;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_cplusplus()
|
||||
*
|
||||
* Enable or disable C++ keywords.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
LParse_cplusplus(int i) {
|
||||
int old = cplusplus_mode;
|
||||
cplusplus_mode = i;
|
||||
return old;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_objc()
|
||||
*
|
||||
* Enable or disable objective-C keywords.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
int
|
||||
LParse_objc(int i) {
|
||||
int old = objc_mode;
|
||||
objc_mode = i;
|
||||
return old;
|
||||
}
|
||||
|
||||
static DOH *macro_name = 0;
|
||||
static DOH *macro_file = 0;
|
||||
static int macro_line = 0;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_macro_location()
|
||||
*
|
||||
* Set the location of a macro when parsing macro text.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
LParse_macro_location(DOH *name, DOH *file, int line) {
|
||||
macro_name = name;
|
||||
macro_file = file;
|
||||
macro_line = line;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_error()
|
||||
*
|
||||
* Report an error.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
LParse_error(DOH *file, int line, char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap,fmt);
|
||||
if (!file) {
|
||||
file = SwigScanner_get_file(cscanner);
|
||||
line = SwigScanner_get_line(cscanner);
|
||||
}
|
||||
if (macro_name) {
|
||||
Printf(stderr,"%s:%d In macro %s at ", macro_file, macro_line, macro_name);
|
||||
}
|
||||
if (line > 0) {
|
||||
Printf(stderr,"%s:%d ", file, line);
|
||||
} else {
|
||||
Printf(stderr,"%s:EOF ",file);
|
||||
}
|
||||
vPrintf(stderr,fmt,ap);
|
||||
va_end(ap);
|
||||
macro_name = 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_skip_balanced()
|
||||
*
|
||||
* Skip over text enclosed in balanced characters (), [], <>, etc...
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
DOH *
|
||||
LParse_skip_balanced(int startchar, int endchar) {
|
||||
DOH *file;
|
||||
int line;
|
||||
file = SwigScanner_get_file(cscanner);
|
||||
line = SwigScanner_get_line(cscanner);
|
||||
if (SwigScanner_skip_balanced(cscanner, startchar, endchar) == -1)
|
||||
LParse_error(file,line,"Missing \'%c\'. Reached the end of input.\n", endchar);
|
||||
return Copy(SwigScanner_text(cscanner));
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_skip_semi()
|
||||
*
|
||||
* Skip to the next semi-colon
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
LParse_skip_semi() {
|
||||
int t, line;
|
||||
DOH *file;
|
||||
int lparse_yylex();
|
||||
|
||||
line = SwigScanner_get_line(cscanner);
|
||||
file = SwigScanner_get_file(cscanner);
|
||||
while ((t = lparse_yylex())) {
|
||||
if (t == SEMI) return;
|
||||
}
|
||||
LParse_error(file,line,"Missing semicolon. Reached the end of input.\n");
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParse_skip_decl()
|
||||
*
|
||||
* Skip the current declaration (terminated by either a semicolon or }
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
LParse_skip_decl() {
|
||||
int t, line, level = 0;
|
||||
DOH *file;
|
||||
int lparse_yylex();
|
||||
|
||||
line = SwigScanner_get_line(cscanner);
|
||||
file = SwigScanner_get_file(cscanner);
|
||||
while ((t = lparse_yylex())) {
|
||||
if ((t == SEMI) && (level == 0)) return;
|
||||
if (t == LBRACE) level++;
|
||||
if (t == RBRACE) {
|
||||
level--;
|
||||
if (level <= 0) return;
|
||||
}
|
||||
}
|
||||
if (level) {
|
||||
LParse_error(file,line,"Missing \'}\'. Reached the end of input.\n");
|
||||
} else {
|
||||
LParse_error(file,line,"Missing semicolon. Reached the end of input.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* yylex1()
|
||||
*
|
||||
* Get next token.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
static int
|
||||
yylex1(void) {
|
||||
int l, l1;
|
||||
DOH *text;
|
||||
char *yytext = 0;
|
||||
int lparse_yylex();
|
||||
|
||||
assert(cscan_init);
|
||||
l = SwigScanner_token(cscanner);
|
||||
if (!l) return 0;
|
||||
l1 = remap[l];
|
||||
if (l1 == -1) return lparse_yylex();
|
||||
|
||||
text = SwigScanner_text(cscanner);
|
||||
yylval.tok.line = Getline(text);
|
||||
yylval.tok.filename = Getfile(text);
|
||||
yylval.tok.data = 0;
|
||||
yylval.tok.ivalue = 0;
|
||||
yytext = Char(text);
|
||||
if (l1 == SWIG_TOKEN_ILLEGAL) {
|
||||
LParse_error(0,0,"Illegal character '%s'\n", text);
|
||||
return yylex1();
|
||||
}
|
||||
if ((l1 == STRING) || (l1 == CHARCONST) || (l1 == SWIG_TOKEN_RSTRING)) {
|
||||
yylval.tok.text = NewString(yytext+1);
|
||||
Setfile(yylval.tok.text,yylval.tok.filename);
|
||||
Setline(yylval.tok.text,yylval.tok.line);
|
||||
Delitem(yylval.tok.text,DOH_END);
|
||||
}
|
||||
if ((l1 == HBLOCK) || (l1 == NUM_INT) || (l1 == NUM_FLOAT) || (l1 == NUM_UNSIGNED) || (l1 == NUM_LONG) || (l1 == NUM_ULONG)) {
|
||||
yylval.tok.text = NewString(yytext);
|
||||
}
|
||||
if (l1 == SWIG_TOKEN_RSTRING) {
|
||||
return (TYPE_TYPESTRING);
|
||||
}
|
||||
|
||||
if (l1 == ID) {
|
||||
/* Look for keywords now */
|
||||
if (strcmp(yytext,"int") == 0) return(TYPE_INT);
|
||||
if (strcmp(yytext,"double") == 0) return(TYPE_DOUBLE);
|
||||
if (strcmp(yytext,"void") == 0) return(TYPE_VOID);
|
||||
if (strcmp(yytext,"char") == 0) return(TYPE_CHAR);
|
||||
if (strcmp(yytext,"short") == 0) return(TYPE_SHORT);
|
||||
if (strcmp(yytext,"long") == 0) return(TYPE_LONG);
|
||||
if (strcmp(yytext,"float") == 0) return(TYPE_FLOAT);
|
||||
if (strcmp(yytext,"signed") == 0) return(TYPE_SIGNED);
|
||||
if (strcmp(yytext,"unsigned") == 0) return(TYPE_UNSIGNED);
|
||||
if (strcmp(yytext,"bool") == 0) return(TYPE_BOOL);
|
||||
|
||||
/* C++ keywords */
|
||||
|
||||
if (cplusplus_mode) {
|
||||
if (strcmp(yytext,"class") == 0) {
|
||||
yylval.tok.text = NewString(yytext);
|
||||
return(CLASS);
|
||||
}
|
||||
if (strcmp(yytext,"private") == 0) return(PRIVATE);
|
||||
if (strcmp(yytext,"public") == 0) return(PUBLIC);
|
||||
if (strcmp(yytext,"protected") == 0) return(PROTECTED);
|
||||
if (strcmp(yytext,"friend") == 0) return(FRIEND);
|
||||
if (strcmp(yytext,"virtual") == 0) return(VIRTUAL);
|
||||
if (strcmp(yytext,"operator") == 0) return(OPERATOR);
|
||||
if (strcmp(yytext,"throw") == 0) return(THROW);
|
||||
if (strcmp(yytext,"inline") == 0) return(lparse_yylex());
|
||||
if (strcmp(yytext,"template") == 0) return(TEMPLATE);
|
||||
}
|
||||
/* Objective-C keywords */
|
||||
|
||||
if (objc_mode) {
|
||||
if (strcmp(yytext,"@interface") == 0) return (OC_INTERFACE);
|
||||
if (strcmp(yytext,"@end") == 0) return (OC_END);
|
||||
if (strcmp(yytext,"@public") == 0) return (OC_PUBLIC);
|
||||
if (strcmp(yytext,"@private") == 0) return (OC_PRIVATE);
|
||||
if (strcmp(yytext,"@protected") == 0) return (OC_PROTECTED);
|
||||
if (strcmp(yytext,"@class") == 0) return(OC_CLASS);
|
||||
if (strcmp(yytext,"@implementation") == 0) return(OC_IMPLEMENT);
|
||||
if (strcmp(yytext,"@protocol") == 0) return(OC_PROTOCOL);
|
||||
}
|
||||
|
||||
/* Misc keywords */
|
||||
if (strcmp(yytext,"static") == 0) return(STATIC);
|
||||
if (strcmp(yytext,"extern") == 0) return(EXTERN);
|
||||
if (strcmp(yytext,"const") == 0) return(CONST);
|
||||
if (strcmp(yytext,"typedef") == 0) return(TYPEDEF);
|
||||
if (strcmp(yytext,"struct") == 0) {
|
||||
yylval.tok.text = NewString(yytext);
|
||||
return(STRUCT);
|
||||
}
|
||||
if (strcmp(yytext,"union") == 0) {
|
||||
yylval.tok.text = NewString(yytext);
|
||||
return(UNION);
|
||||
}
|
||||
if (strcmp(yytext,"enum") == 0) return(ENUM);
|
||||
if (strcmp(yytext,"sizeof") == 0) return(SIZEOF);
|
||||
|
||||
/* Ignored keywords */
|
||||
if (strcmp(yytext,"volatile") == 0) return(lparse_yylex());
|
||||
|
||||
/* SWIG directives */
|
||||
if (yytext[0] == '%') {
|
||||
if (strcmp(yytext,"%module") == 0) return(MODULE);
|
||||
if (strcmp(yytext,"%constant") == 0) return (CONSTANT);
|
||||
if (strcmp(yytext,"%file") == 0) return(FILEDIRECTIVE);
|
||||
if (strcmp(yytext,"%insert") == 0) return (INSERT);
|
||||
if (strcmp(yytext,"%macro") == 0) return(MACRO);
|
||||
if (strcmp(yytext,"%pragma") == 0) return(PRAGMA);
|
||||
if (strcmp(yytext,"%addmethods") == 0) return(ADDMETHODS);
|
||||
if (strcmp(yytext,"%inline") == 0) return(INLINE);
|
||||
if (strcmp(yytext,"%typemap") == 0) return(TYPEMAP);
|
||||
if (strcmp(yytext,"%except") == 0) return(EXCEPT);
|
||||
if (strcmp(yytext,"%echo") == 0) return(ECHO);
|
||||
if (strcmp(yytext,"%apply") == 0) return(APPLY);
|
||||
if (strcmp(yytext,"%clear") == 0) return(CLEAR);
|
||||
if (strcmp(yytext,"%scope") == 0) return(SCOPE);
|
||||
if (strcmp(yytext,"%types") == 0) return(TYPES);
|
||||
}
|
||||
/* Have an unknown identifier, as a last step, we'll */
|
||||
/* do a typedef lookup on it. */
|
||||
yylval.tok.text = NewString(yytext);
|
||||
Setfile(yylval.tok.text, yylval.tok.filename);
|
||||
Setline(yylval.tok.text, yylval.tok.line);
|
||||
|
||||
/* if (strict_type && LParse_typedef_check(yylval.tok.text)) {
|
||||
return TYPE_TYPEDEF;
|
||||
}*/
|
||||
return(ID);
|
||||
}
|
||||
return(l1);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* lparse_yylex()
|
||||
*
|
||||
* main entry point for the parser
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
lparse_yylex() {
|
||||
int t;
|
||||
t = yylex1();
|
||||
/* printf("%d\n",t); */
|
||||
return t;
|
||||
}
|
||||
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* lparse.h
|
||||
*
|
||||
* Lame tag-based parsed based on the SWIG1.1 parser.
|
||||
*
|
||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (C) 1999-2000. The University of Chicago
|
||||
* See the file LICENSE for information on usage and redistribution.
|
||||
*
|
||||
* $Header$
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef _LPARSE_H
|
||||
#define _LPARSE_H
|
||||
|
||||
#include "swig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void LParse_push(DOH *);
|
||||
extern DOH *LParse_skip_balanced(int, int);
|
||||
extern void LParse_skip_semi();
|
||||
extern void LParse_skip_decl();
|
||||
extern DOH *LParse_parse(DOH *str);
|
||||
extern DOH *LParse_file();
|
||||
extern int LParse_line();
|
||||
extern void LParse_set_location(DOH *file, int line);
|
||||
extern void LParse_error(DOH *file, int line, char *fmt, ...);
|
||||
extern void LParse_macro_location(DOH *name, DOH *file, int line);
|
||||
extern int LParse_cplusplus(int i);
|
||||
extern int LParse_objc(int i);
|
||||
|
||||
#define LPARSE_T_INT 1
|
||||
#define LPARSE_T_SHORT 2
|
||||
#define LPARSE_T_LONG 3
|
||||
#define LPARSE_T_UINT 4
|
||||
#define LPARSE_T_USHORT 5
|
||||
#define LPARSE_T_ULONG 6
|
||||
#define LPARSE_T_UCHAR 7
|
||||
#define LPARSE_T_SCHAR 8
|
||||
#define LPARSE_T_BOOL 9
|
||||
#define LPARSE_T_DOUBLE 10
|
||||
#define LPARSE_T_FLOAT 11
|
||||
#define LPARSE_T_CHAR 12
|
||||
#define LPARSE_T_USER 13
|
||||
#define LPARSE_T_VOID 14
|
||||
#define LPARSE_T_ENUM 50
|
||||
#define LPARSE_T_STRING 51
|
||||
#define LPARSE_T_VARARGS 52
|
||||
#define LPARSE_T_FUNCTION 53
|
||||
#define LPARSE_T_SYMBOL 98
|
||||
#define LPARSE_T_ERROR 99
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,189 +0,0 @@
|
|||
$Header$
|
||||
|
||||
This file describes the set of tags and attributes produced by the SWIG1.3 parser.
|
||||
|
||||
1. Common attribute names
|
||||
|
||||
These attribute names are common to every node in the parse tree and are
|
||||
used to implement the tree structure itself.
|
||||
|
||||
Attribute name Description
|
||||
-------------------------------------------------------------
|
||||
"tag" - Tag name of a parse tree node
|
||||
"next" - Next node (sibling)
|
||||
"prev" - Previous node (sibling)
|
||||
"parent" - Parent node
|
||||
"child" - First child node (is the start of a linked list)
|
||||
|
||||
2. Reserved attribute names
|
||||
|
||||
Attributes starting with a "-" are used internally by the parsed and should not be
|
||||
used as attributes by any extension module.
|
||||
|
||||
3. General philosophy
|
||||
|
||||
In SWIG1.1, all SWIG directives were defined as parser rules. This made for a rather
|
||||
large and inflexible parsing module. In this version, the parser has been greatly
|
||||
reduced to a few very general purpose directives. Older SWIG directives, in turn,
|
||||
are then implemented as preprocessor macros. For example, in SWIG1.3 the following
|
||||
directive is used to insert code into part of the output:
|
||||
|
||||
%insert(section) %{ code %}
|
||||
|
||||
Then, the following macros are used to emulate old behavior
|
||||
|
||||
#define %wrapper %insert("wrapper")
|
||||
#define %init %insert("init")
|
||||
#define %runtime %insert("runtime")
|
||||
... etc ...
|
||||
|
||||
Similarly, most old SWIG directives such as "%readonly", "%readwrite", and so forth have
|
||||
been consolidated into a single "%pragma" directive.
|
||||
|
||||
By consolidating parser rules, the number of tags are reduced and language module
|
||||
implementation is simplified.
|
||||
|
||||
4. Namespaces
|
||||
|
||||
Swig directives are tagged as "swig:tagname".
|
||||
C/C++ declarations are tagged as "c:decl".
|
||||
|
||||
Motivation: Maybe I'll add other stuff someday like "fortran:decl".
|
||||
|
||||
5. Parse Tree nodes
|
||||
|
||||
The following list describes all of the possible nodes that can be
|
||||
produced by the parser and their attributes (not including the common
|
||||
attributes above).
|
||||
|
||||
5.1 SWIG Directives
|
||||
|
||||
tag : "swig:scope"
|
||||
syntax : %scope(name) { statements }
|
||||
attributes : "name" - Scope name
|
||||
"child" - attribute contains nodes within the scope.
|
||||
|
||||
tag : "swig:module"
|
||||
syntax : %module idstring
|
||||
attributes : "name" - Module name
|
||||
|
||||
tag : "swig:constant"
|
||||
syntax : %constant name value;
|
||||
attributes : "name" - Constant name
|
||||
"value" - Constant value
|
||||
"type" - Constant type
|
||||
|
||||
tag : "swig:file"
|
||||
syntax : %include filename
|
||||
: %extern filename
|
||||
: %import filename
|
||||
attributes : "type" - File type ("include", "extern", "import")
|
||||
|
||||
tag : "swig:insert"
|
||||
syntax : %insert(section) "filename"
|
||||
%insert(section) %{ code %}
|
||||
%{ code %} Note: same as %insert("header") %{ code %}
|
||||
%inline %{ code %} Note: same as %insert("header") %{ code %}
|
||||
attributes : "section" - Code section
|
||||
"filename" - File to include (if given)
|
||||
"code" - Code to include (if given)
|
||||
|
||||
tag : "swig:pragma"
|
||||
syntax : %pragma name [ value ];
|
||||
%pragma(lang) name [ value ];
|
||||
|
||||
|
||||
tag : "swig:exception"
|
||||
syntax : %exception { code }
|
||||
attributes : "code" - Exception code
|
||||
|
||||
tag : "swig:typemap"
|
||||
syntax : %typemap(method) type (parms) {
|
||||
code
|
||||
}
|
||||
| %typemap(method) type (parms) "code";
|
||||
|
||||
attributes : "method" - Typemap method
|
||||
"code" - Typemap code (if supplied)
|
||||
"type" - Type
|
||||
"name" - Typemap Name
|
||||
"parms" - Parameter list
|
||||
"srcname" - Source name (of another typemap)
|
||||
"srctype" - Source type
|
||||
|
||||
Notes : If code is not set, srcname and srctype may point to another typemap
|
||||
in which a copy is performed.
|
||||
If neither code nor srcname and srctype are set, then the typemap
|
||||
is deleted.
|
||||
|
||||
|
||||
tag : "swig:apply"
|
||||
syntax : %apply type name { parms }
|
||||
attributes : "name"
|
||||
"type"
|
||||
"parms"
|
||||
|
||||
tag : "swig:clear"
|
||||
syntax : %clear parms;
|
||||
attributes : "parms"
|
||||
|
||||
tag : "swig:addmethods"
|
||||
syntax : %addmethods [(name)] { statements }
|
||||
attributes : "name" - Class name (optional)
|
||||
|
||||
5.2 C/C++ Declarations
|
||||
|
||||
tag : "c:function"
|
||||
attributes : "name" - Function name
|
||||
"type" - Return type
|
||||
"parms" - Parameters
|
||||
"storage" - Storage class
|
||||
"code" - Code
|
||||
|
||||
tag : "c:variable"
|
||||
attributes : "name" - Variable name
|
||||
"type" - Variable type
|
||||
"storage" - Storage class
|
||||
"value" - Value
|
||||
|
||||
tag : "c:typedef"
|
||||
attributes : "name" - Typedef name
|
||||
"type" - Typedef type
|
||||
|
||||
tag : "c:enum"
|
||||
attributes : "name" - Enum name
|
||||
"child" - Enum members
|
||||
|
||||
tag : "c:enumvalue"
|
||||
attributes : "name" - Enum value name
|
||||
"value" - Enum value
|
||||
|
||||
|
||||
tag : "c:class"
|
||||
attributes : "name" - Class name
|
||||
"bases" - Base classes
|
||||
"classtype" - { struct, class, union }
|
||||
"altname" - Alternative name (from typedef)
|
||||
"namespace" - Namespace attribute (used to get fully qualified names)
|
||||
|
||||
tag : "c:destructor"
|
||||
attributes : "name" - Destructor name
|
||||
|
||||
tag : "c:classdecl"
|
||||
attributes : "name" - Class name
|
||||
|
||||
tag : "c:access"
|
||||
attributes : "name" - { public, private, protected }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,396 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* type.c
|
||||
*
|
||||
* Lame SWIG1.1 type implementation.
|
||||
*
|
||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (C) 1999-2000. The University of Chicago
|
||||
* See the file LICENSE for information on usage and redistribution.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static char cvsroot[] = "$Header$";
|
||||
|
||||
#include "lparse.h"
|
||||
|
||||
extern DOH *LParseTypeStr(DOH *to);
|
||||
|
||||
static DohObjInfo LParseTypeType = {
|
||||
"LParseType", /* objname */
|
||||
sizeof(LParseType), /* objsize */
|
||||
DelLParseType, /* doh_del */
|
||||
CopyLParseType, /* doh_copy */
|
||||
0, /* doh_clear */
|
||||
0, /* doh_scope */
|
||||
LParseTypeStr, /* doh_str */
|
||||
0, /* doh_data */
|
||||
0, /* doh_dump */
|
||||
0, /* doh_load */
|
||||
0, /* doh_len */
|
||||
0, /* doh_hash */
|
||||
0, /* doh_cmp */
|
||||
0, /* doh_mapping */
|
||||
0, /* doh_sequence */
|
||||
0, /* doh_file */
|
||||
0, /* doh_string */
|
||||
0, /* doh_callable */
|
||||
0, /* doh_position */
|
||||
};
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* NewLParseType() - Create a new datatype
|
||||
* ----------------------------------------------------------------------------- */
|
||||
LParseType *
|
||||
NewLParseType(int ty) {
|
||||
LParseType *t = (LParseType *) DohObjMalloc(sizeof(LParseType));
|
||||
t->objinfo = &LParseTypeType;
|
||||
t->type = ty;
|
||||
t->name = (char *) malloc(LPARSE_MAX_NAME);
|
||||
t->name[0] = 0;
|
||||
t->is_pointer = 0;
|
||||
t->implicit_ptr = 0;
|
||||
t->is_reference = 0;
|
||||
t->status = 0;
|
||||
t->qualifier = 0;
|
||||
t->arraystr = 0;
|
||||
switch(ty) {
|
||||
case LPARSE_T_INT:
|
||||
strcpy(t->name,"int");
|
||||
break;
|
||||
case LPARSE_T_UINT:
|
||||
strcpy(t->name,"unsigned");
|
||||
break;
|
||||
case LPARSE_T_SHORT:
|
||||
strcpy(t->name,"short");
|
||||
break;
|
||||
case LPARSE_T_USHORT:
|
||||
strcpy(t->name,"unsigned short");
|
||||
break;
|
||||
case LPARSE_T_LONG:
|
||||
strcpy(t->name,"long");
|
||||
break;
|
||||
case LPARSE_T_ULONG:
|
||||
strcpy(t->name,"unsigned long");
|
||||
break;
|
||||
case LPARSE_T_FLOAT:
|
||||
strcpy(t->name,"float");
|
||||
break;
|
||||
case LPARSE_T_DOUBLE:
|
||||
strcpy(t->name,"double");
|
||||
break;
|
||||
case LPARSE_T_CHAR:
|
||||
strcpy(t->name,"char");
|
||||
break;
|
||||
case LPARSE_T_SCHAR:
|
||||
strcpy(t->name,"signed char");
|
||||
break;
|
||||
case LPARSE_T_UCHAR:
|
||||
strcpy(t->name,"unsigned char");
|
||||
break;
|
||||
case LPARSE_T_VOID:
|
||||
strcpy(t->name,"void");
|
||||
break;
|
||||
case LPARSE_T_BOOL:
|
||||
strcpy(t->name,"bool");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DelLParseType() - Destroy a datatype
|
||||
* ----------------------------------------------------------------------------- */
|
||||
void DelLParseType(DOH *t) {
|
||||
LParseType *ty = (LParseType *) t;
|
||||
assert(ty->refcount <= 0);
|
||||
free(ty->name);
|
||||
if (ty->qualifier) free(ty->qualifier);
|
||||
if (ty->arraystr) free(ty->arraystr);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CopyLParseType() - Copy a type
|
||||
* ----------------------------------------------------------------------------- */
|
||||
DOH *
|
||||
CopyLParseType(DOH *co) {
|
||||
LParseType *c;
|
||||
LParseType *t = (LParseType *) DohObjMalloc(sizeof(LParseType));
|
||||
c = (LParseType *) co;
|
||||
t->objinfo = &LParseTypeType;
|
||||
t->type = c->type;
|
||||
t->name = (char *) malloc(LPARSE_MAX_NAME);
|
||||
strcpy(t->name,c->name);
|
||||
t->is_pointer = c->is_pointer;
|
||||
t->implicit_ptr = c->implicit_ptr;
|
||||
t->is_reference = c->is_reference;
|
||||
t->status = c->status;
|
||||
t->qualifier = Swig_copy_string(c->qualifier);
|
||||
t->arraystr = Swig_copy_string(c->arraystr);
|
||||
return t;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* LParseTypeStr() - Make a string of a datatype.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
DOH *
|
||||
LParseTypeStr(DOH *to) {
|
||||
DOH *s;
|
||||
int i;
|
||||
LParseType *t = (LParseType *) to;
|
||||
s = NewString("");
|
||||
if (t->qualifier)
|
||||
Printf(s,"%s ",t->qualifier);
|
||||
Printf(s,"%s ",t->name);
|
||||
if (t->is_reference || t->arraystr) t->is_pointer--;
|
||||
for (i = 0; i < t->is_pointer; i++)
|
||||
Putc('*',s);
|
||||
if (t->is_reference || t->arraystr) t->is_pointer++;
|
||||
if (t->is_reference)
|
||||
Putc('&',s);
|
||||
if (t->arraystr)
|
||||
Printf(s,"%s", t->arraystr);
|
||||
return s;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* --- typedef support ---
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#define MAXSCOPE 256
|
||||
static DOH *typedef_hash[MAXSCOPE];
|
||||
static int scope = 0;
|
||||
static int typedef_init = 0;
|
||||
|
||||
static void init_typedef() {
|
||||
int i;
|
||||
for (i = 0; i < MAXSCOPE; i++)
|
||||
typedef_hash[i] = 0;
|
||||
scope = 0;
|
||||
typedef_hash[scope] = NewHash();
|
||||
typedef_init = 1;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void LParse_typedef_add(LParseType *t, DOH *tname)
|
||||
*
|
||||
* Create a new typedef.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void LParse_typedef_add(LParseType *t, DOH *tname) {
|
||||
LParseType *nt;
|
||||
|
||||
if (!typedef_init) init_typedef();
|
||||
/* Check to see if the type already exists */
|
||||
if ((nt = (LParseType *) Getattr(typedef_hash[scope],tname))) {
|
||||
Printf(stderr,"Warning. Datatype %s already defined (2nd definition ignored).\n", tname);
|
||||
return;
|
||||
}
|
||||
|
||||
nt = (LParseType *) CopyLParseType(t);
|
||||
nt->implicit_ptr = (t->is_pointer-t->implicit_ptr); /* Record if mapped type is a pointer */
|
||||
nt->is_pointer = (t->is_pointer-t->implicit_ptr); /* Adjust pointer value to be correct */
|
||||
LParse_typedef_resolve(nt,0); /* Resolve any other mappings of this type */
|
||||
|
||||
/* Add this type to our hash table */
|
||||
Setattr(typedef_hash[scope],tname, nt);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void LParse_typedef_resolve(LParseType *t, int level = 0)
|
||||
*
|
||||
* Checks to see if this datatype is in the typedef hash and
|
||||
* resolves it if necessary. This will check all of the typedef
|
||||
* hash tables we know about.
|
||||
*
|
||||
* level is an optional parameter that determines which scope to use.
|
||||
* Usually this is only used with a bare :: operator in a datatype.
|
||||
*
|
||||
* The const headache :
|
||||
*
|
||||
* Normally SWIG will fail if a const variable is used in a typedef
|
||||
* like this :
|
||||
*
|
||||
* typedef const char *String;
|
||||
*
|
||||
* This is because future occurrences of "String" will be treated like
|
||||
* a char *, but without regard to the "constness". To work around
|
||||
* this problem. The resolve() method checks to see if these original
|
||||
* data type is const. If so, we'll substitute the name of the original
|
||||
* datatype instead. Got it?
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void LParse_typedef_resolve(LParseType *t, int level) {
|
||||
LParseType *td;
|
||||
int s = scope - level;
|
||||
|
||||
if (!typedef_init) init_typedef();
|
||||
while (s >= 0) {
|
||||
if ((td = (LParseType *) Getattr(typedef_hash[s],t->name))) {
|
||||
t->type = td->type;
|
||||
t->is_pointer += td->is_pointer;
|
||||
t->implicit_ptr += td->implicit_ptr;
|
||||
t->status = t->status | td->status;
|
||||
|
||||
/* Check for constness, and replace type name if necessary */
|
||||
|
||||
if (td->qualifier) {
|
||||
if (strcmp(td->qualifier,"const") == 0) {
|
||||
strcpy(t->name,td->name);
|
||||
t->qualifier = Swig_copy_string(td->qualifier);
|
||||
t->implicit_ptr -= td->implicit_ptr;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
s--;
|
||||
}
|
||||
/* Not found, do nothing */
|
||||
return;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void LParse_typedef_replace()
|
||||
*
|
||||
* Checks to see if this datatype is in the typedef hash and
|
||||
* replaces it with the hash entry. Only applies to current scope.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void LParse_typedef_replace(LParseType *t) {
|
||||
LParseType *td;
|
||||
DOH *temp;
|
||||
|
||||
if (!typedef_init) init_typedef();
|
||||
temp = NewString("");
|
||||
if ((td = (LParseType *) Getattr(typedef_hash[scope],t->name))) {
|
||||
t->type = td->type;
|
||||
t->is_pointer = td->is_pointer;
|
||||
t->implicit_ptr -= td->implicit_ptr;
|
||||
strcpy(t->name, td->name);
|
||||
if (td->arraystr) {
|
||||
if (t->arraystr) {
|
||||
Printf(temp,"%s", t->arraystr);
|
||||
free(t->arraystr);
|
||||
}
|
||||
Printf(temp,"%s", td->arraystr);
|
||||
t->arraystr = Swig_copy_string(Char(temp));
|
||||
}
|
||||
}
|
||||
Delete(temp);
|
||||
/* Not found, do nothing */
|
||||
return;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* int LParse_typedef_check(DOH *tname)
|
||||
*
|
||||
* Checks to see whether tname is the name of a datatype we know
|
||||
* about. Returns 1 if there's a match, 0 otherwise
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int LParse_typedef_check(DOH *tname) {
|
||||
int s = scope;
|
||||
if (!typedef_init) init_typedef();
|
||||
while (s >= 0) {
|
||||
if (Getattr(typedef_hash[s],tname)) return 1;
|
||||
s--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void LParse_typedef_updatestatus(LParseType *t, int newstatus)
|
||||
*
|
||||
* Checks to see if this datatype is in the hash table. If
|
||||
* so, we'll update its status. This is sometimes used with
|
||||
* typemap handling. Only applies to current scope.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
void LParse_typedef_updatestatus(LParseType *t, int newstatus) {
|
||||
LParseType *td;
|
||||
if (!typedef_init) init_typedef();
|
||||
if ((td = (LParseType *) Getattr(typedef_hash[scope], t->name))) {
|
||||
td->status = newstatus;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void LParse_merge_scope(DOH *h)
|
||||
*
|
||||
* Copies all of the entries in scope h into the current scope. This is
|
||||
* primarily done with C++ inheritance.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void LParse_merge_scope(DOH *h) {
|
||||
DOH *key;
|
||||
DOH *nt;
|
||||
|
||||
if (!typedef_init) init_typedef();
|
||||
if (h) {
|
||||
/* Copy all of the entries in the given hash table to this new one */
|
||||
key = Firstkey(h);
|
||||
while (key) {
|
||||
nt = Copy(Getattr(h,key));
|
||||
Setattr(typedef_hash[scope],key,nt);
|
||||
key = Nextkey(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void LParse_new_scope(DOH *h)
|
||||
*
|
||||
* Creates a new scope for handling typedefs. This is used in C++ handling
|
||||
* to create typedef local to a class definition.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void LParse_new_scope(DOH *h) {
|
||||
if (!typedef_init) init_typedef();
|
||||
scope++;
|
||||
typedef_hash[scope] = NewHash();
|
||||
if (h) {
|
||||
LParse_merge_scope(h);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DOH *LParse_collapse_scope(DOH *prefix)
|
||||
*
|
||||
* Collapses the current scope into the previous one, but applies a prefix to
|
||||
* all of the datatypes. This is done in order to properly handle C++ stuff.
|
||||
* For example :
|
||||
*
|
||||
* class Foo {
|
||||
* ...
|
||||
* typedef double Real;
|
||||
* }
|
||||
*
|
||||
* will have a type mapping of "double --> Real" within the class itself.
|
||||
* When we collapse the scope, this mapping will become "double --> Foo::Real"
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
DOH *LParse_collapse_scope(DOH *prefix) {
|
||||
LParseType *nt;
|
||||
DOH *key;
|
||||
DOH *temp;
|
||||
DOH *h;
|
||||
|
||||
if (!typedef_init) init_typedef();
|
||||
if (scope > 0) {
|
||||
if (prefix) {
|
||||
key = Firstkey(typedef_hash[scope]);
|
||||
while (key) {
|
||||
nt = (LParseType *) Copy(Getattr(typedef_hash[scope],key));
|
||||
temp = NewString("");
|
||||
Printf(temp,"%s::%s", prefix,key);
|
||||
Setattr(typedef_hash[scope-1],temp,nt);
|
||||
key = Nextkey(typedef_hash[scope]);
|
||||
}
|
||||
}
|
||||
h = typedef_hash[scope];
|
||||
typedef_hash[scope] = 0;
|
||||
scope--;
|
||||
return h;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# ---------------------------------------------------------------
|
||||
# $Header$
|
||||
#----------------------------------------------------------------
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SRCS = init.c inputmodule.c cppmodule.c cparsemodule.c
|
||||
OBJS = init.o inputmodule.o cppmodule.o cparsemodule.o
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
CC = @CC@
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
CFLAGS = @CFLAGS@
|
||||
INCLUDE = -I$(srcdir)/. -I$(srcdir)/../Include -I$(srcdir)/../DOH/Include -I$(srcdir)/../Swig -I$(srcdir)/../Preprocessor -I$(srcdir)/../LParse
|
||||
TARGET = libmodules.a
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $<
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(AR) cr $(TARGET) $(OBJS)
|
||||
$(RANLIB) $(TARGET)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ core *.so *.a *_wrap.*
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* cparsemodule.c
|
||||
*
|
||||
* This module is responsible for running the SWIG C Parsing module.
|
||||
*
|
||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (C) 1999-2000. The University of Chicago
|
||||
* See the file LICENSE for information on usage and redistribution.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include "swig.h"
|
||||
#include "swigconfig.h"
|
||||
#include "lparse.h"
|
||||
|
||||
static const char *usage = "C Parsing options:\n\
|
||||
";
|
||||
|
||||
static
|
||||
int cparse_init(int argc, char **argv) {
|
||||
int i;
|
||||
/* Look for command line options */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i],"-c++") == 0) {
|
||||
LParse_cplusplus(1);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-help") == 0) {
|
||||
Printf(stderr,"%s",usage);
|
||||
Swig_mark_arg(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
DOH *cparse_run(DOH *node) {
|
||||
String *data;
|
||||
DOH *result;
|
||||
|
||||
data = Getattr(node,"data");
|
||||
if (!data) {
|
||||
Printf(stderr,"SWIG: cparse error. no data.\n");
|
||||
Swig_exit(1);
|
||||
}
|
||||
Seek(data,0, SEEK_SET);
|
||||
result = LParse_parse(data);
|
||||
Setattr(result,"last",node);
|
||||
return result;
|
||||
}
|
||||
|
||||
void cparsemodule() {
|
||||
Swig_register_module("cparse","swig:preprocess", cparse_init, cparse_run);
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* cppmodule.c
|
||||
*
|
||||
* This module is responsible for running the SWIG preprocessor module.
|
||||
*
|
||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (C) 1999-2000. The University of Chicago
|
||||
* See the file LICENSE for information on usage and redistribution.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include "swig.h"
|
||||
#include "swigconfig.h"
|
||||
#include "preprocessor.h"
|
||||
|
||||
static int cpp_only = 0;
|
||||
|
||||
static const char *usage = "Preprocessor options:\n\
|
||||
-E - Run the preprocessor only\n\
|
||||
-Dmacro - Define a new macro\n\
|
||||
";
|
||||
|
||||
static
|
||||
int preprocessor_init(int argc, char **argv) {
|
||||
int i;
|
||||
/* Look for command line options */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i],"-E") == 0) {
|
||||
cpp_only = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-c++") == 0) {
|
||||
Preprocessor_define("__cplusplus 1", 0);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strncmp(argv[i],"-D",2) == 0) {
|
||||
DOH *d = NewString(argv[i]+2);
|
||||
Replace(d,"="," ", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
|
||||
Preprocessor_define(d,0);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-includeall") == 0) {
|
||||
Preprocessor_include_all(1);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-help") == 0) {
|
||||
Printf(stderr,"%s",usage);
|
||||
Swig_mark_arg(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
DOH *preprocessor_run(DOH *node) {
|
||||
String *cpps, *data;
|
||||
DOH *result;
|
||||
|
||||
data = Getattr(node,"data");
|
||||
if (!data) {
|
||||
Printf(stderr,"SWIG: preprocessor error. no data.\n");
|
||||
Swig_exit(1);
|
||||
}
|
||||
|
||||
Preprocessor_define("SWIG 1", 0);
|
||||
Preprocessor_define("__STDC__ 1", 0);
|
||||
#ifdef MACSWIG
|
||||
Preprocessor_define("SWIGMAC 1", 0);
|
||||
#endif
|
||||
#ifdef SWIGWIN32
|
||||
Preprocessor_define("SWIGWIN32 1", 0);
|
||||
#endif
|
||||
|
||||
Seek(data,0, SEEK_SET);
|
||||
cpps = Preprocessor_parse(data);
|
||||
if (cpp_only) {
|
||||
Printf(stdout,"%s", cpps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = NewHash();
|
||||
Settag(result,"swig:preprocess");
|
||||
Setfile(cpps,Getfile(data));
|
||||
Setline(cpps,Getline(data));
|
||||
Seek(cpps,0,SEEK_SET);
|
||||
Setattr(result,"data",cpps);
|
||||
Setattr(result,"last",node);
|
||||
return result;
|
||||
}
|
||||
|
||||
void preprocessormodule() {
|
||||
Swig_register_module("preprocessor","swig:input", preprocessor_init, preprocessor_run);
|
||||
Preprocessor_init();
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* init.c
|
||||
*
|
||||
* Initialize built-in SWIG modules.
|
||||
*
|
||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (C) 1999-2000. The University of Chicago
|
||||
* See the file LICENSE for information on usage and redistribution.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include "swig.h"
|
||||
|
||||
extern void inputmodule();
|
||||
extern void preprocessormodule();
|
||||
extern void cparsemodule();
|
||||
extern void swig11module();
|
||||
|
||||
static void (*modules[])(void) = {
|
||||
inputmodule,
|
||||
preprocessormodule,
|
||||
cparsemodule,
|
||||
swig11module,
|
||||
0
|
||||
};
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* init_modules()
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void init_modules() {
|
||||
int i = 0;
|
||||
while (modules[i]) {
|
||||
(*modules[i])();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* This array contains the names of modules that should be loaded by default */
|
||||
static char *default_modules[] = {
|
||||
"input",
|
||||
"preprocessor",
|
||||
"cparse",
|
||||
0
|
||||
};
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
init_modules();
|
||||
return Swig_main(argc, argv, default_modules);
|
||||
}
|
||||
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* inputmodule.c
|
||||
*
|
||||
* This module is responsible for reading input files and setting up all
|
||||
* of the proper search paths.
|
||||
*
|
||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (C) 1999-2000. The University of Chicago
|
||||
* See the file LICENSE for information on usage and redistribution.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include "swig.h"
|
||||
#include "swigconfig.h"
|
||||
|
||||
#ifndef SWIG_LIB
|
||||
#define SWIG_LIB "./swiglib"
|
||||
#endif
|
||||
|
||||
static int checkout = 0;
|
||||
static List *includedirs;
|
||||
static List *libfiles;
|
||||
static String *outfile = 0;
|
||||
static int debug_path = 0;
|
||||
static int debug_input = 0;
|
||||
|
||||
static const char *usage = "File options:\n\
|
||||
-I<dir> - Look for SWIG files in <dir>\n\
|
||||
-l<ifile> - Include SWIG library file.\n\
|
||||
-o outfile - Set name of the output file.\n\
|
||||
-co - Check file out of SWIG library.\n\
|
||||
";
|
||||
|
||||
static
|
||||
int input_init(int argc, char **argv) {
|
||||
char *c;
|
||||
int i;
|
||||
|
||||
/* Directories included with the -I option */
|
||||
includedirs = NewList();
|
||||
|
||||
/* Files added with the -l option */
|
||||
libfiles = NewList();
|
||||
|
||||
/* Look for command line options */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strncmp(argv[i],"-I",2) == 0) {
|
||||
Append(includedirs,argv[i]+2);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-debug_path") == 0) {
|
||||
debug_path = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-debug_input") == 0) {
|
||||
debug_input = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strncmp(argv[i],"-l",2) == 0) {
|
||||
Append(libfiles, argv[i]+2);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-co") == 0) {
|
||||
checkout = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-o") == 0) {
|
||||
Swig_mark_arg(i);
|
||||
if (argv[i+1]) {
|
||||
outfile = NewString(argv[i+1]);
|
||||
Swig_mark_arg(i+1);
|
||||
i++;
|
||||
} else {
|
||||
Swig_arg_error();
|
||||
}
|
||||
} else if (strcmp(argv[i],"-help") == 0) {
|
||||
Printf(stderr,"%s",usage);
|
||||
Swig_mark_arg(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Set the location of the SWIG library */
|
||||
if (!(c = getenv("SWIG_LIB"))) {
|
||||
Append(includedirs,SWIG_LIB);
|
||||
} else {
|
||||
Append(includedirs,c);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
DOH *input_run(DOH *node) {
|
||||
int i;
|
||||
String *infile;
|
||||
FILE *f;
|
||||
String *input;
|
||||
DOH *result;
|
||||
String *swiglib;
|
||||
String *lang_config;
|
||||
|
||||
infile = Getname(node);
|
||||
|
||||
/* Register all of the include directories */
|
||||
swiglib = Swig_swiglib_get();
|
||||
for (i = Len(includedirs); i > 0; i--) {
|
||||
if (swiglib) {
|
||||
String *l = NewStringf("%s%s%s", Getitem(includedirs,i-1),SWIG_FILE_DELIMETER,swiglib);
|
||||
Swig_add_directory(l);
|
||||
}
|
||||
Swig_add_directory(Getitem(includedirs,i-1));
|
||||
}
|
||||
|
||||
if (debug_path) {
|
||||
List *l;
|
||||
Printf(stdout,"SWIG search path:\n");
|
||||
l = Swig_search_path();
|
||||
if (l) {
|
||||
String *s;
|
||||
for (s = Firstitem(l); s; s = Nextitem(l)) {
|
||||
Printf(stdout," %s\n", s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* user has requested to simply check out a file */
|
||||
if (checkout) {
|
||||
String *outfilename;
|
||||
String *s;
|
||||
outfilename = outfile ? outfile : infile;
|
||||
|
||||
/* Grab the file */
|
||||
s = Swig_include(infile);
|
||||
if (!s) {
|
||||
Printf(stderr,"Unable to locate '%s' in the SWIG library.\n", infile);
|
||||
Swig_exit(EXIT_FAILURE);
|
||||
} else {
|
||||
File *f = NewFile(outfilename,"r");
|
||||
if (f) {
|
||||
Delete(f);
|
||||
Printf(stderr,"File '%s' already exists. Checkout aborted.\n", outfilename);
|
||||
} else {
|
||||
f = NewFile(outfilename,"w");
|
||||
if (!f) {
|
||||
Printf(stderr,"Unable to create file '%s'\n", outfilename);
|
||||
} else {
|
||||
Printf(stderr,"'%s' checked out from the SWIG library.\n", infile);
|
||||
Dump(s,f);
|
||||
Delete(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try to find input files */
|
||||
f = Swig_open(infile);
|
||||
if (!f) {
|
||||
Printf(stderr,"Unable to find '%s'\n", infile);
|
||||
Swig_exit (EXIT_FAILURE);
|
||||
}
|
||||
fclose(f);
|
||||
input = NewString("%include \"swig.swg\"\n");
|
||||
lang_config = Swig_get_config_file();
|
||||
if (lang_config) {
|
||||
Printf(input,"\n%%include \"%s\"\n", lang_config);
|
||||
}
|
||||
Printf(input,"\n%%include \"%s\"\n", infile);
|
||||
for (i = 0; i < Len(libfiles); i++) {
|
||||
Printf(input,"\n%%include \"%s\"\n", Getitem(libfiles,i));
|
||||
}
|
||||
result = NewHash();
|
||||
Settag(result,"swig:input");
|
||||
Setattr(result,"name", infile);
|
||||
Setattr(result,"path", Getfile(input));
|
||||
Setattr(result,"outfile", outfile);
|
||||
Setattr(result,"data",input);
|
||||
Setattr(result,"last",node);
|
||||
|
||||
if (debug_input) {
|
||||
Printf(stdout,"::: inputmodule :::\n");
|
||||
Printf(stdout,"%s\n", input);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void inputmodule() {
|
||||
Swig_register_module("input","swig:initial", input_init, input_run);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* test.c
|
||||
*
|
||||
* This module is used to test the tag-based parser.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include "swig.h"
|
||||
|
||||
int test_unknown(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Unknown tag - '%s'\n", Getattr(node,"tag"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_file(DOH *node, void *clientdata) {
|
||||
DOH *c;
|
||||
Printf(stdout,"::: File\n");
|
||||
Printf(stdout," name = '%s'\n", Getattr(node,"name"));
|
||||
Printf(stdout," type = '%s'\n", Getattr(node,"type"));
|
||||
c = Getchild(node);
|
||||
Printf(stdout," # elements = %d\n", Swig_count_nodes(c));
|
||||
Swig_emit_all(c,clientdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_scope(DOH *node, void *clientdata) {
|
||||
DOH *c;
|
||||
Printf(stdout,"::: Scope\n");
|
||||
Printf(stdout," name = '%s'\n", Getattr(node,"name"));
|
||||
c = Getchild(node);
|
||||
Swig_emit_all(c,clientdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_module(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Module\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_insert(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Insert\n");
|
||||
Printf(stdout," section = '%s'\n", Getattr(node,"section"));
|
||||
Printf(stdout," filename = '%s'\n", Getattr(node,"filename"));
|
||||
Printf(stdout," code = '%s'\n", Getattr(node,"code"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_pragma(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Pragma\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," value = '%s'\n", Getvalue(node));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_typemap(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Typemap\n");
|
||||
Printf(stdout," type = '%s'\n", Gettype(node));
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," code = '%s'\n", Getattr(node,"code"));
|
||||
Printf(stdout," srcname = '%s'\n", Getattr(node,"srcname"));
|
||||
Printf(stdout," srctype = '%s'\n", Getattr(node,"srctype"));
|
||||
{
|
||||
DOH *p = Getattr(node,"parms");
|
||||
if (p) {
|
||||
Printf(stdout," parms = '%s'\n", ParmList_protostr(p));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_apply(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Apply\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," type = '%s'\n", Gettype(node));
|
||||
Printf(stdout," parms = (%s)\n", ParmList_protostr(Getattr(node,"parms")));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_exception(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Exception\n");
|
||||
Printf(stdout," code = '%s'\n", Getattr(node,"code"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_clear(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Clear\n");
|
||||
Printf(stdout," parms = (%s)\n", ParmList_protostr(Getattr(node,"parms")));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_constant(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Constant\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," type = '%s'\n", Gettype(node));
|
||||
Printf(stdout," value = '%s'\n", Getvalue(node));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_function(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Function\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," type = '%s'\n", Gettype(node));
|
||||
Printf(stdout," parms = (%s)\n", ParmList_protostr(Getattr(node,"parms")));
|
||||
Printf(stdout," storage = '%s'\n", Getattr(node,"storage"));
|
||||
Printf(stdout," code = '%s'\n", Getattr(node,"code"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_variable(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Variable\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," type = '%s'\n", Gettype(node));
|
||||
Printf(stdout," storage = '%s'\n", Getattr(node,"storage"));
|
||||
Printf(stdout," value = '%s'\n", Getattr(node,"value"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_typedef(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Typedef\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," type = '%s'\n", Gettype(node));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_enum(DOH *node, void *clientdata) {
|
||||
DOH *c;
|
||||
Printf(stdout,"::: Enum\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
c = Getchild(node);
|
||||
Swig_emit_all(c,clientdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_enumvalue(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Enumvalue\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," value = '%s'\n", Getvalue(node));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_class(DOH *node, void *clientdata) {
|
||||
DOH *c;
|
||||
Printf(stdout,"::: Class\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," bases = %s\n", Getattr(node,"bases"));
|
||||
Printf(stdout," altname = '%s'\n", Getattr(node,"altname"));
|
||||
Printf(stdout," classtype = '%s'\n", Getattr(node,"classtype"));
|
||||
c = Getchild(node);
|
||||
Swig_emit_all(c,clientdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_classdecl(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Classdecl\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_addmethods(DOH *node, void *clientdata) {
|
||||
DOH *c;
|
||||
Printf(stdout,"::: Addmethods\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
c = Getchild(node);
|
||||
Swig_emit_all(c,clientdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_destructor(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: Destructor\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
Printf(stdout," code = '%s'\n", Getattr(node,"code"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_access(DOH *node, void *clientdata) {
|
||||
Printf(stdout,"::: AccessSpecifier\n");
|
||||
Printf(stdout," name = '%s'\n", Getname(node));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SwigRule rules[] = {
|
||||
{ "file", test_file},
|
||||
{ "module", test_module},
|
||||
{ "scope", test_scope},
|
||||
{ "insert", test_insert},
|
||||
{ "pragma", test_pragma},
|
||||
{ "typemap", test_typemap},
|
||||
{ "apply", test_apply},
|
||||
{ "exception", test_exception},
|
||||
{ "clear", test_clear},
|
||||
{ "addmethods", test_addmethods},
|
||||
{ "constant", test_constant},
|
||||
{ "function", test_function},
|
||||
{ "variable", test_variable},
|
||||
{ "typedef", test_typedef},
|
||||
{ "enum", test_enum},
|
||||
{ "enumvalue", test_enumvalue},
|
||||
{ "class", test_class},
|
||||
{ "classdecl", test_classdecl},
|
||||
{ "destructor", test_destructor},
|
||||
{ "access", test_access},
|
||||
{ "*", test_unknown},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static
|
||||
int test_init(int argc, char **argv) {
|
||||
Printf(stdout,"test_init:\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
DOH *test_run(DOH *node) {
|
||||
DOH *c;
|
||||
Printf(stdout,"test_run:\n");
|
||||
Swig_add_rules(rules);
|
||||
|
||||
c = Getattr(node,"child");
|
||||
Swig_emit_all(c,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void testmodule() {
|
||||
Swig_register_module("test","swig:top", test_init, test_run);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
Makefile
|
||||
*.flc
|
||||
.deps
|
||||
swig
|
||||
parser.h
|
||||
parser.cxx
|
||||
Loading…
Add table
Add a link
Reference in a new issue