*** empty log message ***

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@1042 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2001-03-03 04:39:54 +00:00
commit 2e9590e9ef
11 changed files with 146 additions and 133 deletions

View file

@ -15,7 +15,7 @@ TCLINCLUDE = -I/usr/local/include
# Location of your Perl installation
PERLINCLUDE = -I/usr/perl5/5.00503/sun4-solaris/CORE
all: wad python tcl perl
all: wad python tcl #perl
wad:
@cd Wad; $(MAKE) wad
@ -24,7 +24,7 @@ python:
@cd Python; $(MAKE) SINCLUDE='$(PYINCLUDE)' python
tcl:
@cd Wad; $(MAKE) SINCLUDE='$(TCLINCLUDE)' tcl
@cd Tcl; $(MAKE) SINCLUDE='$(TCLINCLUDE)' tcl
perl:
@cd Wad; $(MAKE) SINCLUDE='$(PERLINCLUDE)' perl
@ -33,7 +33,15 @@ install:
cp libwad*.so $(LIB)
chmod a+rx $(LIB)/libwad*.so
semi:
@cd Wad; $(MAKE) semi
@cd Python; $(MAKE) semi
@cd Tcl; $(MAKE) semi
clean:
@cd Wad; $(MAKE) clean
@cd Python; $(MAKE) clean
@cd Tcl; $(MAKE) clean
@cd Test; $(MAKE) clean
rm *.so

View file

@ -14,7 +14,7 @@ TCLINCLUDE = @TCLINCLUDE@
# Location of your Perl installation
PERLINCLUDE = @PERL5EXT@
all: wad @MAKEPYTHON@ @MAKETCL@ @MAKEPERL@
all: wad @MAKEPYTHON@ @MAKETCL@ #@MAKEPERL@
wad:
@cd Wad; $(MAKE) wad
@ -23,7 +23,7 @@ python:
@cd Python; $(MAKE) SINCLUDE='$(PYINCLUDE)' python
tcl:
@cd Wad; $(MAKE) SINCLUDE='$(TCLINCLUDE)' tcl
@cd Tcl; $(MAKE) SINCLUDE='$(TCLINCLUDE)' tcl
perl:
@cd Wad; $(MAKE) SINCLUDE='$(PERLINCLUDE)' perl
@ -32,7 +32,15 @@ install:
cp libwad*.so $(LIB)
chmod a+rx $(LIB)/libwad*.so
semi:
@cd Wad; $(MAKE) semi
@cd Python; $(MAKE) semi
@cd Tcl; $(MAKE) semi
clean:
@cd Wad; $(MAKE) clean
@cd Python; $(MAKE) clean
@cd Tcl; $(MAKE) clean
@cd Test; $(MAKE) clean
rm *.so

View file

@ -43,6 +43,9 @@ python: $(OBJS) $(PYOBJS)
wc::
wc $(SRCS)
semi::
@egrep ";" $(SRCS) $(PYSRCS) | wc
clean::
rm -f *.o *.so *~

54
Tools/WAD/Tcl/Makefile.in Normal file
View file

@ -0,0 +1,54 @@
#######################################################################
# WAD Makefile
#
# David Beazley
# January 1, 2001
#######################################################################
# These are the files that make up the WAD core
SRCS = wadtcl.c
OBJS = wadtcl.o
INCLUDE = -I../Include -I. $(SINCLUDE)
WADOPT = @WADOPT@
# Location of your Tcl installation
TCLINCLUDE = @TCLINCLUDE@
TCLSRCS = wadtclinit.cxx
TCLOBJS = wadtclinit.o
# C Compiler
CC = @CC@
CFLAGS = #@CCSHARED@
# C++ Compiler
CXX = @CXX@
CXXFLAGS = #@CXXSHARED@
# Linking options
CLINK =
CXXLINK = @CXXLINK@
# Rules for creation of a .o file from .cxx
.SUFFIXES: .cxx
.cxx.o:
$(CXX) $(CXXFLAGS) $(WADOPT) $(INCLUDE) -c -o $*.o $<
.c.o:
$(CC) $(CFLAGS) $(TCLINCLUDE) $(WADOPT) $(INCLUDE) -c -o $*.o $<
tcl: $(OBJS) $(TCLOBJS)
$(CXXLINK) $(OBJS) $(TCLOBJS) -o libwadtcl.so -L.. -lwadcore
cp libwadtcl.so ..
wc::
wc $(SRCS)
semi::
@egrep ";" $(SRCS) $(TCLSRCS) | wc
clean::
rm -f *.o *.so *~

View file

@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------------
* wadtcl.cxx
* wadtcl.c
*
* Dynamically loadable Tcl module for wad.
*
@ -19,9 +19,9 @@ static void handler(int signo, WadFrame *frame, char *ret) {
static char temp[1024];
int len = 0;
char *name;
char *fd;
WadFrame *f;
WadFrame *fline = 0;
char *srcstr= 0;
Tcl_Interp *interp;
int err;
char *type;
@ -49,84 +49,23 @@ static void handler(int signo, WadFrame *frame, char *ret) {
type = (char*)"Unknown.";
break;
}
fd = (char *) frame;
f = (WadFrame *) fd;
f = frame;
/* Find the last exception frame */
while (!f->last) {
fd = fd + f->size;
f = (WadFrame *) fd;
f= f->next;
}
/* Now work backwards */
fd = fd - f->lastsize;
f = (WadFrame *) fd;
while (1) {
sprintf(temp,"#%-3d 0x%08x in ", f->frameno, f->pc);
strcat(message,temp);
strcat(message,*(fd + f->sym_off) ? fd+f->sym_off : "?");
strcat(message,"()");
if (strlen(SRCFILE(f))) {
strcat(message," in '");
strcat(message, wad_strip_dir(SRCFILE(f)));
strcat(message,"'");
if (f->line_number > 0) {
sprintf(temp,", line %d", f->line_number);
strcat(message,temp);
{
int fd;
fd = open(SRCFILE(f), O_RDONLY);
if (fd > 0) {
fline = f;
}
close(fd);
}
}
} else {
if (strlen(fd+f->obj_off)) {
strcat(message," from '");
strcat(message, wad_strip_dir(OBJFILE(f)));
strcat(message,"'");
}
}
strcat(message,"\n");
if (!f->lastsize) break;
fd = fd - f->lastsize;
f = (WadFrame *) fd;
f = f->prev;
while (f) {
strcat(message, f->debug_str);
if (f->debug_srcstr) srcstr = f->debug_srcstr;
f = f->prev;
}
if (fline) {
int first;
int last;
char *line, *c;
int i;
first = fline->line_number - 2;
last = fline->line_number + 2;
if (first < 1) first = 1;
line = wad_load_source(SRCFILE(fline),first);
if (line) {
strcat(message,"\n");
strcat(message, SRCFILE(fline));
sprintf(temp,", line %d\n\n", fline->line_number);
strcat(message, temp);
for (i = first; i <= last; i++) {
if (i == fline->line_number) strcat(message," => ");
else strcat(message," ");
c = strchr(line,'\n');
if (c) {
*c = 0;
strcat(message,line);
strcat(message,"\n");
*c = '\n';
} else {
strcat(message,line);
strcat(message,"\n");
break;
}
line = c+1;
}
wad_release_source();
strcat(message,"\n");
}
if (srcstr) {
strcat(message,"\n");
strcat(message, srcstr);
strcat(message,"\n");
}
if (wad_heap_overflow) {
@ -147,10 +86,9 @@ static void handler(int signo, WadFrame *frame, char *ret) {
Tcl_AddErrorInfo(interp,message);
}
}
wad_release_trace();
}
static void tclwadinit() {
void tclwadinit() {
printf("WAD Enabled\n");
wad_init();
wad_set_callback(handler);
@ -158,19 +96,6 @@ static void tclwadinit() {
wad_set_return("EvalObjv", TCL_ERROR);
}
/* This hack is used to auto-initialize wad regardless of whether we are
used as an imported module or as a link-library for another module */
class wadinitializer {
public:
wadinitializer() {
tclwadinit();
}
};
static wadinitializer wi;
extern "C"
int Wad_Init(Tcl_Interp *interp) {
return TCL_OK;
}

View file

@ -0,0 +1,14 @@
extern "C" void tclwadinit();
/* This hack is used to auto-initialize wad regardless of whether we are
used as an imported module or as a link-library for another module */
class wadinitializer {
public:
wadinitializer() {
tclwadinit();
}
};
static wadinitializer wi;

View file

@ -12,15 +12,6 @@ WADOBJS = string.o vars.o io.o memory.o return.o default.o stack.o stab.o elf.o
INCLUDE = -I../Include -I. $(SINCLUDE)
WADOPT = -DWAD_SOLARIS
# Location of your Python installation
PYINCLUDE = -I/usr/local/include/python2.0
PYCSRCS = wadpyinit.cxx
PYOBJS = wadpy.o
# Location of your Tcl installation
TCLINCLUDE = -I/usr/local/include
TCLSRCS = wadtcl.cxx
TCLOBJS = wadtcl.o
# Location of your Perl installation
PERLINCLUDE = -I/usr/perl5/5.00503/sun4-solaris/CORE
@ -56,14 +47,6 @@ wad: $(WADOBJS) main.o
cp libwad.so ..
cp libwadcore.a ..
python: $(WADOBJS) $(PYOBJS)
$(CXXLINK) $(WADOBJS) $(PYOBJS) -o libwadpy.so
cp libwadpy.so ..
tcl: $(WADOBJS) $(TCLOBJS)
$(CXXLINK) $(WADOBJS) $(TCLOBJS) -o libwadtcl.so
cp libwadtcl.so ..
perl: wad_perl_handler.c $(WADOBJS) $(PERLOBJS)
$(CXXLINK) $(WADOBJS) $(PERLOBJS) -o libwadpl.so
cp libwadpl.so ..
@ -81,8 +64,7 @@ wc::
wc $(SRCS)
semi::
egrep ";" $(WADSRCS) plat/*.c | wc
@egrep ";" $(WADSRCS) plat/*.c | wc
clean::
rm -f *.o *.so *~

View file

@ -11,15 +11,6 @@ WADOBJS = string.o vars.o io.o memory.o return.o default.o stack.o stab.o elf.o
INCLUDE = -I../Include -I. $(SINCLUDE)
WADOPT = @WADOPT@
# Location of your Python installation
PYINCLUDE = @PYINCLUDE@
PYCSRCS = wadpyinit.cxx
PYOBJS = wadpy.o
# Location of your Tcl installation
TCLINCLUDE = @TCLINCLUDE@
TCLSRCS = wadtcl.cxx
TCLOBJS = wadtcl.o
# Location of your Perl installation
PERLINCLUDE = @PERL5EXT@
@ -55,14 +46,6 @@ wad: $(WADOBJS) main.o
cp libwad.so ..
cp libwadcore.a ..
python: $(WADOBJS) $(PYOBJS)
$(CXXLINK) $(WADOBJS) $(PYOBJS) -o libwadpy.so
cp libwadpy.so ..
tcl: $(WADOBJS) $(TCLOBJS)
$(CXXLINK) $(WADOBJS) $(TCLOBJS) -o libwadtcl.so
cp libwadtcl.so ..
perl: wad_perl_handler.c $(WADOBJS) $(PERLOBJS)
$(CXXLINK) $(WADOBJS) $(PERLOBJS) -o libwadpl.so
cp libwadpl.so ..
@ -80,8 +63,7 @@ wc::
wc $(SRCS)
semi::
egrep ";" $(SRCS) wadpy.cxx | wc
@egrep ";" $(WADSRCS) plat/*.c | wc
clean::
rm -f *.o *.so *~

View file

@ -384,12 +384,13 @@ void wad_signalhandler(int sig, siginfo_t *si, void *vcontext) {
wad_restore_i386_registers(origframe, wad_nlr_levels);
#endif
} else {
wad_nlr_levels = 0;
wad_nlr_levels = -1;
}
wad_string_debug();
wad_memory_debug();
if (sig_callback) {
(*sig_callback)(sig,origframe,retname);
} else {
@ -404,7 +405,7 @@ void wad_signalhandler(int sig, siginfo_t *si, void *vcontext) {
an alternative piece of code that unwinds the stack and
initiates a non-local return. */
if (wad_nlr_levels > 0) {
if (wad_nlr_levels >= 0) {
*(pc) = (greg_t) _returnsignal;
#ifdef WAD_SOLARIS
*(npc) = *(pc) + 4;

View file

@ -248,6 +248,41 @@ void wad_stack_debug(WadFrame *frame) {
}
/* -----------------------------------------------------------------------------
* wad_steal_outarg()
*
* Steal an output argument
* ----------------------------------------------------------------------------- */
long
wad_steal_outarg(WadFrame *f, char *symbol, int argno, int *error) {
long *regs;
WadFrame *lastf = 0;
*error = 0;
/* Start searching */
while (f) {
if (f->sym_name && (strcmp(f->sym_name,symbol) == 0)) {
/* Got a match */
if (lastf) {
#ifdef WAD_SOLARIS
regs = (long *) lastf->stack;
return regs[8+argno];
#endif
#ifdef WAD_LINUX
regs = (long *) f->stack;
return regs[argno+2];
#endif
}
}
lastf = f;
f = f->next;
}
*error = -1;
return 0;
}

View file

@ -349,6 +349,7 @@ dnl We use the following in `AC_OUTPUT' and "make distclean".
configure_substituted_files=`echo \
Wad/Makefile \
Python/Makefile \
Tcl/Makefile \
Test/Makefile \
Prebuilt/linux/Makefile \
Prebuilt/solaris/Makefile \