Added line/file methods
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@69 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
50dfa90b79
commit
76d5855c3f
5 changed files with 78 additions and 2 deletions
50
SWIG/Source/DOH/Doh/Makefile
Normal file
50
SWIG/Source/DOH/Doh/Makefile
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# Generated automatically from Makefile.in by configure.
|
||||||
|
#######################################################################
|
||||||
|
# $Header$
|
||||||
|
# DOH
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
#.KEEP_STATE:
|
||||||
|
|
||||||
|
# Set your C++ compiler here. g++ works on most machines,
|
||||||
|
# but you might have to change it depending on your installation.
|
||||||
|
#
|
||||||
|
CC = cc
|
||||||
|
prefix = /r0/beazley/Projects
|
||||||
|
|
||||||
|
# Comment out the following line if you're on an SGI or don't have ranlib!
|
||||||
|
RANLIB = ranlib
|
||||||
|
AR = ar
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Normally, you shouldn't have to change anything below this point #
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
LIBOBJS = callable.o void.o fio.o memory.o base.o file.o list.o hash.o string.o
|
||||||
|
|
||||||
|
LIBSRCS = callable.c void.c fio.c memory.c base.c file.c list.c hash.c string.c
|
||||||
|
|
||||||
|
LIBHEADERS = ../Include/doh.h
|
||||||
|
LIB = ../libdoh.a
|
||||||
|
INCLUDE = -I../Include
|
||||||
|
CFLAGS = -DDOH_STRING_UPDATE_LINES
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Rules for creation of a .o file from .cxx
|
||||||
|
.SUFFIXES: .c
|
||||||
|
.c.o:
|
||||||
|
$(CC) $(INCLUDE) $(CFLAGS) -c -o $*.o $<
|
||||||
|
|
||||||
|
all: $(LIB)
|
||||||
|
|
||||||
|
$(LIB): $(LIBOBJS)
|
||||||
|
@echo "Building library"
|
||||||
|
$(AR) cr $(LIB) $(LIBOBJS)
|
||||||
|
$(RANLIB) $(LIB)
|
||||||
|
|
||||||
|
clean::
|
||||||
|
rm -f *.o ../libdoh.a
|
||||||
|
nuke::
|
||||||
|
rm -f Makefile *~ #* core a.out
|
||||||
|
|
||||||
|
|
@ -247,6 +247,9 @@ int DohGetline(DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohError(DOH_CALLS,"DohGetline %x\n",obj);
|
DohError(DOH_CALLS,"DohGetline %x\n",obj);
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
|
if (b->objinfo->doh_file && b->objinfo->doh_file->doh_getline) {
|
||||||
|
return (b->objinfo->doh_file->doh_getline)(obj);
|
||||||
|
}
|
||||||
return b->line;
|
return b->line;
|
||||||
} else {
|
} else {
|
||||||
DohError(DOH_UNKNOWN, "Unknown object %x passed to Getline.\n", obj);
|
DohError(DOH_UNKNOWN, "Unknown object %x passed to Getline.\n", obj);
|
||||||
|
|
@ -259,6 +262,10 @@ void DohSetline(DOH *obj, int line) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohError(DOH_CALLS,"DohSetline %x, %d\n",obj, line);
|
DohError(DOH_CALLS,"DohSetline %x, %d\n",obj, line);
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
|
if (b->objinfo->doh_file && b->objinfo->doh_file->doh_setline) {
|
||||||
|
(b->objinfo->doh_file->doh_setline)(obj, line);
|
||||||
|
return;
|
||||||
|
}
|
||||||
b->line = line;
|
b->line = line;
|
||||||
} else {
|
} else {
|
||||||
DohError(DOH_UNKNOWN, "Unknown object %x passed to Setline.\n", obj);
|
DohError(DOH_UNKNOWN, "Unknown object %x passed to Setline.\n", obj);
|
||||||
|
|
@ -270,6 +277,9 @@ DOH *DohGetfile(DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohError(DOH_CALLS,"DohGetfile %x\n",obj);
|
DohError(DOH_CALLS,"DohGetfile %x\n",obj);
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
|
if (b->objinfo->doh_file && b->objinfo->doh_file->doh_getfile) {
|
||||||
|
return (b->objinfo->doh_file->doh_getfile)(obj);
|
||||||
|
}
|
||||||
return b->file;
|
return b->file;
|
||||||
} else {
|
} else {
|
||||||
DohError(DOH_UNKNOWN, "Unknown object %x passed to Getfile.\n", obj);
|
DohError(DOH_UNKNOWN, "Unknown object %x passed to Getfile.\n", obj);
|
||||||
|
|
@ -285,6 +295,10 @@ void DohSetfile(DOH *obj, DOH *file) {
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
if (file) {
|
if (file) {
|
||||||
nf = find_internal(file);
|
nf = find_internal(file);
|
||||||
|
if (b->objinfo->doh_file && b->objinfo->doh_file->doh_setfile) {
|
||||||
|
(b->objinfo->doh_file->doh_setfile)(obj,nf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Incref(nf);
|
Incref(nf);
|
||||||
if (b->file) Delete(b->file);
|
if (b->file) Delete(b->file);
|
||||||
b->file = nf;
|
b->file = nf;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,11 @@ static DohFileMethods FileFileMethods = {
|
||||||
File_ungetc,
|
File_ungetc,
|
||||||
File_seek,
|
File_seek,
|
||||||
File_tell,
|
File_tell,
|
||||||
0,
|
0, /* close */
|
||||||
|
0, /* getfile */
|
||||||
|
0, /* setfile */
|
||||||
|
0, /* getline */
|
||||||
|
0 /* setline */
|
||||||
};
|
};
|
||||||
|
|
||||||
static DohObjInfo FileType = {
|
static DohObjInfo FileType = {
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,11 @@ static DohFileMethods StringFileMethods = {
|
||||||
String_ungetc,
|
String_ungetc,
|
||||||
String_seek,
|
String_seek,
|
||||||
String_tell,
|
String_tell,
|
||||||
0,
|
0, /* close */
|
||||||
|
0, /* getfile */
|
||||||
|
0, /* setfile */
|
||||||
|
0, /* getline */
|
||||||
|
0 /* setline */
|
||||||
};
|
};
|
||||||
|
|
||||||
static DohStringMethods StringStringMethods = {
|
static DohStringMethods StringStringMethods = {
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,10 @@ typedef struct {
|
||||||
int (*doh_seek)(DOH *obj, long offset, int whence);
|
int (*doh_seek)(DOH *obj, long offset, int whence);
|
||||||
long (*doh_tell)(DOH *obj);
|
long (*doh_tell)(DOH *obj);
|
||||||
int (*doh_close)(DOH *obj);
|
int (*doh_close)(DOH *obj);
|
||||||
|
DOH *(*doh_getfile)(DOH *obj);
|
||||||
|
void (*doh_setfile)(DOH *obj, DOH *f);
|
||||||
|
int (*doh_getline)(DOH *obj);
|
||||||
|
void (*doh_setline)(DOH *obj, int);
|
||||||
} DohFileMethods;
|
} DohFileMethods;
|
||||||
|
|
||||||
/* String methods */
|
/* String methods */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue