[Plib-cvs] plib/src/psl pslCompiler.h,NONE,1.1 Makefile.am,1.4,1.5 psl.h,1.7,1.8 pslCodeGen.cxx,1.8,
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2002-09-06 17:20:59
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv6892/plib/src/psl Modified Files: Makefile.am psl.h pslCodeGen.cxx pslCompiler.cxx pslDump.cxx pslExpression.cxx pslLocal.h pslProgram.cxx pslSymbols.cxx Added Files: pslCompiler.h Removed Files: pslParser.h Log Message: Replaced 'parse' with 'compile' throughout. --- NEW FILE: pslCompiler.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 ; [...156 lines suppressed...] { 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 ; } locality_sp = 0 ; next_fwdref = 0 ; next_label = 0 ; next_code_symbol = 0 ; next_code = 0 ; next_var = 0 ; } void dump () const ; int compile ( const char *fname ) ; int compile ( FILE *fd ) ; } ; Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/psl/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 6 Sep 2002 13:50:51 -0000 1.4 +++ Makefile.am 6 Sep 2002 17:20:56 -0000 1.5 @@ -4,7 +4,7 @@ lib_LIBRARIES = libplibpsl.a include_HEADERS = psl.h pslContext.h pslLocal.h \ - pslParser.h pslSymbol.h + pslCompiler.h pslSymbol.h libplibpsl_a_SOURCES = psl.cxx pslCodeGen.cxx pslContext.cxx \ pslCompiler.cxx pslSymbols.cxx pslToken.cxx \ Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- psl.h 6 Sep 2002 15:07:44 -0000 1.7 +++ psl.h 6 Sep 2002 17:20:56 -0000 1.8 @@ -34,7 +34,7 @@ typedef unsigned char pslOpcode ; class pslContext ; -class pslParser ; +class pslCompiler ; class pslProgram ; @@ -59,7 +59,7 @@ { pslOpcode *code ; pslContext *context ; - pslParser *parser ; + pslCompiler *compiler ; pslExtension *extensions ; void *userData ; @@ -73,15 +73,15 @@ pslContext *getContext () const { return context ; } pslOpcode *getCode () const { return code ; } - pslParser *getParser () const { return parser ; } + pslCompiler *getCompiler () const { return compiler ; } pslExtension *getExtensions () const { return extensions ; } void *getUserData () const { return userData ; } void setUserData ( void *ud ) { userData = ud ; } void dump () const ; - int parse ( const char *fname ) ; - int parse ( FILE *fd ) ; + int compile ( const char *fname ) ; + int compile ( FILE *fd ) ; void reset () ; pslResult step () ; } ; Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pslCodeGen.cxx 6 Sep 2002 13:50:51 -0000 1.8 +++ pslCodeGen.cxx 6 Sep 2002 17:20:56 -0000 1.9 @@ -24,7 +24,7 @@ #include "pslLocal.h" -int pslParser::parse ( const char *fname ) +int pslCompiler::compile ( const char *fname ) { init () ; @@ -38,13 +38,13 @@ return FALSE ; } [...98 lines suppressed...] pushCodeByte ( OPCODE_JUMP_FALSE ) ; @@ -140,7 +140,7 @@ return res ; } -int pslParser::pushJump ( int l ) +int pslCompiler::pushJump ( int l ) { pushCodeByte ( OPCODE_JUMP ) ; @@ -152,7 +152,7 @@ } -int pslParser::pushPauseStatement() +int pslCompiler::pushPauseStatement() { pushCodeByte ( OPCODE_PAUSE ) ; return TRUE ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pslCompiler.cxx 6 Sep 2002 16:44:51 -0000 1.8 +++ pslCompiler.cxx 6 Sep 2002 17:20:56 -0000 1.9 @@ -25,7 +25,7 @@ #include "pslLocal.h" -int pslParser::pushReturnStatement () +int pslCompiler::pushReturnStatement () { char c [ MAX_TOKEN ] ; @@ -47,7 +47,7 @@ } [...85 lines suppressed...] char c [ MAX_TOKEN ] ; @@ -360,7 +360,7 @@ -int pslParser::pushGlobalDeclaration () +int pslCompiler::pushGlobalDeclaration () { char c [ MAX_TOKEN ] ; char fn [ MAX_TOKEN ] ; @@ -404,7 +404,7 @@ } -int pslParser::pushFunctionDeclaration ( const char *fn ) +int pslCompiler::pushFunctionDeclaration ( const char *fn ) { char c [ MAX_TOKEN ] ; Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslDump.cxx 6 Sep 2002 16:44:51 -0000 1.7 +++ pslDump.cxx 6 Sep 2002 17:20:56 -0000 1.8 @@ -59,7 +59,7 @@ } ; -void pslParser::print_opcode ( FILE *fd, unsigned char op ) const +void pslCompiler::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 pslParser::dump () const +void pslCompiler::dump () const { int i ; Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslExpression.cxx 6 Sep 2002 13:50:51 -0000 1.5 +++ pslExpression.cxx 6 Sep 2002 17:20:56 -0000 1.6 @@ -25,7 +25,7 @@ #include "pslLocal.h" -int pslParser::pushPrimitive () +int pslCompiler::pushPrimitive () { char c [ MAX_TOKEN ] ; pslGetToken ( c ) ; @@ -102,7 +102,7 @@ -int pslParser::pushMultExpression () +int pslCompiler::pushMultExpression () { if ( ! pushPrimitive () ) return FALSE ; @@ -132,7 +132,7 @@ -int pslParser::pushAddExpression () +int pslCompiler::pushAddExpression () { if ( ! pushMultExpression () ) return FALSE ; @@ -162,7 +162,7 @@ -int pslParser::pushRelExpression () +int pslCompiler::pushRelExpression () { if ( ! pushAddExpression () ) return FALSE ; @@ -227,7 +227,7 @@ } -int pslParser::pushExpression () +int pslCompiler::pushExpression () { return pushRelExpression () ; } Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pslLocal.h 6 Sep 2002 16:44:51 -0000 1.10 +++ pslLocal.h 6 Sep 2002 17:20:56 -0000 1.11 @@ -98,6 +98,6 @@ #include "pslSymbol.h" #include "pslContext.h" -#include "pslParser.h" +#include "pslCompiler.h" Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslProgram.cxx 6 Sep 2002 15:07:44 -0000 1.5 +++ pslProgram.cxx 6 Sep 2002 17:20:56 -0000 1.6 @@ -34,10 +34,10 @@ extensions = ext ; - parser = new pslParser ( code, ext ) ; + compiler = new pslCompiler ( code, ext ) ; context = new pslContext ( this ) ; - parser -> init () ; + compiler -> init () ; context -> reset () ; } @@ -45,7 +45,7 @@ pslProgram::pslProgram ( pslProgram *src ) { code = src -> getCode () ; - parser = src -> getParser () ; + compiler = src -> getCompiler () ; extensions = src -> getExtensions () ; userData = src -> getUserData () ; @@ -56,23 +56,23 @@ pslProgram::~pslProgram () { - delete parser ; + delete compiler ; delete context ; delete [] code ; } -void pslProgram::dump () const { parser -> dump () ; } +void pslProgram::dump () const { compiler -> dump () ; } void pslProgram::reset () { context -> reset () ; } pslResult pslProgram::step () { return context -> step () ; } -int pslProgram::parse ( const char *fname ) +int pslProgram::compile ( const char *fname ) { - return parser -> parse(fname) ; + return compiler -> compile (fname) ; } -int pslProgram::parse ( FILE *fd ) +int pslProgram::compile ( FILE *fd ) { - return parser -> parse( fd ) ; + return compiler -> compile( fd ) ; } Index: pslSymbols.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslSymbols.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pslSymbols.cxx 6 Sep 2002 16:44:51 -0000 1.9 +++ pslSymbols.cxx 6 Sep 2002 17:20:56 -0000 1.10 @@ -25,7 +25,7 @@ #include "pslLocal.h" -pslAddress pslParser::setVarSymbol ( const char *s ) +pslAddress pslCompiler::setVarSymbol ( const char *s ) { for ( int i = 0 ; i < next_var ; i++ ) if ( strcmp ( s, symtab [ i ] . symbol ) == 0 && @@ -48,7 +48,7 @@ -pslAddress pslParser::getVarSymbol ( const char *s ) +pslAddress pslCompiler::getVarSymbol ( const char *s ) { /* Search Backwards so most local variable shows up first */ @@ -62,7 +62,7 @@ } -int pslParser::getExtensionSymbol ( const char *s ) +int pslCompiler::getExtensionSymbol ( const char *s ) { for ( int i = 0 ; extensions [ i ] . symbol != NULL ; i++ ) if ( strcmp ( s, extensions [ i ] . symbol ) == 0 ) @@ -72,7 +72,7 @@ } -void pslParser::addFwdRef ( const char *s, pslAddress where ) +void pslCompiler::addFwdRef ( const char *s, pslAddress where ) { for ( int i = 0 ; i < next_fwdref ; i++ ) { @@ -94,7 +94,7 @@ -void pslParser::fixup ( const char *s, pslAddress v ) +void pslCompiler::fixup ( const char *s, pslAddress v ) { for ( int i = 0 ; i < next_fwdref ; i++ ) { @@ -113,7 +113,7 @@ -void pslParser::checkUnresolvedSymbols () +void pslCompiler::checkUnresolvedSymbols () { for ( int i = 0 ; i < next_fwdref ; i++ ) { @@ -131,7 +131,7 @@ -pslAddress pslParser::getCodeSymbol ( const char *s, pslAddress where ) +pslAddress pslCompiler::getCodeSymbol ( const char *s, pslAddress where ) { for ( int i = 0 ; i < next_code_symbol ; i++ ) if ( strcmp ( s, code_symtab [ i ] . symbol ) == 0 ) @@ -146,7 +146,7 @@ -void pslParser::setCodeSymbol ( const char *s, pslAddress v ) +void pslCompiler::setCodeSymbol ( const char *s, pslAddress v ) { for ( int i = 0 ; i < next_code_symbol ; i++ ) if ( strcmp ( s, code_symtab [ i ] . symbol ) == 0 ) --- pslParser.h DELETED --- |