plib-cvs Mailing List for PLIB (Page 27)
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-13 22:45:10
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv5655 Modified Files: appl_guide.html index.html prog_guide.html Log Message: Seems as if Steve partially re-used the header from the PUI document. I am quite sure he did NOT use Netscape on WinNT. Index: appl_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/appl_guide.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- appl_guide.html 13 Sep 2002 22:38:41 -0000 1.3 +++ appl_guide.html 13 Sep 2002 22:45:06 -0000 1.4 @@ -2,9 +2,8 @@ <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="keywords" content="PSL, PLIB, OpenGL, 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"> Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- index.html 13 Sep 2002 22:38:41 -0000 1.3 +++ index.html 13 Sep 2002 22:45:07 -0000 1.4 @@ -2,9 +2,8 @@ <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="keywords" content="PSL, PLIB, OpenGL, 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.</title> </head> <body text="#B5A642" bgcolor="#005000" link="#8FFF8F" vlink="#18A515" alink="#20336B" background="../marble.png"> Index: prog_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/prog_guide.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- prog_guide.html 13 Sep 2002 22:38:41 -0000 1.3 +++ prog_guide.html 13 Sep 2002 22:45:07 -0000 1.4 @@ -2,9 +2,8 @@ <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="keywords" content="PSL, PLIB, OpenGL, 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"> |
From: Sebastian U. <ud...@us...> - 2002-09-13 22:38:45
|
Update of /cvsroot/plib/plib/doc/pui In directory usw-pr-cvs1:/tmp/cvs-serv3825/pui Modified Files: index.html Log Message: HTML 4.0 compliance Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/pui/index.html,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- index.html 1 Sep 2002 08:45:46 -0000 1.47 +++ index.html 13 Sep 2002 22:38:41 -0000 1.48 @@ -1,4 +1,4 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
From: Sebastian U. <ud...@us...> - 2002-09-13 22:38:45
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv3825/psl Modified Files: appl_guide.html index.html prog_guide.html Log Message: HTML 4.0 compliance Index: appl_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/appl_guide.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- appl_guide.html 13 Sep 2002 17:37:25 -0000 1.2 +++ appl_guide.html 13 Sep 2002 22:38:41 -0000 1.3 @@ -1,5 +1,4 @@ - -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> @@ -44,7 +43,7 @@ loads a script called "test.psl", compiles and runs it. <pre> - #include <plib/psl.h> + #include <plib/psl.h> void main () { Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/index.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- index.html 10 Sep 2002 04:37:38 -0000 1.2 +++ index.html 13 Sep 2002 22:38:41 -0000 1.3 @@ -1,4 +1,4 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> Index: prog_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/prog_guide.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- prog_guide.html 13 Sep 2002 17:37:25 -0000 1.2 +++ prog_guide.html 13 Sep 2002 22:38:41 -0000 1.3 @@ -1,4 +1,4 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
From: Steve B. <sj...@us...> - 2002-09-13 22:32:19
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv1825/plib/examples/src/psl/data Modified Files: test.psl Log Message: Added subroutine parameters. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- test.psl 13 Sep 2002 17:37:26 -0000 1.17 +++ test.psl 13 Sep 2002 22:32:15 -0000 1.18 @@ -1,18 +1,13 @@ -float f = 1.0 ; - - -void xxx () +void xxx ( int a, float b, string c ) { - f = f * 1.0001 ; + printf ( "Hello", a, b, c, "\n" ) ; } void main () { - int i ; - - for ( i = 0 ; i < 1000000 ; i = i + 1 ) - xxx () ; + xxx ( 1234, 567.89, "Weee!!!" ) ; + xxx ( 9876, 543.21, "AGAIN!!!" ) ; } |
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv1825/plib/src/psl Modified Files: pslCodeGen.cxx pslCompiler.cxx pslCompiler.h pslContext.cxx pslDump.cxx pslError.cxx pslOpcodes.h pslProgram.cxx Log Message: Added subroutine parameters. Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pslCodeGen.cxx 13 Sep 2002 17:37:26 -0000 1.15 +++ pslCodeGen.cxx 13 Sep 2002 22:32:15 -0000 1.16 @@ -96,6 +96,13 @@ pushCodeByte ( ff [ 3 ] ) ; } +void pslCompiler::pushGetParameter ( pslAddress var, int argpos ) +{ + pushCodeByte ( OPCODE_GET_PARAMETER ) ; + pushCodeByte ( var ) ; + pushCodeByte ( argpos ) ; +} + void pslCompiler::makeIntVariable ( const char *c ) { int a = getVarSymbol ( c ) ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- pslCompiler.cxx 13 Sep 2002 17:37:27 -0000 1.17 +++ pslCompiler.cxx 13 Sep 2002 22:32:15 -0000 1.18 @@ -729,18 +729,64 @@ if ( c[0] != '(' ) return error ( "Missing '(' in declaration of '%s'", fn ) ; - getToken ( c ) ; + pushLocality () ; + + int argpos = 0 ; + + while ( 1 ) + { + getToken ( c ) ; + + if ( c [ 0 ] == ')' || c [ 0 ] == '\0' ) + break ; + + char s [ MAX_TOKEN ] ; + + getToken ( s ) ; + + pslAddress a = setVarSymbol ( s ) ; + + if ( strcmp ( c, "int" ) == 0 ) makeIntVariable ( s ) ; else + if ( strcmp ( c, "float" ) == 0 ) makeFloatVariable ( s ) ; else + if ( strcmp ( c, "string" ) == 0 ) makeStringVariable ( s ) ; else + { + popLocality () ; + return error ( "Missing ')' in declaration of '%s'", fn ) ; + } + + pushGetParameter ( a, argpos++ ) ; + + getToken ( c ) ; + + if ( c[0] == ',' ) + continue ; + + if ( c[0] == ')' ) + break ; + + popLocality () ; + return error ( "Missing ',' or ')' in declaration of '%s'", fn ) ; + } if ( c[0] != ')' ) + { + popLocality () ; return error ( "Missing ')' in declaration of '%s'", fn ) ; + } getToken ( c ) ; if ( c [ 0 ] != '{' ) + { + popLocality () ; return error ( "Missing '{' in function '%s'", fn ) ; + } if ( ! pushCompoundStatement () ) + { + popLocality () ; return error ( "Missing '}' in function '%s'", fn ) ; + } getToken ( c ) ; @@ -752,6 +798,7 @@ code [ jump_target ] = next_code & 0xFF ; code [ jump_target+1 ] = (next_code >> 8) & 0xFF ; + popLocality () ; return TRUE ; } Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- pslCompiler.h 13 Sep 2002 17:37:27 -0000 1.17 +++ pslCompiler.h 13 Sep 2002 22:32:15 -0000 1.18 @@ -44,6 +44,9 @@ +class pslProgram ; + + class pslCompiler { /* File I/O and preprocessor */ @@ -90,6 +93,8 @@ int pushJumpIfTrue ( int l ) ; int pushJump ( int l ) ; + void pushGetParameter ( pslAddress var, int argpos ) ; + void makeIntVariable ( const char *s ) ; void makeFloatVariable ( const char *s ) ; void makeStringVariable( const char *s ) ; @@ -253,11 +258,16 @@ int next_code ; pslOpcode *code ; pslContext *context ; + pslProgram *program ; public: - pslCompiler ( pslOpcode *_code, pslExtension *_extn, const char *_progName ) + pslCompiler ( pslProgram *prog, + pslOpcode *_code, + pslExtension *_extn, + const char *_progName ) { + program = prog ; progName = ulStrDup ( _progName ) ; code = _code ; Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pslContext.cxx 13 Sep 2002 17:37:27 -0000 1.6 +++ pslContext.cxx 13 Sep 2002 22:32:15 -0000 1.7 @@ -67,6 +67,17 @@ } return PSL_PROGRAM_CONTINUE ; + case OPCODE_GET_PARAMETER : + { + int var = code [ ++pc ] ; + int nargs = stack [ sp - 2 ] . getInt () ; + int off = sp - ( nargs + 2 ) + code [ ++pc ] ; + + variable [ var ] . set ( & stack [ off ] ) ; + pc++ ; + } + return PSL_PROGRAM_CONTINUE ; + case OPCODE_POP : popVoid() ; pc++ ; Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslDump.cxx 8 Sep 2002 22:17:32 -0000 1.12 +++ pslDump.cxx 13 Sep 2002 22:32:15 -0000 1.13 @@ -55,6 +55,7 @@ { "SET_INT_VARIABLE" , OPCODE_SET_INT_VARIABLE , 1 }, { "SET_FLOAT_VARIABLE" , OPCODE_SET_FLOAT_VARIABLE , 1 }, { "SET_STRING_VARIABLE", OPCODE_SET_STRING_VARIABLE, 1 }, + { "GET_PARAMETER" , OPCODE_GET_PARAMETER , 2 }, /* Flow Control */ @@ -177,11 +178,12 @@ case OPCODE_SET_INT_VARIABLE : case OPCODE_SET_FLOAT_VARIABLE : case OPCODE_SET_STRING_VARIABLE : - fprintf ( fd, "\t[%d]", code [ addr+1 ] ) ; - break ; - case OPCODE_PUSH_VARIABLE : fprintf ( fd, "\t\t[%d]", code [ addr+1 ] ) ; + break ; + + case OPCODE_GET_PARAMETER : + fprintf ( fd, "\t\t[%d],off=%d", code [ addr+1 ], code [ addr+2 ] ) ; break ; case OPCODE_POP_VARIABLE : Index: pslError.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslError.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslError.cxx 13 Sep 2002 17:37:27 -0000 1.5 +++ pslError.cxx 13 Sep 2002 22:32:15 -0000 1.6 @@ -48,7 +48,7 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( this, PSL_COMPILETIME_WARNING, _pslGetFname(), _pslGetLineNo(), + (*_pslErrorCB)( program, PSL_COMPILETIME_WARNING, _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: WARNING - %s\n", @@ -69,7 +69,7 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( this, PSL_COMPILETIME_ERROR, _pslGetFname(), _pslGetLineNo(), + (*_pslErrorCB)( program, PSL_COMPILETIME_ERROR, _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: *ERROR* - %s\n", @@ -108,7 +108,7 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( program, PPSL_RUNTIME_ERROR, getProgName(), pc, _pslErrorBuffer ) ; + (*_pslErrorCB)( program, PSL_RUNTIME_ERROR, getProgName(), pc, _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" PC=%d: *ERROR* - %s\n", getProgName(), pc, _pslErrorBuffer ) ; Index: pslOpcodes.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslOpcodes.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslOpcodes.h 8 Sep 2002 18:56:29 -0000 1.4 +++ pslOpcodes.h 13 Sep 2002 22:32:15 -0000 1.5 @@ -55,5 +55,6 @@ #define OPCODE_SET_FLOAT_VARIABLE 0x1C #define OPCODE_SET_STRING_VARIABLE 0x1D #define OPCODE_STACK_DUPLICATE 0x1E +#define OPCODE_GET_PARAMETER 0x1F Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pslProgram.cxx 8 Sep 2002 00:37:45 -0000 1.9 +++ pslProgram.cxx 13 Sep 2002 22:32:15 -0000 1.10 @@ -40,7 +40,7 @@ setProgName ( _prgnm ) ; - compiler = new pslCompiler ( code, ext, getProgName () ) ; + compiler = new pslCompiler ( this, code, ext, getProgName () ) ; context = new pslContext ( this ) ; compiler-> init () ; |
From: Steve B. <sj...@us...> - 2002-09-13 17:37:30
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv31108/plib/src/psl Modified Files: psl.h pslCodeGen.cxx pslCompiler.cxx pslCompiler.h pslContext.cxx pslContext.h pslError.cxx Log Message: Added documentation for PSL Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- psl.h 11 Sep 2002 21:42:32 -0000 1.13 +++ psl.h 13 Sep 2002 17:37:26 -0000 1.14 @@ -261,6 +261,6 @@ void pslInit () ; -void pslSetErrorCallback ( void (*CB) ( int, char *, int, char * ) ) ; +void pslSetErrorCallback ( void (*CB) ( pslProgram *, int, char *, int, char * ) ) ; Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslCodeGen.cxx 11 Sep 2002 21:42:32 -0000 1.14 +++ pslCodeGen.cxx 13 Sep 2002 17:37:26 -0000 1.15 @@ -67,9 +67,8 @@ } -void pslCompiler::pushIntConstant ( const char *c ) +void pslCompiler::pushIntConstant ( int i ) { - int i = atoi ( c ) ; char *ii = (char *) & i ; pushCodeByte ( OPCODE_PUSH_INT_CONSTANT ) ; @@ -79,6 +78,12 @@ pushCodeByte ( ii [ 3 ] ) ; } +void pslCompiler::pushIntConstant ( const char *c ) +{ + int i = atoi ( c ) ; + pushIntConstant ( i ) ; +} + void pslCompiler::pushFloatConstant ( const char *c ) { float f = (float) atof ( c ) ; @@ -138,6 +143,7 @@ if ( ext < 0 ) { + pushIntConstant ( argc ) ; pushCodeByte ( OPCODE_CALL ) ; int a = getCodeSymbol ( c, next_code ) ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- pslCompiler.cxx 10 Sep 2002 23:02:06 -0000 1.16 +++ pslCompiler.cxx 13 Sep 2002 17:37:27 -0000 1.17 @@ -591,6 +591,8 @@ /* Have the program call 'main' and then halt */ + pushIntConstant ( 0 ) ; /* No arguments to main *YET* */ + pushCodeByte ( OPCODE_CALL ) ; pushCodeAddr ( getCodeSymbol ( "main", next_code ) ) ; pushCodeByte ( 0 ) ; /* Argc */ Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- pslCompiler.h 12 Sep 2002 12:10:26 -0000 1.16 +++ pslCompiler.h 13 Sep 2002 17:37:27 -0000 1.17 @@ -98,6 +98,7 @@ void pushIntConstant ( const char *s ) ; void pushFloatConstant ( const char *s ) ; void pushStringConstant( const char *s ) ; + void pushIntConstant ( int i ) ; void pushVoidConstant () ; Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslContext.cxx 8 Sep 2002 18:56:29 -0000 1.5 +++ pslContext.cxx 13 Sep 2002 17:37:27 -0000 1.6 @@ -107,9 +107,13 @@ case OPCODE_RETURN : { + int nargs ; pslValue result ; + popNumber ( &result ) ; pc = popInt () ; + nargs = popInt () ; + popVoid ( nargs ) ; pushNumber ( &result ) ; } return PSL_PROGRAM_CONTINUE ; Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslContext.h 8 Sep 2002 22:17:32 -0000 1.7 +++ pslContext.h 13 Sep 2002 17:37:27 -0000 1.8 @@ -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 ( int n = 1 ) { sp -= n ; } int popInt () { return stack [ --sp ] . getInt () ; } float popFloat () { return stack [ --sp ] . getFloat () ; } char *popString () { return stack [ --sp ] . getString () ; } Index: pslError.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslError.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslError.cxx 10 Sep 2002 23:02:07 -0000 1.4 +++ pslError.cxx 13 Sep 2002 17:37:27 -0000 1.5 @@ -28,11 +28,12 @@ static char _pslErrorBuffer [ 1024 ] = { '\0' } ; -void (*_pslErrorCB) ( int severity, const char *progname, int line_no, - const char *message ) = NULL ; +void (*_pslErrorCB) ( pslProgram *p, int severity, const char *progname, + int line_no , const char *message ) = NULL ; -void pslSetErrorCallback ( void (*CB) ( int, const char *, int, const char * ) ) +void pslSetErrorCallback ( void (*CB) ( pslProgram *, int, const char *, + int, const char * ) ) { _pslErrorCB = CB ; } @@ -47,7 +48,7 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( PSL_COMPILETIME_WARNING, _pslGetFname(), _pslGetLineNo(), + (*_pslErrorCB)( this, PSL_COMPILETIME_WARNING, _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: WARNING - %s\n", @@ -68,7 +69,7 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( PSL_COMPILETIME_ERROR, _pslGetFname(), _pslGetLineNo(), + (*_pslErrorCB)( this, PSL_COMPILETIME_ERROR, _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: *ERROR* - %s\n", @@ -89,7 +90,7 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( PSL_RUNTIME_WARNING, getProgName(), pc, _pslErrorBuffer ) ; + (*_pslErrorCB)( program, PSL_RUNTIME_WARNING, getProgName(), pc, _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" PC=%d: WARNING - %s\n", getProgName(), pc, _pslErrorBuffer ) ; @@ -107,7 +108,7 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( PSL_RUNTIME_ERROR, getProgName(), pc, _pslErrorBuffer ) ; + (*_pslErrorCB)( program, PPSL_RUNTIME_ERROR, getProgName(), pc, _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" PC=%d: *ERROR* - %s\n", getProgName(), pc, _pslErrorBuffer ) ; |
From: Steve B. <sj...@us...> - 2002-09-13 17:37:30
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv31108/plib/examples/src/psl/data Modified Files: test.psl Log Message: Added documentation for PSL Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- test.psl 12 Sep 2002 04:39:26 -0000 1.16 +++ test.psl 13 Sep 2002 17:37:26 -0000 1.17 @@ -1,66 +1,18 @@ -#define ONE 1 - -void main () -{ - -#ifdef ONE - printf ( "Yes! 1\n" ) ; -#endif - -#ifdef ONE - printf ( "Yes! 2\n" ) ; -#else - printf ( "No...2\n" ) ; -#endif - -#ifndef ONE - printf ( "No...3\n" ) ; -#else - printf ( "Yes! 3\n" ) ; -#endif - - -#ifdef ONE - -#ifdef ONE - printf ( "Yes! 4\n" ) ; -#endif - -#ifdef ONE - printf ( "Yes! 5\n" ) ; -#else - printf ( "No...5\n" ) ; -#endif - -#ifndef ONE - printf ( "No...6\n" ) ; -#else - printf ( "Yes! 6\n" ) ; -#endif +float f = 1.0 ; - printf ( "Yes! 7\n" ) ; -#else -#ifdef ONE - printf ( "No...7\n" ) ; -#endif - -#ifdef ONE - printf ( "No...8\n" ) ; -#else - printf ( "No...9\n" ) ; -#endif +void xxx () +{ + f = f * 1.0001 ; +} -#ifndef ONE - printf ( "No...A\n" ) ; -#else - printf ( "No...B\n" ) ; -#endif - printf ( "No...C\n" ) ; -#endif +void main () +{ + int i ; - printf ( "Yes! 8\n" ) ; + for ( i = 0 ; i < 1000000 ; i = i + 1 ) + xxx () ; } |
From: Steve B. <sj...@us...> - 2002-09-13 17:37:30
|
Update of /cvsroot/plib/plib/examples/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv31108/plib/examples/src/psl Modified Files: psl_demo.cxx Log Message: Added documentation for PSL Index: psl_demo.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/psl_demo.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- psl_demo.cxx 10 Sep 2002 04:37:38 -0000 1.13 +++ psl_demo.cxx 13 Sep 2002 17:37:26 -0000 1.14 @@ -31,7 +31,6 @@ #endif #include <plib/psl.h> - pslValue my_printf ( int argc, pslValue *argv, pslProgram *p ) { if ( argv[0].getType() != PSL_STRING ) @@ -82,8 +81,16 @@ pslProgram *prog_1 = new pslProgram ( extensions, "code1" ) ; + ulClock ck ; + ck.setMaxDelta ( 100000.0 ) ; + ck.update () ; + prog_1 -> compile ( "data/test.psl" ) ; - // prog_1 -> dump () ; + + ck.update () ; + fprintf(stderr, "%fs compiletime elapsed\n", ck.getDeltaTime () ) ; + + prog_1 -> dump () ; /* Clone program 2 from program 1 */ @@ -94,13 +101,16 @@ prog_1 -> setUserData ( (void *) "Program 1" ) ; prog_2 -> setUserData ( (void *) "Program 2" ) ; - /* Run both programs together until one of them ends */ + ck.update () ; while ( 1 ) { - if ( prog_1 -> step () == PSL_PROGRAM_END ) break ; -// if ( prog_2 -> step () == PSL_PROGRAM_END ) break ; + if ( prog_1 -> step () == PSL_PROGRAM_END || + prog_2 -> step () == PSL_PROGRAM_END ) + break ; } + ck.update () ; + fprintf(stderr, "%fs runtime elapsed\n", ck.getDeltaTime () ) ; exit ( 0 ) ; } |
From: Steve B. <sj...@us...> - 2002-09-13 17:37:30
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv31108/plib/doc/psl Modified Files: appl_guide.html prog_guide.html Log Message: Added documentation for PSL Index: appl_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/appl_guide.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- appl_guide.html 10 Sep 2002 04:37:38 -0000 1.1 +++ appl_guide.html 13 Sep 2002 17:37:25 -0000 1.2 @@ -24,6 +24,383 @@ scripting abilities using the PSL interpreter. <p> +To include PSL scripts into your application requires that you: +<pre> + + #include <plib/psl.h> + +</pre> +...and link with '<code>-lplibpsl</code>' +<p> [...352 lines suppressed...] +The 'pause' command indicates that this script has completed it's +work for this frame. +<p> +Alternatively, some applications may wish to run the scripts for +fixed amounts of time, fixed numbers of byte-codes - or until +some other criterion is satisfied. +<H3> Resetting a Script </H3> +There is a <code>pslProgram::reset()</code> function that +restarts the PSL program from the beginning having first +reset all of its internal variables. +<H3> Debugging PSL scripts </H3> +For debugging PSL scripts, you may replace the 'step' call with +'trace' - which causes the byte-code for each instruction to be +printed to stderr as it's executed. +<p> +You can also call <code>pslProgram::dump()</code> to print out +all of the byte-code and the PSL symbol table for the program. <hr> <address> <a href="http://www.sjbaker.org">Steve J. Baker.</a> <<a href="mailto:sjb...@ai...">sjb...@ai...</a>></address> Index: prog_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/prog_guide.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- prog_guide.html 10 Sep 2002 04:37:38 -0000 1.1 +++ prog_guide.html 13 Sep 2002 17:37:25 -0000 1.2 @@ -13,21 +13,140 @@ <tr> <td> <center> -<h1>The PSL Programming Guide </h1></center> +<h1>The PLIB Scripting Language Programming Guide </h1></center> <center>By Steve Baker</center> </td> </tr> </table> <H1>Introduction</H1> + [...113 lines suppressed...] + <li> Hex and octal constants. + <li> Arrays & Structs. + <li> Operations on "string" variables. + <li> String concatenation. + <li> '\' to escape the end-of-line character in strings and macro's. + <li> Array bounds checking. + <li> Parameter passing by name. + <li> Many of C's standard library functions are needed. +</ul> + +Currently there are hard limits in many places - the number of +variables, the size of the program, the depth of nesting, etc. +These limits will gradually be removed as PSL is developed. + <hr> <address> <a href="http://www.sjbaker.org">Steve J. Baker.</a> <<a href="mailto:sjb...@ai...">sjb...@ai...</a>></address> </body> </html> + |
From: Sebastian U. <ud...@us...> - 2002-09-12 12:10:31
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv2454 Modified Files: pslCompiler.h Log Message: Const-correctness Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pslCompiler.h 12 Sep 2002 04:39:26 -0000 1.15 +++ pslCompiler.h 12 Sep 2002 12:10:26 -0000 1.16 @@ -156,7 +156,7 @@ int skippingFlag ; int next_skippingLevel ; - int skipping () + int skipping () const { return ! skipOverride && skippingFlag != 0 ; } |
From: Steve B. <sj...@us...> - 2002-09-12 04:39:30
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv32635/plib/examples/src/psl/data Modified Files: test.psl Log Message: Implement #ifdef/#ifndef/#else/#endif Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- test.psl 12 Sep 2002 03:17:06 -0000 1.15 +++ test.psl 12 Sep 2002 04:39:26 -0000 1.16 @@ -1,42 +1,66 @@ -#include <data/header.psh> #define ONE 1 -#define TWO 2 -#define THREE 3 -#undef ONE -#define ONE (THREE-TWO) void main () { - int i ; [...67 lines suppressed...] +#endif + +#ifdef ONE + printf ( "No...8\n" ) ; +#else + printf ( "No...9\n" ) ; +#endif + +#ifndef ONE + printf ( "No...A\n" ) ; +#else + printf ( "No...B\n" ) ; +#endif + + printf ( "No...C\n" ) ; +#endif + + printf ( "Yes! 8\n" ) ; } |
From: Steve B. <sj...@us...> - 2002-09-12 04:39:29
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv32635/plib/src/psl Modified Files: pslCompiler.h pslToken.cxx Log Message: Implement #ifdef/#ifndef/#else/#endif Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslCompiler.h 12 Sep 2002 03:17:06 -0000 1.14 +++ pslCompiler.h 12 Sep 2002 04:39:26 -0000 1.15 @@ -152,6 +152,15 @@ int searchDefines ( const char *s ) const ; + int skipOverride ; + int skippingFlag ; + int next_skippingLevel ; + + int skipping () + { + return ! skipOverride && skippingFlag != 0 ; + } + pslSymbol symtab [ MAX_SYMBOL ] ; pslSymbol code_symtab [ MAX_SYMBOL ] ; @@ -309,6 +318,8 @@ next_code_symbol = 0 ; next_code = 0 ; next_var = 0 ; + skippingFlag = 0 ; + next_skippingLevel = 1 ; } void dump () const ; Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- pslToken.cxx 12 Sep 2002 03:17:06 -0000 1.16 +++ pslToken.cxx 12 Sep 2002 04:39:26 -0000 1.17 @@ -37,25 +37,41 @@ } while ( c != '\n' && c != -1 ) ; } + + int pslCompiler::getChar () { - /* - If we got a newline then we have to test to see whether - a '#' preprocessor directive is on this line. - */ [...161 lines suppressed...] + define_token [ next_define ] = new char [ strlen ( token ) + 1 ] ; + define_replacement [ next_define ] = new char [ strlen ( subst ) + 1 ] ; + strcpy ( define_token [ next_define ], token ) ; + strcpy ( define_replacement [ next_define ], subst ) ; + next_define++ ; + } } } @@ -199,7 +281,9 @@ */ skipToEOL () ; - _pslPushDefaultFile ( p ) ; + + if ( ! skipping () ) + _pslPushDefaultFile ( p ) ; } |
From: Steve B. <sj...@us...> - 2002-09-12 03:17:09
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv13491/plib/examples/src/psl/data Modified Files: test.psl Log Message: Fixed #define and #undef to disallow tokens that aren't legal identifiers. Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- test.psl 11 Sep 2002 05:27:58 -0000 1.14 +++ test.psl 12 Sep 2002 03:17:06 -0000 1.15 @@ -1,11 +1,11 @@ #include <data/header.psh> - -#define ONE 1 -#define TWO 2 +#define ONE 1 +#define TWO 2 #define THREE 3 #undef ONE #define ONE (THREE-TWO) + void main () { int i ; |
From: Steve B. <sj...@us...> - 2002-09-12 03:17:09
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv13491/plib/src/psl Modified Files: pslCompiler.h pslToken.cxx Log Message: Fixed #define and #undef to disallow tokens that aren't legal identifiers. Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslCompiler.h 11 Sep 2002 21:21:37 -0000 1.13 +++ pslCompiler.h 12 Sep 2002 03:17:06 -0000 1.14 @@ -61,6 +61,7 @@ int doPreProcessorCommand () ; void getToken ( char *s, int define_sub = TRUE ) ; void ungetToken ( const char *s ) ; + void skipToEOL () ; /* Write data into Code space */ Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pslToken.cxx 11 Sep 2002 21:21:37 -0000 1.15 +++ pslToken.cxx 12 Sep 2002 03:17:06 -0000 1.16 @@ -27,6 +27,16 @@ static char ungotten_token [ MAX_UNGET ][ MAX_TOKEN ] ; static int unget_token_stack_depth = 0 ; +void pslCompiler::skipToEOL () +{ + int c ; + + do + { + c = getChar () ; + } while ( c != '\n' && c != -1 ) ; [...86 lines suppressed...] + return '\n' ; } if ( strcmp ( token, "ifndef" ) == 0 ) @@ -228,13 +254,8 @@ error ( "Unrecognised preprocessor directive '%s'", token ) ; - /* Skip to the end of this line. */ - - int c ; - - do { c = getChar () ; } while ( c != '\n' && c != -1 ) ; - - return c ; + skipToEOL () ; + return '\n' ; } |
From: Sebastian U. <ud...@us...> - 2002-09-11 22:29:46
|
Update of /cvsroot/plib/plib/src/util In directory usw-pr-cvs1:/tmp/cvs-serv5814 Modified Files: ul.h Log Message: Bumped PLIB_MINOR_VERSION to '7' Index: ul.h =================================================================== RCS file: /cvsroot/plib/plib/src/util/ul.h,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- ul.h 2 Sep 2002 06:05:49 -0000 1.54 +++ ul.h 11 Sep 2002 22:29:43 -0000 1.55 @@ -92,7 +92,7 @@ /* PLIB version macros */ #define PLIB_MAJOR_VERSION 1 -#define PLIB_MINOR_VERSION 6 +#define PLIB_MINOR_VERSION 7 #define PLIB_TINY_VERSION 0 #define PLIB_VERSION (PLIB_MAJOR_VERSION*100 \ |
From: Sebastian U. <ud...@us...> - 2002-09-11 22:28:35
|
Update of /cvsroot/plib/plib/tools In directory usw-pr-cvs1:/tmp/cvs-serv5485 Modified Files: configure.in Log Message: Bumped VERSION to 1.7.0 Index: configure.in =================================================================== RCS file: /cvsroot/plib/plib/tools/configure.in,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- configure.in 1 Sep 2002 07:24:14 -0000 1.6 +++ configure.in 11 Sep 2002 22:28:31 -0000 1.7 @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/af2rgb/af2rgb.cxx) -AM_INIT_AUTOMAKE(plib_tools, 1.6.0) +AM_INIT_AUTOMAKE(plib_tools, 1.7.0) dnl Checks for programs. AC_PROG_CC |
From: Sebastian U. <ud...@us...> - 2002-09-11 21:42:35
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv24066 Modified Files: psl.h pslCodeGen.cxx Log Message: Fixed some compiler warnings with ICC Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- psl.h 8 Sep 2002 00:37:44 -0000 1.12 +++ psl.h 11 Sep 2002 21:42:32 -0000 1.13 @@ -99,7 +99,7 @@ { case PSL_INT : return (float) i ; case PSL_FLOAT : return f ; - case PSL_STRING : return atof( s ) ; + case PSL_STRING : return (float) atof( s ) ; case PSL_VOID : return 0.0f ; } return 0.0f ; @@ -186,7 +186,7 @@ switch ( t ) { case PSL_INT : i = atoi ( v ) ; return ; - case PSL_FLOAT : f = atof ( v ) ; return ; + case PSL_FLOAT : f = (float) atof ( v ) ; return ; case PSL_STRING : delete [] s ; s = ulStrDup ( v ) ; return ; Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslCodeGen.cxx 8 Sep 2002 18:56:29 -0000 1.13 +++ pslCodeGen.cxx 11 Sep 2002 21:42:32 -0000 1.14 @@ -81,7 +81,7 @@ void pslCompiler::pushFloatConstant ( const char *c ) { - float f = atof ( c ) ; + float f = (float) atof ( c ) ; char *ff = (char *) & f ; pushCodeByte ( OPCODE_PUSH_FLOAT_CONSTANT ) ; |
From: Sebastian U. <ud...@us...> - 2002-09-11 21:21:41
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv16718 Modified Files: pslCompiler.h pslToken.cxx Log Message: Const-correctness Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslCompiler.h 11 Sep 2002 05:27:58 -0000 1.12 +++ pslCompiler.h 11 Sep 2002 21:21:37 -0000 1.13 @@ -149,7 +149,7 @@ char *define_token [ MAX_SYMBOL ] ; char *define_replacement [ MAX_SYMBOL ] ; - int searchDefines ( char *s ) ; + int searchDefines ( const char *s ) const ; pslSymbol symtab [ MAX_SYMBOL ] ; pslSymbol code_symtab [ MAX_SYMBOL ] ; Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslToken.cxx 11 Sep 2002 05:27:58 -0000 1.14 +++ pslToken.cxx 11 Sep 2002 21:21:37 -0000 1.15 @@ -54,7 +54,7 @@ } -int pslCompiler::searchDefines ( char *token ) +int pslCompiler::searchDefines ( const char *token ) const { for ( int i = 0 ; i < next_define ; i++ ) if ( define_token [ i ] != NULL && |
From: Steve B. <sj...@us...> - 2002-09-11 05:28:02
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv30442/plib/src/psl Modified Files: pslCompiler.h pslToken.cxx Log Message: Added #define/#undef Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslCompiler.h 10 Sep 2002 04:37:39 -0000 1.11 +++ pslCompiler.h 11 Sep 2002 05:27:58 -0000 1.12 @@ -49,9 +49,17 @@ /* File I/O and preprocessor */ int getChar () ; + void doIncludeStatement () ; + void doDefineStatement () ; + void doIfdefStatement () ; + void doUndefStatement () ; + void doIfndefStatement () ; + void doElseStatement () ; + void doEndifStatement () ; + int doPreProcessorCommand () ; - void getToken ( char *s ) ; + void getToken ( char *s, int define_sub = TRUE ) ; void ungetToken ( const char *s ) ; @@ -132,10 +140,16 @@ int pushGlobalDeclaration () ; void pushProgram () ; - /* The symbol tables for variables and code */ + /* The symbol tables for variables, code and define's */ int next_label ; int next_code_symbol ; + int next_define ; + + char *define_token [ MAX_SYMBOL ] ; + char *define_replacement [ MAX_SYMBOL ] ; + + int searchDefines ( char *s ) ; pslSymbol symtab [ MAX_SYMBOL ] ; pslSymbol code_symtab [ MAX_SYMBOL ] ; @@ -240,6 +254,8 @@ for ( int i = 0 ; i < MAX_SYMBOL ; i++ ) { + define_token [ i ] = NULL ; + define_replacement [ i ] = NULL ; symtab [ i ] . symbol = NULL ; forward_ref [ i ] . symbol = NULL ; code_symtab [ i ] . symbol = NULL ; @@ -252,6 +268,8 @@ { for ( int i = 0 ; i < MAX_SYMBOL ; i++ ) { + delete [] define_token [ i ] ; + delete [] define_replacement [ i ] ; delete [] symtab [ i ] . symbol ; delete [] code_symtab [ i ] . symbol ; delete [] forward_ref [ i ] . symbol ; @@ -270,6 +288,8 @@ for ( i = 0 ; i < MAX_SYMBOL ; i++ ) { + delete [] define_token [ i ] ; define_token [ i ] = NULL ; + delete [] define_replacement [ i ] ; define_replacement [ i ] = NULL ; 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 ; @@ -279,6 +299,7 @@ locality_sp = 0 ; + next_define = 0 ; next_continue = 0 ; next_break = 0 ; next_tmp_label= 0 ; Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslToken.cxx 10 Sep 2002 23:02:08 -0000 1.13 +++ pslToken.cxx 11 Sep 2002 05:27:58 -0000 1.14 @@ -54,6 +54,87 @@ } +int pslCompiler::searchDefines ( char *token ) +{ + for ( int i = 0 ; i < next_define ; i++ ) + if ( define_token [ i ] != NULL && + strcmp ( token, define_token [ i ] ) == 0 ) + return i ; + + return -1 ; [...157 lines suppressed...] + + if ( def == -1 ) + return ; + + /* + If there is a replacement for this token, un-get it so it's the + next thing we'll read. + */ + + for ( int i = strlen ( define_replacement [ def ] ) - 1 ; i >= 0 ; i-- ) + _pslUnGetChar ( define_replacement [ def ][ i ] ) ; + + /* + Then have another try at reading the token. + */ + + getToken ( res ) ; } |
From: Steve B. <sj...@us...> - 2002-09-11 05:28:02
|
Update of /cvsroot/plib/plib/examples/src/psl/data In directory usw-pr-cvs1:/tmp/cvs-serv30442/plib/examples/src/psl/data Modified Files: test.psl Log Message: Added #define/#undef Index: test.psl =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/data/test.psl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- test.psl 10 Sep 2002 04:37:39 -0000 1.13 +++ test.psl 11 Sep 2002 05:27:58 -0000 1.14 @@ -1,11 +1,16 @@ #include <data/header.psh> +#define ONE 1 +#define TWO 2 +#define THREE 3 +#undef ONE +#define ONE (THREE-TWO) void main () { int i ; - for ( i = 0 ; i < 20 ; i = i + 1 - 3 + 3 ) + for ( i = 0 ; i < 20 ; i = i + ONE ) { if ( i == 10 ) { printf ( "Continuing past TEN\n" ) ; continue ; } if ( i == 17 ) { printf ( "Seventeen is enough!\n" ) ; break ; } |
From: Sebastian U. <ud...@us...> - 2002-09-10 23:10:44
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv9700 Modified Files: pslFileIO.cxx Log Message: Replaced instance of 'delete' with 'delete []' Index: pslFileIO.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslFileIO.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslFileIO.cxx 10 Sep 2002 23:05:55 -0000 1.3 +++ pslFileIO.cxx 10 Sep 2002 23:10:41 -0000 1.4 @@ -77,7 +77,7 @@ fclose ( fd ) ; } - delete fname ; + delete [] fname ; } void unGetChar ( int c ) |
From: Sebastian U. <ud...@us...> - 2002-09-10 23:06:01
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv8414 Modified Files: pslFileIO.cxx Log Message: Replaced an instance of 'new' + strcpy () with ulStrDup () Index: pslFileIO.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslFileIO.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslFileIO.cxx 10 Sep 2002 23:02:35 -0000 1.2 +++ pslFileIO.cxx 10 Sep 2002 23:05:55 -0000 1.3 @@ -43,8 +43,7 @@ pslFile ( FILE *_fd, const char *_fname ) { - fname = new char [ strlen ( _fname ) + 1 ] ; - strcpy ( fname, _fname ) ; + fname = ulStrDup ( _fname ) ; fd = _fd ; ungetSP = 0 ; |
From: Sebastian U. <ud...@us...> - 2002-09-10 23:02:39
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv7620 Modified Files: pslFileIO.cxx Log Message: Removed some global namespace pollution from PSL; Const-correctness Index: pslFileIO.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslFileIO.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslFileIO.cxx 10 Sep 2002 04:37:39 -0000 1.1 +++ pslFileIO.cxx 10 Sep 2002 23:02:35 -0000 1.2 @@ -26,8 +26,8 @@ class pslFile ; -pslFile *defaultFileStack [ MAX_INCLUDE_DEPTH ] ; -int fileStackPointer = 0 ; +static pslFile *defaultFileStack [ MAX_INCLUDE_DEPTH ] ; +static int fileStackPointer = 0 ; class pslFile { @@ -107,20 +107,20 @@ return c ; } - int getLineNo () { return line_no ; } - char *getFname () { return fname ; } + int getLineNo () const { return line_no ; } + char *getFname () const { return fname ; } } ; -char *getFname () +char *_pslGetFname () { return defaultFileStack [ fileStackPointer - 1 ] -> getFname () ; } -int getLineNo () +int _pslGetLineNo () { return defaultFileStack [ fileStackPointer - 1 ] -> getLineNo () ; } -void popDefaultFile () { delete defaultFileStack [ fileStackPointer - 1 ] ; } -void pushDefaultFile ( FILE *fd, const char *fname ) { new pslFile ( fd, fname ) ; } +void _pslPopDefaultFile () { delete defaultFileStack [ fileStackPointer - 1 ] ; } +void _pslPushDefaultFile ( FILE *fd, const char *fname ) { new pslFile ( fd, fname ) ; } -void pushDefaultFile ( const char *fname ) +void _pslPushDefaultFile ( const char *fname ) { FILE *fd = fopen ( fname, "ra" ) ; @@ -130,12 +130,12 @@ return ; } - pushDefaultFile ( fd, fname ) ; + _pslPushDefaultFile ( fd, fname ) ; } -int getChar () +int _pslGetChar () { /* WARNING -- RECURSIVE -- WARNING -- RECURSIVE -- WARNING -- RECURSIVE */ @@ -151,8 +151,8 @@ { if ( fileStackPointer > 1 ) { - popDefaultFile () ; - return getChar () ; + _pslPopDefaultFile () ; + return _pslGetChar () ; } return -1 ; @@ -162,7 +162,7 @@ } -void unGetChar ( int c ) +void _pslUnGetChar ( int c ) { defaultFileStack [ fileStackPointer-1 ] -> unGetChar ( c ) ; } |
From: Sebastian U. <ud...@us...> - 2002-09-10 23:02:17
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv7466 Modified Files: pslCompiler.cxx pslError.cxx pslFileIO.h pslToken.cxx Log Message: Removed some global namespace pollution from PSL Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pslCompiler.cxx 10 Sep 2002 04:37:39 -0000 1.15 +++ pslCompiler.cxx 10 Sep 2002 23:02:06 -0000 1.16 @@ -46,9 +46,9 @@ { init () ; - pushDefaultFile ( fd, (fname == NULL) ? progName : fname ) ; + _pslPushDefaultFile ( fd, (fname == NULL) ? progName : fname ) ; pushProgram () ; - popDefaultFile () ; + _pslPopDefaultFile () ; if ( num_errors != 0 || num_warnings != 0 ) fprintf ( stderr, "PSL: '%s' Compiled with %d Warnings, %d Fatal Errors\n", Index: pslError.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslError.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pslError.cxx 10 Sep 2002 04:37:39 -0000 1.3 +++ pslError.cxx 10 Sep 2002 23:02:07 -0000 1.4 @@ -47,11 +47,11 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( PSL_COMPILETIME_WARNING, getFname(), getLineNo(), + (*_pslErrorCB)( PSL_COMPILETIME_WARNING, _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: WARNING - %s\n", - getFname(),getLineNo(), + _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; bumpWarnings () ; @@ -68,11 +68,11 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( PSL_COMPILETIME_ERROR, getFname(), getLineNo(), + (*_pslErrorCB)( PSL_COMPILETIME_ERROR, _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: *ERROR* - %s\n", - getFname(),getLineNo(), + _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; bumpErrors () ; Index: pslFileIO.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslFileIO.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pslFileIO.h 10 Sep 2002 04:37:39 -0000 1.1 +++ pslFileIO.h 10 Sep 2002 23:02:08 -0000 1.2 @@ -22,14 +22,14 @@ $Id$ */ -char *getFname () ; -int getLineNo () ; +char *_pslGetFname () ; +int _pslGetLineNo () ; -void popDefaultFile () ; -void pushDefaultFile ( FILE *fd, const char *fname ) ; -void pushDefaultFile ( const char *fname ) ; +void _pslPopDefaultFile () ; +void _pslPushDefaultFile ( FILE *fd, const char *fname ) ; +void _pslPushDefaultFile ( const char *fname ) ; -void unGetChar ( int c ) ; -int getChar () ; +void _pslUnGetChar ( int c ) ; +int _pslGetChar () ; Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslToken.cxx 10 Sep 2002 04:37:39 -0000 1.12 +++ pslToken.cxx 10 Sep 2002 23:02:08 -0000 1.13 @@ -34,16 +34,16 @@ a '#' preprocessor directive is on this line. */ - int c = ::getChar () ; + int c = _pslGetChar () ; if ( c == '\n' ) { - int d = ::getChar () ; + int d = _pslGetChar () ; if ( d == '#' ) return doPreProcessorCommand () ; - ::unGetChar ( d ) ; + _pslUnGetChar ( d ) ; } /* @@ -92,7 +92,7 @@ int c ; do { c = getChar () ; } while ( c != '\n' && c != -1 ) ; - pushDefaultFile ( p ) ; + _pslPushDefaultFile ( p ) ; } @@ -195,7 +195,7 @@ /* If you get two stars in a row - unget the second one */ if ( c == '*' ) - unGetChar ( '*' ) ; + _pslUnGetChar ( '*' ) ; } while ( c != '/' ) ; @@ -275,7 +275,7 @@ if ( tp > 0 ) { - unGetChar ( c ) ; + _pslUnGetChar ( c ) ; res [ tp ] = '\0' ; } else |
From: Sebastian U. <ud...@us...> - 2002-09-10 22:25:06
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv30413 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.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- psl.dsp 8 Sep 2002 00:40:14 -0000 1.6 +++ psl.dsp 10 Sep 2002 22:25:03 -0000 1.7 @@ -130,6 +130,14 @@ # End Source File # Begin Source File +SOURCE=.\pslFileIO.cxx +# End Source File +# Begin Source File + +SOURCE=.\pslFileIO.h +# End Source File +# Begin Source File + SOURCE=.\psl.h # End Source File # Begin Source File |