plib-cvs Mailing List for PLIB (Page 28)
Brought to you by:
sjbaker
You can subscribe to this list here.
2002 |
Jan
(25) |
Feb
(10) |
Mar
(60) |
Apr
(49) |
May
(54) |
Jun
(94) |
Jul
(82) |
Aug
(251) |
Sep
(366) |
Oct
(17) |
Nov
(20) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(12) |
Feb
(8) |
Mar
(2) |
Apr
(4) |
May
(5) |
Jun
(8) |
Jul
(23) |
Aug
(8) |
Sep
(7) |
Oct
(5) |
Nov
(20) |
Dec
(20) |
2004 |
Jan
(19) |
Feb
(70) |
Mar
(108) |
Apr
(24) |
May
(6) |
Jun
(5) |
Jul
|
Aug
(8) |
Sep
(18) |
Oct
(27) |
Nov
|
Dec
(13) |
2005 |
Jan
(19) |
Feb
(13) |
Mar
(1) |
Apr
|
May
(10) |
Jun
(1) |
Jul
(10) |
Aug
(5) |
Sep
(2) |
Oct
(2) |
Nov
(6) |
Dec
(4) |
2006 |
Jan
(9) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sebastian U. <ud...@us...> - 2002-09-10 22:22:41
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv29729 Modified Files: Makefile.am Log Message: install-header file 'psl.h' does not need to be listed in libplibpsl_a_SOURCES Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Makefile.am 10 Sep 2002 04:37:39 -0000 1.11 +++ Makefile.am 10 Sep 2002 22:22:37 -0000 1.12 @@ -10,7 +10,7 @@ pslExpression.cxx pslProgram.cxx pslDump.cxx \ pslError.cxx pslFileIO.cxx pslCompiler.h \ pslContext.h pslFileIO.h pslLocal.h \ - pslOpcodes.h pslSymbol.h psl.h + pslOpcodes.h pslSymbol.h INCLUDES = -I$(top_srcdir)/src/util |
From: Steve B. <sj...@us...> - 2002-09-10 04:37:42
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv15285/plib/src/psl Modified Files: Makefile.am pslCompiler.cxx pslCompiler.h pslError.cxx pslLocal.h pslToken.cxx Added Files: pslFileIO.cxx pslFileIO.h Log Message: Added #include processing. --- NEW FILE: pslFileIO.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [...130 lines suppressed...] if ( c < 0 ) /* EOF */ { if ( fileStackPointer > 1 ) { popDefaultFile () ; return getChar () ; } return -1 ; } return c ; } void unGetChar ( int c ) { defaultFileStack [ fileStackPointer-1 ] -> unGetChar ( c ) ; } --- NEW FILE: pslFileIO.h --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: pslFileIO.h,v 1.1 2002/09/10 04:37:39 sjbaker Exp $ */ char *getFname () ; int getLineNo () ; void popDefaultFile () ; void pushDefaultFile ( FILE *fd, const char *fname ) ; void pushDefaultFile ( const char *fname ) ; void unGetChar ( int c ) ; int getChar () ; Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.am 8 Sep 2002 19:49:17 -0000 1.10 +++ Makefile.am 10 Sep 2002 04:37:39 -0000 1.11 @@ -5,11 +5,12 @@ include_HEADERS = psl.h -libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslCompiler.cxx pslCompiler.h \ - pslContext.cxx pslContext.h pslDump.cxx pslError.cxx \ - pslExpression.cxx pslLocal.h pslOpcodes.h \ - pslProgram.cxx pslSymbol.h pslSymbols.cxx \ - pslToken.cxx +libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslContext.cxx \ + pslCompiler.cxx pslSymbols.cxx pslToken.cxx \ + pslExpression.cxx pslProgram.cxx pslDump.cxx \ + pslError.cxx pslFileIO.cxx pslCompiler.h \ + pslContext.h pslFileIO.h pslLocal.h \ + pslOpcodes.h pslSymbol.h psl.h INCLUDES = -I$(top_srcdir)/src/util Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslCompiler.cxx 8 Sep 2002 22:17:32 -0000 1.14 +++ pslCompiler.cxx 10 Sep 2002 04:37:39 -0000 1.15 @@ -38,28 +38,26 @@ return FALSE ; } - int res = compile ( fd ) ; - fclose ( fd ) ; - return res ; + return compile ( fd, fname ) ; } -int pslCompiler::compile ( FILE *fd ) +int pslCompiler::compile ( FILE *fd, const char *fname ) { init () ; - setDefaultFile ( fd ) ; - pushProgram () ; + pushDefaultFile ( fd, (fname == NULL) ? progName : fname ) ; + pushProgram () ; + popDefaultFile () ; if ( num_errors != 0 || num_warnings != 0 ) - fprintf ( stderr, "PSL: Compiled with %d Warnings, %d Fatal Errors\n", - num_warnings, num_errors ) ; + fprintf ( stderr, "PSL: '%s' Compiled with %d Warnings, %d Fatal Errors\n", + progName, num_warnings, num_errors ) ; /* If there are errors, prevent the program from running. */ if ( num_errors != 0 ) { -dump () ; next_code = 0 ; pushCodeByte ( OPCODE_HALT ) ; } Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pslCompiler.h 8 Sep 2002 22:17:32 -0000 1.10 +++ pslCompiler.h 10 Sep 2002 04:37:39 -0000 1.11 @@ -46,21 +46,22 @@ class pslCompiler { - int line_no ; + /* File I/O and preprocessor */ - int getLineNo () const { return line_no ; } + int getChar () ; + void doIncludeStatement () ; + int doPreProcessorCommand () ; + void getToken ( char *s ) ; [...165 lines suppressed...] pslCompiler ( pslOpcode *_code, pslExtension *_extn, const char *_progName ) @@ -253,8 +266,6 @@ { int i ; - line_no = 1 ; - for ( i = 0 ; i < MAX_CODE ; i++ ) code [ i ] = OPCODE_HALT ; for ( i = 0 ; i < MAX_SYMBOL ; i++ ) @@ -280,7 +291,7 @@ void dump () const ; int compile ( const char *fname ) ; - int compile ( FILE *fd ) ; + int compile ( FILE *fd, const char *fname = NULL ) ; } ; Index: pslError.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslError.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslError.cxx 8 Sep 2002 18:56:29 -0000 1.2 +++ pslError.cxx 10 Sep 2002 04:37:39 -0000 1.3 @@ -47,11 +47,11 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( PSL_COMPILETIME_WARNING, getProgName(), getLineNo(), + (*_pslErrorCB)( PSL_COMPILETIME_WARNING, getFname(), getLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: WARNING - %s\n", - getProgName(),getLineNo(), + getFname(),getLineNo(), _pslErrorBuffer ) ; bumpWarnings () ; @@ -68,11 +68,11 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( PSL_COMPILETIME_ERROR, getProgName(), getLineNo(), + (*_pslErrorCB)( PSL_COMPILETIME_ERROR, getFname(), getLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: *ERROR* - %s\n", - getProgName(),getLineNo(), + getFname(),getLineNo(), _pslErrorBuffer ) ; bumpErrors () ; Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslLocal.h 8 Sep 2002 04:51:39 -0000 1.14 +++ pslLocal.h 10 Sep 2002 04:37:39 -0000 1.15 @@ -37,20 +37,23 @@ /* Limits */ -#define MAX_ARGS 64 -#define MAX_VARIABLE 256 -#define MAX_LABEL 256 -#define MAX_TOKEN 1024 -#define MAX_CODE 512 -#define MAX_STACK 256 -#define MAX_NESTING 32 -#define MAX_UNGET 64 +#define MAX_ARGS 64 +#define MAX_VARIABLE 256 +#define MAX_LABEL 256 +#define MAX_TOKEN 1024 +#define MAX_CODE 512 +#define MAX_STACK 256 +#define MAX_NESTING 32 +#define MAX_UNGET 64 +#define MAX_UNGET_CHAR 1024 #define MAX_SYMBOL (MAX_VARIABLE + MAX_LABEL) +#define MAX_INCLUDE_DEPTH 8 typedef unsigned short pslAddress ; extern int _pslInitialised ; +#include "pslFileIO.h" #include "pslOpcodes.h" #include "pslSymbol.h" #include "pslCompiler.h" Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslToken.cxx 8 Sep 2002 18:56:29 -0000 1.11 +++ pslToken.cxx 10 Sep 2002 04:37:39 -0000 1.12 @@ -24,52 +24,136 @@ #include "pslLocal.h" -static FILE *defaultFile ; static char ungotten_token [ MAX_UNGET ][ MAX_TOKEN ] ; -static int unget_stack_depth = 0 ; - +static int unget_token_stack_depth = 0 ; -void pslCompiler::setDefaultFile ( FILE *fd ) +int pslCompiler::getChar () [...210 lines suppressed...] + unGetChar ( c ) ; res [ tp ] = '\0' ; } else @@ -203,13 +288,13 @@ void pslCompiler::ungetToken ( const char *s ) { - if ( unget_stack_depth >= MAX_UNGET-1 ) + if ( unget_token_stack_depth >= MAX_UNGET-1 ) { error ( "Too many ungetTokens! This must be an *UGLY* PSL program!" ) ; exit ( -1 ) ; } - strcpy ( ungotten_token[unget_stack_depth++], s ) ; + strcpy ( ungotten_token[unget_token_stack_depth++], s ) ; } |
From: Steve B. <sj...@us...> - 2002-09-10 04:37:42
|
Update of /cvsroot/plib/plib/examples/src/ssg/tux In directory usw-pr-cvs1:/tmp/cvs-serv15285/plib/examples/src/ssg/tux Modified Files: tux_example.cxx Log Message: Added #include processing. Index: tux_example.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/tux/tux_example.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- tux_example.cxx 1 Sep 2002 12:04:52 -0000 1.5 +++ tux_example.cxx 10 Sep 2002 04:37:39 -0000 1.6 @@ -68,7 +68,7 @@ */ sgSetCoord ( & campos, 0.0f, -5.0f, 1.0f, 25.0 * sin(frameno/100.0), 0.0f, 0.0f ) ; - sgSetCoord ( & tuxpos, 0.0f, 0.0f, 0.0f, frameno, 0.0f, 0.0f ) ; + sgSetCoord ( & tuxpos, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, frameno/100.0f ) ; ssgSetCamera ( & campos ) ; penguin -> setTransform ( & tuxpos ) ; |
From: Steve B. <sj...@us...> - 2002-09-10 04:37:42
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv15285/plib/examples/src/psl/data Modified Files: test.psl Added Files: header.psh Log Message: Added #include processing. --- NEW FILE: header.psh --- void newline () { printf ( "\n" ) ; } void tab () { printf ( "\t" ) ; } Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- test.psl 8 Sep 2002 22:17:32 -0000 1.12 +++ test.psl 10 Sep 2002 04:37:39 -0000 1.13 @@ -1,31 +1,37 @@ +#include <data/header.psh> + void main () { int i ; for ( i = 0 ; i < 20 ; i = i + 1 - 3 + 3 ) { -if ( i == 10 ) continue ; -if ( i == 17 ) break ; + if ( i == 10 ) { printf ( "Continuing past TEN\n" ) ; continue ; } + if ( i == 17 ) { printf ( "Seventeen is enough!\n" ) ; break ; } switch ( i ) { case 0 : case 1 : case 2 : - printf ( "Small! " ) ; + printf ( "Small!" ) ; + tab () ; break ; case 3 : case 4 : case 5 : - printf ( "Medium! " ) ; + printf ( "Medium!" ) ; + tab () ; break ; default: - printf ( "Huge! ", i ) ; + printf ( "Huge!" ) ; + tab () ; break ; } - printf ( "\n" ) ; + printf ( " ", i ) ; + newline () ; } } |
From: Steve B. <sj...@us...> - 2002-09-10 04:37:42
|
Update of /cvsroot/plib/plib/examples/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv15285/plib/examples/src/psl Modified Files: psl_demo.cxx Log Message: Added #include processing. Index: psl_demo.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/psl_demo.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- psl_demo.cxx 8 Sep 2002 18:56:29 -0000 1.12 +++ psl_demo.cxx 10 Sep 2002 04:37:38 -0000 1.13 @@ -83,7 +83,7 @@ pslProgram *prog_1 = new pslProgram ( extensions, "code1" ) ; prog_1 -> compile ( "data/test.psl" ) ; - prog_1 -> dump () ; + // prog_1 -> dump () ; /* Clone program 2 from program 1 */ |
From: Steve B. <sj...@us...> - 2002-09-10 04:37:42
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv15285/plib/doc/psl Modified Files: index.html Added Files: appl_guide.html prog_guide.html Log Message: Added #include processing. --- NEW FILE: appl_guide.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="keywords" content="PSL, PLIB, OpenGL, UI, portable, script, language, Baker, Steve"> <meta name="description" content="The PLIB Scripting Language (PSL) Library is a lightweight scripting language that is well suited for games or other interactive programs."> <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]"> <title>The PLIB Scripting Language: Applications Guide.</title> </head> <body text="#B5A642" bgcolor="#005000" link="#8FFF8F" vlink="#18A515" alink="#20336B" background="../marble.png"> <table> <tr> <td> <center> <h1>The PSL Application Programmer's Guide.</h1></center> <center>By Steve Baker</center> </td> </tr> </table> <H1>Introduction</H1> This document is to help people writing C++ applications to include scripting abilities using the PSL interpreter. <p> <hr> <address> <a href="http://www.sjbaker.org">Steve J. Baker.</a> <<a href="mailto:sjb...@ai...">sjb...@ai...</a>></address> </body> </html> --- NEW FILE: prog_guide.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="keywords" content="PSL, PLIB, OpenGL, UI, portable, script, language, Baker, Steve"> <meta name="description" content="The PLIB Scripting Language (PSL) Library is a lightweight scripting language that is well suited for games or other interactive programs."> <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]"> <title>The PLIB Scripting Language: Programming Guide.</title> </head> <body text="#B5A642" bgcolor="#005000" link="#8FFF8F" vlink="#18A515" alink="#20336B" background="../marble.png"> <table> <tr> <td> <center> <h1>The PSL Programming Guide </h1></center> <center>By Steve Baker</center> </td> </tr> </table> <H1>Introduction</H1> This document explains how to write PSL programs. <p> How you actually run those programs depends on which PSL-enabled application you are running. There is a stand-along PSL interpreter in plib/examples/src/psl/psl - but it's unlikely to be as useful as the actual application you are writing for. <p> <hr> <address> <a href="http://www.sjbaker.org">Steve J. Baker.</a> <<a href="mailto:sjb...@ai...">sjb...@ai...</a>></address> </body> </html> Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/index.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- index.html 5 Sep 2002 06:14:57 -0000 1.1 +++ index.html 10 Sep 2002 04:37:38 -0000 1.2 @@ -5,7 +5,7 @@ <meta name="keywords" content="PSL, PLIB, OpenGL, UI, portable, script, language, Baker, Steve"> <meta name="description" content="The PLIB Scripting Language (PSL) Library is a lightweight scripting language that is well suited for games or other interactive programs."> <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]"> - <title>The PLIB Scripting Language: Programmers Guide.</title> + <title>The PLIB Scripting Language.</title> </head> <body text="#B5A642" bgcolor="#005000" link="#8FFF8F" vlink="#18A515" alink="#20336B" background="../marble.png"> @@ -13,20 +13,39 @@ <tr> <td> <center> -<h1> -PSL: PLIB's Scripting Language </h1></center> - -<center> -<h1> -Programmers Guide.</h1></center> - +<h1>PSL: PLIB's Scripting Language.</h1></center> <center>By Steve Baker</center> </td> </tr> </table> -<h2>Introduction</h2> -THIS DOCUMENT IS WORK IN PROGRESS! +<H1>Introduction</H1> +Whilst applications can use any suitable scripting +language (Python, PERL, Lua, etc) in conjunction with PLIB, there are +attractions to using PLIB's own scripting language: PSL. +<p> +In particular, in using PSL, you do not add any dependancies on +your application. If the end user has the correct version of PLIB +installed - then the scripting language is already there - for sure. +<p> +PSL is a very light-weight C-like language with some features borrowed +from C++. It's also 'stackless' and very friendly to games applications. +<p> +There are two PSL documents: +<ul> +<li><a href="appl_guide.html">The PSL-enabled Applications Guide.</a> +-- If you are planning on including a PSL interpreter into your program, +(making it 'PSL-enabled') then you should read the Applications Guide. +<li><a href="prog_guide.html">The PSL Programmers Guide.</a> +-- If you are writing scripts for a PSL-enabled application, then you'll +only need to read the Programmer's Guide. +</ul> +<p> +Each application can extend PSL by providing additional built-in +functions - so if you are a PSL programer then you'll probably need to +read the documentation for whatever PSL-enabled application +you are writing for. If you are writing a PSL-enabled application, then +you'd better sit down and WRITE that document! <hr> <address> <a href="http://www.sjbaker.org">Steve J. Baker.</a> <<a href="mailto:sjb...@ai...">sjb...@ai...</a>></address> |
From: Sebastian U. <ud...@us...> - 2002-09-09 22:27:55
|
Update of /cvsroot/plib/plib/src/js In directory usw-pr-cvs1:/tmp/cvs-serv30736 Modified Files: js.h Log Message: Some more updates for better readability Index: js.h =================================================================== RCS file: /cvsroot/plib/plib/src/js/js.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- js.h 9 Sep 2002 22:11:00 -0000 1.25 +++ js.h 9 Sep 2002 22:27:53 -0000 1.26 @@ -262,12 +262,12 @@ #endif +#ifdef macintosh + inline void jsJoystick::open () { name [0] = '\0' ; -#ifdef macintosh - [...120 lines suppressed...] + for ( int i = 0 ; i < num_axes ; i++ ) + axes[i] = 1500.0f ; + + return ; + } + # ifdef JS_NEW while (1) @@ -837,8 +879,9 @@ axes[1] = (float) js.y ; } # endif -#endif } + +#endif //lint -restore |
From: Sebastian U. <ud...@us...> - 2002-09-09 22:11:05
|
Update of /cvsroot/plib/plib/src/js In directory usw-pr-cvs1:/tmp/cvs-serv26029 Modified Files: js.h Log Message: Separated jsJoystick API from implementation in js.h (boy, we need libplibjs ...) Index: js.h =================================================================== RCS file: /cvsroot/plib/plib/src/js/js.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- js.h 9 Sep 2002 20:51:31 -0000 1.24 +++ js.h 9 Sep 2002 22:11:00 -0000 1.25 @@ -119,27 +119,24 @@ # endif #endif + class jsJoystick { #ifdef macintosh +# define isp_num_axis 9 +# define isp_num_needs 41 - #define isp_num_axis 9 [...1173 lines suppressed...] - if ( axes ) - { - axes[0] = (float) js.x ; - axes[1] = (float) js.y ; - } + if ( axes != NULL ) + { + axes[0] = (float) js.x ; + axes[1] = (float) js.y ; + } # endif #endif - } -} ; - -extern void jsInit () ; +} //lint -restore |
From: M?rten Str?m. <str...@us...> - 2002-09-09 09:08:32
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv5200 Modified Files: ssg.h ssgContext.cxx ssgEntity.cxx ssgOptimiser.cxx Log Message: Added orthographic culling support. Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.147 retrieving revision 1.148 diff -u -d -r1.147 -r1.148 --- ssg.h 2 Sep 2002 06:05:47 -0000 1.147 +++ ssg.h 9 Sep 2002 09:08:29 -0000 1.148 @@ -2247,7 +2247,6 @@ ssgSimpleState *basicState ; sgFrustum *frustum ; - int orthographic ; sgMat4 cameraMatrix ; int cullFace ; int ovTexture ; @@ -2307,21 +2306,22 @@ int cullfaceIsEnabled () { return cullFace ; } sgFrustum *getFrustum () { return frustum ; } - void setFrustum ( const SGfloat l, const SGfloat r, - const SGfloat b, const SGfloat t, - const SGfloat n, const SGfloat f ) - { - frustum->setFrustum ( l,r,b,t,n,f ); - } + // make a perspective projection + void setFrustum ( float l, float r, float b, float t, float n, float f ) ; + + // make an orthographic projection + void setOrtho ( float l, float r, float b, float t, float n, float f ) ; + void getNearFar ( float *n, float *f ) ; void getFOV ( float *w, float *h ) ; void getOrtho ( float *w, float *h ) ; + void setNearFar ( float n, float f ) ; - void setOrtho ( float w, float h ) ; - void setFOV ( float w, float h ) ; + void setOrtho ( float w, float h ) ; // make orthographic + void setFOV ( float w, float h ) ; // make perspective - int isOrtho () { return orthographic ; } + int isOrtho () { return frustum -> isOrtho () ; } // is orthographic ssgSimpleState *getState () { return currentState ; } void cull ( ssgRoot *r ) ; @@ -2382,6 +2382,16 @@ _ssgCurrentContext->getOrtho ( w, h ) ; } +inline void ssgSetFrustum ( float l, float r, float b, float t, float n, float f ) +{ + _ssgCurrentContext->setFrustum ( l, r, b, t, n, f ) ; +} + +inline void ssgSetOrtho ( float l, float r, float b, float t, float n, float f ) +{ + _ssgCurrentContext->setOrtho ( l, r, b, t, n, f ) ; +} + inline void ssgSetFOV ( float w, float h ) { _ssgCurrentContext->setFOV ( w, h ) ; @@ -2457,14 +2467,6 @@ { return _ssgCurrentContext -> getFrustum() ; } - -inline void ssgSetFrustum ( const SGfloat l, const SGfloat r, - const SGfloat b, const SGfloat t, - const SGfloat n, const SGfloat f ) -{ - ssgGetFrustum()->setFrustum ( l,r,b,t,n,f ); -} - void ssgInit () ; Index: ssgContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgContext.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ssgContext.cxx 2 Sep 2002 06:05:48 -0000 1.15 +++ ssgContext.cxx 9 Sep 2002 09:08:29 -0000 1.16 @@ -44,7 +44,7 @@ makeCurrent () ; currentState = NULL ; basicState = NULL ; - orthographic = FALSE ; + //orthographic = FALSE ; cullFace = TRUE ; ovTexture = FALSE ; ovCullface = FALSE ; @@ -120,6 +120,17 @@ ovCullface = on_off ; } [...63 lines suppressed...] - float b = frustum -> getBot () ; - float t = frustum -> getTop () ; - float n = frustum -> getNear () ; - float f = frustum -> getFar () ; - - sgMakeIdentMat4 ( dst ) ; - dst[0][0] = 2.0f / ( r - l ) ; - dst[1][1] = 2.0f / ( t - b ) ; - dst[2][2] = -2.0f / ( f - n ) ; - - dst[3][0] = - ( r + l ) / ( r - l ) ; - dst[3][1] = - ( t + b ) / ( t - b ) ; - dst[3][2] = - ( f + n ) / ( f - n ) ; - } - else - frustum -> getMat4 ( dst ) ; + frustum -> getMat4 ( dst ) ; } void ssgContext::getModelviewMatrix ( sgMat4 dst ) Index: ssgEntity.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgEntity.cxx,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- ssgEntity.cxx 2 Sep 2002 06:05:48 -0000 1.21 +++ ssgEntity.cxx 9 Sep 2002 09:08:29 -0000 1.22 @@ -221,10 +221,7 @@ tmp . orthoXform ( m ) ; - if ( _ssgCurrentContext->isOrtho() ) - return SSG_STRADDLE ; /* XXX Fix Me!! XXX */ - else - return (ssgCullResult) f -> contains ( &tmp ) ; + return (ssgCullResult) f -> contains ( &tmp ) ; } Index: ssgOptimiser.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgOptimiser.cxx,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- ssgOptimiser.cxx 2 Sep 2002 06:05:48 -0000 1.27 +++ ssgOptimiser.cxx 9 Sep 2002 09:08:29 -0000 1.28 @@ -802,8 +802,7 @@ if ( parent -> isAKindOf ( ssgTypeSelector () ) ) { /* cannot remove kids from selectors */ - static ssgInvisible empty ; - parent -> replaceKid ( old_kid, &empty ) ; + parent -> replaceKid ( old_kid, new ssgInvisible ) ; } else { |
From: M?rten Str?m. <str...@us...> - 2002-09-09 09:07:06
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv4601 Modified Files: sg.h sg.cxx Log Message: Added orthographic support to 'sgFrustum'. Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- sg.h 2 Sep 2002 06:05:46 -0000 1.47 +++ sg.h 9 Sep 2002 09:07:02 -0000 1.48 @@ -1026,22 +1026,26 @@ class sgFrustum { - /* The parameters for a glFrustum or pfMakePerspFrust */ + /* Is the projection orthographic (or perspective)? */ + int ortho ; + + /* The parameters for glFrustum/glOrtho */ - SGfloat left, right, top, bot, nnear, ffar ; + SGfloat left, right, bot, top, nnear, ffar ; [...99 lines suppressed...] + void setOrtho ( const SGfloat w, const SGfloat h ) + { + ortho = TRUE ; + hfov = ( w <= 0 ) ? ( h * SG_THREE / SG_TWO ) : w ; + vfov = ( h <= 0 ) ? ( w * SG_THREE / SG_TWO ) : h ; + update () ; + } + void getNearFar ( SGfloat *n, SGfloat *f ) const { if ( n != (SGfloat *) 0 ) *n = nnear ; @@ -1104,6 +1144,8 @@ ffar = f ; update () ; } + + int isOrtho (void) const { return ortho ; } int contains ( const sgVec3 p ) const ; int contains ( const sgSphere *s ) const ; Index: sg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.cxx,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- sg.cxx 2 Sep 2002 06:05:46 -0000 1.37 +++ sg.cxx 9 Sep 2002 09:07:03 -0000 1.38 @@ -565,97 +565,138 @@ { if ( fabs ( hfov ) < 0.1 || fabs ( vfov ) < 0.1 ) { - ulSetError ( UL_WARNING, "sgFrustum: Can't support fields of view narrower than 0.1 degrees."); + ulSetError ( UL_WARNING, ortho ? + "sgFrustum: Can't support width or height <0.1 units." : + "sgFrustum: Can't support fields of view narrower than 0.1 degrees." ) ; return ; } - /* Corners of screen relative to eye... */ [...265 lines suppressed...] + */ + + + if ( -sp1 > radius || -sp2 > radius || -sp3 > radius || -sp4 > radius ) return SG_OUTSIDE ; /* @@ -736,10 +819,8 @@ and we can save time elsewhere if we know that for sure. */ - if ( -s->getCenter() [ 2 ] - s->getRadius() > nnear && - -s->getCenter() [ 2 ] + s->getRadius() < ffar && - sp1 >= s->getRadius() && sp2 >= s->getRadius() && - sp3 >= s->getRadius() && sp4 >= s->getRadius() ) + if ( sp1 >= radius && sp2 >= radius && sp3 >= radius && sp4 >= radius + && -center[2] - radius >= nnear && -center[2] + radius <= ffar ) return SG_INSIDE ; return SG_STRADDLE ; |
From: M?rten Str?m. <str...@us...> - 2002-09-09 09:01:32
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv2530 Modified Files: ssgLoadFLT.cxx Log Message: more switch support + minor fixes + removed alloca Index: ssgLoadFLT.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadFLT.cxx,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- ssgLoadFLT.cxx 2 Sep 2002 06:05:48 -0000 1.33 +++ ssgLoadFLT.cxx 9 Sep 2002 09:01:29 -0000 1.34 @@ -99,17 +99,12 @@ # endif #endif -#define USE_ALLOCA - #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <stdio.h> #ifdef __sgi # include <sys/endian.h> [...236 lines suppressed...] -#else - ssgEntity *kids[n]; -#endif + ssgEntity *kids[32]; for (i = n; i--;) { kids[i] = grp->getKid(i); kids[i]->ref(); grp->removeKid(i); kids[i]->deRef(); @@ -2914,11 +2953,7 @@ return Flatten(kid, mat); } else { -#ifdef USE_ALLOCA - ssgEntity **kids = (ssgEntity **)alloca(sizeof(ssgEntity *) * n); -#else - ssgEntity *kids[n]; -#endif + ssgEntity *kids[32]; for (i = n; i--;) { kids[i] = grp->getKid(i); kids[i]->ref(); grp->removeKid(i); kids[i]->deRef(); |
From: M?rten Str?m. <str...@us...> - 2002-09-09 09:01:23
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv2457 Modified Files: ssgLoaderWriterStuff.cxx Log Message: Using heap allocation instead of 'alloca'. Index: ssgLoaderWriterStuff.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoaderWriterStuff.cxx,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- ssgLoaderWriterStuff.cxx 2 Sep 2002 06:05:48 -0000 1.27 +++ ssgLoaderWriterStuff.cxx 9 Sep 2002 09:01:18 -0000 1.28 @@ -33,20 +33,9 @@ // in Nov of 2000 // Distributed with Steve Bakers plib under the LGPL licence -#include "ssgLocal.h" +#include "ssgLocal.h" #include "ssgLoaderWriterStuff.h" -// need a prototype for alloca: -#if defined(__sgi) || defined(__MWERKS__) -#include <alloca.h> -#endif -#if defined(_MSC_VER) -#include <malloc.h> -#endif - -#if defined(__MINGW32__) -#include <libiberty.h> -#endif #undef ABS #undef MIN @@ -141,7 +130,7 @@ ( new_vertex[2] - oldvertex[2] > -epsilon) && ( new_vertex[2] - oldvertex[2] < epsilon)) { - float *f; + float *f = 0; if ( useTexture ) { assert( texCoordArray ); // if texCoordArray would be NULL, useTexture would not be set. @@ -202,7 +191,7 @@ ssgTriangulate - triangulate a simple polygon. */ -static int triangulateConcave(sgVec3 *coords, int *w, int n, int x, int y, int *tris) // was: triangulate_concave +static int triangulateConcave(sgVec3 *coords, int *w, int n, int x, int y, int *tris) { struct Vtx { int index; @@ -210,19 +199,20 @@ Vtx *next; }; - Vtx *p0, *p1, *p2, *m0, *m1, *m2, *t; + Vtx buf[16], *arr, *p0, *p1, *p2, *m0, *m1, *m2, *t; int i, chk, num_tris; float a0, a1, a2, b0, b1, b2, c0, c1, c2; /* construct a circular linked list of the vertices */ - p0 = (Vtx *) alloca(sizeof(Vtx)); + arr = (n > 16) ? new Vtx [ n ] : buf; + p0 = &arr[0]; p0->index = w ? w[0] : 0; p0->x = coords[p0->index][x]; p0->y = coords[p0->index][y]; p1 = p0; p2 = 0; for (i = 1; i < n; i++) { - p2 = (Vtx *) alloca(sizeof(Vtx)); + p2 = &arr[i]; p2->index = w ? w[i] : i; p2->x = coords[p2->index][x]; p2->y = coords[p2->index][y]; @@ -241,6 +231,8 @@ if (chk && m0 == p0 && m1 == p1 && m2 == p2) { /* no suitable vertex found.. */ ulSetError(UL_WARNING, "ssgTriangulate: Self-intersecting polygon."); + if (arr != buf) + delete [] arr; return 0; } chk = 1; @@ -306,6 +298,9 @@ tris[3 * num_tris + 1] = p1->index; tris[3 * num_tris + 2] = p2->index; num_tris++; + + if (arr != buf) + delete [] arr; return num_tris; } |
From: Steve B. <sj...@us...> - 2002-09-08 22:17:36
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv21290/plib/examples/src/psl/data Modified Files: test.psl Log Message: Added 'break' and 'continue' - fixed a runtime stack overflow in 'switch'. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- test.psl 8 Sep 2002 18:56:29 -0000 1.11 +++ test.psl 8 Sep 2002 22:17:32 -0000 1.12 @@ -5,18 +5,24 @@ for ( i = 0 ; i < 20 ; i = i + 1 - 3 + 3 ) { +if ( i == 10 ) continue ; +if ( i == 17 ) break ; + switch ( i ) { case 0 : case 1 : case 2 : printf ( "Small! " ) ; + break ; case 3 : case 4 : case 5 : printf ( "Medium! " ) ; + break ; default: printf ( "Huge! ", i ) ; + break ; } printf ( "\n" ) ; |
From: Steve B. <sj...@us...> - 2002-09-08 22:17:35
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv21290/plib/src/psl Modified Files: pslCompiler.cxx pslCompiler.h pslContext.h pslDump.cxx pslSymbols.cxx Log Message: Added 'break' and 'continue' - fixed a runtime stack overflow in 'switch'. Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslCompiler.cxx 8 Sep 2002 18:56:29 -0000 1.13 +++ pslCompiler.cxx 8 Sep 2002 22:17:32 -0000 1.14 @@ -59,6 +59,7 @@ if ( num_errors != 0 ) { +dump () ; next_code = 0 ; pushCodeByte ( OPCODE_HALT ) ; } @@ -90,6 +91,86 @@ } [...240 lines suppressed...] + if ( strcmp ( c, "string" ) == 0 ) return pushLocalVarDecl ( PSL_STRING) ; + if ( strcmp ( c, "int" ) == 0 ) return pushLocalVarDecl ( PSL_INT ) ; + if ( strcmp ( c, "float" ) == 0 ) return pushLocalVarDecl ( PSL_FLOAT ) ; + if ( strcmp ( c, "return" ) == 0 ) return pushReturnStatement () ; + if ( strcmp ( c, "break" ) == 0 ) return pushBreakStatement () ; + if ( strcmp ( c, "continue" ) == 0 ) return pushContinueStatement () ; + if ( strcmp ( c, "pause" ) == 0 ) return pushPauseStatement () ; + if ( strcmp ( c, "for" ) == 0 ) return pushForStatement () ; + if ( strcmp ( c, "do" ) == 0 ) return pushDoWhileStatement () ; + if ( strcmp ( c, "switch" ) == 0 ) return pushSwitchStatement () ; + if ( strcmp ( c, "while" ) == 0 ) return pushWhileStatement () ; + if ( strcmp ( c, "if" ) == 0 ) return pushIfStatement () ; + if ( isalnum ( c [ 0 ] ) ) return pushAssignmentStatement(c); + if ( c [ 0 ] == '{' ) return pushCompoundStatement () ; - if ( strcmp ( c, "case" ) == 0 || strcmp ( c, "default" ) == 0 ) + if ( strcmp ( c, "case" ) == 0 || strcmp ( c, "default" ) == 0 ) return error ( "'%s' encountered - not inside 'switch' statement", c ) ; ungetToken ( c ) ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pslCompiler.h 8 Sep 2002 18:56:29 -0000 1.9 +++ pslCompiler.h 8 Sep 2002 22:17:32 -0000 1.10 @@ -106,6 +106,9 @@ /* Top level parsers. */ + int pushBreakStatement () ; + int pushContinueStatement () ; + int pushReturnStatement () ; int pushPauseStatement () ; int pushSwitchStatement () ; @@ -131,6 +134,20 @@ pslAddress getVarSymbol ( const char *s ) ; pslAddress setVarSymbol ( const char *s ) ; + int breakToAddressStack [ MAX_LABEL ] ; + int continueToAddressStack [ MAX_LABEL ] ; + int next_break ; + int next_tmp_label ; + int next_continue ; + + void pushBreakToLabel () ; + int pushContinueToLabel () ; + void setContinueToLabel ( int which ) ; + void pushNoContinue () ; + + void popBreakToLabel () ; + void popContinueToLabel () ; + pslAddress getCodeSymbol ( const char *s, pslAddress fixupLoc ) ; void setCodeSymbol ( const char *s, pslAddress v ) ; @@ -250,11 +267,15 @@ num_errors = num_warnings = 0 ; locality_sp = 0 ; - next_fwdref = 0 ; - next_label = 0 ; + + next_continue = 0 ; + next_break = 0 ; + next_tmp_label= 0 ; + next_fwdref = 0 ; + next_label = 0 ; next_code_symbol = 0 ; - next_code = 0 ; - next_var = 0 ; + next_code = 0 ; + next_var = 0 ; } void dump () const ; Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pslContext.h 8 Sep 2002 00:37:44 -0000 1.6 +++ pslContext.h 8 Sep 2002 22:17:32 -0000 1.7 @@ -62,7 +62,7 @@ void pushString ( const char *x ) { stack [ sp++ ] . set ( x ) ; } void pushNumber ( const pslNumber *x ) { stack [ sp++ ] . set ( x ) ; } - void popVoid () { --sp ; } + void popVoid () { --sp ; } int popInt () { return stack [ --sp ] . getInt () ; } float popFloat () { return stack [ --sp ] . getFloat () ; } char *popString () { return stack [ --sp ] . getString () ; } Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslDump.cxx 8 Sep 2002 04:51:39 -0000 1.11 +++ pslDump.cxx 8 Sep 2002 22:17:32 -0000 1.12 @@ -43,8 +43,11 @@ { "PUSH_INT_CONSTANT" , OPCODE_PUSH_INT_CONSTANT , sizeof(int) }, { "PUSH_FLOAT_CONSTANT", OPCODE_PUSH_FLOAT_CONSTANT, sizeof(float) }, { "PUSH_STRING_CONSTANT",OPCODE_PUSH_STRING_CONSTANT, 0 }, - { "POP_INTO_VARIABLE" , OPCODE_POP_VARIABLE , 1 }, { "PUSH_VARIABLE" , OPCODE_PUSH_VARIABLE , 1 }, + + { "DUPLICATE" , OPCODE_STACK_DUPLICATE , 0 }, + + { "POP_INTO_VARIABLE" , OPCODE_POP_VARIABLE , 1 }, { "POP" , OPCODE_POP , 0 }, /* Variable creation */ @@ -220,7 +223,7 @@ case OPCODE_JUMP_FALSE : case OPCODE_JUMP_TRUE : - fprintf ( fd, "\t%d", code[addr+1] + ( code[addr+2] << 8 ) ) ; + fprintf ( fd, "\t\t%d", code[addr+1] + ( code[addr+2] << 8 ) ) ; break ; case OPCODE_JUMP : Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslSymbols.cxx 7 Sep 2002 23:05:06 -0000 1.12 +++ pslSymbols.cxx 8 Sep 2002 22:17:32 -0000 1.13 @@ -166,4 +166,3 @@ } - |
From: Sebastian U. <ud...@us...> - 2002-09-08 19:49:22
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv16541 Modified Files: Makefile.am Log Message: Added local header files to libplibpsl_a_SOURCES Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Makefile.am 8 Sep 2002 18:56:29 -0000 1.9 +++ Makefile.am 8 Sep 2002 19:49:17 -0000 1.10 @@ -5,10 +5,11 @@ include_HEADERS = psl.h -libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslContext.cxx \ - pslCompiler.cxx pslSymbols.cxx pslToken.cxx \ - pslExpression.cxx pslProgram.cxx pslDump.cxx \ - pslError.cxx +libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslCompiler.cxx pslCompiler.h \ + pslContext.cxx pslContext.h pslDump.cxx pslError.cxx \ + pslExpression.cxx pslLocal.h pslOpcodes.h \ + pslProgram.cxx pslSymbol.h pslSymbols.cxx \ + pslToken.cxx INCLUDES = -I$(top_srcdir)/src/util |
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv2453/plib/src/psl Modified Files: Makefile.am pslCodeGen.cxx pslCompiler.cxx pslCompiler.h pslContext.cxx pslError.cxx pslExpression.cxx pslOpcodes.h pslToken.cxx Log Message: Fixed bug with backslashes in string constants. Added 'switch' and 'for' statements. Improved error recovery. Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile.am 7 Sep 2002 23:05:06 -0000 1.8 +++ Makefile.am 8 Sep 2002 18:56:29 -0000 1.9 @@ -3,8 +3,7 @@ lib_LIBRARIES = libplibpsl.a -include_HEADERS = psl.h pslContext.h pslLocal.h \ - pslCompiler.h pslSymbol.h pslOpcodes.h +include_HEADERS = psl.h libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslContext.cxx \ pslCompiler.cxx pslSymbols.cxx pslToken.cxx \ Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslCodeGen.cxx 8 Sep 2002 04:51:39 -0000 1.12 +++ pslCodeGen.cxx 8 Sep 2002 18:56:29 -0000 1.13 @@ -170,6 +170,8 @@ void pslCompiler::pushNotEqual () { pushCodeByte ( OPCODE_NOTEQUAL ) ; } void pslCompiler::pushEqual () { pushCodeByte ( OPCODE_EQUAL ) ; } +void pslCompiler::pushStackDup () { pushCodeByte ( OPCODE_STACK_DUPLICATE ) ; } + int pslCompiler::pushJumpIfTrue ( int l ) { pushCodeByte ( OPCODE_JUMP_TRUE ) ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslCompiler.cxx 8 Sep 2002 04:51:39 -0000 1.12 +++ pslCompiler.cxx 8 Sep 2002 18:56:29 -0000 1.13 @@ -90,6 +90,86 @@ } +int pslCompiler::pushSwitchStatement () +{ + if ( ! pushExpression () ) + return error ( "Missing control expression for 'switch'" ) ; + + char c [ MAX_TOKEN ] ; + + getToken ( c ) ; /* Hopefully, the word 'while' */ [...445 lines suppressed...] if ( c[0] != ')' ) - { - error ( "Missing ')' in declaration of '%s'", fn ) ; - return FALSE ; - } + return error ( "Missing ')' in declaration of '%s'", fn ) ; getToken ( c ) ; if ( c [ 0 ] != '{' ) - error ( "Missing '{' in function '%s'", fn ) ; + return error ( "Missing '{' in function '%s'", fn ) ; if ( ! pushCompoundStatement () ) - error ( "Missing '}' in function '%s'", fn ) ; + return error ( "Missing '}' in function '%s'", fn ) ; getToken ( c ) ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pslCompiler.h 8 Sep 2002 04:51:39 -0000 1.8 +++ pslCompiler.h 8 Sep 2002 18:56:29 -0000 1.9 @@ -62,6 +62,7 @@ /* Basic low level code generation. */ + void pushStackDup () ; void pushPop () ; void pushSubtract () ; void pushAdd () ; @@ -107,6 +108,7 @@ int pushReturnStatement () ; int pushPauseStatement () ; + int pushSwitchStatement () ; int pushWhileStatement () ; int pushDoWhileStatement () ; int pushForStatement () ; @@ -117,9 +119,9 @@ int pushStatement () ; int pushFunctionDeclaration ( const char *fn ) ; - int pushLocalVariableDeclaration ( pslType t ) ; - int pushGlobalVariableDeclaration ( const char *fn, pslType t ) ; - int pushStaticVariableDeclaration () ; + int pushLocalVarDecl ( pslType t ) ; + int pushGlobalVarDecl ( const char *fn, pslType t ) ; + int pushStaticVarDecl () ; int pushGlobalDeclaration () ; void pushProgram () ; @@ -146,8 +148,8 @@ const char *getProgName () const { return progName ; } - void error ( const char *fmt, ... ) ; - void warning ( const char *fmt, ... ) ; + int error ( const char *fmt, ... ) ; + int warning ( const char *fmt, ... ) ; int next_var ; int next_label ; Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslContext.cxx 8 Sep 2002 04:51:39 -0000 1.4 +++ pslContext.cxx 8 Sep 2002 18:56:29 -0000 1.5 @@ -114,6 +114,14 @@ } return PSL_PROGRAM_CONTINUE ; + case OPCODE_STACK_DUPLICATE : + { + pslValue *v1 = & stack [ sp - 1 ] ; + pushNumber ( v1 ) ; + pc++ ; + } + return PSL_PROGRAM_CONTINUE ; + case OPCODE_SUB : { pslValue *v1 = & stack [ sp - 1 ] ; Index: pslError.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslError.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslError.cxx 7 Sep 2002 23:05:06 -0000 1.1 +++ pslError.cxx 8 Sep 2002 18:56:29 -0000 1.2 @@ -39,7 +39,7 @@ -void pslCompiler::warning ( const char *fmt, ... ) +int pslCompiler::warning ( const char *fmt, ... ) { va_list argp; va_start ( argp, fmt ) ; @@ -55,11 +55,12 @@ _pslErrorBuffer ) ; bumpWarnings () ; + return FALSE ; } -void pslCompiler::error ( const char *fmt, ... ) +int pslCompiler::error ( const char *fmt, ... ) { va_list argp; va_start ( argp, fmt ) ; @@ -75,6 +76,7 @@ _pslErrorBuffer ) ; bumpErrors () ; + return FALSE ; } Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pslExpression.cxx 7 Sep 2002 23:05:06 -0000 1.8 +++ pslExpression.cxx 8 Sep 2002 18:56:29 -0000 1.9 @@ -34,18 +34,16 @@ { if ( ! pushExpression () ) { - error ( "Missing expression after '('" ) ; ungetToken ( c ) ; - return FALSE ; + return error ( "Missing expression after '('" ) ; } getToken ( c ) ; if ( c [ 0 ] != ')' ) { - error ( "Missing ')' (found '%s')", c ); ungetToken ( c ) ; - return FALSE ; + return error ( "Missing ')' (found '%s')", c ); } return TRUE ; Index: pslOpcodes.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslOpcodes.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslOpcodes.h 8 Sep 2002 04:51:39 -0000 1.3 +++ pslOpcodes.h 8 Sep 2002 18:56:29 -0000 1.4 @@ -54,4 +54,6 @@ #define OPCODE_SET_INT_VARIABLE 0x1B #define OPCODE_SET_FLOAT_VARIABLE 0x1C #define OPCODE_SET_STRING_VARIABLE 0x1D +#define OPCODE_STACK_DUPLICATE 0x1E + Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pslToken.cxx 8 Sep 2002 04:51:39 -0000 1.10 +++ pslToken.cxx 8 Sep 2002 18:56:29 -0000 1.11 @@ -151,6 +151,8 @@ case 'a' : res [ tp++ ] = '\a' ; break ; default: res [ tp++ ] = c ; break ; } + + isBkSlash = FALSE ; } else res [ tp++ ] = c ; |
From: Steve B. <sj...@us...> - 2002-09-08 18:56:32
|
Update of /cvsroot/plib/plib/examples/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv2453/plib/examples/src/psl Modified Files: psl_demo.cxx Log Message: Fixed bug with backslashes in string constants. Added 'switch' and 'for' statements. Improved error recovery. Index: psl_demo.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/psl_demo.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- psl_demo.cxx 7 Sep 2002 23:05:06 -0000 1.11 +++ psl_demo.cxx 8 Sep 2002 18:56:29 -0000 1.12 @@ -51,7 +51,6 @@ } } } - printf ( "\n" ) ; pslValue ret ; return ret ; @@ -100,7 +99,7 @@ while ( 1 ) { if ( prog_1 -> step () == PSL_PROGRAM_END ) break ; - if ( prog_2 -> step () == PSL_PROGRAM_END ) break ; +// if ( prog_2 -> step () == PSL_PROGRAM_END ) break ; } exit ( 0 ) ; |
From: Steve B. <sj...@us...> - 2002-09-08 18:56:32
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv2453/plib/examples/src/psl/data Modified Files: test.psl Log Message: Fixed bug with backslashes in string constants. Added 'switch' and 'for' statements. Improved error recovery. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- test.psl 8 Sep 2002 04:51:38 -0000 1.10 +++ test.psl 8 Sep 2002 18:56:29 -0000 1.11 @@ -5,7 +5,21 @@ for ( i = 0 ; i < 20 ; i = i + 1 - 3 + 3 ) { - printf ( "I=", i ) ; + switch ( i ) + { + case 0 : + case 1 : + case 2 : + printf ( "Small! " ) ; + case 3 : + case 4 : + case 5 : + printf ( "Medium! " ) ; + default: + printf ( "Huge! ", i ) ; + } + + printf ( "\n" ) ; } } |
Update of /cvsroot/plib/plib/demos/ode_demo/opcode In directory usw-pr-cvs1:/tmp/cvs-serv18870 Removed Files: OPC_RayTriOverlap.h OPC_Settings.h OPC_SphereAABBOverlap.h OPC_SphereCollider.cpp OPC_SphereCollider.h OPC_SphereTriOverlap.h OPC_TreeBuilders.cpp OPC_TreeBuilders.h OPC_TreeCollider.cpp OPC_TreeCollider.h OPC_TriBoxOverlap.h OPC_TriTriOverlap.h OPC_Triangle.cpp OPC_Triangle.h OPC_Types.h OPC_VolumeCollider.cpp OPC_VolumeCollider.h Opcode.cpp Opcode.h ReadMe.txt StdAfx.cpp StdAfx.h Log Message: Removed remains of ode_demo --- OPC_RayTriOverlap.h DELETED --- --- OPC_Settings.h DELETED --- --- OPC_SphereAABBOverlap.h DELETED --- --- OPC_SphereCollider.cpp DELETED --- --- OPC_SphereCollider.h DELETED --- --- OPC_SphereTriOverlap.h DELETED --- --- OPC_TreeBuilders.cpp DELETED --- --- OPC_TreeBuilders.h DELETED --- --- OPC_TreeCollider.cpp DELETED --- --- OPC_TreeCollider.h DELETED --- --- OPC_TriBoxOverlap.h DELETED --- --- OPC_TriTriOverlap.h DELETED --- --- OPC_Triangle.cpp DELETED --- --- OPC_Triangle.h DELETED --- --- OPC_Types.h DELETED --- --- OPC_VolumeCollider.cpp DELETED --- --- OPC_VolumeCollider.h DELETED --- --- Opcode.cpp DELETED --- --- Opcode.h DELETED --- --- ReadMe.txt DELETED --- --- StdAfx.cpp DELETED --- --- StdAfx.h DELETED --- |
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv21376/plib/src/psl Modified Files: pslCodeGen.cxx pslCompiler.cxx pslCompiler.h pslContext.cxx pslDump.cxx pslLocal.h pslOpcodes.h pslToken.cxx Log Message: Added 'for' loops and 'do/while'. Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslCodeGen.cxx 7 Sep 2002 23:05:06 -0000 1.11 +++ pslCodeGen.cxx 8 Sep 2002 04:51:39 -0000 1.12 @@ -170,6 +170,17 @@ void pslCompiler::pushNotEqual () { pushCodeByte ( OPCODE_NOTEQUAL ) ; } void pslCompiler::pushEqual () { pushCodeByte ( OPCODE_EQUAL ) ; } +int pslCompiler::pushJumpIfTrue ( int l ) +{ + pushCodeByte ( OPCODE_JUMP_TRUE ) ; + + int res = next_code ; + + pushCodeAddr ( l ) ; + + return res ; +} + int pslCompiler::pushJumpIfFalse ( int l ) { pushCodeByte ( OPCODE_JUMP_FALSE ) ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslCompiler.cxx 7 Sep 2002 23:05:06 -0000 1.11 +++ pslCompiler.cxx 8 Sep 2002 04:51:39 -0000 1.12 @@ -90,9 +90,143 @@ } -int pslCompiler::pushWhileStatement () +int pslCompiler::pushDoWhileStatement () { + /* Remember place to jump back to */ + + int start_loc = next_code ; + + if ( ! pushStatement () ) [...126 lines suppressed...] + + +int pslCompiler::pushWhileStatement () +{ /* Remember place to jump back to */ int start_loc = next_code ; @@ -299,6 +433,12 @@ if ( strcmp ( c, "pause" ) == 0 ) return pushPauseStatement () ; + + if ( strcmp ( c, "for" ) == 0 ) + return pushForStatement () ; + + if ( strcmp ( c, "do" ) == 0 ) + return pushDoWhileStatement () ; if ( strcmp ( c, "while" ) == 0 ) return pushWhileStatement () ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslCompiler.h 8 Sep 2002 00:37:44 -0000 1.7 +++ pslCompiler.h 8 Sep 2002 04:51:39 -0000 1.8 @@ -76,6 +76,7 @@ void pushNotEqual () ; void pushEqual () ; int pushJumpIfFalse ( int l ) ; + int pushJumpIfTrue ( int l ) ; int pushJump ( int l ) ; void makeIntVariable ( const char *s ) ; @@ -107,6 +108,8 @@ int pushReturnStatement () ; int pushPauseStatement () ; int pushWhileStatement () ; + int pushDoWhileStatement () ; + int pushForStatement () ; int pushIfStatement () ; int pushFunctionCall ( const char *s ) ; int pushAssignmentStatement ( const char *s ) ; Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslContext.cxx 7 Sep 2002 23:05:06 -0000 1.3 +++ pslContext.cxx 8 Sep 2002 04:51:39 -0000 1.4 @@ -315,6 +315,13 @@ case OPCODE_HALT : return PSL_PROGRAM_END ; /* Note: PC is *NOT* incremented. */ + case OPCODE_JUMP_TRUE : + if ( popInt () ) + pc = code [ pc + 1 ] + ( code [ pc + 2 ] << 8 ) ; + else + pc += 3 ; + return PSL_PROGRAM_CONTINUE ; + case OPCODE_JUMP_FALSE : if ( popInt () ) pc += 3 ; Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pslDump.cxx 7 Sep 2002 23:05:06 -0000 1.10 +++ pslDump.cxx 8 Sep 2002 04:51:39 -0000 1.11 @@ -59,6 +59,7 @@ { "CALL", OPCODE_CALL , 3 }, { "RETURN", OPCODE_RETURN , 0 }, { "JUMP_FALSE", OPCODE_JUMP_FALSE , 2 }, + { "JUMP_TRUE", OPCODE_JUMP_TRUE , 2 }, { "JUMP", OPCODE_JUMP , 2 }, { "PAUSE", OPCODE_PAUSE , 0 }, { "HALT", OPCODE_HALT , 0 }, @@ -218,6 +219,7 @@ break ; case OPCODE_JUMP_FALSE : + case OPCODE_JUMP_TRUE : fprintf ( fd, "\t%d", code[addr+1] + ( code[addr+2] << 8 ) ) ; break ; Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslLocal.h 7 Sep 2002 23:05:06 -0000 1.13 +++ pslLocal.h 8 Sep 2002 04:51:39 -0000 1.14 @@ -44,6 +44,7 @@ #define MAX_CODE 512 #define MAX_STACK 256 #define MAX_NESTING 32 +#define MAX_UNGET 64 #define MAX_SYMBOL (MAX_VARIABLE + MAX_LABEL) typedef unsigned short pslAddress ; Index: pslOpcodes.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslOpcodes.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslOpcodes.h 7 Sep 2002 11:16:09 -0000 1.2 +++ pslOpcodes.h 8 Sep 2002 04:51:39 -0000 1.3 @@ -42,15 +42,16 @@ #define OPCODE_NOTEQUAL 0x0F #define OPCODE_EQUAL 0x10 #define OPCODE_JUMP_FALSE 0x11 -#define OPCODE_JUMP 0x12 -#define OPCODE_POP 0x13 -#define OPCODE_HALT 0x14 -#define OPCODE_CALLEXT 0x15 -#define OPCODE_PAUSE 0x16 -#define OPCODE_RETURN 0x17 -#define OPCODE_PUSH_VARIABLE 0x18 -#define OPCODE_POP_VARIABLE 0x19 -#define OPCODE_SET_INT_VARIABLE 0x1A -#define OPCODE_SET_FLOAT_VARIABLE 0x1B -#define OPCODE_SET_STRING_VARIABLE 0x1C +#define OPCODE_JUMP_TRUE 0x12 +#define OPCODE_JUMP 0x13 +#define OPCODE_POP 0x14 +#define OPCODE_HALT 0x15 +#define OPCODE_CALLEXT 0x16 +#define OPCODE_PAUSE 0x17 +#define OPCODE_RETURN 0x18 +#define OPCODE_PUSH_VARIABLE 0x19 +#define OPCODE_POP_VARIABLE 0x1A +#define OPCODE_SET_INT_VARIABLE 0x1B +#define OPCODE_SET_FLOAT_VARIABLE 0x1C +#define OPCODE_SET_STRING_VARIABLE 0x1D Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pslToken.cxx 7 Sep 2002 23:05:06 -0000 1.9 +++ pslToken.cxx 8 Sep 2002 04:51:39 -0000 1.10 @@ -24,8 +24,6 @@ #include "pslLocal.h" -#define MAX_UNGET 16 - static FILE *defaultFile ; static char ungotten_token [ MAX_UNGET ][ MAX_TOKEN ] ; static int unget_stack_depth = 0 ; |
From: Steve B. <sj...@us...> - 2002-09-08 04:51:43
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv21376/plib/examples/src/psl/data Modified Files: test.psl Log Message: Added 'for' loops and 'do/while'. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- test.psl 7 Sep 2002 23:05:06 -0000 1.9 +++ test.psl 8 Sep 2002 04:51:38 -0000 1.10 @@ -1,39 +1,11 @@ - -int x = 0.0 ; - -int wibble () -{ - x = x + 1 ; - identify () ; - return 123 ; -} - -float y = 987.654 ; - -/* - C style Comments... -*/ - -// ...and C++ style both work... - void main () { - x = 0 ; - - printf ( "X,Y=", x, y ) ; + int i ; + for ( i = 0 ; i < 20 ; i = i + 1 - 3 + 3 ) { - int x = wibble() ; - - printf ( "X=", x ) ; - - { - int x = 456.0 ; - printf ( "Local X=", x ) ; - } - - printf ( "X=", x ) ; + printf ( "I=", i ) ; } } |
From: Sebastian U. <ud...@us...> - 2002-09-08 00:40:17
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv7335 Modified Files: psl.dsp Log Message: Synced with recent changes to Makefile.am Index: psl.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.dsp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- psl.dsp 7 Sep 2002 10:58:23 -0000 1.5 +++ psl.dsp 8 Sep 2002 00:40:14 -0000 1.6 @@ -122,6 +122,10 @@ # End Source File # Begin Source File +SOURCE=.\pslError.cxx +# End Source File +# Begin Source File + SOURCE=.\pslExpression.cxx # End Source File # Begin Source File |
From: Sebastian U. <ud...@us...> - 2002-09-08 00:37:49
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv6828 Modified Files: psl.h pslCompiler.h pslContext.h pslProgram.cxx Log Message: Const-correctness, again Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- psl.h 7 Sep 2002 23:05:06 -0000 1.11 +++ psl.h 8 Sep 2002 00:37:44 -0000 1.12 @@ -22,7 +22,7 @@ */ -#include <stdio.h> +#include "ul.h" enum pslResult { @@ -133,8 +133,7 @@ virtual void set ( float v ) { t = PSL_FLOAT ; f = v ; } virtual void set ( const char *v ) { t = PSL_STRING ; delete [] s ; - s = new char [ strlen(v)+1 ] ; - strcpy ( s, v ) ; } + s = ulStrDup ( v ) ; } virtual void set ( const pslNumber *v ) { @@ -189,8 +188,7 @@ case PSL_INT : i = atoi ( v ) ; return ; case PSL_FLOAT : f = atof ( v ) ; return ; case PSL_STRING : delete [] s ; - s = new char [ strlen(v)+1 ] ; - strcpy ( s, v ) ; + s = ulStrDup ( v ) ; return ; case PSL_VOID : return ; } @@ -232,8 +230,8 @@ public: - pslProgram ( pslExtension *ext, char *_progName = NULL ) ; - pslProgram ( pslProgram *src, char *_progName = NULL ) ; + pslProgram ( pslExtension *ext, const char *_progName = NULL ) ; + pslProgram ( pslProgram *src, const char *_progName = NULL ) ; ~pslProgram () ; @@ -247,12 +245,11 @@ void setProgName ( const char *nm ) { delete [] progName ; - progName = new char [ strlen ( nm ) + 1 ] ; - strcpy ( progName, nm ) ; + progName = ulStrDup ( nm ) ; } void *getUserData () const { return userData ; } - void setUserData ( void *ud ) { userData = ud ; } + void setUserData ( void *ud ) { userData = ud ; } void dump () const ; int compile ( const char *fname ) ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pslCompiler.h 7 Sep 2002 23:05:06 -0000 1.6 +++ pslCompiler.h 8 Sep 2002 00:37:44 -0000 1.7 @@ -48,7 +48,7 @@ { int line_no ; - int getLineNo () { return line_no ; } + int getLineNo () const { return line_no ; } int getChar ( FILE *fd ) ; int unGetChar ( int c, FILE *fd ) ; @@ -141,7 +141,7 @@ char *progName ; - const char *getProgName () { return progName ; } + const char *getProgName () const { return progName ; } void error ( const char *fmt, ... ) ; void warning ( const char *fmt, ... ) ; @@ -198,8 +198,7 @@ pslCompiler ( pslOpcode *_code, pslExtension *_extn, const char *_progName ) { - progName = new char [ strlen ( _progName ) + 1 ] ; - strcpy ( progName, _progName ) ; + progName = ulStrDup ( _progName ) ; code = _code ; extensions = _extn ; Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslContext.h 7 Sep 2002 23:05:06 -0000 1.5 +++ pslContext.h 8 Sep 2002 00:37:44 -0000 1.6 @@ -39,7 +39,7 @@ void bumpErrors () { num_errors++ ; } void bumpWarnings () { num_warnings++ ; } - const char *getProgName () { return program -> getProgName () ; } + const char *getProgName () const { return program -> getProgName () ; } void error ( const char *fmt, ... ) ; void warning ( const char *fmt, ... ) ; Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pslProgram.cxx 7 Sep 2002 23:05:06 -0000 1.8 +++ pslProgram.cxx 8 Sep 2002 00:37:45 -0000 1.9 @@ -24,7 +24,7 @@ #include "pslLocal.h" -pslProgram::pslProgram ( pslExtension *ext, char *_prgnm ) +pslProgram::pslProgram ( pslExtension *ext, const char *_prgnm ) { if ( ! _pslInitialised ) ulSetError ( UL_FATAL, @@ -48,7 +48,7 @@ } -pslProgram::pslProgram ( pslProgram *src, char *_prgnm ) +pslProgram::pslProgram ( pslProgram *src, const char *_prgnm ) { progName = NULL ; |
From: Steve B. <sj...@us...> - 2002-09-07 23:05:10
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv21782/plib/src/psl Modified Files: Makefile.am psl.h pslCodeGen.cxx pslCompiler.cxx pslCompiler.h pslContext.cxx pslContext.h pslDump.cxx pslExpression.cxx pslLocal.h pslProgram.cxx pslSymbols.cxx pslToken.cxx Added Files: pslError.cxx Log Message: Removed ode_demo. Added better error reporting for psl. --- NEW FILE: pslError.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [...77 lines suppressed...] void pslContext::error ( const char *fmt, ... ) { va_list argp; va_start ( argp, fmt ) ; vsprintf ( _pslErrorBuffer, fmt, argp ) ; va_end ( argp ) ; if ( _pslErrorCB != NULL ) (*_pslErrorCB)( PSL_RUNTIME_ERROR, getProgName(), pc, _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" PC=%d: *ERROR* - %s\n", getProgName(), pc, _pslErrorBuffer ) ; bumpErrors () ; } Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 7 Sep 2002 10:59:29 -0000 1.7 +++ Makefile.am 7 Sep 2002 23:05:06 -0000 1.8 @@ -8,7 +8,8 @@ libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslContext.cxx \ pslCompiler.cxx pslSymbols.cxx pslToken.cxx \ - pslExpression.cxx pslProgram.cxx pslDump.cxx + pslExpression.cxx pslProgram.cxx pslDump.cxx \ + pslError.cxx INCLUDES = -I$(top_srcdir)/src/util Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- psl.h 7 Sep 2002 11:24:39 -0000 1.10 +++ psl.h 7 Sep 2002 23:05:06 -0000 1.11 @@ -32,6 +32,11 @@ } ; +#define PSL_COMPILETIME_WARNING 1 +#define PSL_COMPILETIME_ERROR 2 +#define PSL_RUNTIME_WARNING 3 +#define PSL_RUNTIME_ERROR 4 + typedef unsigned char pslOpcode ; class pslContext ; class pslCompiler ; @@ -223,10 +228,12 @@ void *userData ; + char *progName ; + public: - pslProgram ( pslExtension *ext ) ; - pslProgram ( pslProgram *src ) ; + pslProgram ( pslExtension *ext, char *_progName = NULL ) ; + pslProgram ( pslProgram *src, char *_progName = NULL ) ; ~pslProgram () ; @@ -235,6 +242,15 @@ pslCompiler *getCompiler () const { return compiler ; } pslExtension *getExtensions () const { return extensions ; } + char *getProgName () const { return progName ; } + + void setProgName ( const char *nm ) + { + delete [] progName ; + progName = new char [ strlen ( nm ) + 1 ] ; + strcpy ( progName, nm ) ; + } + void *getUserData () const { return userData ; } void setUserData ( void *ud ) { userData = ud ; } @@ -248,4 +264,6 @@ void pslInit () ; +void pslSetErrorCallback ( void (*CB) ( int, char *, int, char * ) ) ; + Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pslCodeGen.cxx 7 Sep 2002 07:00:35 -0000 1.10 +++ pslCodeGen.cxx 7 Sep 2002 23:05:06 -0000 1.11 @@ -24,33 +24,6 @@ #include "pslLocal.h" -int pslCompiler::compile ( const char *fname ) -{ - init () ; - - FILE *fd = fopen ( fname, "ra" ) ; - - if ( fd == NULL ) - { - perror ( "PSL:" ) ; - ulSetError ( UL_WARNING, "PSL: Failed while opening '%s' for reading.", - fname ); - return FALSE ; - } - - compile ( fd ) ; - fclose ( fd ) ; - return TRUE ; -} - - -int pslCompiler::compile ( FILE *fd ) -{ - pslSetDefaultFile ( fd ) ; - pushProgram () ; - return TRUE ; -} - void pslCompiler::pushCodeByte ( pslOpcode op ) { Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pslCompiler.cxx 7 Sep 2002 07:00:35 -0000 1.10 +++ pslCompiler.cxx 7 Sep 2002 23:05:06 -0000 1.11 @@ -25,20 +25,63 @@ #include "pslLocal.h" + +int pslCompiler::compile ( const char *fname ) +{ + FILE *fd = fopen ( fname, "ra" ) ; + + if ( fd == NULL ) + { + perror ( "PSL:" ) ; [...391 lines suppressed...] } - pslGetToken ( c ) ; + getToken ( c ) ; if ( c [ 0 ] != '{' ) - ulSetError ( UL_WARNING, - "PSL: Missing '{' in function '%s'", fn ) ; + error ( "Missing '{' in function '%s'", fn ) ; if ( ! pushCompoundStatement () ) - ulSetError ( UL_WARNING, - "PSL: Missing '}' in function '%s'", fn ) ; + error ( "Missing '}' in function '%s'", fn ) ; - pslGetToken ( c ) ; + getToken ( c ) ; /* If we fall off the end of the function, we still need a return value */ Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslCompiler.h 7 Sep 2002 07:00:35 -0000 1.5 +++ pslCompiler.h 7 Sep 2002 23:05:06 -0000 1.6 @@ -46,6 +46,17 @@ class pslCompiler { + int line_no ; + + int getLineNo () { return line_no ; } + + int getChar ( FILE *fd ) ; + int unGetChar ( int c, FILE *fd ) ; + + void ungetToken ( const char *c ) ; + void getToken ( char *c, FILE *fd = NULL ) ; + void setDefaultFile ( FILE *fd ) ; + void pushCodeByte ( unsigned char b ) ; void pushCodeAddr ( pslAddress a ) ; @@ -122,6 +133,19 @@ private: + int num_errors ; + int num_warnings ; + + void bumpErrors () { num_errors++ ; } + void bumpWarnings () { num_warnings++ ; } + + char *progName ; + + const char *getProgName () { return progName ; } + + void error ( const char *fmt, ... ) ; + void warning ( const char *fmt, ... ) ; + int next_var ; int next_label ; int next_code ; @@ -146,7 +170,7 @@ void pushLocality () { if ( locality_sp >= MAX_NESTING-1 ) - ulSetError ( UL_WARNING, "PSL: Too many nested {}'s" ) ; + error ( "Too many nested {}'s" ) ; else locality_stack [ locality_sp++ ] = next_var ; } @@ -154,7 +178,7 @@ void popLocality () { if ( locality_sp <= 0 ) - ulSetError ( UL_FATAL, "PSL: Locality stack underflow !!" ) ; + error ( "Locality stack underflow !!" ) ; /* Delete any local symbols */ @@ -172,8 +196,11 @@ public: - pslCompiler ( pslOpcode *_code, pslExtension *_extn ) + pslCompiler ( pslOpcode *_code, pslExtension *_extn, const char *_progName ) { + progName = new char [ strlen ( _progName ) + 1 ] ; + strcpy ( progName, _progName ) ; + code = _code ; extensions = _extn ; @@ -205,6 +232,8 @@ { int i ; + line_no = 1 ; + for ( i = 0 ; i < MAX_CODE ; i++ ) code [ i ] = OPCODE_HALT ; for ( i = 0 ; i < MAX_SYMBOL ; i++ ) @@ -213,6 +242,8 @@ delete [] code_symtab [ i ] . symbol ; code_symtab [ i ] . symbol = NULL ; delete [] forward_ref [ i ] . symbol ; forward_ref [ i ] . symbol = NULL ; } + + num_errors = num_warnings = 0 ; locality_sp = 0 ; next_fwdref = 0 ; Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslContext.cxx 7 Sep 2002 07:00:35 -0000 1.2 +++ pslContext.cxx 7 Sep 2002 23:05:06 -0000 1.3 @@ -29,9 +29,9 @@ switch ( code [ pc ] ) { case OPCODE_NOOP : - ulSetError ( UL_FATAL, "PSL: Suspicious opcode 0x00?!", code[pc] ) ; + error ( "Suspicious opcode 0x00?!", code[pc] ) ; pc++ ; - return PSL_PROGRAM_CONTINUE ; + return PSL_PROGRAM_END ; case OPCODE_PUSH_INT_CONSTANT : { @@ -80,8 +80,7 @@ if ( required_argc >= 0 && argc != required_argc ) { - ulSetError ( UL_WARNING, - "PSL: Wrong number of parameters for function %s\n", + warning ( "Wrong number of parameters for function %s\n", extensions [ ext ] . symbol ) ; } @@ -155,14 +154,14 @@ if ( v1 -> getFloat() != 0.0f ) v2 -> set ( v2 -> getFloat() / v1 -> getFloat() ) ; else - ulSetError ( UL_WARNING, "PSL: Floating Point Divide by Zero!" ) ; + warning ( "Floating Point Divide by Zero!" ) ; } else { if ( v1 -> getInt() != 0 ) v2 -> set ( v2 -> getInt() / v1 -> getInt() ) ; else - ulSetError ( UL_WARNING, "PSL: Integer Divide by Zero!" ) ; + warning ( "Integer Divide by Zero!" ) ; } popVoid () ; pc++ ; @@ -176,14 +175,14 @@ if ( v1->getType() == PSL_FLOAT || v2->getType() == PSL_FLOAT ) { - ulSetError ( UL_WARNING, "PSL: Floating Point Modulo!" ) ; + warning ( "Floating Point Modulo!" ) ; } else { if ( v1 -> getInt() != 0 ) v2 -> set ( v2 -> getInt () % v1 -> getInt () ) ; else - ulSetError ( UL_WARNING, "PSL: Integer Modulo Zero!" ) ; + warning ( "Integer Modulo Zero!" ) ; } popVoid () ; @@ -353,8 +352,8 @@ return PSL_PROGRAM_CONTINUE ; default : - ulSetError ( UL_FATAL, "PSL: Suspicious opcode 0x02x?!", code[pc] ) ; - return PSL_PROGRAM_CONTINUE ; + error ( "Suspicious opcode 0x02x?!", code[pc] ) ; + return PSL_PROGRAM_END ; } } Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslContext.h 7 Sep 2002 11:24:39 -0000 1.4 +++ pslContext.h 7 Sep 2002 23:05:06 -0000 1.5 @@ -33,6 +33,17 @@ int sp ; pslAddress pc ; + int num_errors ; + int num_warnings ; + + void bumpErrors () { num_errors++ ; } + void bumpWarnings () { num_warnings++ ; } + + const char *getProgName () { return program -> getProgName () ; } + + void error ( const char *fmt, ... ) ; + void warning ( const char *fmt, ... ) ; + public: pslContext ( pslProgram *p ) Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pslDump.cxx 7 Sep 2002 07:00:35 -0000 1.9 +++ pslDump.cxx 7 Sep 2002 23:05:06 -0000 1.10 @@ -150,6 +150,17 @@ } printf ( "\n" ) ; + + if ( num_errors > 0 ) + printf ( "PROGRAM FAILED TO COMPILE WITH %d WARNINGS AND %d ERRORS\n", + num_warnings, num_errors ) ; + else + if ( num_warnings > 0 ) + printf ( "PROGRAM COMPILED WITH %d WARNINGS\n", num_warnings ) ; + else + printf ( "PROGRAM COMPILED OK\n" ) ; + + printf ( "\n" ) ; } Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslExpression.cxx 7 Sep 2002 07:00:35 -0000 1.7 +++ pslExpression.cxx 7 Sep 2002 23:05:06 -0000 1.8 @@ -28,23 +28,23 @@ int pslCompiler::pushPrimitive () { char c [ MAX_TOKEN ] ; - pslGetToken ( c ) ; + getToken ( c ) ; if ( c [ 0 ] == '(' ) { if ( ! pushExpression () ) { - ulSetError ( UL_WARNING, "PSL: Missing expression after '('" ) ; [...102 lines suppressed...] - pslGetToken ( c2 ) ; + getToken ( c2 ) ; if ( c2 [ 0 ] == '=' ) { @@ -201,11 +201,11 @@ c[2] = '\0' ; } else - pslUngetToken ( c2 ) ; + ungetToken ( c2 ) ; if (( c [ 0 ] == '!' || c [ 0 ] == '=' ) && c [ 1 ] != '=' ) { - pslUngetToken ( c2 ) ; + ungetToken ( c2 ) ; return TRUE ; } Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslLocal.h 7 Sep 2002 07:00:36 -0000 1.12 +++ pslLocal.h 7 Sep 2002 23:05:06 -0000 1.13 @@ -46,14 +46,6 @@ #define MAX_NESTING 32 #define MAX_SYMBOL (MAX_VARIABLE + MAX_LABEL) - -/* Token Parser */ - -void pslUngetToken ( const char *c ) ; -void pslGetToken ( char *c, FILE *fd = NULL ) ; -void pslSetDefaultFile ( FILE *fd ) ; - - typedef unsigned short pslAddress ; extern int _pslInitialised ; Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslProgram.cxx 7 Sep 2002 07:00:36 -0000 1.7 +++ pslProgram.cxx 7 Sep 2002 23:05:06 -0000 1.8 @@ -24,7 +24,7 @@ #include "pslLocal.h" -pslProgram::pslProgram ( pslExtension *ext ) +pslProgram::pslProgram ( pslExtension *ext, char *_prgnm ) { if ( ! _pslInitialised ) ulSetError ( UL_FATAL, @@ -34,18 +34,30 @@ extensions = ext ; - compiler = new pslCompiler ( code, ext ) ; - context = new pslContext ( this ) ; + progName = NULL ; - compiler -> init () ; + if ( _prgnm == NULL ) _prgnm = "PSLptogram" ; + + setProgName ( _prgnm ) ; + + compiler = new pslCompiler ( code, ext, getProgName () ) ; + context = new pslContext ( this ) ; + + compiler-> init () ; context -> reset () ; } -pslProgram::pslProgram ( pslProgram *src ) +pslProgram::pslProgram ( pslProgram *src, char *_prgnm ) { + progName = NULL ; + + if ( _prgnm == NULL ) _prgnm = src -> getProgName () ; + + setProgName ( _prgnm ) ; + code = src -> getCode () ; - compiler = src -> getCompiler () ; + compiler = src -> getCompiler () ; extensions = src -> getExtensions () ; userData = src -> getUserData () ; @@ -56,24 +68,33 @@ pslProgram::~pslProgram () { - delete compiler ; - delete context ; - delete [] code ; + delete [] progName ; + delete compiler ; + delete context ; + delete [] code ; } -void pslProgram::dump () const { compiler -> dump () ; } +void pslProgram::dump () const { compiler-> dump () ; } void pslProgram::reset () { context -> reset () ; } pslResult pslProgram::step () { return context -> step () ; } pslResult pslProgram::trace () { return context -> trace () ; } -int pslProgram::compile ( const char *fname ) + + +int pslProgram::compile ( const char *fname ) { - return compiler -> compile (fname) ; + if ( strcmp ( getProgName(), "PSLprogram" ) == 0 ) + setProgName ( fname ) ; + + return compiler -> compile ( fname ) ; } -int pslProgram::compile ( FILE *fd ) + +int pslProgram::compile ( FILE *fd ) { - return compiler -> compile( fd ) ; + return compiler -> compile ( fd ) ; } + + Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslSymbols.cxx 6 Sep 2002 18:51:53 -0000 1.11 +++ pslSymbols.cxx 7 Sep 2002 23:05:06 -0000 1.12 @@ -31,13 +31,13 @@ if ( strcmp ( s, symtab [ i ] . symbol ) == 0 && symtab [ i ] . locality >= locality_sp ) { - ulSetError ( UL_WARNING, "PSL: Multiple definition of '%s'.", s ) ; + error ( "Multiple definition of '%s'.", s ) ; return symtab [ i ] . address ; } if ( next_var >= MAX_VARIABLE-1 ) { - ulSetError ( UL_WARNING, "PSL: Too many variables." ) ; + error ( "Too many variables." ) ; next_var-- ; } @@ -56,7 +56,7 @@ if ( strcmp ( s, symtab [ i ] . symbol ) == 0 ) return symtab [ i ] . address ; - ulSetError ( UL_WARNING, "PSL: Undefined symbol '%s'.", s ) ; + error ( "Undefined symbol '%s'.", s ) ; return setVarSymbol ( s ) ; } @@ -85,7 +85,7 @@ if ( next_fwdref >= MAX_SYMBOL ) { - ulSetError ( UL_WARNING, "PSL: Too many unresolved forward references." ) ; + error ( "Too many unresolved forward references." ) ; return ; } @@ -119,8 +119,7 @@ { if ( forward_ref [ i ] . symbol != NULL ) { - ulSetError ( UL_WARNING, "PSL: '%s' does not exist.", - forward_ref [ i ] . symbol ) ; + error ( "'%s' does not exist.", forward_ref [ i ] . symbol ) ; /* Prevent multiple errors for same symbol */ @@ -151,13 +150,13 @@ for ( int i = 0 ; i < next_code_symbol ; i++ ) if ( strcmp ( s, code_symtab [ i ] . symbol ) == 0 ) { - ulSetError ( UL_WARNING, "PSL: Multiple definition of '%s'.", s ) ; + error ( "Multiple definition of '%s'.", s ) ; return ; } if ( next_code_symbol >= MAX_VARIABLE-1 ) { - ulSetError ( UL_WARNING, "PSL: Too many labels." ) ; + error ( "Too many labels." ) ; next_code_symbol-- ; } Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pslToken.cxx 7 Sep 2002 07:00:36 -0000 1.8 +++ pslToken.cxx 7 Sep 2002 23:05:06 -0000 1.9 @@ -31,13 +31,33 @@ static int unget_stack_depth = 0 ; -void pslSetDefaultFile ( FILE *fd ) +void pslCompiler::setDefaultFile ( FILE *fd ) { defaultFile = fd ; } -void pslGetToken ( char *res, FILE *fd ) [...111 lines suppressed...] - ungetc ( c, fd ) ; + unGetChar ( c, fd ) ; res [ tp ] = '\0' ; } else @@ -184,12 +201,11 @@ } -void pslUngetToken ( const char *s ) +void pslCompiler::ungetToken ( const char *s ) { if ( unget_stack_depth >= MAX_UNGET-1 ) { - ulSetError ( UL_WARNING, - "PSL: Too many ungetTokens! This must be an *UGLY* PSL program!" ) ; + error ( "Too many ungetTokens! This must be an *UGLY* PSL program!" ) ; exit ( -1 ) ; } |
From: Steve B. <sj...@us...> - 2002-09-07 23:05:09
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv21782/plib/examples/src/psl/data Modified Files: test.psl Log Message: Removed ode_demo. Added better error reporting for psl. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- test.psl 7 Sep 2002 07:00:34 -0000 1.8 +++ test.psl 7 Sep 2002 23:05:06 -0000 1.9 @@ -24,7 +24,7 @@ printf ( "X,Y=", x, y ) ; { - int x = wibble(); + int x = wibble() ; printf ( "X=", x ) ; |