opendemo-cvs Mailing List for OpenDemo (Page 4)
Status: Beta
Brought to you by:
girlich
You can subscribe to this list here.
2002 |
Jan
(43) |
Feb
|
Mar
|
Apr
(38) |
May
(65) |
Jun
(108) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(17) |
Feb
(13) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(8) |
Sep
(62) |
Oct
(81) |
Nov
(12) |
Dec
(32) |
2004 |
Jan
(25) |
Feb
(76) |
Mar
(32) |
Apr
(10) |
May
(6) |
Jun
|
Jul
(1) |
Aug
(5) |
Sep
|
Oct
(19) |
Nov
(1) |
Dec
|
2005 |
Jan
(2) |
Feb
(23) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(14) |
Nov
|
Dec
|
From: Uwe G. <gi...@us...> - 2004-04-17 18:15:48
|
Update of /cvsroot/opendemo/opendemo/src/sof2/opendemo/opendemo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18878/sof2/opendemo/opendemo Modified Files: od_filebuf.h Log Message: Allow to completely disable usage of zlib routines at compile time. The zlib files will still be compiled though. Index: od_filebuf.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/sof2/opendemo/opendemo/od_filebuf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** od_filebuf.h 28 Feb 2004 20:49:08 -0000 1.2 --- od_filebuf.h 17 Apr 2004 18:15:38 -0000 1.3 *************** *** 25,29 **** #include "od_membuf.h" #include "od_private.h" /* for od */ - #include "zlib/zlib.h" #ifdef __cplusplus --- 25,28 ---- *************** *** 32,35 **** --- 31,35 ---- + /* Set HAVE_ZLIB to 0, if you don't want to compile with it. */ #define HAVE_ZLIB 1 *************** *** 39,42 **** --- 39,43 ---- */ #if HAVE_ZLIB + #include "zlib/zlib.h" #define gen_eof(x) ((od.cv.od_zlib.integer) ? (gzeof(x)) : (odfeof(x))) #ifdef RETURN_HACK *************** *** 56,60 **** --- 57,65 ---- typedef struct { + #if HAVE_ZLIB gzFile fp; /* input file stream, may be compressed or uncompressed */ + #else + odFILE *fp; /* OD self made input stream */ + #endif mb_t* mb; /* buffer used to allow peeking */ size_t tail; /* fbRead*() starts reading data at buffer + tail */ |
From: Uwe G. <gi...@us...> - 2004-04-17 18:15:47
|
Update of /cvsroot/opendemo/opendemo/src/q3a/opendemo/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18878/q3a/opendemo/game Modified Files: od_filebuf.h Log Message: Allow to completely disable usage of zlib routines at compile time. The zlib files will still be compiled though. Index: od_filebuf.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/q3a/opendemo/game/od_filebuf.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** od_filebuf.h 26 Nov 2003 20:57:37 -0000 1.5 --- od_filebuf.h 17 Apr 2004 18:15:38 -0000 1.6 *************** *** 25,29 **** #include "od_membuf.h" #include "od_private.h" /* for od */ - #include "zlib/zlib.h" #ifdef __cplusplus --- 25,28 ---- *************** *** 32,35 **** --- 31,35 ---- + /* Set HAVE_ZLIB to 0, if you don't want to compile with it. */ #define HAVE_ZLIB 1 *************** *** 39,42 **** --- 39,43 ---- */ #if HAVE_ZLIB + #include "zlib/zlib.h" #define gen_eof(x) ((od.cv.od_zlib.integer) ? (gzeof(x)) : (odfeof(x))) #ifdef RETURN_HACK *************** *** 56,60 **** --- 57,65 ---- typedef struct { + #if HAVE_ZLIB gzFile fp; /* input file stream, may be compressed or uncompressed */ + #else + odFILE *fp; /* OD self made input stream */ + #endif mb_t* mb; /* buffer used to allow peeking */ size_t tail; /* fbRead*() starts reading data at buffer + tail */ |
From: Uwe G. <gi...@us...> - 2004-04-17 18:15:47
|
Update of /cvsroot/opendemo/opendemo/src/stef/opendemo/opendemo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18878/stef/opendemo/opendemo Modified Files: od_filebuf.h Log Message: Allow to completely disable usage of zlib routines at compile time. The zlib files will still be compiled though. Index: od_filebuf.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/stef/opendemo/opendemo/od_filebuf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** od_filebuf.h 28 Feb 2004 21:00:24 -0000 1.2 --- od_filebuf.h 17 Apr 2004 18:15:38 -0000 1.3 *************** *** 25,29 **** #include "od_membuf.h" #include "od_private.h" /* for od */ - #include "zlib/zlib.h" #ifdef __cplusplus --- 25,28 ---- *************** *** 32,35 **** --- 31,35 ---- + /* Set HAVE_ZLIB to 0, if you don't want to compile with it. */ #define HAVE_ZLIB 1 *************** *** 39,42 **** --- 39,43 ---- */ #if HAVE_ZLIB + #include "zlib/zlib.h" #define gen_eof(x) ((od.cv.od_zlib.integer) ? (gzeof(x)) : (odfeof(x))) #ifdef RETURN_HACK *************** *** 56,60 **** --- 57,65 ---- typedef struct { + #if HAVE_ZLIB gzFile fp; /* input file stream, may be compressed or uncompressed */ + #else + odFILE *fp; /* OD self made input stream */ + #endif mb_t* mb; /* buffer used to allow peeking */ size_t tail; /* fbRead*() starts reading data at buffer + tail */ |
From: Uwe G. <gi...@us...> - 2004-04-17 18:15:47
|
Update of /cvsroot/opendemo/opendemo/src/rtcw-mp/opendemo/opendemo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18878/rtcw-mp/opendemo/opendemo Modified Files: od_filebuf.h Log Message: Allow to completely disable usage of zlib routines at compile time. The zlib files will still be compiled though. Index: od_filebuf.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/rtcw-mp/opendemo/opendemo/od_filebuf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** od_filebuf.h 28 Feb 2004 20:27:17 -0000 1.2 --- od_filebuf.h 17 Apr 2004 18:15:38 -0000 1.3 *************** *** 25,29 **** #include "od_membuf.h" #include "od_private.h" /* for od */ - #include "zlib/zlib.h" #ifdef __cplusplus --- 25,28 ---- *************** *** 32,35 **** --- 31,35 ---- + /* Set HAVE_ZLIB to 0, if you don't want to compile with it. */ #define HAVE_ZLIB 1 *************** *** 39,42 **** --- 39,43 ---- */ #if HAVE_ZLIB + #include "zlib/zlib.h" #define gen_eof(x) ((od.cv.od_zlib.integer) ? (gzeof(x)) : (odfeof(x))) #ifdef RETURN_HACK *************** *** 56,60 **** --- 57,65 ---- typedef struct { + #if HAVE_ZLIB gzFile fp; /* input file stream, may be compressed or uncompressed */ + #else + odFILE *fp; /* OD self made input stream */ + #endif mb_t* mb; /* buffer used to allow peeking */ size_t tail; /* fbRead*() starts reading data at buffer + tail */ |
From: Uwe G. <gi...@us...> - 2004-04-17 18:15:46
|
Update of /cvsroot/opendemo/opendemo/src/jk2/opendemo/opendemo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18878/jk2/opendemo/opendemo Modified Files: od_filebuf.h Log Message: Allow to completely disable usage of zlib routines at compile time. The zlib files will still be compiled though. Index: od_filebuf.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/jk2/opendemo/opendemo/od_filebuf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** od_filebuf.h 28 Feb 2004 19:47:34 -0000 1.2 --- od_filebuf.h 17 Apr 2004 18:15:37 -0000 1.3 *************** *** 25,29 **** #include "od_membuf.h" #include "od_private.h" /* for od */ - #include "zlib/zlib.h" #ifdef __cplusplus --- 25,28 ---- *************** *** 32,35 **** --- 31,35 ---- + /* Set HAVE_ZLIB to 0, if you don't want to compile with it. */ #define HAVE_ZLIB 1 *************** *** 39,42 **** --- 39,43 ---- */ #if HAVE_ZLIB + #include "zlib/zlib.h" #define gen_eof(x) ((od.cv.od_zlib.integer) ? (gzeof(x)) : (odfeof(x))) #ifdef RETURN_HACK *************** *** 56,60 **** --- 57,65 ---- typedef struct { + #if HAVE_ZLIB gzFile fp; /* input file stream, may be compressed or uncompressed */ + #else + odFILE *fp; /* OD self made input stream */ + #endif mb_t* mb; /* buffer used to allow peeking */ size_t tail; /* fbRead*() starts reading data at buffer + tail */ |
From: Uwe G. <gi...@us...> - 2004-04-17 18:04:14
|
Update of /cvsroot/opendemo/opendemo/src/stef/opendemo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17389 Modified Files: Makefile Log Message: Add the opendemo directory to the include path in the batch files. Hint came from RCFmember. Index: Makefile =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/stef/opendemo/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 28 Sep 2003 19:29:38 -0000 1.3 --- Makefile 17 Apr 2004 18:04:05 -0000 1.4 *************** *** 416,420 **** BATCH_TARGET_GAME=$(BATCH_BASEDIR_GAME)/game.bat BATCH_LINKFILE_GAME=game ! BATCH_CFLAGS_GAME= LINK_LIST_GAME=$(subst .c,,$(BATCH_LIST_GAME)) ..\g_syscalls LINK_DESTFILE_GAME=../../vm/qagame --- 416,420 ---- BATCH_TARGET_GAME=$(BATCH_BASEDIR_GAME)/game.bat BATCH_LINKFILE_GAME=game ! BATCH_CFLAGS_GAME=-I..\..\opendemo LINK_LIST_GAME=$(subst .c,,$(BATCH_LIST_GAME)) ..\g_syscalls LINK_DESTFILE_GAME=../../vm/qagame |
From: Uwe G. <gi...@us...> - 2004-04-17 18:01:19
|
Update of /cvsroot/opendemo/opendemo/src/rtcw-mp/opendemo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16770 Modified Files: Makefile Log Message: Add the opendemo directory to the include path in the batch files. Hint came from RCFmember. Add an additional directory to look for source files (for batch target). Remove Q3_UI batch target. No idea, why this was here anyway. Index: Makefile =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/rtcw-mp/opendemo/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 5 Oct 2003 19:38:01 -0000 1.9 --- Makefile 17 Apr 2004 18:01:10 -0000 1.10 *************** *** 388,395 **** --- 388,397 ---- BATCH_DIR1_GAME= BATCH_DIR2_GAME=zlib/ + BATCH_DIR3_GAME=botai/ BATCH_LIST_GAME=$(GAME_OBJ_BATCH) BATCH_BASEDIR_GAME=$(GDIR) BATCH_TARGET_GAME=$(BATCH_BASEDIR_GAME)/game.bat BATCH_LINKFILE_GAME=game + BATCH_CFLAGS_GAME=-I..\..\opendemo LINK_BASEDIR_GAME=baseq3 LINK_LIST_GAME=$(subst .c,,$(BATCH_LIST_GAME)) ..\g_syscalls *************** *** 398,406 **** BATCH_DIR1_GAME_TA= BATCH_DIR2_GAME_TA=zlib/ BATCH_LIST_GAME_TA=$(GAME_OBJ_BATCH) BATCH_BASEDIR_GAME_TA=$(GDIR) BATCH_TARGET_GAME_TA=$(BATCH_BASEDIR_GAME)/game_ta.bat BATCH_LINKFILE_GAME_TA=game_ta ! BATCH_CFLAGS_GAME_TA=-DMISSIONPACK LINK_BASEDIR_GAME_TA=missionpack LINK_LIST_GAME_TA=$(subst .c,,$(BATCH_LIST_GAME_TA)) ..\g_syscalls --- 400,409 ---- BATCH_DIR1_GAME_TA= BATCH_DIR2_GAME_TA=zlib/ + BATCH_DIR3_GAME_TA=botai/ BATCH_LIST_GAME_TA=$(GAME_OBJ_BATCH) BATCH_BASEDIR_GAME_TA=$(GDIR) BATCH_TARGET_GAME_TA=$(BATCH_BASEDIR_GAME)/game_ta.bat BATCH_LINKFILE_GAME_TA=game_ta ! BATCH_CFLAGS_GAME_TA=-DMISSIONPACK -I..\..\opendemo LINK_BASEDIR_GAME_TA=missionpack LINK_LIST_GAME_TA=$(subst .c,,$(BATCH_LIST_GAME_TA)) ..\g_syscalls *************** *** 460,464 **** $(MAKE) batch2 BAT=CGAME_TA $(MAKE) batch2 BAT=UI - $(MAKE) batch2 BAT=Q3_UI batch2: $(BATCH_TARGET_GEN) $(LINK_TARGET_GEN) --- 463,466 ---- |
From: Uwe G. <gi...@us...> - 2004-04-17 17:52:59
|
Update of /cvsroot/opendemo/opendemo/src/jk2/opendemo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15510 Modified Files: Makefile Log Message: Add the opendemo directory to the include path in the batch files. Hint came from RCFmember. Index: Makefile =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/jk2/opendemo/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 28 Sep 2003 19:29:37 -0000 1.2 --- Makefile 17 Apr 2004 17:52:47 -0000 1.3 *************** *** 391,395 **** BATCH_TARGET_GAME=$(BATCH_BASEDIR_GAME)/game.bat BATCH_LINKFILE_GAME=game ! BATCH_CFLAGS_GAME=-DMISSIONPACK LINK_BASEDIR_GAME=..\..\..\base\vm LINK_LIST_GAME=$(subst .c,,$(BATCH_LIST_GAME)) ..\g_syscalls --- 391,395 ---- BATCH_TARGET_GAME=$(BATCH_BASEDIR_GAME)/game.bat BATCH_LINKFILE_GAME=game ! BATCH_CFLAGS_GAME=-DMISSIONPACK -I..\..\opendemo LINK_BASEDIR_GAME=..\..\..\base\vm LINK_LIST_GAME=$(subst .c,,$(BATCH_LIST_GAME)) ..\g_syscalls |
From: Uwe G. <gi...@us...> - 2004-04-17 17:48:43
|
Update of /cvsroot/opendemo/opendemo/src/sof2/opendemo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14637 Modified Files: Makefile Log Message: Add the opendemo directory to the include path in the batch files. Hint came from RCFmember. Index: Makefile =================================================================== RCS file: /cvsroot/opendemo/opendemo/src/sof2/opendemo/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 28 Feb 2004 09:46:45 -0000 1.5 --- Makefile 17 Apr 2004 17:48:35 -0000 1.6 *************** *** 609,613 **** BATCH_TARGET_GAME=$(BATCH_BASEDIR_GAME)/game.bat BATCH_LINKFILE_GAME=game ! BATCH_CFLAGS_GAME=-DMISSIONPACK -I..\..\cgame -I..\..\game -I..\..\ui LINK_BASEDIR_GAME=..\..\..\base\vm LINK_LIST_GAME=$(subst .c,,$(BATCH_LIST_GAME)) ..\g_syscalls --- 609,613 ---- BATCH_TARGET_GAME=$(BATCH_BASEDIR_GAME)/game.bat BATCH_LINKFILE_GAME=game ! BATCH_CFLAGS_GAME=-DMISSIONPACK -I..\..\cgame -I..\..\game -I..\..\ui -I..\..\opendemo LINK_BASEDIR_GAME=..\..\..\base\vm LINK_LIST_GAME=$(subst .c,,$(BATCH_LIST_GAME)) ..\g_syscalls |
From: Uwe G. <gi...@us...> - 2004-03-31 08:54:13
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15387 Modified Files: odfile_expat_intern.h odfile_expat_intern.c odfile_expat.xs Log Message: implement header and footer footer methods Index: odfile_expat_intern.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat_intern.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** odfile_expat_intern.h 30 Mar 2004 08:04:49 -0000 1.4 --- odfile_expat_intern.h 31 Mar 2004 08:42:25 -0000 1.5 *************** *** 17,22 **** XML_Parser parser; char *infile; - char *xmldecl; - char *doctype; char *mapname; int snap; --- 17,20 ---- *************** *** 24,28 **** int firstTime; int firstSequence; ! int last_snap_offset; } odfile_expat; --- 22,29 ---- int firstTime; int firstSequence; ! int header_length; ! int footer_offset; ! char *header; ! char *footer; } odfile_expat; *************** *** 39,42 **** --- 40,45 ---- extern int ofe_firstSequence(odfile_expat *self); extern void ofe_set_firstSequence(odfile_expat *self, int firstSequence); + extern const char* ofe_header(odfile_expat *self); + extern const char* ofe_footer(odfile_expat *self); Index: odfile_expat_intern.c =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat_intern.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** odfile_expat_intern.c 30 Mar 2004 08:07:03 -0000 1.4 --- odfile_expat_intern.c 31 Mar 2004 08:42:25 -0000 1.5 *************** *** 46,77 **** /* XML file parse handlers */ - void XMLCALL _HandleXMLDecl(void *userData, const XML_Char *version, - const XML_Char *encoding, int standalone) - { - odfile_expat* self = (odfile_expat*)userData; - char buffer[100]; - - CFREE(self->xmldecl); - snprintf(buffer, sizeof(buffer), - "<?xml version=\"%s\" encoding=\"%s\"?>\n", - version, encoding); - self->xmldecl = strdup(buffer); - } - - - void XMLCALL _HandleDoctype(void *userData, const XML_Char *doctypeName, - const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset) - { - odfile_expat* self = (odfile_expat*)userData; - char buffer[500]; - - CFREE(self->doctype); - snprintf(buffer, sizeof(buffer), - "<!DOCTYPE %s PUBLIC \"%s\" \"%s\">", - doctypeName, pubid, sysid); - self->doctype = strdup(buffer); - } - - void XMLCALL _HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts) --- 46,49 ---- *************** *** 88,91 **** --- 60,64 ---- ofe_set_firstSequence(self, atoi(_getAttribute(atts,"sequence"))); self->snapshotc = 0; + self->header_length = XML_GetCurrentByteIndex(self->parser); } self->snapshotc++; *************** *** 99,105 **** odfile_expat* self = (odfile_expat*)userData; if (strcmp(name, "snapshot") == 0) { ! self->last_snap_offset = XML_GetCurrentByteIndex(self->parser) ! + 11; ! /* + 1 + 1 + strlen("snapshot") + 1; */ } } --- 72,76 ---- odfile_expat* self = (odfile_expat*)userData; if (strcmp(name, "snapshot") == 0) { ! self->footer_offset = XML_GetCurrentByteIndex(self->parser); } } *************** *** 143,148 **** /* set the handlers */ - XML_SetXmlDeclHandler (p, _HandleXMLDecl); - XML_SetStartDoctypeDeclHandler (p, _HandleDoctype); XML_SetStartElementHandler (p, _HandleStartElement); XML_SetEndElementHandler (p, _HandleEndElement); --- 114,117 ---- *************** *** 192,195 **** --- 161,229 ---- } while (bytes_read > 0); + if (self != 0) { + /* post process */ + struct stat buf; + int footer_length; + + self->header = malloc(self->header_length + 1); /* trailing \0 */ + if (self->header == NULL) { + fprintf(stderr,"%s: could not allocate %d bytes for the header: %s\n", + fname, self->header_length + 1, strerror(errno)); + OFE_DONE(self); + goto out; + } + + if (lseek(docfd, 0, SEEK_SET) < 0) { + fprintf(stderr,"%s: could not rewind %s: %s\n", + fname, ofe_name(self), strerror(errno)); + OFE_DONE(self); + goto out; + } + if (read(docfd, self->header, self->header_length) != self->header_length) { + fprintf(stderr, + "%s: could not read header (%d bytes) from %s: %s\n", + fname, self->header_length, ofe_name(self), + strerror(errno)); + OFE_DONE(self); + goto out; + } + self->header[self->header_length] = '\0'; /* trailing \0 */ + + if (fstat(docfd, &buf) < 0) { + fprintf(stderr,"%s: could not stat() the file %s: %s\n", + fname, ofe_name(self), strerror(errno)); + OFE_DONE(self); + goto out; + } + self->footer_offset += 11; /* + </snapshot> */ + footer_length = buf.st_size - self->footer_offset; + + self->footer = malloc(footer_length + 1); /* trailing \0 */ + if (self->footer == NULL) { + fprintf(stderr,"%s: could not allocate %d bytes for the footer: %s\n", + fname, footer_length + 1, strerror(errno)); + OFE_DONE(self); + goto out; + } + + if (lseek(docfd, self->footer_offset, SEEK_SET) < 0) { + fprintf(stderr, + "%s: could not seek %s to the footer (offset %d): %s\n", + fname, ofe_name(self), self->footer_offset, + strerror(errno)); + OFE_DONE(self); + goto out; + } + if (read(docfd, self->footer, footer_length) != footer_length) { + fprintf(stderr, + "%s: could not read footer (%d bytes) from %s: %s\n", + fname, footer_length, ofe_name(self), + strerror(errno)); + OFE_DONE(self); + goto out; + } + self->footer[footer_length] = '\0'; /* trailing \0 */ + } + out: /* remove the parser object */ *************** *** 204,214 **** } - if (self != 0) { - /* post process */ - /* - fprintf(stderr,"last pos = %d\n", self->last_snap_offset); - */ - } - /* return the object (or a NULL pointer) */ return self; --- 238,241 ---- *************** *** 273,283 **** void ofe_done(odfile_expat *self) { CFREE(self->infile); /* was created with strdup() */ - CFREE(self->xmldecl); /* was created with strdup() */ - CFREE(self->doctype); /* was created with strdup() */ CFREE(self->mapname); /* was created with strdup() */ CFREE(self); /* was created with malloc() */ } --- 300,324 ---- + const char* + ofe_header(odfile_expat *self) + { + return self->header; + } + + + const char* + ofe_footer(odfile_expat *self) + { + return self->footer; + } + + void ofe_done(odfile_expat *self) { CFREE(self->infile); /* was created with strdup() */ CFREE(self->mapname); /* was created with strdup() */ + CFREE(self->header); /* was created with malloc() */ + CFREE(self->footer); /* was created with malloc() */ CFREE(self); /* was created with malloc() */ } Index: odfile_expat.xs =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat.xs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** odfile_expat.xs 30 Mar 2004 08:08:20 -0000 1.4 --- odfile_expat.xs 31 Mar 2004 08:42:25 -0000 1.5 *************** *** 95,96 **** --- 95,114 ---- + const char* + header(self) + odfile_expat *self; + CODE: + RETVAL = ofe_header(self); + OUTPUT: + RETVAL + + + const char* + footer(self) + odfile_expat *self; + CODE: + RETVAL = ofe_footer(self); + OUTPUT: + RETVAL + + |
From: Uwe G. <gi...@us...> - 2004-03-31 08:50:53
|
Update of /cvsroot/opendemo/opendemo/tools/odcut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14768 Modified Files: odcut.pl odfile_dom.pm odfile_parser.pm Log Message: odfile API changed: get_header -> header, get_footer -> footer Index: odcut.pl =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odcut.pl,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** odcut.pl 30 Mar 2004 08:09:45 -0000 1.42 --- odcut.pl 31 Mar 2004 08:39:06 -0000 1.43 *************** *** 850,854 **** return 0 unless my $odfile = $self->get_currentfile(); ! my $text = $odfile->get_header(); $self->write_output($text); } --- 850,854 ---- return 0 unless my $odfile = $self->get_currentfile(); ! my $text = $odfile->header(); $self->write_output($text); } *************** *** 863,867 **** return 0 unless my $odfile = $self->get_currentfile(); ! my $text = $odfile->get_footer(); $self->write_output($text); } --- 863,867 ---- return 0 unless my $odfile = $self->get_currentfile(); ! my $text = $odfile->footer(); $self->write_output($text); } Index: odfile_dom.pm =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_dom.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** odfile_dom.pm 30 Mar 2004 08:09:45 -0000 1.6 --- odfile_dom.pm 31 Mar 2004 08:39:07 -0000 1.7 *************** *** 212,216 **** ! sub get_header($) { my $self = shift; --- 212,216 ---- ! sub header($) { my $self = shift; *************** *** 281,285 **** ! sub get_footer($) { my $text = ""; --- 281,285 ---- ! sub footer($) { my $text = ""; Index: odfile_parser.pm =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_parser.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** odfile_parser.pm 30 Mar 2004 08:09:45 -0000 1.6 --- odfile_parser.pm 31 Mar 2004 08:39:07 -0000 1.7 *************** *** 345,349 **** ! sub get_header($) { my $self = shift; --- 345,349 ---- ! sub header($) { my $self = shift; *************** *** 352,356 **** ! sub get_footer($) { my $self = shift; --- 352,356 ---- ! sub footer($) { my $self = shift; |
From: Uwe G. <gi...@us...> - 2004-03-30 08:21:20
|
Update of /cvsroot/opendemo/opendemo/tools/odcut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3773 Modified Files: odcut.pl odcutgui.pm odfile_parser.pm odfile_dom.pm Log Message: change in the odfile interface: get_name() -> name() get_snapshotc() -> snapshotc() Index: odcut.pl =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odcut.pl,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** odcut.pl 28 Mar 2004 19:27:25 -0000 1.41 --- odcut.pl 30 Mar 2004 08:09:45 -0000 1.42 *************** *** 886,890 **** my $found = 0; foreach my $file ($self->get_files()) { ! if ($file->get_name() eq $command->get_arg(0)) { # we have this file already cached $found = 1; --- 886,890 ---- my $found = 0; foreach my $file ($self->get_files()) { ! if ($file->name() eq $command->get_arg(0)) { # we have this file already cached $found = 1; *************** *** 927,932 **** if ($self->get_currentfile()) { main::logging 0, "DEMOFILE \"%s\", frames 0..%d\n", ! $self->get_currentfile()->get_name(), ! $self->get_currentfile()->get_snapshotc() - 1; } else { --- 927,932 ---- if ($self->get_currentfile()) { main::logging 0, "DEMOFILE \"%s\", frames 0..%d\n", ! $self->get_currentfile()->name(), ! $self->get_currentfile()->snapshotc() - 1; } else { *************** *** 938,942 **** my $close = undef; foreach my $file ($self->get_files()) { ! if ($file->get_name() eq $command->get_arg(0)) { # Should close this file. $close = $file; --- 938,942 ---- my $close = undef; foreach my $file ($self->get_files()) { ! if ($file->name() eq $command->get_arg(0)) { # Should close this file. $close = $file; *************** *** 957,962 **** # file to close. foreach my $file ($self->get_files()) { ! if ($file->get_name() ne $command->get_arg(0)) { ! $self->do_command(odcommand->new("d " . $file->get_name())); $self->interactive(0); last; --- 957,962 ---- # file to close. foreach my $file ($self->get_files()) { ! if ($file->name() ne $command->get_arg(0)) { ! $self->do_command(odcommand->new("d " . $file->name())); $self->interactive(0); last; *************** *** 1022,1029 **** $command->get_arg(0) < 0 || $command->get_arg(0) >= ! $self->get_currentfile()->get_snapshotc()) { main::warning 0, "FRAME ERROR frame number %d out of range [0,%d]\n", ! $command->get_arg(0), $self->get_currentfile()->get_snapshotc()-1; } else { --- 1022,1029 ---- $command->get_arg(0) < 0 || $command->get_arg(0) >= ! $self->get_currentfile()->snapshotc()) { main::warning 0, "FRAME ERROR frame number %d out of range [0,%d]\n", ! $command->get_arg(0), $self->get_currentfile()->snapshotc()-1; } else { *************** *** 1049,1062 **** $command->get_arg(0) < 0 || $command->get_arg(0) >= ! $self->get_currentfile()->get_snapshotc()) { main::warning 0, "RANGE ERROR start frame number %d out of range [0,%d]\n", ! $command->get_arg(0), $self->get_currentfile()->get_snapshotc()-1; } elsif ( $command->get_arg(1) < 0 || $command->get_arg(1) >= ! $self->get_currentfile()->get_snapshotc()) { main::warning 0, "RANGE ERROR end frame number %d out of range [0,%d]\n", ! $command->get_arg(1), $self->get_currentfile()->get_snapshotc()-1; } else { --- 1049,1062 ---- $command->get_arg(0) < 0 || $command->get_arg(0) >= ! $self->get_currentfile()->snapshotc()) { main::warning 0, "RANGE ERROR start frame number %d out of range [0,%d]\n", ! $command->get_arg(0), $self->get_currentfile()->snapshotc()-1; } elsif ( $command->get_arg(1) < 0 || $command->get_arg(1) >= ! $self->get_currentfile()->snapshotc()) { main::warning 0, "RANGE ERROR end frame number %d out of range [0,%d]\n", ! $command->get_arg(1), $self->get_currentfile()->snapshotc()-1; } else { Index: odcutgui.pm =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odcutgui.pm,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** odcutgui.pm 22 Mar 2004 19:47:05 -0000 1.36 --- odcutgui.pm 30 Mar 2004 08:09:45 -0000 1.37 *************** *** 243,248 **** my $tab = $self->{NOTEBOOK}->GetPage($self->{NOTEBOOK}->GetSelection()); my $file = $tab->{"file"}; ! printf "current file is %s\n", $file->get_name(); ! $self->do_command(odcommand->new("d " . $file->get_name())); $self->UpdateTitle(); } --- 243,248 ---- my $tab = $self->{NOTEBOOK}->GetPage($self->{NOTEBOOK}->GetSelection()); my $file = $tab->{"file"}; ! printf "current file is %s\n", $file->name(); ! $self->do_command(odcommand->new("d " . $file->name())); $self->UpdateTitle(); } *************** *** 448,455 **** { my ($self, $file) = @_; ! printf "close file: %s\n", $file->get_name(); # close the desired file ! $self->do_command(odcommand->new("c " . $file->get_name())); $self->UpdateGUI(); } --- 448,455 ---- { my ($self, $file) = @_; ! printf "close file: %s\n", $file->name(); # close the desired file ! $self->do_command(odcommand->new("c " . $file->name())); $self->UpdateGUI(); } *************** *** 652,656 **** my $stream = $self->{"odgame"}->GetOutputStream(); ! my $demofile = $output->get_currentfile()->get_name(); my $map = $output->get_currentfile()->mapname(); --- 652,656 ---- my $stream = $self->{"odgame"}->GetOutputStream(); ! my $demofile = $output->get_currentfile()->name(); my $map = $output->get_currentfile()->mapname(); *************** *** 787,791 **** my $tab = $notebook->GetPage($i); my $tabfile = $tab->{"file"}; ! if (!$tabfile->get_name()) { $remove = 1; $notebook->RemovePage($i); --- 787,791 ---- my $tab = $notebook->GetPage($i); my $tabfile = $tab->{"file"}; ! if (!$tabfile->name()) { $remove = 1; $notebook->RemovePage($i); *************** *** 814,819 **** if (!$file_found) { my $tab = odcuttab->new($notebook,$file); ! $tab->SetToolTip($file->get_name()); ! my $shortname = basename($file->get_name()); $notebook->AddPage( $tab, $shortname, 1, -1 ); } --- 814,819 ---- if (!$file_found) { my $tab = odcuttab->new($notebook,$file); ! $tab->SetToolTip($file->name()); ! my $shortname = basename($file->name()); $notebook->AddPage( $tab, $shortname, 1, -1 ); } *************** *** 838,842 **** my $tab = $self->{NOTEBOOK}->GetPage($i); my $file = $tab->{"file"}; ! $self->{CLOSEMENU}->Append( 100+ $i, $file->get_name(), 'Close ' . $file->get_name()); EVT_MENU($self,100 + $i, sub { OnClose($self, $file) } ); } --- 838,842 ---- my $tab = $self->{NOTEBOOK}->GetPage($i); my $file = $tab->{"file"}; ! $self->{CLOSEMENU}->Append( 100+ $i, $file->name(), 'Close ' . $file->name()); EVT_MENU($self,100 + $i, sub { OnClose($self, $file) } ); } *************** *** 864,868 **** my $current_file = $self->{"output"}->get_currentfile(); if ($current_file) { ! $text = $current_file->get_name() . " - " . $text; } $self->SetTitle($text); --- 864,868 ---- my $current_file = $self->{"output"}->get_currentfile(); if ($current_file) { ! $text = $current_file->name() . " - " . $text; } $self->SetTitle($text); *************** *** 918,922 **** $self->{SLIDER} = Wx::Slider->new($self, -1, 0, ! 0, $file->get_snapshotc() -1, [-1,-1], [-1,-1], wxSL_LABELS ); --- 918,922 ---- $self->{SLIDER} = Wx::Slider->new($self, -1, 0, ! 0, $file->snapshotc() -1, [-1,-1], [-1,-1], wxSL_LABELS ); *************** *** 962,966 **** $self->{"odcutmain"} = odcutmain->new($output); foreach my $file ($output->get_files()) { ! $self->{"odcutmain"}->Add( $file->get_name() ); } $self->{"odcutmain"}->Show(1); --- 962,966 ---- $self->{"odcutmain"} = odcutmain->new($output); foreach my $file ($output->get_files()) { ! $self->{"odcutmain"}->Add( $file->name() ); } $self->{"odcutmain"}->Show(1); Index: odfile_parser.pm =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_parser.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** odfile_parser.pm 29 Feb 2004 10:26:29 -0000 1.5 --- odfile_parser.pm 30 Mar 2004 08:09:45 -0000 1.6 *************** *** 79,83 **** ! sub get_name($) { my $self = shift; --- 79,83 ---- ! sub name($) { my $self = shift; *************** *** 93,97 **** # Get the number of snapshots in the file. ! sub get_snapshotc($) { my $self = shift; --- 93,97 ---- # Get the number of snapshots in the file. ! sub snapshotc($) { my $self = shift; Index: odfile_dom.pm =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_dom.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** odfile_dom.pm 29 Feb 2004 10:27:11 -0000 1.5 --- odfile_dom.pm 30 Mar 2004 08:09:45 -0000 1.6 *************** *** 63,67 **** ! sub get_name($) { my $self = shift; --- 63,67 ---- ! sub name($) { my $self = shift; *************** *** 77,81 **** # Get the number of snapshots in the file. ! sub get_snapshotc($) { my $self = shift; --- 77,81 ---- # Get the number of snapshots in the file. ! sub snapshotc($) { my $self = shift; |
From: Uwe G. <gi...@us...> - 2004-03-30 08:19:54
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3551 Modified Files: odfile_expat.xs Log Message: time, sequence, snapshot implemented get_name() -> name() renamed Index: odfile_expat.xs =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat.xs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** odfile_expat.xs 29 Mar 2004 19:42:00 -0000 1.3 --- odfile_expat.xs 30 Mar 2004 08:08:20 -0000 1.4 *************** *** 30,37 **** char* ! get_name(self) odfile_expat *self; CODE: ! RETVAL = ofe_get_name(self); OUTPUT: RETVAL --- 30,78 ---- char* ! name(self) odfile_expat *self; CODE: ! RETVAL = ofe_name(self); ! OUTPUT: ! RETVAL ! ! ! int ! snapshotc(self) ! odfile_expat *self; ! CODE: ! RETVAL = ofe_snapshotc(self); ! OUTPUT: ! RETVAL ! ! ! int ! firstTime(self, ...) ! odfile_expat *self; ! CODE: ! if (items > 1) { ! int firstTime = (int)SvIV(ST(1)); ! ofe_set_firstTime(self, firstTime); ! RETVAL = 0; ! } ! else { ! RETVAL = ofe_firstTime(self); ! } ! OUTPUT: ! RETVAL ! ! ! int ! firstSequence(self, ...) ! odfile_expat *self; ! CODE: ! if (items > 1) { ! int firstSequence = (int)SvIV(ST(1)); ! ofe_set_firstSequence(self, firstSequence); ! RETVAL = 0; ! } ! else { ! RETVAL = ofe_firstSequence(self); ! } OUTPUT: RETVAL |
From: Uwe G. <gi...@us...> - 2004-03-30 08:18:39
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3379 Modified Files: odfile_expat_intern.c Log Message: first time, forst sequence implemented _getAttribute for easier XML attribute handling snapshotc implemented last offset stored (nneded for footer) Index: odfile_expat_intern.c =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat_intern.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** odfile_expat_intern.c 29 Mar 2004 19:40:13 -0000 1.3 --- odfile_expat_intern.c 30 Mar 2004 08:07:03 -0000 1.4 *************** *** 11,16 **** ! /* library include */ ! #include <expat.h> /* for all XML_*() routines */ --- 11,16 ---- ! /* private includes */ ! #include "odfile_expat_intern.h" *************** *** 27,38 **** - /* private includes */ - #include "odfile_expat_intern.h" - - #define CFREE(x) { if ((x)!=NULL) free(x) ; (x) = NULL; } #define OFE_DONE(x) { if ((x)!=NULL) ofe_done(x); (x) = NULL; } /* XML file parse handlers */ void XMLCALL _HandleXMLDecl(void *userData, const XML_Char *version, --- 27,48 ---- #define CFREE(x) { if ((x)!=NULL) free(x) ; (x) = NULL; } #define OFE_DONE(x) { if ((x)!=NULL) ofe_done(x); (x) = NULL; } + /* XML attribute handle functions */ + const char* + _getAttribute(const XML_Char **atts, char *key) + { + int i; + for (i=0;atts[i]!=NULL;i+=2) { + if (strcmp(atts[i],key) == 0) { + return atts[i+1]; + } + } + return NULL; + } + + /* XML file parse handlers */ void XMLCALL _HandleXMLDecl(void *userData, const XML_Char *version, *************** *** 69,79 **** odfile_expat* self = (odfile_expat*)userData; if (strcmp(name, "map") == 0) { ! int i; ! for (i=0;atts[i]!=NULL;i+=2) { ! if (strcmp(atts[i],"name") == 0) { ! ofe_set_mapname(self, atts[i+1]); ! break; ! } } } --- 79,93 ---- odfile_expat* self = (odfile_expat*)userData; if (strcmp(name, "map") == 0) { ! ofe_set_mapname(self, _getAttribute(atts, "name")); ! } ! else if (strcmp(name, "snapshot") == 0) { ! if (self->snap == 0) { ! /* first snapshot */ ! self->snap = 1; ! ofe_set_firstTime(self, atoi(_getAttribute(atts,"time"))); ! ofe_set_firstSequence(self, atoi(_getAttribute(atts,"sequence"))); ! self->snapshotc = 0; } + self->snapshotc++; } *************** *** 81,84 **** --- 95,109 ---- + void XMLCALL _HandleEndElement(void *userData, const XML_Char *name) + { + odfile_expat* self = (odfile_expat*)userData; + if (strcmp(name, "snapshot") == 0) { + self->last_snap_offset = XML_GetCurrentByteIndex(self->parser) + + 11; + /* + 1 + 1 + strlen("snapshot") + 1; */ + } + } + + /* object methods */ odfile_expat* *************** *** 111,114 **** --- 136,142 ---- } + /* memorize parser */ + self->parser = p; + /* every handler get the odfile_expat pointer */ XML_SetUserData(p, self); *************** *** 118,127 **** XML_SetStartDoctypeDeclHandler (p, _HandleDoctype); XML_SetStartElementHandler (p, _HandleStartElement); /* open the file for reading */ ! docfd = open(ofe_get_name(self), O_RDONLY); if (docfd<0) { fprintf(stderr,"%s: could note open '%s' for reading: %s\n", ! fname, ofe_get_name(self), strerror(errno)); OFE_DONE(self); goto out; --- 146,156 ---- XML_SetStartDoctypeDeclHandler (p, _HandleDoctype); XML_SetStartElementHandler (p, _HandleStartElement); + XML_SetEndElementHandler (p, _HandleEndElement); /* open the file for reading */ ! docfd = open(ofe_name(self), O_RDONLY); if (docfd<0) { fprintf(stderr,"%s: could note open '%s' for reading: %s\n", ! fname, ofe_name(self), strerror(errno)); OFE_DONE(self); goto out; *************** *** 145,149 **** if (bytes_read < 0) { fprintf(stderr,"%s: could not read in %d bytes from %s: %s\n", ! fname, OFE_BUFFER_SIZE, ofe_get_name(self), strerror(errno)); OFE_DONE(self); goto out; --- 174,178 ---- if (bytes_read < 0) { fprintf(stderr,"%s: could not read in %d bytes from %s: %s\n", ! fname, OFE_BUFFER_SIZE, ofe_name(self), strerror(errno)); OFE_DONE(self); goto out; *************** *** 176,182 **** if (self != 0) { ! fprintf(stderr, "%s%s", ! self->xmldecl, self->doctype); ! fprintf(stderr, "<map name=\"%s\">", ofe_mapname(self)); } --- 205,212 ---- if (self != 0) { ! /* post process */ ! /* ! fprintf(stderr,"last pos = %d\n", self->last_snap_offset); ! */ } *************** *** 187,191 **** char* ! ofe_get_name(odfile_expat *self) { return self->infile; --- 217,221 ---- char* ! ofe_name(odfile_expat *self) { return self->infile; *************** *** 193,196 **** --- 223,261 ---- + int + ofe_snapshotc(odfile_expat *self) + { + return self->snapshotc; + } + + + void + ofe_set_firstTime(odfile_expat *self, int firstTime) + { + self->firstTime = firstTime; + } + + + int + ofe_firstTime(odfile_expat *self) + { + return self->firstTime; + } + + + void + ofe_set_firstSequence(odfile_expat *self, int firstSequence) + { + self->firstSequence = firstSequence; + } + + + int + ofe_firstSequence(odfile_expat *self) + { + return self->firstSequence; + } + + void ofe_set_mapname(odfile_expat *self, const char *mapname) |
From: Uwe G. <gi...@us...> - 2004-03-30 08:16:43
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2934 Modified Files: odfile_expat_intern.h Log Message: more prototypes (snapshotc, time, and sequence) object enlarged expat.h must be included here, as we store the XML parser in the object Index: odfile_expat_intern.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat_intern.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** odfile_expat_intern.h 29 Mar 2004 19:37:36 -0000 1.3 --- odfile_expat_intern.h 30 Mar 2004 08:04:49 -0000 1.4 *************** *** 10,19 **** --- 10,28 ---- + #include <expat.h> + + /* data type */ typedef struct odfile_expat_s { + XML_Parser parser; char *infile; char *xmldecl; char *doctype; char *mapname; + int snap; + int snapshotc; + int firstTime; + int firstSequence; + int last_snap_offset; } odfile_expat; *************** *** 21,28 **** /* prototypes */ extern odfile_expat* ofe_init(char *filename); ! extern char* ofe_get_name(odfile_expat *self); extern void ofe_done(odfile_expat *self); extern const char* ofe_mapname(odfile_expat *self); extern void ofe_set_mapname(odfile_expat *self, const char *mapname); --- 30,42 ---- /* prototypes */ extern odfile_expat* ofe_init(char *filename); ! extern char* ofe_name(odfile_expat *self); extern void ofe_done(odfile_expat *self); extern const char* ofe_mapname(odfile_expat *self); extern void ofe_set_mapname(odfile_expat *self, const char *mapname); + extern int ofe_snapshotc(odfile_expat *self); + extern int ofe_firstTime(odfile_expat *self); + extern void ofe_set_firstTime(odfile_expat *self, int firstTime); + extern int ofe_firstSequence(odfile_expat *self); + extern void ofe_set_firstSequence(odfile_expat *self, int firstSequence); |
From: Uwe G. <gi...@us...> - 2004-03-29 19:53:34
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32661 Modified Files: odfile_expat.xs Log Message: implement mapname set/get Index: odfile_expat.xs =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat.xs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** odfile_expat.xs 29 Mar 2004 10:06:21 -0000 1.2 --- odfile_expat.xs 29 Mar 2004 19:42:00 -0000 1.3 *************** *** 38,39 **** --- 38,55 ---- + const char* + mapname(self, ...) + odfile_expat *self; + CODE: + if (items > 1) { + char *mapname = (char *)SvPV_nolen(ST(1)); + ofe_set_mapname(self, mapname); + RETVAL = NULL; + } + else { + RETVAL = ofe_mapname(self); + } + OUTPUT: + RETVAL + + |
From: Uwe G. <gi...@us...> - 2004-03-29 19:51:43
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32047 Modified Files: odfile_expat_intern.c Log Message: done function must remove more content functions for manupulating map name added XML parser calls handlers for XML header and element start element start handles map name only Index: odfile_expat_intern.c =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat_intern.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** odfile_expat_intern.c 29 Mar 2004 16:22:17 -0000 1.2 --- odfile_expat_intern.c 29 Mar 2004 19:40:13 -0000 1.3 *************** *** 15,18 **** --- 15,30 ---- + /* From Expat 1.97.5 on, the following code isn't necessary any more. */ + #ifndef XMLCALL + #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) + #define XMLCALL __cdecl + #elif defined(__GNUC__) + #define XMLCALL __attribute__((cdecl)) + #else + #define XMLCALL + #endif + #endif + + /* private includes */ #include "odfile_expat_intern.h" *************** *** 23,26 **** --- 35,85 ---- + /* XML file parse handlers */ + void XMLCALL _HandleXMLDecl(void *userData, const XML_Char *version, + const XML_Char *encoding, int standalone) + { + odfile_expat* self = (odfile_expat*)userData; + char buffer[100]; + + CFREE(self->xmldecl); + snprintf(buffer, sizeof(buffer), + "<?xml version=\"%s\" encoding=\"%s\"?>\n", + version, encoding); + self->xmldecl = strdup(buffer); + } + + + void XMLCALL _HandleDoctype(void *userData, const XML_Char *doctypeName, + const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset) + { + odfile_expat* self = (odfile_expat*)userData; + char buffer[500]; + + CFREE(self->doctype); + snprintf(buffer, sizeof(buffer), + "<!DOCTYPE %s PUBLIC \"%s\" \"%s\">", + doctypeName, pubid, sysid); + self->doctype = strdup(buffer); + } + + + void XMLCALL _HandleStartElement(void *userData, const XML_Char *name, + const XML_Char **atts) + { + odfile_expat* self = (odfile_expat*)userData; + if (strcmp(name, "map") == 0) { + int i; + for (i=0;atts[i]!=NULL;i+=2) { + if (strcmp(atts[i],"name") == 0) { + ofe_set_mapname(self, atts[i+1]); + break; + } + } + } + + } + + + /* object methods */ odfile_expat* ofe_init(char *filename) *************** *** 52,57 **** } /* set the handlers */ ! /* TODO */ /* open the file for reading */ --- 111,121 ---- } + /* every handler get the odfile_expat pointer */ + XML_SetUserData(p, self); + /* set the handlers */ ! XML_SetXmlDeclHandler (p, _HandleXMLDecl); ! XML_SetStartDoctypeDeclHandler (p, _HandleDoctype); ! XML_SetStartElementHandler (p, _HandleStartElement); /* open the file for reading */ *************** *** 111,114 **** --- 175,184 ---- } + if (self != 0) { + fprintf(stderr, "%s%s", + self->xmldecl, self->doctype); + fprintf(stderr, "<map name=\"%s\">", ofe_mapname(self)); + } + /* return the object (or a NULL pointer) */ return self; *************** *** 124,130 **** --- 194,218 ---- void + ofe_set_mapname(odfile_expat *self, const char *mapname) + { + CFREE(self->mapname); + self->mapname = strdup(mapname); + } + + + const char* + ofe_mapname(odfile_expat *self) + { + return self->mapname; + } + + + void ofe_done(odfile_expat *self) { CFREE(self->infile); /* was created with strdup() */ + CFREE(self->xmldecl); /* was created with strdup() */ + CFREE(self->doctype); /* was created with strdup() */ + CFREE(self->mapname); /* was created with strdup() */ CFREE(self); /* was created with malloc() */ } |
From: Uwe G. <gi...@us...> - 2004-03-29 19:49:07
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31610 Modified Files: odfile_expat_intern.h Log Message: structure contains parts of the XML header and the map name prototypes for manipulating the map name Index: odfile_expat_intern.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat_intern.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** odfile_expat_intern.h 29 Mar 2004 16:20:42 -0000 1.2 --- odfile_expat_intern.h 29 Mar 2004 19:37:36 -0000 1.3 *************** *** 13,16 **** --- 13,19 ---- typedef struct odfile_expat_s { char *infile; + char *xmldecl; + char *doctype; + char *mapname; } odfile_expat; *************** *** 20,23 **** --- 23,28 ---- extern char* ofe_get_name(odfile_expat *self); extern void ofe_done(odfile_expat *self); + extern const char* ofe_mapname(odfile_expat *self); + extern void ofe_set_mapname(odfile_expat *self, const char *mapname); |
From: Uwe G. <gi...@us...> - 2004-03-29 16:33:46
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24076 Modified Files: odfile_expat_intern.c Log Message: parser implementation started: read file, call expat no handlers defined yet object destructor implemented Index: odfile_expat_intern.c =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat_intern.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** odfile_expat_intern.c 29 Mar 2004 10:04:08 -0000 1.1 --- odfile_expat_intern.c 29 Mar 2004 16:22:17 -0000 1.2 *************** *** 3,8 **** /* system includes */ ! #include <string.h> /* for memset() */ ! #include <stdlib.h> /* for malloc() */ --- 3,12 ---- /* system includes */ ! #include <errno.h> /* for errno */ ! #include <fcntl.h> /* for open() */ ! #include <string.h> /* for memset() */ ! #include <stdio.h> /* for fprintf() */ ! #include <stdlib.h> /* for malloc() */ ! #include <unistd.h> /* for read() */ *************** *** 15,28 **** odfile_expat* ofe_init(char *filename) { odfile_expat *self; self = malloc(sizeof(*self)); ! if (self != NULL) { ! memset(self, 0, sizeof(*self)); ! self->infile = strdup(filename); ! /* TODO parse the file */ ! } return self; } --- 19,115 ---- + #define CFREE(x) { if ((x)!=NULL) free(x) ; (x) = NULL; } + #define OFE_DONE(x) { if ((x)!=NULL) ofe_done(x); (x) = NULL; } + + odfile_expat* ofe_init(char *filename) { + const char *fname = "ofe_init"; odfile_expat *self; + XML_Parser p = NULL; + int docfd = -1; + int bytes_read; + + /* allocate object buffer */ self = malloc(sizeof(*self)); ! if (self == NULL) { ! fprintf(stderr,"%s: could not allocate odfile_expat structure: %s\n", fname, strerror(errno)); ! goto out; ! } ! ! /* clean the structure */ ! memset(self, 0, sizeof(*self)); ! ! /* store the file name */ ! self->infile = strdup(filename); ! ! /* create the parser */ ! p = XML_ParserCreate(NULL); ! if (p == NULL) { ! OFE_DONE(self); ! goto out; ! } ! ! /* set the handlers */ ! /* TODO */ ! ! /* open the file for reading */ ! docfd = open(ofe_get_name(self), O_RDONLY); ! if (docfd<0) { ! fprintf(stderr,"%s: could note open '%s' for reading: %s\n", ! fname, ofe_get_name(self), strerror(errno)); ! OFE_DONE(self); ! goto out; ! } ! ! /* parse the file */ ! do { ! void *buff; ! ! /* get the buffer */ ! buff = XML_GetBuffer(p, OFE_BUFFER_SIZE); ! if (buff == NULL) { ! fprintf(stderr,"%s: could not get XML buffer\n", ! fname); ! OFE_DONE(self); ! goto out; ! } ! ! /* read in the file */ ! bytes_read = read(docfd, buff, OFE_BUFFER_SIZE); ! if (bytes_read < 0) { ! fprintf(stderr,"%s: could not read in %d bytes from %s: %s\n", ! fname, OFE_BUFFER_SIZE, ofe_get_name(self), strerror(errno)); ! OFE_DONE(self); ! goto out; ! } ! ! /* parse this buffer */ ! if (!XML_ParseBuffer(p, bytes_read, bytes_read==0)) { ! fprintf(stderr,"%s: XML parse error at line %d, col %d: %s\n", ! fname, ! XML_GetCurrentLineNumber(p), ! XML_GetCurrentColumnNumber(p), ! XML_ErrorString(XML_GetErrorCode(p))); ! OFE_DONE(self); ! goto out; ! } ! ! } while (bytes_read > 0); ! ! out: ! /* remove the parser object */ ! if (p != NULL) { ! XML_ParserFree(p); ! } ! ! /* close the input file */ ! if (docfd != -1) { ! close(docfd); ! docfd = -1; ! } ! ! /* return the object (or a NULL pointer) */ return self; } *************** *** 36,37 **** --- 123,132 ---- + void + ofe_done(odfile_expat *self) + { + CFREE(self->infile); /* was created with strdup() */ + CFREE(self); /* was created with malloc() */ + } + + |
From: Uwe G. <gi...@us...> - 2004-03-29 16:32:11
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23937 Modified Files: odfile_expat_intern.h Log Message: ofe_done prototype buffer size 64K Index: odfile_expat_intern.h =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat_intern.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** odfile_expat_intern.h 29 Mar 2004 10:04:09 -0000 1.1 --- odfile_expat_intern.h 29 Mar 2004 16:20:42 -0000 1.2 *************** *** 6,9 **** --- 6,13 ---- + /* constant */ + #define OFE_BUFFER_SIZE 65536 + + /* data type */ typedef struct odfile_expat_s { *************** *** 15,18 **** --- 19,23 ---- extern odfile_expat* ofe_init(char *filename); extern char* ofe_get_name(odfile_expat *self); + extern void ofe_done(odfile_expat *self); |
From: Uwe G. <gi...@us...> - 2004-03-29 10:21:04
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17035 Modified Files: Changes Log Message: new version 0.03 Index: Changes =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/Changes,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Changes 28 Mar 2004 19:18:38 -0000 1.1 --- Changes 29 Mar 2004 10:09:39 -0000 1.2 *************** *** 11,12 **** --- 11,17 ---- - Expat will be linked in + 0.03 Mon Mar 29 12:00:20 2004 + - better use of typemaps for C->Perl output + - additinal C file for C-only stuff + - Expat include file is already included + |
From: Uwe G. <gi...@us...> - 2004-03-29 10:20:28
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16839 Modified Files: Makefile.PL Log Message: add all C files to compile correct email address of author Index: Makefile.PL =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/Makefile.PL,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.PL 28 Mar 2004 19:18:38 -0000 1.1 --- Makefile.PL 29 Mar 2004 10:09:03 -0000 1.2 *************** *** 10,18 **** ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/odfile_expat.pm', # retrieve abstract from module ! AUTHOR => 'Uwe Girlich <uw...@su...>') : ()), LIBS => ['-lexpat'], # e.g., '-lm' DEFINE => '', # e.g., '-DHAVE_SOMETHING' INC => '-I.', # e.g., '-I. -I/usr/include/other' ! # Un-comment this if you add C files to link with later: ! # OBJECT => '$(O_FILES)', # link all the C files too ); --- 10,17 ---- ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/odfile_expat.pm', # retrieve abstract from module ! AUTHOR => 'Uwe Girlich <uw...@pl...>') : ()), LIBS => ['-lexpat'], # e.g., '-lm' DEFINE => '', # e.g., '-DHAVE_SOMETHING' INC => '-I.', # e.g., '-I. -I/usr/include/other' ! OBJECT => '$(O_FILES)', # link all the C files too ); |
From: Uwe G. <gi...@us...> - 2004-03-29 10:19:39
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16742 Modified Files: README Log Message: version 0.03 Index: README =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 28 Mar 2004 19:22:29 -0000 1.2 --- README 29 Mar 2004 10:08:13 -0000 1.3 *************** *** 1,3 **** ! odfile_expat version 0.02 ========================= --- 1,3 ---- ! odfile_expat version 0.03 ========================= |
From: Uwe G. <gi...@us...> - 2004-03-29 10:18:55
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16575 Modified Files: MANIFEST Log Message: new (odfile_expat_intern.*) files added Index: MANIFEST =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/MANIFEST,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MANIFEST 28 Mar 2004 19:18:38 -0000 1.1 --- MANIFEST 29 Mar 2004 10:07:29 -0000 1.2 *************** *** 3,6 **** --- 3,8 ---- MANIFEST odfile_expat.xs + odfile_expat_intern.c + odfile_expat_intern.h ppport.h typemap |
From: Uwe G. <gi...@us...> - 2004-03-29 10:17:46
|
Update of /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16335 Modified Files: odfile_expat.xs Log Message: proper use of typemaps for C->Perl actual code moved info *_intern Index: odfile_expat.xs =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odfile_expat/odfile_expat.xs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** odfile_expat.xs 28 Mar 2004 19:18:38 -0000 1.1 --- odfile_expat.xs 29 Mar 2004 10:06:21 -0000 1.2 *************** *** 8,14 **** #include "ppport.h" ! typedef struct odfile_expat_s { ! char *infile; ! } odfile_expat; --- 8,13 ---- #include "ppport.h" ! ! #include "odfile_expat_intern.h" *************** *** 19,41 **** ! SV* ! new(classname, filename) ! char *classname; char *filename; - PREINIT: - odfile_expat* self; CODE: ! /* fprintf(stderr,"class=%s, file='%s'\n", classname, filename); */ ! self = malloc(sizeof(*self)); ! memset(self, 0, sizeof(*self)); ! if (self == NULL) { ! RETVAL = &PL_sv_undef; ! } ! else { ! self->infile = strdup(filename); ! /* parse the file */ ! RETVAL = newSViv( 0 ); ! sv_setref_pv(RETVAL, classname, (void*)self); ! } OUTPUT: RETVAL --- 18,28 ---- ! odfile_expat* ! new(CLASS, filename) ! char *CLASS; char *filename; CODE: ! /* fprintf(stderr,"class=%s, file='%s'\n", CLASS, filename); */ ! RETVAL = ofe_init(filename); OUTPUT: RETVAL *************** *** 46,53 **** odfile_expat *self; CODE: ! RETVAL = self->infile; OUTPUT: RETVAL - --- 33,39 ---- odfile_expat *self; CODE: ! RETVAL = ofe_get_name(self); OUTPUT: RETVAL |