plib-cvs Mailing List for PLIB (Page 30)
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: Steve B. <sj...@us...> - 2002-09-06 15:07:47
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv22280/plib/examples/src/psl/data Modified Files: test.psl Log Message: Global variable initialisations now work. pslInit created and checked for. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test.psl 5 Sep 2002 15:40:27 -0000 1.4 +++ test.psl 6 Sep 2002 15:07:44 -0000 1.5 @@ -1,10 +1,14 @@ + +float x = 0.0 ; + void wibble () { - hello () ; + x = x + 1 ; + identify () ; } -float x = 123.456 ; +float y = 987.654 ; void main () { @@ -12,7 +16,7 @@ while ( x < 10 ) { - x = x + 1 ; + print ( x, y ) ; wibble () ; pause ; } |
From: Steve B. <sj...@us...> - 2002-09-06 15:07:47
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv22280/plib/src/psl Modified Files: psl.cxx psl.h pslCompiler.cxx pslLocal.h pslProgram.cxx Log Message: Global variable initialisations now work. pslInit created and checked for. Index: psl.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- psl.cxx 5 Sep 2002 22:22:38 -0000 1.3 +++ psl.cxx 6 Sep 2002 15:07:44 -0000 1.4 @@ -24,4 +24,8 @@ #include "pslLocal.h" +int _pslInitialised = FALSE ; + +void pslInit () { _pslInitialised = TRUE ; } + Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- psl.h 6 Sep 2002 13:50:51 -0000 1.6 +++ psl.h 6 Sep 2002 15:07:44 -0000 1.7 @@ -87,4 +87,5 @@ } ; +void pslInit () ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pslCompiler.cxx 6 Sep 2002 13:50:51 -0000 1.6 +++ pslCompiler.cxx 6 Sep 2002 15:07:44 -0000 1.7 @@ -267,16 +267,6 @@ { char c [ MAX_TOKEN ] ; - /* Have the program call 'main' and then halt */ - - pushCodeByte ( OPCODE_CALL ) ; - - int main_fixup = next_code ; - - pushCodeAddr ( getCodeSymbol ( "main", next_code ) ) ; - pushCodeByte ( 0 ) ; /* Argc */ - pushCodeByte ( OPCODE_HALT ) ; - /* Compile the program */ while ( TRUE ) @@ -291,6 +281,13 @@ pushGlobalDeclaration () ; } + /* Have the program call 'main' and then halt */ + + pushCodeByte ( OPCODE_CALL ) ; + pushCodeAddr ( getCodeSymbol ( "main", next_code ) ) ; + pushCodeByte ( 0 ) ; /* Argc */ + pushCodeByte ( OPCODE_HALT ) ; + checkUnresolvedSymbols () ; } @@ -389,6 +386,8 @@ { char c [ MAX_TOKEN ] ; + pslAddress jump_target = pushJump ( 0 ) ; + setCodeSymbol ( fn, next_code ) ; pslGetToken ( c ) ; @@ -425,6 +424,10 @@ pushConstant ( "0.0" ) ; pushReturn () ; + + code [ jump_target ] = next_code & 0xFF ; + code [ jump_target+1 ] = (next_code >> 8) & 0xFF ; + return TRUE ; } Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pslLocal.h 6 Sep 2002 13:50:51 -0000 1.8 +++ pslLocal.h 6 Sep 2002 15:07:44 -0000 1.9 @@ -93,6 +93,8 @@ typedef unsigned short pslAddress ; +extern int _pslInitialised ; + #include "pslSymbol.h" #include "pslContext.h" #include "pslParser.h" Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslProgram.cxx 6 Sep 2002 13:50:51 -0000 1.4 +++ pslProgram.cxx 6 Sep 2002 15:07:44 -0000 1.5 @@ -26,6 +26,10 @@ pslProgram::pslProgram ( pslExtension *ext ) { + if ( ! _pslInitialised ) + ulSetError ( UL_FATAL, + "PSL: You didn't call pslInit() before using PSL functions." ) ; + code = new pslOpcode [ MAX_CODE ] ; extensions = ext ; |
From: Steve B. <sj...@us...> - 2002-09-06 13:50:54
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv26019/plib/src/psl Modified Files: Makefile.am psl.h pslCodeGen.cxx pslCompiler.cxx pslDump.cxx pslExpression.cxx pslLocal.h pslProgram.cxx pslSymbols.cxx pslToken.cxx Added Files: pslContext.cxx pslContext.h pslParser.h pslSymbol.h Removed Files: pslRun.cxx Log Message: Forward references now work. All 'PSL_whatever' classes changed to pslWhatever to match PLIB conventions. --- NEW FILE: pslContext.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 For further information visit http://plib.sourceforge.net [...146 lines suppressed...] pc = code [ pc + 1 ] + ( code [ pc + 2 ] << 8 ) ; return PSL_PROGRAM_CONTINUE ; default : if ( ( code [ pc ] & 0xF0 ) == OPCODE_PUSH_VARIABLE ) { pushVariable ( variable [ code[pc] & 0x0F ] ) ; pc++ ; } else if ( ( code [ pc ] & 0xF0 ) == OPCODE_POP_VARIABLE ) { variable [ code[pc] & 0x0F ] = popVariable () ; pc++ ; } return PSL_PROGRAM_CONTINUE ; } } --- NEW FILE: pslContext.h --- class pslContext { pslOpcode *code ; pslExtension *extensions ; pslProgram *program ; pslVariable variable [ MAX_VARIABLE ] ; pslVariable stack [ MAX_STACK ] ; int sp ; pslAddress pc ; public: pslContext ( pslProgram *p ) { code = p -> getCode () ; extensions = p -> getExtensions () ; program = p ; reset () ; } ~pslContext () {} ; void pushInt ( int x ) { stack [ sp++ ] . i = x ; } void pushFloat ( float x ) { stack [ sp++ ] . f = x ; } void pushVariable ( pslVariable x ) { stack [ sp++ ] = x ; } void popVoid () { --sp ; } int popInt () { return stack [ --sp ] . i ; } float popFloat () { return stack [ --sp ] . f ; } pslVariable popVariable () { return stack [ --sp ] ; } pslResult step () ; void reset () { memset ( variable, 0, MAX_VARIABLE * sizeof ( pslVariable ) ) ; sp = 0 ; pc = 0 ; } } ; --- NEW FILE: pslParser.h --- struct pslFwdRef { char *symbol ; pslAddress where ; void set ( const char *s, pslAddress w ) { symbol = new char [ strlen(s)+1 ] ; strcpy ( symbol, s ) ; where = w ; } pslAddress getWhere () { return where ; } int matches ( const char *s ) { return symbol != NULL && strcmp ( s, symbol ) == 0 ; [...125 lines suppressed...] for ( i = 0 ; i < MAX_SYMBOL ; i++ ) { delete symtab [ i ] . symbol ; symtab [ i ] . symbol = NULL ; delete code_symtab [ i ] . symbol ; code_symtab [ i ] . symbol = NULL ; delete forward_ref [ i ] . symbol ; forward_ref [ i ] . symbol = NULL ; } next_fwdref = 0 ; next_label = 0 ; next_code_symbol = 0 ; next_code = 0 ; next_var = 0 ; } void dump () const ; int parse ( const char *fname ) ; int parse ( FILE *fd ) ; } ; --- NEW FILE: pslSymbol.h --- class pslSymbol { public: char *symbol ; pslAddress address ; pslSymbol () { symbol = NULL ; address = 0 ; } void set ( const char *s, pslAddress v ) { symbol = new char [ strlen ( s ) + 1 ] ; strcpy ( symbol, s ) ; address = v ; } ~pslSymbol () { delete symbol ; } } ; Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.am 5 Sep 2002 15:40:28 -0000 1.3 +++ Makefile.am 6 Sep 2002 13:50:51 -0000 1.4 @@ -3,9 +3,10 @@ lib_LIBRARIES = libplibpsl.a -include_HEADERS = psl.h pslLocal.h +include_HEADERS = psl.h pslContext.h pslLocal.h \ + pslParser.h pslSymbol.h -libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslRun.cxx \ +libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslContext.cxx \ pslCompiler.cxx pslSymbols.cxx pslToken.cxx \ pslExpression.cxx pslProgram.cxx pslDump.cxx Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- psl.h 5 Sep 2002 23:23:59 -0000 1.5 +++ psl.h 6 Sep 2002 13:50:51 -0000 1.6 @@ -24,7 +24,7 @@ #include <stdio.h> -enum PSL_Result +enum pslResult { PSL_PROGRAM_END, PSL_PROGRAM_PAUSE, @@ -32,49 +32,49 @@ } ; -typedef unsigned char PSL_Opcode ; -class PSL_Context ; -class PSL_Parser ; -class PSL_Program ; +typedef unsigned char pslOpcode ; +class pslContext ; +class pslParser ; +class pslProgram ; -union PSL_Variable +union pslVariable { float f ; int i ; } ; -class PSL_Extension +class pslExtension { public: const char *symbol ; int argc ; - PSL_Variable (*func) ( int, PSL_Variable *, PSL_Program *p ) ; + pslVariable (*func) ( int, pslVariable *, pslProgram *p ) ; } ; -class PSL_Program +class pslProgram { - PSL_Opcode *code ; - PSL_Context *context ; - PSL_Parser *parser ; - PSL_Extension *extensions ; + pslOpcode *code ; + pslContext *context ; + pslParser *parser ; + pslExtension *extensions ; void *userData ; public: - PSL_Program ( PSL_Extension *ext ) ; - PSL_Program ( PSL_Program *src ) ; + pslProgram ( pslExtension *ext ) ; + pslProgram ( pslProgram *src ) ; - ~PSL_Program () ; + ~pslProgram () ; - PSL_Context *getContext () const { return context ; } - PSL_Opcode *getCode () const { return code ; } - PSL_Parser *getParser () const { return parser ; } - PSL_Extension *getExtensions () const { return extensions ; } + pslContext *getContext () const { return context ; } + pslOpcode *getCode () const { return code ; } + pslParser *getParser () const { return parser ; } + pslExtension *getExtensions () const { return extensions ; } void *getUserData () const { return userData ; } void setUserData ( void *ud ) { userData = ud ; } @@ -83,7 +83,7 @@ int parse ( const char *fname ) ; int parse ( FILE *fd ) ; void reset () ; - PSL_Result step () ; + pslResult step () ; } ; Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslCodeGen.cxx 5 Sep 2002 23:33:19 -0000 1.7 +++ pslCodeGen.cxx 6 Sep 2002 13:50:51 -0000 1.8 @@ -24,7 +24,7 @@ #include "pslLocal.h" -int PSL_Parser::parse ( const char *fname ) +int pslParser::parse ( const char *fname ) { init () ; @@ -44,28 +44,28 @@ } [...103 lines suppressed...] pushCodeByte ( OPCODE_JUMP_FALSE ) ; @@ -139,7 +140,7 @@ return res ; } -int PSL_Parser::pushJump ( int l ) +int pslParser::pushJump ( int l ) { pushCodeByte ( OPCODE_JUMP ) ; @@ -151,7 +152,7 @@ } -int PSL_Parser::pushPauseStatement() +int pslParser::pushPauseStatement() { pushCodeByte ( OPCODE_PAUSE ) ; return TRUE ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslCompiler.cxx 5 Sep 2002 23:33:19 -0000 1.5 +++ pslCompiler.cxx 6 Sep 2002 13:50:51 -0000 1.6 @@ -25,20 +25,20 @@ #include "pslLocal.h" -int PSL_Parser::pushReturnStatement () +int pslParser::pushReturnStatement () { char c [ MAX_TOKEN ] ; - PSL_GetToken ( c ) ; + pslGetToken ( c ) ; [...320 lines suppressed...] if ( c[0] != ')' ) { @@ -412,7 +409,7 @@ return FALSE ; } - PSL_GetToken ( c ) ; + pslGetToken ( c ) ; if ( c [ 0 ] != '{' ) ulSetError ( UL_WARNING, @@ -422,7 +419,7 @@ ulSetError ( UL_WARNING, "PSL: Missing '}' in function '%s'", fn ) ; - PSL_GetToken ( c ) ; + pslGetToken ( c ) ; /* If we fall off the end of the function, we still need a return value */ Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslDump.cxx 5 Sep 2002 23:23:59 -0000 1.5 +++ pslDump.cxx 6 Sep 2002 13:50:51 -0000 1.6 @@ -59,7 +59,7 @@ } ; -void PSL_Parser::print_opcode ( FILE *fd, unsigned char op ) const +void pslParser::print_opcode ( FILE *fd, unsigned char op ) const { if ( ( op & 0xF0 ) == OPCODE_PUSH_VARIABLE ) fprintf ( fd, " PUSH_VAR\t%s", symtab [ op & 0x0F ] . symbol ) ; @@ -76,7 +76,7 @@ } -void PSL_Parser::dump () const +void pslParser::dump () const { int i ; Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslExpression.cxx 5 Sep 2002 23:33:19 -0000 1.4 +++ pslExpression.cxx 6 Sep 2002 13:50:51 -0000 1.5 @@ -25,26 +25,26 @@ #include "pslLocal.h" -int PSL_Parser::pushPrimitive () +int pslParser::pushPrimitive () { char c [ MAX_TOKEN ] ; - PSL_GetToken ( c ) ; + pslGetToken ( c ) ; if ( c [ 0 ] == '(' ) [...138 lines suppressed...] else - PSL_UngetToken ( c2 ) ; + pslUngetToken ( c2 ) ; if (( c [ 0 ] == '!' || c [ 0 ] == '=' ) && c [ 1 ] != '=' ) { - PSL_UngetToken ( c2 ) ; + pslUngetToken ( c2 ) ; return TRUE ; } @@ -227,7 +227,7 @@ } -int PSL_Parser::pushExpression () +int pslParser::pushExpression () { return pushRelExpression () ; } Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslLocal.h 5 Sep 2002 23:33:19 -0000 1.7 +++ pslLocal.h 6 Sep 2002 13:50:51 -0000 1.8 @@ -78,9 +78,9 @@ /* Token Parser */ -void PSL_UngetToken ( const char *c ) ; -void PSL_GetToken ( char *c, FILE *fd = NULL ) ; -void PSL_SetDefaultFile ( FILE *fd ) ; +void pslUngetToken ( const char *c ) ; +void pslGetToken ( char *c, FILE *fd = NULL ) ; +void pslSetDefaultFile ( FILE *fd ) ; /* [...186 lines suppressed...] - for ( i = 0 ; i < MAX_SYMBOL ; i++ ) symtab [ i ] . symbol = NULL ; - for ( i = 0 ; i < MAX_SYMBOL ; i++ ) delete code_symtab [ i ] . symbol ; - for ( i = 0 ; i < MAX_SYMBOL ; i++ ) code_symtab [ i ] . symbol = NULL ; - - next_label = 0 ; - next_code_symbol = 0 ; - next_code = 0 ; - next_var = 0 ; - } +typedef unsigned short pslAddress ; - void dump () const ; - int parse ( const char *fname ) ; - int parse ( FILE *fd ) ; -} ; +#include "pslSymbol.h" +#include "pslContext.h" +#include "pslParser.h" Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslProgram.cxx 5 Sep 2002 23:24:00 -0000 1.3 +++ pslProgram.cxx 6 Sep 2002 13:50:51 -0000 1.4 @@ -24,33 +24,33 @@ #include "pslLocal.h" -PSL_Program::PSL_Program ( PSL_Extension *ext ) +pslProgram::pslProgram ( pslExtension *ext ) { - code = new PSL_Opcode [ MAX_CODE ] ; + code = new pslOpcode [ MAX_CODE ] ; extensions = ext ; - parser = new PSL_Parser ( code, ext ) ; - context = new PSL_Context ( this ) ; + parser = new pslParser ( code, ext ) ; + context = new pslContext ( this ) ; parser -> init () ; context -> reset () ; } -PSL_Program::PSL_Program ( PSL_Program *src ) +pslProgram::pslProgram ( pslProgram *src ) { code = src -> getCode () ; parser = src -> getParser () ; extensions = src -> getExtensions () ; userData = src -> getUserData () ; - context = new PSL_Context ( this ) ; + context = new pslContext ( this ) ; context -> reset () ; } -PSL_Program::~PSL_Program () +pslProgram::~pslProgram () { delete parser ; delete context ; @@ -58,16 +58,16 @@ } -void PSL_Program::dump () const { parser -> dump () ; } -void PSL_Program::reset () { context -> reset () ; } -PSL_Result PSL_Program::step () { return context -> step () ; } +void pslProgram::dump () const { parser -> dump () ; } +void pslProgram::reset () { context -> reset () ; } +pslResult pslProgram::step () { return context -> step () ; } -int PSL_Program::parse ( const char *fname ) +int pslProgram::parse ( const char *fname ) { return parser -> parse(fname) ; } -int PSL_Program::parse ( FILE *fd ) +int pslProgram::parse ( FILE *fd ) { return parser -> parse( fd ) ; } Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslSymbols.cxx 5 Sep 2002 23:24:00 -0000 1.7 +++ pslSymbols.cxx 6 Sep 2002 13:50:51 -0000 1.8 @@ -25,7 +25,7 @@ #include "pslLocal.h" -PSL_Address PSL_Parser::setVarSymbol ( const char *s ) +pslAddress pslParser::setVarSymbol ( const char *s ) { for ( int i = 0 ; i < next_var ; i++ ) if ( strcmp ( s, symtab [ i ] . symbol ) == 0 ) @@ -47,7 +47,7 @@ [...96 lines suppressed...] -void PSL_Parser::setCodeSymbol ( const char *s, PSL_Address v ) +void pslParser::setCodeSymbol ( const char *s, pslAddress v ) { 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 ) ; - code_symtab [ i ] . address = v ; return ; } @@ -101,6 +159,8 @@ } code_symtab [ next_code_symbol++ ] . set ( s, v ) ; + + fixup ( s, v ) ; } Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslToken.cxx 5 Sep 2002 23:33:19 -0000 1.5 +++ pslToken.cxx 6 Sep 2002 13:50:51 -0000 1.6 @@ -31,13 +31,13 @@ static int unget_stack_depth = 0 ; -void PSL_SetDefaultFile ( FILE *fd ) +void pslSetDefaultFile ( FILE *fd ) { defaultFile = fd ; } -void PSL_GetToken ( char *res, FILE *fd ) +void pslGetToken ( char *res, FILE *fd ) { if ( unget_stack_depth > 0 ) { @@ -89,7 +89,7 @@ } -void PSL_UngetToken ( const char *s ) +void pslUngetToken ( const char *s ) { if ( unget_stack_depth >= MAX_UNGET-1 ) { --- pslRun.cxx DELETED --- |
From: Steve B. <sj...@us...> - 2002-09-06 13:50:54
|
Update of /cvsroot/plib/plib/examples/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv26019/plib/examples/src/psl Modified Files: psl_demo.cxx Log Message: Forward references now work. All 'PSL_whatever' classes changed to pslWhatever to match PLIB conventions. Index: psl_demo.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/psl_demo.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- psl_demo.cxx 5 Sep 2002 22:23:36 -0000 1.6 +++ psl_demo.cxx 6 Sep 2002 13:50:51 -0000 1.7 @@ -32,18 +32,18 @@ #include <plib/psl.h> -PSL_Variable hello ( int argc, PSL_Variable *argv, PSL_Program *p ) +pslVariable hello ( int argc, pslVariable *argv, pslProgram *p ) { printf ( "I am %s.\n", (char *)( p->getUserData ()) ) ; - PSL_Variable ret ; + pslVariable ret ; ret.f = 0.0f ; return ret ; } -PSL_Extension extensions [] = +pslExtension extensions [] = { { "hello", 0, hello }, { NULL, 0, NULL } @@ -54,14 +54,14 @@ { /* Create program 1 and compile it. */ - PSL_Program *prog_1 = new PSL_Program ( extensions ) ; + pslProgram *prog_1 = new pslProgram ( extensions ) ; prog_1 -> parse ( "data/test.psl" ) ; prog_1 -> dump () ; /* Clone program 2 from program 1 */ - PSL_Program *prog_2 = new PSL_Program ( prog_1 ) ; + pslProgram *prog_2 = new pslProgram ( prog_1 ) ; /* Make them unique by assigning user data to them */ |
From: Sebastian U. <ud...@us...> - 2002-09-05 23:33:22
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv8193 Modified Files: pslCodeGen.cxx pslCompiler.cxx pslExpression.cxx pslLocal.h pslToken.cxx Log Message: Removed some global namespace pollution from PSL Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pslCodeGen.cxx 5 Sep 2002 23:23:59 -0000 1.6 +++ pslCodeGen.cxx 5 Sep 2002 23:33:19 -0000 1.7 @@ -46,7 +46,7 @@ int PSL_Parser::parse ( FILE *fd ) { - setDefaultFile ( fd ) ; + PSL_SetDefaultFile ( fd ) ; pushProgram () ; return TRUE ; } Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslCompiler.cxx 5 Sep 2002 23:23:59 -0000 1.4 +++ pslCompiler.cxx 5 Sep 2002 23:33:19 -0000 1.5 @@ -29,16 +29,16 @@ { char c [ MAX_TOKEN ] ; - getToken ( c ) ; + PSL_GetToken ( c ) ; if ( c [ 0 ] == ';' ) /* Return without data == "return 0" */ { - ungetToken ( c ) ; + PSL_UngetToken ( c ) ; pushConstant ( "0.0" ) ; [...219 lines suppressed...] if ( c[0] != ')' ) { @@ -412,7 +412,7 @@ return FALSE ; } - getToken ( c ) ; + PSL_GetToken ( c ) ; if ( c [ 0 ] != '{' ) ulSetError ( UL_WARNING, @@ -422,7 +422,7 @@ ulSetError ( UL_WARNING, "PSL: Missing '}' in function '%s'", fn ) ; - getToken ( c ) ; + PSL_GetToken ( c ) ; /* If we fall off the end of the function, we still need a return value */ Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslExpression.cxx 5 Sep 2002 22:22:38 -0000 1.3 +++ pslExpression.cxx 5 Sep 2002 23:33:19 -0000 1.4 @@ -28,23 +28,23 @@ int PSL_Parser::pushPrimitive () { char c [ MAX_TOKEN ] ; - getToken ( c ) ; + PSL_GetToken ( c ) ; if ( c [ 0 ] == '(' ) { if ( ! pushExpression () ) { ulSetError ( UL_WARNING, "PSL: Missing expression after '('" ) ; [...100 lines suppressed...] - getToken ( c2 ) ; + PSL_GetToken ( c2 ) ; if ( c2 [ 0 ] == '=' ) { @@ -192,11 +192,11 @@ c[2] = '\0' ; } else - ungetToken ( c2 ) ; + PSL_UngetToken ( c2 ) ; if (( c [ 0 ] == '!' || c [ 0 ] == '=' ) && c [ 1 ] != '=' ) { - ungetToken ( c2 ) ; + PSL_UngetToken ( c2 ) ; return TRUE ; } Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pslLocal.h 5 Sep 2002 23:23:59 -0000 1.6 +++ pslLocal.h 5 Sep 2002 23:33:19 -0000 1.7 @@ -78,9 +78,9 @@ /* Token Parser */ -void ungetToken ( const char *c ) ; -void getToken ( char *c, FILE *fd = NULL ) ; -void setDefaultFile ( FILE *fd ) ; +void PSL_UngetToken ( const char *c ) ; +void PSL_GetToken ( char *c, FILE *fd = NULL ) ; +void PSL_SetDefaultFile ( FILE *fd ) ; /* Address/Opcodes are: Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslToken.cxx 5 Sep 2002 22:38:22 -0000 1.4 +++ pslToken.cxx 5 Sep 2002 23:33:19 -0000 1.5 @@ -31,13 +31,13 @@ static int unget_stack_depth = 0 ; -void setDefaultFile ( FILE *fd ) +void PSL_SetDefaultFile ( FILE *fd ) { defaultFile = fd ; } -void getToken ( char *res, FILE *fd ) +void PSL_GetToken ( char *res, FILE *fd ) { if ( unget_stack_depth > 0 ) { @@ -89,7 +89,7 @@ } -void ungetToken ( const char *s ) +void PSL_UngetToken ( const char *s ) { if ( unget_stack_depth >= MAX_UNGET-1 ) { |
From: Sebastian U. <ud...@us...> - 2002-09-05 23:24:05
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv3919 Modified Files: psl.h pslCodeGen.cxx pslCompiler.cxx pslDump.cxx pslLocal.h pslProgram.cxx pslSymbols.cxx Log Message: Made PSL const-correct Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- psl.h 5 Sep 2002 22:22:38 -0000 1.4 +++ psl.h 5 Sep 2002 23:23:59 -0000 1.5 @@ -48,7 +48,7 @@ class PSL_Extension { public: - char *symbol ; + const char *symbol ; int argc ; PSL_Variable (*func) ( int, PSL_Variable *, PSL_Program *p ) ; } ; @@ -71,17 +71,17 @@ ~PSL_Program () ; - PSL_Context *getContext () { return context ; } - PSL_Opcode *getCode () { return code ; } - PSL_Parser *getParser () { return parser ; } - PSL_Extension *getExtensions () { return extensions ; } + PSL_Context *getContext () const { return context ; } + PSL_Opcode *getCode () const { return code ; } + PSL_Parser *getParser () const { return parser ; } + PSL_Extension *getExtensions () const { return extensions ; } - void *getUserData () { return userData ; } + void *getUserData () const { return userData ; } void setUserData ( void *ud ) { userData = ud ; } - void dump () ; - int parse ( char *fname ) ; - int parse ( FILE *fd ) ; + void dump () const ; + int parse ( const char *fname ) ; + int parse ( FILE *fd ) ; void reset () ; PSL_Result step () ; } ; Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslCodeGen.cxx 5 Sep 2002 22:38:22 -0000 1.5 +++ pslCodeGen.cxx 5 Sep 2002 23:23:59 -0000 1.6 @@ -24,7 +24,7 @@ #include "pslLocal.h" -int PSL_Parser::parse ( char *fname ) +int PSL_Parser::parse ( const char *fname ) { init () ; @@ -77,14 +77,14 @@ pushCodeByte ( ff [ 3 ] ) ; } -void PSL_Parser::pushVariable ( char *c ) +void PSL_Parser::pushVariable ( const char *c ) { int a = getVarSymbol ( c ) ; pushCodeByte ( OPCODE_PUSH_VARIABLE | a ) ; } -void PSL_Parser::pushAssignment ( char *c ) +void PSL_Parser::pushAssignment ( const char *c ) { int a = getVarSymbol ( c ) ; @@ -92,7 +92,7 @@ } -void PSL_Parser::pushCall ( char *c, int argc ) +void PSL_Parser::pushCall ( const char *c, int argc ) { int ext = getExtensionSymbol ( c ) ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslCompiler.cxx 5 Sep 2002 22:22:38 -0000 1.3 +++ pslCompiler.cxx 5 Sep 2002 23:23:59 -0000 1.4 @@ -132,7 +132,7 @@ } -int PSL_Parser::pushFunctionCall ( char *var ) +int PSL_Parser::pushFunctionCall ( const char *var ) { char c [ MAX_TOKEN ] ; @@ -179,7 +179,7 @@ } -int PSL_Parser::pushAssignmentStatement ( char *var ) +int PSL_Parser::pushAssignmentStatement ( const char *var ) { char c [ MAX_TOKEN ] ; @@ -317,7 +317,7 @@ -int PSL_Parser::pushGlobalVariableDeclaration ( char *s ) +int PSL_Parser::pushGlobalVariableDeclaration ( const char *s ) { char c [ MAX_TOKEN ] ; @@ -388,7 +388,7 @@ } -int PSL_Parser::pushFunctionDeclaration ( char *fn ) +int PSL_Parser::pushFunctionDeclaration ( const char *fn ) { char c [ MAX_TOKEN ] ; Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslDump.cxx 5 Sep 2002 22:38:22 -0000 1.4 +++ pslDump.cxx 5 Sep 2002 23:23:59 -0000 1.5 @@ -33,7 +33,7 @@ -OpcodeDecode opcodeDecode [] = +static const OpcodeDecode opcodeDecode [] = { { "PUSH_CONSTANT", OPCODE_PUSH_CONSTANT }, { "CALL", OPCODE_CALL }, @@ -59,7 +59,7 @@ } ; -void PSL_Parser::print_opcode ( FILE *fd, unsigned char op ) +void PSL_Parser::print_opcode ( FILE *fd, unsigned char op ) const { if ( ( op & 0xF0 ) == OPCODE_PUSH_VARIABLE ) fprintf ( fd, " PUSH_VAR\t%s", symtab [ op & 0x0F ] . symbol ) ; @@ -76,7 +76,7 @@ } -void PSL_Parser::dump () +void PSL_Parser::dump () const { int i ; Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslLocal.h 5 Sep 2002 22:38:22 -0000 1.5 +++ pslLocal.h 5 Sep 2002 23:23:59 -0000 1.6 @@ -184,9 +184,9 @@ int pushJump ( int l ) ; void pushConstant ( const char *c ) ; - void pushVariable ( char *c ) ; - void pushAssignment ( char *c ) ; - void pushCall ( char *c, int argc ) ; + void pushVariable ( const char *c ) ; + void pushAssignment ( const char *c ) ; + void pushCall ( const char *c, int argc ) ; void pushReturn () ; /* Higher level parsers. */ @@ -203,27 +203,27 @@ int pushPauseStatement () ; int pushWhileStatement () ; int pushIfStatement () ; - int pushFunctionCall ( char *c ) ; - int pushAssignmentStatement ( char *c ) ; + int pushFunctionCall ( const char *c ) ; + int pushAssignmentStatement ( const char *c ) ; int pushCompoundStatement () ; int pushStatement () ; - int pushFunctionDeclaration ( char *fn ) ; + int pushFunctionDeclaration ( const char *fn ) ; int pushLocalVariableDeclaration () ; - int pushGlobalVariableDeclaration ( char *fn ) ; + int pushGlobalVariableDeclaration ( const char *fn ) ; int pushStaticVariableDeclaration () ; int pushGlobalDeclaration () ; void pushProgram () ; - void print_opcode ( FILE *fd, unsigned char op ) ; + void print_opcode ( FILE *fd, unsigned char op ) const ; - PSL_Address getVarSymbol ( char *s ) ; - PSL_Address setVarSymbol ( char *s ) ; + PSL_Address getVarSymbol ( const char *s ) ; + PSL_Address setVarSymbol ( const char *s ) ; PSL_Address getCodeSymbol ( const char *s ) ; void setCodeSymbol ( const char *s, PSL_Address v ) ; - int getExtensionSymbol ( char *s ) ; + int getExtensionSymbol ( const char *s ) ; private: @@ -264,7 +264,7 @@ } } - PSL_Extension *getExtensions () { return extensions ; } + PSL_Extension *getExtensions () const { return extensions ; } void init () { @@ -282,8 +282,8 @@ next_var = 0 ; } - void dump () ; - int parse ( char *fname ) ; + void dump () const ; + int parse ( const char *fname ) ; int parse ( FILE *fd ) ; } ; Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslProgram.cxx 5 Sep 2002 22:22:38 -0000 1.2 +++ pslProgram.cxx 5 Sep 2002 23:24:00 -0000 1.3 @@ -58,10 +58,17 @@ } -void PSL_Program::dump () { parser -> dump () ; } -int PSL_Program::parse ( char *fname ){ return parser -> parse(fname) ; } -int PSL_Program::parse ( FILE *fd ) { return parser -> parse( fd ) ; } +void PSL_Program::dump () const { parser -> dump () ; } +void PSL_Program::reset () { context -> reset () ; } +PSL_Result PSL_Program::step () { return context -> step () ; } -void PSL_Program::reset () { context -> reset () ; } -PSL_Result PSL_Program::step () { return context -> step () ; } +int PSL_Program::parse ( const char *fname ) +{ + return parser -> parse(fname) ; +} + +int PSL_Program::parse ( FILE *fd ) +{ + return parser -> parse( fd ) ; +} Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pslSymbols.cxx 5 Sep 2002 22:38:22 -0000 1.6 +++ pslSymbols.cxx 5 Sep 2002 23:24:00 -0000 1.7 @@ -25,7 +25,7 @@ #include "pslLocal.h" -PSL_Address PSL_Parser::setVarSymbol ( char *s ) +PSL_Address PSL_Parser::setVarSymbol ( const char *s ) { for ( int i = 0 ; i < next_var ; i++ ) if ( strcmp ( s, symtab [ i ] . symbol ) == 0 ) @@ -47,7 +47,7 @@ -PSL_Address PSL_Parser::getVarSymbol ( char *s ) +PSL_Address PSL_Parser::getVarSymbol ( const char *s ) { for ( int i = 0 ; i < next_var ; i++ ) if ( strcmp ( s, symtab [ i ] . symbol ) == 0 ) @@ -59,7 +59,7 @@ } -int PSL_Parser::getExtensionSymbol ( char *s ) +int PSL_Parser::getExtensionSymbol ( const char *s ) { for ( int i = 0 ; extensions [ i ] . symbol != NULL ; i++ ) if ( strcmp ( s, extensions [ i ] . symbol ) == 0 ) |
From: Sebastian U. <ud...@us...> - 2002-09-05 22:38:25
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv15585 Modified Files: pslCodeGen.cxx pslDump.cxx pslLocal.h pslSymbols.cxx pslToken.cxx Log Message: Solved some compiler warnings Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslCodeGen.cxx 5 Sep 2002 22:22:38 -0000 1.4 +++ pslCodeGen.cxx 5 Sep 2002 22:38:22 -0000 1.5 @@ -65,7 +65,7 @@ } -void PSL_Parser::pushConstant ( char *c ) +void PSL_Parser::pushConstant ( const char *c ) { float f = atof ( c ) ; char *ff = (char *) & f ; Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslDump.cxx 5 Sep 2002 22:22:38 -0000 1.3 +++ pslDump.cxx 5 Sep 2002 22:38:22 -0000 1.4 @@ -27,7 +27,7 @@ struct OpcodeDecode { - char *s ; + const char *s ; unsigned char opcode ; } ; Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslLocal.h 5 Sep 2002 22:22:38 -0000 1.4 +++ pslLocal.h 5 Sep 2002 22:38:22 -0000 1.5 @@ -78,7 +78,7 @@ /* Token Parser */ -void ungetToken ( char *c ) ; +void ungetToken ( const char *c ) ; void getToken ( char *c, FILE *fd = NULL ) ; void setDefaultFile ( FILE *fd ) ; @@ -106,7 +106,7 @@ address = 0 ; } - void set ( char *s, PSL_Address v ) + void set ( const char *s, PSL_Address v ) { symbol = new char [ strlen ( s ) + 1 ] ; strcpy ( symbol, s ) ; @@ -183,7 +183,7 @@ int pushJumpIfFalse ( int l ) ; int pushJump ( int l ) ; - void pushConstant ( char *c ) ; + void pushConstant ( const char *c ) ; void pushVariable ( char *c ) ; void pushAssignment ( char *c ) ; void pushCall ( char *c, int argc ) ; @@ -221,8 +221,8 @@ PSL_Address getVarSymbol ( char *s ) ; PSL_Address setVarSymbol ( char *s ) ; - PSL_Address getCodeSymbol ( char *s ) ; - void setCodeSymbol ( char *s, PSL_Address v ) ; + PSL_Address getCodeSymbol ( const char *s ) ; + void setCodeSymbol ( const char *s, PSL_Address v ) ; int getExtensionSymbol ( char *s ) ; private: Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslSymbols.cxx 5 Sep 2002 22:22:38 -0000 1.5 +++ pslSymbols.cxx 5 Sep 2002 22:38:22 -0000 1.6 @@ -69,7 +69,7 @@ } -PSL_Address PSL_Parser::getCodeSymbol ( char *s ) +PSL_Address PSL_Parser::getCodeSymbol ( const char *s ) { for ( int i = 0 ; i < next_code_symbol ; i++ ) if ( strcmp ( s, code_symtab [ i ] . symbol ) == 0 ) @@ -84,7 +84,7 @@ -void PSL_Parser::setCodeSymbol ( char *s, PSL_Address v ) +void PSL_Parser::setCodeSymbol ( const char *s, PSL_Address v ) { for ( int i = 0 ; i < next_code_symbol ; i++ ) if ( strcmp ( s, code_symtab [ i ] . symbol ) == 0 ) Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslToken.cxx 5 Sep 2002 22:22:38 -0000 1.3 +++ pslToken.cxx 5 Sep 2002 22:38:22 -0000 1.4 @@ -89,7 +89,7 @@ } -void ungetToken ( char *s ) +void ungetToken ( const char *s ) { if ( unget_stack_depth >= MAX_UNGET-1 ) { |
From: Sebastian U. <ud...@us...> - 2002-09-05 22:23:39
|
Update of /cvsroot/plib/plib/examples/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv10541 Modified Files: psl_demo.cxx Log Message: Added copyright notices and copying permission statement Index: psl_demo.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/psl_demo.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- psl_demo.cxx 5 Sep 2002 21:15:53 -0000 1.5 +++ psl_demo.cxx 5 Sep 2002 22:23:36 -0000 1.6 @@ -1,3 +1,26 @@ +/* + PLIB - A Suite of Portable Game Libraries + Copyright (C) 2001 Steve Baker + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; 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$ +*/ + #include <stdio.h> #include <stdlib.h> |
From: Sebastian U. <ud...@us...> - 2002-09-05 22:22:42
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv10219 Modified Files: psl.cxx psl.h pslCodeGen.cxx pslCompiler.cxx pslDump.cxx pslExpression.cxx pslLocal.h pslProgram.cxx pslRun.cxx pslSymbols.cxx pslToken.cxx Log Message: Added copyright notices and copying permission statement Index: psl.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- psl.cxx 5 Sep 2002 14:58:57 -0000 1.2 +++ psl.cxx 5 Sep 2002 22:22:38 -0000 1.3 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include "pslLocal.h" Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- psl.h 5 Sep 2002 14:58:57 -0000 1.3 +++ psl.h 5 Sep 2002 22:22:38 -0000 1.4 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include <stdio.h> Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslCodeGen.cxx 5 Sep 2002 16:03:32 -0000 1.3 +++ pslCodeGen.cxx 5 Sep 2002 22:22:38 -0000 1.4 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include "pslLocal.h" Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslCompiler.cxx 5 Sep 2002 16:03:32 -0000 1.2 +++ pslCompiler.cxx 5 Sep 2002 22:22:38 -0000 1.3 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include "pslLocal.h" Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslDump.cxx 5 Sep 2002 15:40:28 -0000 1.2 +++ pslDump.cxx 5 Sep 2002 22:22:38 -0000 1.3 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include "pslLocal.h" Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslExpression.cxx 5 Sep 2002 14:58:57 -0000 1.2 +++ pslExpression.cxx 5 Sep 2002 22:22:38 -0000 1.3 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include "pslLocal.h" Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslLocal.h 5 Sep 2002 16:03:33 -0000 1.3 +++ pslLocal.h 5 Sep 2002 22:22:38 -0000 1.4 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include <stdio.h> #include <stdlib.h> Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslProgram.cxx 5 Sep 2002 19:09:00 -0000 1.1 +++ pslProgram.cxx 5 Sep 2002 22:22:38 -0000 1.2 @@ -1,3 +1,25 @@ +/* + 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$ +*/ #include "pslLocal.h" Index: pslRun.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslRun.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslRun.cxx 5 Sep 2002 14:58:57 -0000 1.3 +++ pslRun.cxx 5 Sep 2002 22:22:38 -0000 1.4 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include "pslLocal.h" Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslSymbols.cxx 5 Sep 2002 16:03:33 -0000 1.4 +++ pslSymbols.cxx 5 Sep 2002 22:22:38 -0000 1.5 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include "pslLocal.h" Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslToken.cxx 5 Sep 2002 14:58:57 -0000 1.2 +++ pslToken.cxx 5 Sep 2002 22:22:38 -0000 1.3 @@ -1,3 +1,26 @@ +/* + 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$ +*/ + #include "pslLocal.h" |
From: Sebastian U. <ud...@us...> - 2002-09-05 21:15:56
|
Update of /cvsroot/plib/plib/examples/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv15793 Modified Files: psl_demo.cxx Log Message: Fix for WIN32 compatibility Index: psl_demo.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/psl_demo.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- psl_demo.cxx 5 Sep 2002 14:58:56 -0000 1.4 +++ psl_demo.cxx 5 Sep 2002 21:15:53 -0000 1.5 @@ -1,7 +1,11 @@ #include <stdio.h> #include <stdlib.h> -#include <unistd.h> +#ifdef WIN32 +# include <windows.h> +#else +# include <unistd.h> +#endif #include <plib/psl.h> |
From: Sebastian U. <ud...@us...> - 2002-09-05 21:12:16
|
Update of /cvsroot/plib/plib/examples In directory usw-pr-cvs1:/tmp/cvs-serv14520 Modified Files: plib_examples.dsw Log Message: Added MSVC project file for psl_demo Index: plib_examples.dsw =================================================================== RCS file: /cvsroot/plib/plib/examples/plib_examples.dsw,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- plib_examples.dsw 11 Aug 2002 18:20:37 -0000 1.21 +++ plib_examples.dsw 5 Sep 2002 21:12:11 -0000 1.22 @@ -194,6 +194,9 @@ Begin Project Dependency Project_Dep_Name dynamics End Project Dependency + Begin Project Dependency + Project_Dep_Name psl_demo + End Project Dependency }}} ############################################################################### @@ -379,6 +382,18 @@ ############################################################################### Project: "dynamics"=.\src\ssg\dynamics\dynamics.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "psl_demo"=.\src\psl\psl_demo.dsp - Package Owner=<4> Package=<5> {{{ |
From: Sebastian U. <ud...@us...> - 2002-09-05 21:11:58
|
Update of /cvsroot/plib/plib/examples/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv14428/src/pui Modified Files: PointPicker.dsp Log Message: Added MSVC project file for psl_demo Index: PointPicker.dsp =================================================================== RCS file: /cvsroot/plib/plib/examples/src/pui/PointPicker.dsp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- PointPicker.dsp 25 Aug 2002 15:36:45 -0000 1.9 +++ PointPicker.dsp 5 Sep 2002 21:11:56 -0000 1.10 @@ -56,8 +56,8 @@ # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PointPicker___Win32_Debug" -# PROP BASE Intermediate_Dir "PointPicker___Win32_Debug" +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 |
From: Sebastian U. <ud...@us...> - 2002-09-05 21:11:58
|
Update of /cvsroot/plib/plib/examples/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv14428/src/psl Added Files: psl_demo.dsp Log Message: Added MSVC project file for psl_demo --- NEW FILE: psl_demo.dsp --- # Microsoft Developer Studio Project File - Name="psl_demo" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=psl_demo - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "psl_demo.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "psl_demo.mak" CFG="psl_demo - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "psl_demo - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "psl_demo - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "psl_demo" # PROP Scc_LocalPath "." CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "psl_demo - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib psl.lib ul.lib /nologo /subsystem:console /machine:I386 /out:"psl_demo.exe" /libpath:"..\..\..\..\plib" !ELSEIF "$(CFG)" == "psl_demo - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib psl_d.lib ul_d.lib /nologo /subsystem:console /debug /machine:I386 /out:"psl_demo.exe" /pdbtype:sept /libpath:"..\..\..\..\plib" !ENDIF # Begin Target # Name "psl_demo - Win32 Release" # Name "psl_demo - Win32 Debug" # Begin Source File SOURCE=.\psl_demo.cxx # End Source File # End Target # End Project |
From: Sebastian U. <ud...@us...> - 2002-09-05 20:59:08
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv8985 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.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- psl.dsp 5 Sep 2002 12:05:40 -0000 1.1 +++ psl.dsp 5 Sep 2002 20:59:05 -0000 1.2 @@ -98,10 +98,18 @@ # End Source File # Begin Source File +SOURCE=.\pslCompiler.cxx +# End Source File +# Begin Source File + SOURCE=.\psl.cxx # End Source File # Begin Source File +SOURCE=.\pslDump.cxx +# End Source File +# Begin Source File + SOURCE=.\pslExpression.cxx # End Source File # Begin Source File @@ -110,11 +118,15 @@ # End Source File # Begin Source File -SOURCE=.\pslRun.cxx +SOURCE=.\pslLocal.h # End Source File # Begin Source File -SOURCE=.\pslStatement.cxx +SOURCE=.\pslProgram.cxx +# End Source File +# Begin Source File + +SOURCE=.\pslRun.cxx # End Source File # Begin Source File |
From: Sebastian U. <ud...@us...> - 2002-09-05 20:50:23
|
Update of /cvsroot/plib/plib In directory usw-pr-cvs1:/tmp/cvs-serv5884 Modified Files: plib.dsw Log Message: Added PSL MSVC project file Index: plib.dsw =================================================================== RCS file: /cvsroot/plib/plib/plib.dsw,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- plib.dsw 22 Jun 2001 22:50:49 -0000 1.11 +++ plib.dsw 5 Sep 2002 20:50:20 -0000 1.12 @@ -79,6 +79,9 @@ Project_Dep_Name ssg End Project Dependency Begin Project Dependency + Project_Dep_Name psl + End Project Dependency + Begin Project Dependency Project_Dep_Name pui End Project Dependency Begin Project Dependency @@ -94,6 +97,22 @@ ############################################################################### +Project: "psl"=.\src\psl\psl.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + psl + .\src\psl + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "pui"=.\src\pui\pui.dsp - Package Owner=<4> Package=<5> @@ -106,9 +125,6 @@ Package=<4> {{{ - Begin Project Dependency - Project_Dep_Name sg - End Project Dependency }}} ############################################################################### |
From: Sebastian U. <ud...@us...> - 2002-09-05 20:50:14
|
Update of /cvsroot/plib/plib/src/sl In directory usw-pr-cvs1:/tmp/cvs-serv5815/src/sl Modified Files: sl.dsp Log Message: Added PSL MSVC project file Index: sl.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/sl/sl.dsp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- sl.dsp 31 Aug 2002 21:03:11 -0000 1.14 +++ sl.dsp 5 Sep 2002 20:50:09 -0000 1.15 @@ -61,8 +61,8 @@ # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "sl___Win32_Debug" -# PROP BASE Intermediate_Dir "sl___Win32_Debug" +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 |
From: Sebastian U. <ud...@us...> - 2002-09-05 20:50:14
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv5815/src/sg Modified Files: sg.dsp Log Message: Added PSL MSVC project file Index: sg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.dsp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- sg.dsp 25 Aug 2002 12:04:54 -0000 1.13 +++ sg.dsp 5 Sep 2002 20:50:09 -0000 1.14 @@ -61,8 +61,8 @@ # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "sg___Win32_Debug" -# PROP BASE Intermediate_Dir "sg___Win32_Debug" +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 |
From: Steve B. <sj...@us...> - 2002-09-05 19:09:06
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv32314/plib/src/psl Added Files: pslProgram.cxx Log Message: Ooops! Forgot to ciommit this. --- NEW FILE: pslProgram.cxx --- #include "pslLocal.h" PSL_Program::PSL_Program ( PSL_Extension *ext ) { code = new PSL_Opcode [ MAX_CODE ] ; extensions = ext ; parser = new PSL_Parser ( code, ext ) ; context = new PSL_Context ( this ) ; parser -> init () ; context -> reset () ; } PSL_Program::PSL_Program ( PSL_Program *src ) { code = src -> getCode () ; parser = src -> getParser () ; extensions = src -> getExtensions () ; userData = src -> getUserData () ; context = new PSL_Context ( this ) ; context -> reset () ; } PSL_Program::~PSL_Program () { delete parser ; delete context ; delete [] code ; } void PSL_Program::dump () { parser -> dump () ; } int PSL_Program::parse ( char *fname ){ return parser -> parse(fname) ; } int PSL_Program::parse ( FILE *fd ) { return parser -> parse( fd ) ; } void PSL_Program::reset () { context -> reset () ; } PSL_Result PSL_Program::step () { return context -> step () ; } |
From: Steve B. <sj...@us...> - 2002-09-05 16:03:39
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv31317/plib/src/psl Modified Files: pslCodeGen.cxx pslCompiler.cxx pslLocal.h pslSymbols.cxx Log Message: Fixed forward jumps. Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslCodeGen.cxx 5 Sep 2002 14:58:57 -0000 1.2 +++ pslCodeGen.cxx 5 Sep 2002 16:03:32 -0000 1.3 @@ -105,28 +105,24 @@ void PSL_Parser::pushNotEqual () { pushCodeByte ( OPCODE_NOTEQUAL ) ; } void PSL_Parser::pushEqual () { pushCodeByte ( OPCODE_EQUAL ) ; } -int PSL_Parser::pushJumpIfFalse ( char *c ) +int PSL_Parser::pushJumpIfFalse ( int l ) { - int a = getCodeSymbol ( c ) ; - pushCodeByte ( OPCODE_JUMP_FALSE ) ; int res = next_code ; - pushCodeAddr ( a ) ; + pushCodeAddr ( l ) ; return res ; } -int PSL_Parser::pushJump ( char *c ) +int PSL_Parser::pushJump ( int l ) { - int a = getCodeSymbol ( c ) ; - pushCodeByte ( OPCODE_JUMP ) ; int res = next_code ; - pushCodeAddr ( a ) ; + pushCodeAddr ( l ) ; return res ; } Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslCompiler.cxx 5 Sep 2002 15:40:28 -0000 1.1 +++ pslCompiler.cxx 5 Sep 2002 16:03:32 -0000 1.2 @@ -26,13 +26,10 @@ int PSL_Parser::pushWhileStatement () { - char lab1 [ 5 ] ; - char lab2 [ 5 ] ; /* Remember place to jump back to */ - sprintf ( lab1, "%d", next_label++ ) ; - setCodeSymbol ( lab1, next_code ) ; + int start_loc = next_code ; if ( ! pushExpression () ) { @@ -40,9 +37,7 @@ return FALSE ; } - sprintf ( lab2, "%d", next_label++ ) ; - - int label_loc = pushJumpIfFalse ( lab2 ) ; + int label_loc = pushJumpIfFalse ( 0 ) ; if ( ! pushStatement () ) { @@ -50,9 +45,7 @@ return FALSE ; } - pushJump ( lab1 ) ; - - setCodeSymbol ( lab2, next_code ) ; + pushJump ( start_loc ) ; code [ label_loc ] = next_code & 0xFF ; code [ label_loc+1 ] = ( next_code >> 8 ) & 0xFF ; @@ -62,19 +55,13 @@ int PSL_Parser::pushIfStatement () { - char lab1 [ 5 ] ; - char lab2 [ 5 ] ; - if ( ! pushExpression () ) { ulSetError ( UL_WARNING, "PSL: Missing expression for 'if'" ) ; return FALSE ; } - sprintf ( lab1, "%d", next_label++ ) ; - sprintf ( lab2, "%d", next_label++ ) ; - - int else_loc = pushJumpIfFalse ( lab1 ) ; + int else_loc = pushJumpIfFalse ( 0 ) ; if ( ! pushStatement () ) { @@ -96,8 +83,6 @@ if ( strcmp ( c, "else" ) != 0 ) { - setCodeSymbol ( lab1, next_code ) ; - code [ else_loc ] = next_code & 0xFF ; code [ else_loc+1 ] = ( next_code >> 8 ) & 0xFF ; @@ -106,9 +91,7 @@ return TRUE ; } - int label_loc = pushJump ( lab2 ) ; - - setCodeSymbol ( lab1, next_code ) ; + int label_loc = pushJump ( 0 ) ; code [ else_loc ] = next_code & 0xFF ; code [ else_loc+1 ] = ( next_code >> 8 ) & 0xFF ; @@ -118,8 +101,6 @@ ulSetError ( UL_WARNING, "PSL: Missing statement for 'else'" ) ; return FALSE ; } - - setCodeSymbol ( lab2, next_code ) ; code [ label_loc ] = next_code & 0xFF ; code [ label_loc+1 ] = ( next_code >> 8 ) & 0xFF ; Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslLocal.h 5 Sep 2002 15:30:35 -0000 1.2 +++ pslLocal.h 5 Sep 2002 16:03:33 -0000 1.3 @@ -157,8 +157,8 @@ void pushGreaterEqual () ; void pushNotEqual () ; void pushEqual () ; - int pushJumpIfFalse ( char *c ) ; - int pushJump ( char *c ) ; + int pushJumpIfFalse ( int l ) ; + int pushJump ( int l ) ; void pushConstant ( char *c ) ; void pushVariable ( char *c ) ; @@ -207,6 +207,7 @@ int next_var ; int next_label ; int next_code ; + int next_code_symbol ; PSL_Symbol symtab [ MAX_SYMBOL ] ; PSL_Symbol code_symtab [ MAX_SYMBOL ] ; @@ -253,6 +254,7 @@ for ( i = 0 ; i < MAX_SYMBOL ; i++ ) code_symtab [ i ] . symbol = NULL ; next_label = 0 ; + next_code_symbol = 0 ; next_code = 0 ; next_var = 0 ; } Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslSymbols.cxx 5 Sep 2002 15:30:35 -0000 1.3 +++ pslSymbols.cxx 5 Sep 2002 16:03:33 -0000 1.4 @@ -4,58 +4,35 @@ PSL_Address PSL_Parser::setVarSymbol ( char *s ) { - for ( int i = 0 ; i < MAX_SYMBOL ; i++ ) - { - if ( symtab [ i ] . symbol == NULL ) - { - if ( next_var >= MAX_VARIABLE-1 ) - { - ulSetError ( UL_WARNING, "PSL: Too many variables." ) ; - next_var-- ; [...95 lines suppressed...] + 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 ) ; code_symtab [ i ] . address = v ; return ; } + + if ( next_code_symbol >= MAX_VARIABLE-1 ) + { + ulSetError ( UL_WARNING, "PSL: Too many labels." ) ; + next_code_symbol-- ; } - ulSetError ( UL_WARNING, "PSL: Too many function names." ) ; + code_symtab [ next_code_symbol++ ] . set ( s, v ) ; } + |
From: Steve B. <sj...@us...> - 2002-09-05 15:40:31
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv18890/plib/src/psl Modified Files: Makefile.am pslDump.cxx Added Files: pslCompiler.cxx Removed Files: pslStatement.cxx Log Message: Change filename to be more meaningful. --- NEW FILE: pslCompiler.cxx --- #include "pslLocal.h" int PSL_Parser::pushReturnStatement () { char c [ MAX_TOKEN ] ; getToken ( c ) ; if ( c [ 0 ] == ';' ) /* Return without data == "return 0" */ { ungetToken ( c ) ; pushConstant ( "0.0" ) ; } else { ungetToken ( c ) ; pushExpression () ; [...392 lines suppressed...] if ( c [ 0 ] != '{' ) ulSetError ( UL_WARNING, "PSL: Missing '{' in function '%s'", fn ) ; if ( ! pushCompoundStatement () ) ulSetError ( UL_WARNING, "PSL: Missing '}' in function '%s'", fn ) ; getToken ( c ) ; /* If we fall off the end of the function, we still need a return value */ pushConstant ( "0.0" ) ; pushReturn () ; return TRUE ; } Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 5 Sep 2002 14:58:56 -0000 1.2 +++ Makefile.am 5 Sep 2002 15:40:28 -0000 1.3 @@ -6,7 +6,7 @@ include_HEADERS = psl.h pslLocal.h libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslRun.cxx \ - pslStatement.cxx pslSymbols.cxx pslToken.cxx \ + pslCompiler.cxx pslSymbols.cxx pslToken.cxx \ pslExpression.cxx pslProgram.cxx pslDump.cxx INCLUDES = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/util Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslDump.cxx 5 Sep 2002 14:58:57 -0000 1.1 +++ pslDump.cxx 5 Sep 2002 15:40:28 -0000 1.2 @@ -81,7 +81,7 @@ int ext = code[i+1] ; int argc = code[i+2] ; - printf ( "\t%s %d", extensions[ext].symbol, argc ) ; + printf ( "\t%s,nargs=%d", extensions[ext].symbol, argc ) ; i += 2 ; } else --- pslStatement.cxx DELETED --- |
From: Steve B. <sj...@us...> - 2002-09-05 15:40:31
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv18890/plib/examples/src/psl/data Modified Files: test.psl Log Message: Change filename to be more meaningful. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- test.psl 5 Sep 2002 15:30:35 -0000 1.3 +++ test.psl 5 Sep 2002 15:40:27 -0000 1.4 @@ -4,7 +4,7 @@ hello () ; } -float x ; +float x = 123.456 ; void main () { |
From: Steve B. <sj...@us...> - 2002-09-05 15:30:40
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv14996/plib/src/psl Modified Files: pslLocal.h pslStatement.cxx pslSymbols.cxx Log Message: Added global variable declarations. Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslLocal.h 5 Sep 2002 14:58:57 -0000 1.1 +++ pslLocal.h 5 Sep 2002 15:30:35 -0000 1.2 @@ -184,12 +184,20 @@ int pushAssignmentStatement ( char *c ) ; int pushCompoundStatement () ; int pushStatement () ; - int pushFunction () ; - void pushProgram () ; + + int pushFunctionDeclaration ( char *fn ) ; + int pushLocalVariableDeclaration () ; + int pushGlobalVariableDeclaration ( char *fn ) ; + int pushStaticVariableDeclaration () ; + + int pushGlobalDeclaration () ; + void pushProgram () ; void print_opcode ( FILE *fd, unsigned char op ) ; PSL_Address getVarSymbol ( char *s ) ; + PSL_Address setVarSymbol ( char *s ) ; + PSL_Address getCodeSymbol ( char *s ) ; void setCodeSymbol ( char *s, PSL_Address v ) ; int getExtensionSymbol ( char *s ) ; Index: pslStatement.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslStatement.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslStatement.cxx 5 Sep 2002 14:58:57 -0000 1.2 +++ pslStatement.cxx 5 Sep 2002 15:30:35 -0000 1.3 @@ -230,6 +230,12 @@ getToken ( c ) ; + if ( strcmp ( c, "static" ) == 0 ) + return pushStaticVariableDeclaration () ; + + if ( strcmp ( c, "float" ) == 0 ) + return pushLocalVariableDeclaration () ; + if ( strcmp ( c, "return" ) == 0 ) return pushReturnStatement () ; [...96 lines suppressed...] + "PSL: Expected a declaration of a variable or function - but got '%s'", c); + return FALSE ; +} + + +int PSL_Parser::pushFunctionDeclaration ( char *fn ) +{ + char c [ MAX_TOKEN ] ; + setCodeSymbol ( fn, next_code ) ; getToken ( c ) ; @@ -343,6 +424,7 @@ pushConstant ( "0.0" ) ; pushReturn () ; + return TRUE ; } Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslSymbols.cxx 5 Sep 2002 14:58:57 -0000 1.2 +++ pslSymbols.cxx 5 Sep 2002 15:30:35 -0000 1.3 @@ -2,12 +2,43 @@ #include "pslLocal.h" +PSL_Address PSL_Parser::setVarSymbol ( char *s ) +{ + for ( int i = 0 ; i < MAX_SYMBOL ; i++ ) + { + if ( symtab [ i ] . symbol == NULL ) + { + if ( next_var >= MAX_VARIABLE-1 ) + { + ulSetError ( UL_WARNING, "PSL: Too many variables." ) ; + next_var-- ; + } + + symtab [ i ] . set ( s, next_var++ ) ; + return symtab [ i ] . address ; + } + else + if ( strcmp ( s, symtab [ i ] . symbol ) == 0 ) + { + ulSetError ( UL_WARNING, "PSL: Multiple definition of '%s'.", s ) ; + return symtab [ i ] . address ; + } + } + + ulSetError ( UL_WARNING, "PSL: Too many variables." ) ; + return MAX_VARIABLE-1 ; +} + + + PSL_Address PSL_Parser::getVarSymbol ( char *s ) { for ( int i = 0 ; i < MAX_SYMBOL ; i++ ) { if ( symtab [ i ] . symbol == NULL ) { + ulSetError ( UL_WARNING, "PSL: Undefined symbol '%s'.", s ) ; + if ( next_var >= MAX_VARIABLE-1 ) { ulSetError ( UL_WARNING, "PSL: Too many variables." ) ; @@ -22,7 +53,8 @@ return symtab [ i ] . address ; } - ulSetError ( UL_WARNING, "PSL: Too many symbols." ) ; + ulSetError ( UL_WARNING, "PSL: Undefined symbol '%s'.", s ) ; + ulSetError ( UL_WARNING, "PSL: Too many variables." ) ; return MAX_VARIABLE-1 ; } |
From: Steve B. <sj...@us...> - 2002-09-05 15:30:38
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv14996/plib/examples/src/psl/data Modified Files: test.psl Log Message: Added global variable declarations. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test.psl 5 Sep 2002 14:58:56 -0000 1.2 +++ test.psl 5 Sep 2002 15:30:35 -0000 1.3 @@ -4,6 +4,8 @@ hello () ; } +float x ; + void main () { x = 0 ; |
From: Steve B. <sj...@us...> - 2002-09-05 14:59:00
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv1575/plib/src/psl Modified Files: Makefile.am psl.cxx psl.h pslCodeGen.cxx pslExpression.cxx pslRun.cxx pslStatement.cxx pslSymbols.cxx pslToken.cxx Added Files: pslDump.cxx pslLocal.h Log Message: Function calls now work. --- NEW FILE: pslDump.cxx --- #include "pslLocal.h" struct OpcodeDecode { char *s ; unsigned char opcode ; } ; OpcodeDecode opcodeDecode [] = { { "PUSH_CONSTANT", OPCODE_PUSH_CONSTANT }, { "CALL", OPCODE_CALL }, { "PAUSE", OPCODE_PAUSE }, { "JUMP_FALSE", OPCODE_JUMP_FALSE }, { "JUMP", OPCODE_JUMP }, [...120 lines suppressed...] printf ( "\n" ) ; printf ( "Labels:\n" ) ; for ( i = 0 ; i < MAX_SYMBOL ; i++ ) if ( code_symtab [ i ] . symbol != NULL ) { printf ( "\t%5s => %4d", code_symtab[i].symbol, code_symtab[i].address ) ; if ( i & 1 ) printf ( "\n" ) ; else printf ( " " ) ; } printf ( "\n" ) ; } --- NEW FILE: pslLocal.h --- #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "psl.h" #include "ul.h" #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif /* Limits */ #define MAX_ARGS 16 #define MAX_VARIABLE 16 #define MAX_LABEL 16 [...218 lines suppressed...] { int i ; for ( i = 0 ; i < MAX_CODE ; i++ ) code [ i ] = OPCODE_HALT ; for ( i = 0 ; i < MAX_SYMBOL ; i++ ) delete symtab [ i ] . symbol ; for ( i = 0 ; i < MAX_SYMBOL ; i++ ) symtab [ i ] . symbol = NULL ; for ( i = 0 ; i < MAX_SYMBOL ; i++ ) delete code_symtab [ i ] . symbol ; for ( i = 0 ; i < MAX_SYMBOL ; i++ ) code_symtab [ i ] . symbol = NULL ; next_label = 0 ; next_code = 0 ; next_var = 0 ; } void dump () ; int parse ( char *fname ) ; int parse ( FILE *fd ) ; } ; Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 5 Sep 2002 06:14:57 -0000 1.1 +++ Makefile.am 5 Sep 2002 14:58:56 -0000 1.2 @@ -3,11 +3,11 @@ lib_LIBRARIES = libplibpsl.a -include_HEADERS = psl.h pslPrivate.h +include_HEADERS = psl.h pslLocal.h libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslRun.cxx \ pslStatement.cxx pslSymbols.cxx pslToken.cxx \ - pslExpression.cxx pslProgram.cxx + pslExpression.cxx pslProgram.cxx pslDump.cxx INCLUDES = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/util Index: psl.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- psl.cxx 5 Sep 2002 06:14:57 -0000 1.1 +++ psl.cxx 5 Sep 2002 14:58:57 -0000 1.2 @@ -1,32 +1,4 @@ -#include "pslPrivate.h" - -int PSL_Parser::parse ( char *fname ) -{ - init () ; - - FILE *fd = fopen ( fname, "ra" ) ; - - if ( fd == NULL ) - { -#ifdef SHOUT_ABOUT_PSL_ERRORS - perror ( "PSL:" ) ; - fprintf ( stderr, "PSL: Failed while opening '%s' for reading.\n", fname ); -#endif - return FALSE ; - } - - parse ( fd ) ; - fclose ( fd ) ; - return TRUE ; -} - - -int PSL_Parser::parse ( FILE *fd ) -{ - setDefaultFile ( fd ) ; - pushProgram () ; - return TRUE ; -} +#include "pslLocal.h" Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- psl.h 5 Sep 2002 07:09:13 -0000 1.2 +++ psl.h 5 Sep 2002 14:58:57 -0000 1.3 @@ -14,13 +14,20 @@ class PSL_Parser ; class PSL_Program ; + +union PSL_Variable +{ + float f ; + int i ; +} ; + class PSL_Extension { public: char *symbol ; int argc ; - float (*func) ( int, float *, PSL_Program *p ) ; + PSL_Variable (*func) ( int, PSL_Variable *, PSL_Program *p ) ; } ; Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslCodeGen.cxx 5 Sep 2002 06:14:57 -0000 1.1 +++ pslCodeGen.cxx 5 Sep 2002 14:58:57 -0000 1.2 @@ -1,5 +1,33 @@ -#include "pslPrivate.h" +#include "pslLocal.h" + +int PSL_Parser::parse ( 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 ; + } + + parse ( fd ) ; + fclose ( fd ) ; + return TRUE ; +} + + +int PSL_Parser::parse ( FILE *fd ) +{ + setDefaultFile ( fd ) ; + pushProgram () ; + return TRUE ; +} + void PSL_Parser::pushCodeByte ( PSL_Opcode op ) { @@ -62,6 +90,7 @@ } +void PSL_Parser::pushReturn () { pushCodeByte ( OPCODE_RETURN) ; } void PSL_Parser::pushPop () { pushCodeByte ( OPCODE_POP ) ; } void PSL_Parser::pushSubtract () { pushCodeByte ( OPCODE_SUB ) ; } void PSL_Parser::pushAdd () { pushCodeByte ( OPCODE_ADD ) ; } Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslExpression.cxx 5 Sep 2002 06:14:57 -0000 1.1 +++ pslExpression.cxx 5 Sep 2002 14:58:57 -0000 1.2 @@ -1,5 +1,5 @@ -#include "pslPrivate.h" +#include "pslLocal.h" int PSL_Parser::pushPrimitive () @@ -11,7 +11,7 @@ { if ( ! pushExpression () ) { - fprintf ( stderr, "PSL: Missing expression after '('\n" ) ; + ulSetError ( UL_WARNING, "PSL: Missing expression after '('" ) ; ungetToken ( c ) ; return FALSE ; } @@ -20,7 +20,7 @@ if ( c [ 0 ] != ')' ) { - fprintf ( stderr, "PSL: Missing ')' (found '%s')\n", c ) ; + ulSetError ( UL_WARNING, "PSL: Missing ')' (found '%s')", c ); ungetToken ( c ) ; return FALSE ; } Index: pslRun.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslRun.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslRun.cxx 5 Sep 2002 07:09:13 -0000 1.2 +++ pslRun.cxx 5 Sep 2002 14:58:57 -0000 1.3 @@ -1,5 +1,5 @@ -#include "pslPrivate.h" +#include "pslLocal.h" PSL_Result PSL_Context::step () { @@ -7,17 +7,18 @@ { case OPCODE_PUSH_CONSTANT : { - char *ff = (char *) & ( stack [ sp++ ] ) ; [...152 lines suppressed...] + if ( popFloat () ) pc += 3 ; else pc = code [ pc + 1 ] + ( code [ pc + 2 ] << 8 ) ; @@ -136,13 +146,13 @@ default : if ( ( code [ pc ] & 0xF0 ) == OPCODE_PUSH_VARIABLE ) { - stack [ sp++ ] = variable [ code[pc] & 0x0F ] ; + pushVariable ( variable [ code[pc] & 0x0F ] ) ; pc++ ; } else if ( ( code [ pc ] & 0xF0 ) == OPCODE_POP_VARIABLE ) { - variable [ code[pc] & 0x0F ] = stack [ --sp ] ; + variable [ code[pc] & 0x0F ] = popVariable () ; pc++ ; } return PSL_PROGRAM_CONTINUE ; Index: pslStatement.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslStatement.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslStatement.cxx 5 Sep 2002 06:14:57 -0000 1.1 +++ pslStatement.cxx 5 Sep 2002 14:58:57 -0000 1.2 @@ -1,54 +1,26 @@ -#include "pslPrivate.h" - - -struct OpcodeDecode -{ - char *s ; - unsigned char opcode ; -} ; - +#include "pslLocal.h" [...283 lines suppressed...] - if ( i & 1 ) - printf ( "\n" ) ; - else - printf ( " " ) ; - } + if ( ! pushCompoundStatement () ) + ulSetError ( UL_WARNING, + "PSL: Missing '}' in function '%s'", fn ) ; - printf ( "\n" ) ; + getToken ( c ) ; + + /* If we fall off the end of the function, we still need a return value */ + + pushConstant ( "0.0" ) ; + pushReturn () ; } + Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslSymbols.cxx 5 Sep 2002 06:14:57 -0000 1.1 +++ pslSymbols.cxx 5 Sep 2002 14:58:57 -0000 1.2 @@ -1,5 +1,5 @@ -#include "pslPrivate.h" +#include "pslLocal.h" PSL_Address PSL_Parser::getVarSymbol ( char *s ) @@ -10,7 +10,7 @@ { if ( next_var >= MAX_VARIABLE-1 ) { - fprintf ( stderr, "PSL: Too many variables.\n" ) ; + ulSetError ( UL_WARNING, "PSL: Too many variables." ) ; next_var-- ; } @@ -22,7 +22,7 @@ return symtab [ i ] . address ; } - fprintf ( stderr, "PSL: Too many symbols in one program.\n" ) ; + ulSetError ( UL_WARNING, "PSL: Too many symbols." ) ; return MAX_VARIABLE-1 ; } @@ -41,17 +41,17 @@ { for ( int i = 0 ; i < MAX_SYMBOL ; i++ ) { - if ( symtab [ i ] . symbol == NULL ) + if ( code_symtab [ i ] . symbol == NULL ) { - symtab [ i ] . set ( s, 0 ) ; - return 0 ; + code_symtab [ i ] . set ( s, 0 ) ; + return code_symtab [ i ] . address ; } - else - if ( strcmp ( s, symtab [ i ] . symbol ) == 0 ) - return symtab [ i ] . address ; + + if ( strcmp ( s, code_symtab [ i ] . symbol ) == 0 ) + return code_symtab [ i ] . address ; } - fprintf ( stderr, "PSL: Too many symbols in one program.\n" ) ; + ulSetError ( UL_WARNING, "PSL: Undefined Function '%s'.", s ) ; return 0 ; } @@ -61,20 +61,20 @@ { for ( int i = 0 ; i < MAX_SYMBOL ; i++ ) { - if ( symtab [ i ] . symbol == NULL ) + if ( code_symtab [ i ] . symbol == NULL ) { - symtab [ i ] . set ( s, v ) ; + code_symtab [ i ] . set ( s, v ) ; return ; } else - if ( strcmp ( s, symtab [ i ] . symbol ) == 0 ) + if ( strcmp ( s, code_symtab [ i ] . symbol ) == 0 ) { - symtab [ i ] . address = v ; + code_symtab [ i ] . address = v ; return ; } } - fprintf ( stderr, "PSL: Too many symbols in one program.\n" ) ; + ulSetError ( UL_WARNING, "PSL: Too many function names." ) ; } Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslToken.cxx 5 Sep 2002 06:14:57 -0000 1.1 +++ pslToken.cxx 5 Sep 2002 14:58:57 -0000 1.2 @@ -1,5 +1,5 @@ -#include "pslPrivate.h" +#include "pslLocal.h" #define MAX_UNGET 16 @@ -46,7 +46,8 @@ if ( tp >= MAX_TOKEN - 1 ) { - fprintf ( stderr, "token: Input string is bigger than %d characters!\n", + ulSetError ( UL_WARNING, + "PSL: Input string is bigger than %d characters!", MAX_TOKEN - 1 ) ; tp-- ; } @@ -69,7 +70,8 @@ { if ( unget_stack_depth >= MAX_UNGET-1 ) { - fprintf ( stderr, "token: Too many ungetTokens! This must be an *UGLY* PSL program!\n" ) ; + ulSetError ( UL_WARNING, + "PSL: Too many ungetTokens! This must be an *UGLY* PSL program!" ) ; exit ( -1 ) ; } |
From: Steve B. <sj...@us...> - 2002-09-05 14:59:00
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv1575/plib/examples/src/psl/data Modified Files: test.psl Log Message: Function calls now work. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test.psl 5 Sep 2002 06:46:06 -0000 1.1 +++ test.psl 5 Sep 2002 14:58:56 -0000 1.2 @@ -1,14 +1,19 @@ +void wibble () { -x = 0 ; -y = 0 ; -z = 0 ; - -while ( x < 10 ) -{ - x = x + 1 ; hello () ; - pause ; } + +void main () +{ + x = 0 ; + + while ( x < 10 ) + { + x = x + 1 ; + wibble () ; + pause ; + } } + |