plib-cvs Mailing List for PLIB (Page 23)
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-10-17 13:42:36
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv18449/plib/src/ssg Modified Files: ssgSaveFLT.cxx Log Message: Updated FLT writer to generate texture and vertex palette entries. Index: ssgSaveFLT.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgSaveFLT.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ssgSaveFLT.cxx 17 Oct 2002 12:05:00 -0000 1.1 +++ ssgSaveFLT.cxx 17 Oct 2002 13:42:31 -0000 1.2 @@ -34,7 +34,67 @@ #include <stdio.h> #include "ssgLocal.h" -static FILE* save_fd; + +struct FLT_texture +{ + char fname [ 200 ] ; /* 200 is the OpenFlight limit - don't increase it! */ +} ; + + [...317 lines suppressed...] + + /* Cleanup */ + + int max, i ; + + max = texList -> getNumEntities () ; + + for ( i = 0 ; i < max ; i++ ) + delete (FLT_texture *) texList -> getEntity ( i ) ; + delete texList ; + + max = vtxList -> getNumEntities () ; + + for ( i = 0 ; i < max ; i++ ) + delete (FLT_vertex *) vtxList -> getEntity ( i ) ; + delete vtxList ; + return TRUE ; } |
From: Steve B. <sj...@us...> - 2002-10-17 12:05:06
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv14820/plib/src/pui Modified Files: puFileSelector.cxx Log Message: Fix for puFileSelector committed on behalf of John Fay. Index: puFileSelector.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFileSelector.cxx,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- puFileSelector.cxx 24 Sep 2002 22:18:07 -0000 1.31 +++ puFileSelector.cxx 17 Oct 2002 12:04:58 -0000 1.32 @@ -218,6 +218,8 @@ new_dst [ dst_len + src_len - 1 ] = SLASH[0] ; file_selector -> __getInput() -> setValue ( new_dst ) ; + file_selector -> setValue ( new_dst ) ; + delete [] new_dst ; file_selector -> find_files () ; return ; @@ -233,6 +235,8 @@ memcpy ( new_dst + dst_len, src, src_len + 1 ) ; /* Copy trailing '\0' */ file_selector -> __getInput() -> setValue ( new_dst ) ; + file_selector -> setValue ( new_dst ) ; + delete [] new_dst ; } else |
From: Steve B. <sj...@us...> - 2002-10-17 12:05:06
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv14820/plib/src/ssg Modified Files: Makefile.am ssg.cxx ssg.h Added Files: ssgSaveFLT.cxx Log Message: Fix for puFileSelector committed on behalf of John Fay. --- NEW FILE: ssgSaveFLT.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 [...282 lines suppressed...] int ssgSaveFLT ( const char *fname, ssgEntity *root ) { save_fd = NULL ; if ( ( save_fd = fopen ( fname, "wb") ) == NULL ) { fprintf ( stderr, "Could not open file '%s' for writing.\n", fname ) ; return FALSE ; } writeHeader () ; writeEntity ( root ) ; fclose ( save_fd ) ; return TRUE ; } Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/Makefile.am,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- Makefile.am 27 Sep 2002 15:45:06 -0000 1.39 +++ Makefile.am 17 Oct 2002 12:05:00 -0000 1.40 @@ -23,7 +23,7 @@ ssgLoadOFF.cxx ssgSaveOFF.cxx ssgSaveQHI.cxx ssgLoadVRML1.cxx \ ssgSaveVRML1.cxx ssgLoaderWriterStuff.h ssgMSFSPalette.h ssg3ds.h \ ssgLoadMDL.h ssgSave3ds.cxx ssgAxisTransform.cxx ssgLoadATG.cxx \ - ssgSaveATG.cxx ssgLoadIV.cxx ssgLoad.cxx ssgLoadVRML.h \ + ssgSaveFLT.cxx ssgSaveATG.cxx ssgLoadIV.cxx ssgLoad.cxx ssgLoadVRML.h \ ssgLoadMDL_BGLTexture.cxx ssgLoadXPlaneObj.cxx INCLUDES = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/util Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- ssg.cxx 27 Sep 2002 15:45:06 -0000 1.58 +++ ssg.cxx 17 Oct 2002 12:05:00 -0000 1.59 @@ -134,7 +134,7 @@ ssgAddModelFormat ( ".tri", ssgLoadTRI , ssgSaveTRI ) ; ssgAddModelFormat ( ".md2", ssgLoadMD2 , NULL ) ; ssgAddModelFormat ( ".x" , ssgLoadX , ssgSaveX ) ; - ssgAddModelFormat ( ".flt", ssgLoadFLT , NULL ) ; + ssgAddModelFormat ( ".flt", ssgLoadFLT , ssgSaveFLT ) ; ssgAddModelFormat ( ".strip", ssgLoadStrip, NULL ) ; ssgAddModelFormat ( ".m" , ssgLoadM , ssgSaveM ) ; ssgAddModelFormat ( ".off" , ssgLoadOFF , ssgSaveOFF ) ; Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.150 retrieving revision 1.151 diff -u -d -r1.150 -r1.151 --- ssg.h 27 Sep 2002 15:45:06 -0000 1.150 +++ ssg.h 17 Oct 2002 12:05:00 -0000 1.151 @@ -2630,9 +2630,9 @@ int ssgSaveX ( const char *fname, ssgEntity *ent ) ; int ssgSaveM ( const char *fname, ssgEntity *ent ) ; int ssgSave3ds ( const char *fname, ssgEntity *ent ) ; +int ssgSaveFLT ( const char *fname, ssgEntity *ent ) ; int ssgSaveOFF ( const char *fname, ssgEntity *ent ) ; int ssgSaveQHI ( const char *fname, ssgEntity *ent ) ; -int ssgSave3ds ( const char *fname, ssgEntity *ent ) ; int ssgSaveATG ( const char *fname, ssgEntity *ent ) ; int ssgSaveVRML1( const char *fname, ssgEntity *ent ) ; |
From: Sebastian U. <ud...@us...> - 2002-10-15 19:43:07
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv4571 Modified Files: ssgLoadXPlaneObj.cxx Log Message: Minor optimizations Index: ssgLoadXPlaneObj.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadXPlaneObj.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ssgLoadXPlaneObj.cxx 27 Sep 2002 15:45:06 -0000 1.1 +++ ssgLoadXPlaneObj.cxx 15 Oct 2002 19:43:04 -0000 1.2 @@ -137,7 +137,7 @@ for (--size; n < size; ++n) { - c = fgetc(fp); + c = getc(fp); if (c == EOF) return 0; @@ -148,7 +148,7 @@ *p = 0; - c = fgetc(fp); + c = getc(fp); if (c != '\n') ungetc( c, fp ); @@ -460,3 +460,4 @@ ObjLoader loader( options ); return loader.load( fname ); } + |
From: Sebastian U. <ud...@us...> - 2002-10-15 19:42:52
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv4428 Modified Files: ssg.dsp Log Message: Added XPlane loader Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- ssg.dsp 25 Aug 2002 12:50:21 -0000 1.42 +++ ssg.dsp 15 Oct 2002 19:42:46 -0000 1.43 @@ -282,6 +282,10 @@ # End Source File # Begin Source File +SOURCE=.\ssgLoadXPlaneObj.cxx +# End Source File +# Begin Source File + SOURCE=.\ssgLocal.h # End Source File # Begin Source File |
From: Steve B. <sj...@us...> - 2002-10-03 03:33:35
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv6051/plib/src/ssg Modified Files: ssgOptimiser.cxx Log Message: Replaced sgScalarProductVec2 with sgLengthVec3. Index: ssgOptimiser.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgOptimiser.cxx,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- ssgOptimiser.cxx 9 Sep 2002 09:08:29 -0000 1.28 +++ ssgOptimiser.cxx 3 Oct 2002 03:33:30 -0000 1.29 @@ -320,7 +320,7 @@ } for ( i = 0 ; i < vnum ; i++ ) - if ( sgScalarProductVec2 ( vlist[i]->normal, vlist[i]->normal ) < 0.001 ) + if ( sgLengthVec3 ( vlist[i]->normal ) < 0.001 ) sgSetVec3 ( vlist[i]->normal, 0.0f, 0.0f, 1.0f ) ; else sgNormaliseVec3 ( vlist [ i ] -> normal ) ; |
From: Sebastian U. <ud...@us...> - 2002-09-27 23:57:36
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv24623 Added Files: puInputBase.cxx Log Message: John F. Fay / me: Introduced common baseclass for puInput and puLargeInput --- NEW FILE: puInputBase.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 $Id: puInputBase.cxx,v 1.1 2002/09/27 23:57:33 ude Exp $ */ #include "puLocal.h" UL_RTTI_DEF(puInputBase) void puInputBase::normalizeCursors ( void ) { int sl = strlen ( widget -> getStringValue () ) ; /* Clamp the positions to the limits of the text. */ if ( cursor_position < 0 ) cursor_position = 0 ; if ( select_start_position < 0 ) select_start_position = 0 ; if ( select_end_position < 0 ) select_end_position = 0 ; if ( cursor_position > sl ) cursor_position = sl ; if ( select_start_position > sl ) select_start_position = sl ; if ( select_end_position > sl ) select_end_position = sl ; /* Swap the ends of the select window if they get crossed over */ if ( select_end_position < select_start_position ) { int tmp = select_end_position ; select_end_position = select_start_position ; select_start_position = tmp ; } } void puInputBase::removeSelectRegion ( void ) { char *text = widget -> getStringValue () ; int text_len = strlen ( text ) ; char *p = new char [ text_len + 1 - ( select_end_position - select_start_position ) ] ; memcpy ( p, text, select_start_position ) ; memcpy ( p + select_start_position, text + select_end_position, text_len - select_end_position + 1 ) ; widget -> setValue ( p ) ; delete [] p ; cursor_position = select_end_position = select_start_position ; } void puInputBase::addValidData ( const char *data ) { int valid_len = valid_data != NULL ? strlen ( valid_data ) : 0 ; int data_len = data != NULL ? strlen ( data ) : 0 ; int new_data_len = valid_len + data_len ; char *new_data = new char [ new_data_len + 1 ] ; if ( valid_len != 0 ) memcpy ( new_data, valid_data, valid_len ) ; if ( data_len != 0 ) memcpy ( new_data + valid_len, data, data_len ) ; new_data [ new_data_len ] = '\0' ; delete [] valid_data ; valid_data = new_data ; } |
From: Sebastian U. <ud...@us...> - 2002-09-27 23:53:57
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv23161 Modified Files: Makefile.am pu.h puInput.cxx puLargeInput.cxx pui.dsp Log Message: John F. Fay / me: Introduced common baseclass for puInput and puLargeInput Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/pui/Makefile.am,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Makefile.am 31 Aug 2002 22:21:21 -0000 1.18 +++ Makefile.am 27 Sep 2002 23:53:52 -0000 1.19 @@ -13,7 +13,7 @@ puValue.cxx puFont.cxx puBiSlider.cxx puTriSlider.cxx \ puDial.cxx puVerticalMenu.cxx puLargeInput.cxx \ puFileSelector.cxx puComboBox.cxx puSelectBox.cxx puRange.cxx \ - puSpinBox.cxx puScrollBar.cxx + puSpinBox.cxx puScrollBar.cxx puInputBase.cxx INCLUDES = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/fnt INCLUDES += -I$(top_srcdir)/src/util Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.135 retrieving revision 1.136 diff -u -d -r1.135 -r1.136 --- pu.h 24 Sep 2002 22:18:07 -0000 1.135 +++ pu.h 27 Sep 2002 23:53:52 -0000 1.136 @@ -669,20 +669,20 @@ void setCallback ( puCallback c ) { cb = c ; } puCallback getCallback ( void ) const { return cb ; } - void invokeCallback ( void ) { if ( cb ) (*cb)(this) ; } + void invokeCallback ( void ) { if ( cb != NULL ) (*cb)(this) ; } void setActiveCallback ( puCallback c ) { active_cb = c ; } puCallback getActiveCallback ( void ) const { return active_cb ; } - void invokeActiveCallback ( void ) { if ( active_cb ) (*active_cb)(this) ; } + void invokeActiveCallback ( void ) { if ( active_cb != NULL ) (*active_cb)(this) ; } [...204 lines suppressed...] - if ( valid_data != NULL ) - return ( strchr ( valid_data, c ) != NULL ) ? 1 : 0 ; - else - return 1 ; - } - void invokeDownCallback ( void ) { rejectInput () ; - normalize_cursors () ; + normalizeCursors () ; if ( down_cb != NULL ) (*down_cb)(this) ; } - - void enableInput ( void ) { input_disabled = FALSE ; } - void disableInput ( void ) { input_disabled = TRUE ; } - int inputDisabled ( void ) const { return input_disabled ; } void setValue ( const char *s ) ; void setText ( const char *l ) { setValue ( l ) ; } /* DEPRECATED */ Index: puInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puInput.cxx,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- puInput.cxx 24 Sep 2002 22:18:07 -0000 1.30 +++ puInput.cxx 27 Sep 2002 23:53:52 -0000 1.31 @@ -24,45 +24,7 @@ #include "puLocal.h" -UL_RTTI_DEF1(puInput,puObject) - - -void puInput::normalize_cursors ( void ) -{ - int sl = strlen ( getStringValue () ) ; - - /* Clamp the positions to the limits of the text. */ [...98 lines suppressed...] - - -puInput::puInput ( int minx, int miny, int maxx, int maxy ) : - puObject ( minx, miny, maxx, maxy ) -{ - type |= PUCLASS_INPUT ; - - accepting = FALSE ; - - cursor_position = 0 ; - select_start_position = -1 ; - select_end_position = -1 ; - - valid_data = NULL ; - input_disabled = FALSE ; - - setColourScheme ( 0.8f, 0.7f, 0.7f ) ; /* Yeukky Pink */ - setColour ( PUCOL_MISC, 0.1f, 0.1f, 1.0f ) ; /* Colour of 'I' bar cursor */ -} Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- puLargeInput.cxx 25 Sep 2002 19:44:30 -0000 1.44 +++ puLargeInput.cxx 27 Sep 2002 23:53:53 -0000 1.45 @@ -24,12 +24,12 @@ #include "puLocal.h" -UL_RTTI_DEF1(puLargeInput,puGroup) +UL_RTTI_DEF2(puLargeInput,puInputBase,puGroup) // Callbacks from the internal widgets -static void puLargeInputHandleRightSlider ( puObject * slider ) +static void puLargeInputHandleRightSlider ( puObject *slider ) [...154 lines suppressed...] } -void puLargeInput::addValidData ( const char *data ) -{ - int valid_len = valid_data != NULL ? strlen ( valid_data ) : 0 ; - int data_len = data != NULL ? strlen ( data ) : 0 ; - int new_data_len = valid_len + data_len ; - - char *new_data = new char [ new_data_len + 1 ] ; - - if ( valid_len != 0 ) - memcpy ( new_data, valid_data, valid_len ) ; - if ( data_len != 0 ) - memcpy ( new_data + valid_len, data, data_len ) ; - - new_data [ new_data_len ] = '\0' ; - delete [] valid_data ; - valid_data = new_data ; -} Index: pui.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pui.dsp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- pui.dsp 1 Sep 2002 02:51:42 -0000 1.23 +++ pui.dsp 27 Sep 2002 23:53:53 -0000 1.24 @@ -154,6 +154,10 @@ # End Source File # Begin Source File +SOURCE=.\puInputBase.cxx +# End Source File +# Begin Source File + SOURCE=.\puInput.cxx # End Source File # Begin Source File |
From: Sebastian U. <ud...@us...> - 2002-09-27 21:20:05
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv8917 Modified Files: psl.cxx psl.h Log Message: Const-correctness Index: psl.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- psl.cxx 27 Sep 2002 15:45:06 -0000 1.5 +++ psl.cxx 27 Sep 2002 21:19:59 -0000 1.6 @@ -24,12 +24,12 @@ #include "pslLocal.h" -int _pslInitialised = FALSE ; -char *_pslScriptPath = NULL ; +int _pslInitialised = FALSE ; +static char *_pslScriptPath = NULL ; void pslInit () { _pslInitialised = TRUE ; } -void pslScriptPath ( char *path ) +void pslScriptPath ( const char *path ) { delete [] _pslScriptPath ; _pslScriptPath = ulStrDup ( path ) ; Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- psl.h 27 Sep 2002 15:45:06 -0000 1.23 +++ psl.h 27 Sep 2002 21:19:59 -0000 1.24 @@ -330,7 +330,7 @@ void pslInit () ; -void pslScriptPath ( char *path ) ; +void pslScriptPath ( const char *path ) ; void pslSetErrorCallback ( void (*CB) ( pslProgram *, int, char *, int, char * ) ) ; #endif |
From: Steve B. <sj...@us...> - 2002-09-27 15:45:10
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv20459/plib/src/ssg Modified Files: Makefile.am ssg.cxx ssg.h ssgconf.h Added Files: ssgLoadXPlaneObj.cxx Log Message: Added Bernie Bright's XPlane loader. Fixed some more 'gotcha's in PSL. --- NEW FILE: ssgLoadXPlaneObj.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 [...423 lines suppressed...] ulSetError( UL_WARNING, "ssgLoadXPlaneObj: invalid line, '%s'", line ); fclose(fp); delete root; return 0; } } while ((p = getline( line, sizeof(line), fp )) != 0 && type != 99); } fclose( fp ); return root; } ssgEntity* ssgLoadXPlaneOBJ( const char* fname, const ssgLoaderOptions* options ) { ObjLoader loader( options ); return loader.load( fname ); } Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/Makefile.am,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- Makefile.am 31 Aug 2002 22:36:07 -0000 1.38 +++ Makefile.am 27 Sep 2002 15:45:06 -0000 1.39 @@ -24,7 +24,7 @@ ssgSaveVRML1.cxx ssgLoaderWriterStuff.h ssgMSFSPalette.h ssg3ds.h \ ssgLoadMDL.h ssgSave3ds.cxx ssgAxisTransform.cxx ssgLoadATG.cxx \ ssgSaveATG.cxx ssgLoadIV.cxx ssgLoad.cxx ssgLoadVRML.h \ - ssgLoadMDL_BGLTexture.cxx + ssgLoadMDL_BGLTexture.cxx ssgLoadXPlaneObj.cxx INCLUDES = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/util Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- ssg.cxx 2 Sep 2002 06:05:47 -0000 1.57 +++ ssg.cxx 27 Sep 2002 15:45:06 -0000 1.58 @@ -143,7 +143,6 @@ ssgAddModelFormat ( ".wrl", ssgLoadVRML1, ssgSaveVRML1 ) ; ssgAddModelFormat ( ".iv", ssgLoadIV , NULL ) ; - #ifdef SSG_LOAD_MDL_SUPPORTED ssgAddModelFormat ( ".mdl", ssgLoadMDL , NULL ) ; #endif @@ -199,6 +198,9 @@ ssgAddTextureFormat ( ".ngt" , ssgLoadMDLTexture ) ; #endif +#ifdef SSG_LOAD_XPL_SUPPORTED + ssgAddModelFormat ( ".xpl", ssgLoadXPlaneOBJ , NULL ) ; +#endif } Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.149 retrieving revision 1.150 diff -u -d -r1.149 -r1.150 --- ssg.h 15 Sep 2002 01:29:11 -0000 1.149 +++ ssg.h 27 Sep 2002 15:45:06 -0000 1.150 @@ -2654,7 +2654,8 @@ ssgEntity *ssgLoadOFF ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadATG ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadVRML1( const char *fname, const ssgLoaderOptions* options = NULL ) ; -ssgEntity *ssgLoadIV( const char *fname, const ssgLoaderOptions* options = NULL ) ; +ssgEntity *ssgLoadIV ( const char *fname, const ssgLoaderOptions* options = NULL ) ; +ssgEntity *ssgLoadXPlaneOBJ ( const char *fname, const ssgLoaderOptions *options = NULL ) ; typedef ssgEntity *ssgLoadFunc ( const char *, const ssgLoaderOptions * ) ; Index: ssgconf.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgconf.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ssgconf.h 2 Sep 2002 06:05:49 -0000 1.10 +++ ssgconf.h 27 Sep 2002 15:45:06 -0000 1.11 @@ -50,4 +50,5 @@ #define SSG_LOAD_BMP_SUPPORTED #define SSG_LOAD_MDL_SUPPORTED #define SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED +#define SSG_LOAD_XPL_SUPPORTED #endif |
From: Steve B. <sj...@us...> - 2002-09-27 15:45:10
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv20459/plib/doc/psl Modified Files: appl_guide.html prog_guide.html Log Message: Added Bernie Bright's XPlane loader. Fixed some more 'gotcha's in PSL. Index: appl_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/appl_guide.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- appl_guide.html 15 Sep 2002 01:42:54 -0000 1.6 +++ appl_guide.html 27 Sep 2002 15:45:06 -0000 1.7 @@ -405,6 +405,15 @@ <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. +<H3> Include paths. </H3> +By default, PSL searches for files with relative pathnames in +the current directory - but you can override this by setting: +<pre> + + + pslScriptPath ( "directory" ) ; + +</pre> <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.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- prog_guide.html 22 Sep 2002 18:26:56 -0000 1.13 +++ prog_guide.html 27 Sep 2002 15:45:06 -0000 1.14 @@ -123,6 +123,7 @@ The following features are "NOT IMPLEMENTED YET" - but will hopefully arrive soon: <ul> + <li> Multiple variable definitions like 'int i, j, k ;' <li> Structs. <li> '\' to escape the end-of-line character in strings and macro's. <li> Parameter passing by name. |
From: Steve B. <sj...@us...> - 2002-09-27 15:45:10
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv20459/plib/src/psl Modified Files: psl.cxx psl.h pslCompiler.cxx pslFileIO.cxx pslLocal.h Log Message: Added Bernie Bright's XPlane loader. Fixed some more 'gotcha's in PSL. Index: psl.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- psl.cxx 6 Sep 2002 15:07:44 -0000 1.4 +++ psl.cxx 27 Sep 2002 15:45:06 -0000 1.5 @@ -24,8 +24,43 @@ #include "pslLocal.h" -int _pslInitialised = FALSE ; +int _pslInitialised = FALSE ; +char *_pslScriptPath = NULL ; void pslInit () { _pslInitialised = TRUE ; } + +void pslScriptPath ( char *path ) +{ + delete [] _pslScriptPath ; + _pslScriptPath = ulStrDup ( path ) ; +} + + +char* _pslMakeScriptPath ( char* path, const char* fname ) +{ + if ( fname != NULL && fname [ 0 ] != '\0' ) + { + if ( ! ulIsAbsolutePathName ( fname ) && + _pslScriptPath != NULL && _pslScriptPath[0] != '\0' ) + { + strcpy ( path, _pslScriptPath ) ; + strcat ( path, "/" ) ; + strcat ( path, fname ) ; + } + else + strcpy ( path, fname ) ; + + /* Convert backward slashes to forward slashes */ + + for ( char* ptr = path ; *ptr ; ptr ++ ) + if ( *ptr == '\\' ) + *ptr = '/' ; + } + else + path [0] = 0 ; + + return path ; +} + Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- psl.h 22 Sep 2002 20:49:05 -0000 1.22 +++ psl.h 27 Sep 2002 15:45:06 -0000 1.23 @@ -330,6 +330,7 @@ void pslInit () ; +void pslScriptPath ( char *path ) ; void pslSetErrorCallback ( void (*CB) ( pslProgram *, int, char *, int, char * ) ) ; #endif Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- pslCompiler.cxx 22 Sep 2002 18:25:16 -0000 1.27 +++ pslCompiler.cxx 27 Sep 2002 15:45:06 -0000 1.28 @@ -28,13 +28,16 @@ int pslCompiler::compile ( const char *fname ) { - FILE *fd = fopen ( fname, "ra" ) ; + char filename [ 1024 ] ; + _pslMakeScriptPath ( filename, fname ) ; + + FILE *fd = fopen ( filename, "ra" ) ; if ( fd == NULL ) { perror ( "PSL:" ) ; ulSetError ( UL_WARNING, "PSL: Failed while opening '%s' for reading.", - fname ); + filename ); return FALSE ; } Index: pslFileIO.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslFileIO.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pslFileIO.cxx 15 Sep 2002 14:32:53 -0000 1.5 +++ pslFileIO.cxx 27 Sep 2002 15:45:06 -0000 1.6 @@ -120,11 +120,15 @@ void _pslPushDefaultFile ( const char *fname ) { - FILE *fd = fopen ( fname, "ra" ) ; + char filename [ 1024 ] ; + _pslMakeScriptPath ( filename, fname ) ; + + FILE *fd = fopen ( filename, "ra" ) ; if ( fd == NULL ) { - fprintf ( stderr, "PSL: ERROR - Can't open #include'ed file '%s'", fname ) ; + fprintf ( stderr, + "PSL: ERROR - Can't open #include'ed file '%s'", filename ) ; return ; } Index: pslLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslLocal.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- pslLocal.h 15 Sep 2002 00:02:51 -0000 1.16 +++ pslLocal.h 27 Sep 2002 15:45:06 -0000 1.17 @@ -59,4 +59,5 @@ #include "pslCompiler.h" #include "pslContext.h" +char* _pslMakeScriptPath ( char* path, const char* fname ) ; |
From: Sebastian U. <ud...@us...> - 2002-09-25 19:44:35
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv25558 Modified Files: puLargeInput.cxx Log Message: John F. Fay: Fix to previous changes Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- puLargeInput.cxx 24 Sep 2002 22:18:07 -0000 1.43 +++ puLargeInput.cxx 25 Sep 2002 19:44:30 -0000 1.44 @@ -31,7 +31,7 @@ static void puLargeInputHandleRightSlider ( puObject * slider ) { - float val = ((puRange *)slider)->getMaxValue () - slider->getFloatValue () ; + float val = ((puScrollBar *)slider)->getMaxValue () - slider->getFloatValue () ; puLargeInput* text = (puLargeInput*) slider->getUserData () ; //int lines_in_window = text->getLinesInWindow () ; |
From: Sebastian U. <ud...@us...> - 2002-09-24 22:18:12
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv17123 Modified Files: pu.h puFileSelector.cxx puInput.cxx puLargeInput.cxx Log Message: John F. Fay / me: Major improvements to the efficience of string handling in PUI Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.134 retrieving revision 1.135 diff -u -d -r1.134 -r1.135 --- pu.h 21 Sep 2002 17:47:09 -0000 1.134 +++ pu.h 24 Sep 2002 22:18:07 -0000 1.135 @@ -1524,25 +1524,9 @@ void setValidData ( const char *data ) { delete [] valid_data ; - - if ( data != NULL ) - valid_data = ulStrDup ( data ) ; - else - valid_data = NULL ; - } - - void addValidData ( const char *data ) [...71 lines suppressed...] - strcpy ( new_data, "\0" ) ; - if ( valid_data ) strcat ( new_data, valid_data ) ; - if ( data ) strcat ( new_data, data ) ; - delete [] valid_data ; - valid_data = new_data ; + valid_data = data != NULL ? ulStrDup ( data ) : NULL ; } + void addValidData ( const char *data ) ; int isValidCharacter ( char c ) const { @@ -1920,7 +1868,7 @@ { rejectInput () ; normalize_cursors () ; - if ( down_cb ) (*down_cb)(this) ; + if ( down_cb != NULL ) (*down_cb)(this) ; } void enableInput ( void ) { input_disabled = FALSE ; } Index: puFileSelector.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFileSelector.cxx,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- puFileSelector.cxx 21 Sep 2002 17:47:09 -0000 1.30 +++ puFileSelector.cxx 24 Sep 2002 22:18:07 -0000 1.31 @@ -53,6 +53,7 @@ #define DOTDOTSLASH "../" #define SLASH "/" #endif +#define SLASH_LEN 1 static void puFileSelectorHandleSlider ( puObject * slider ) { @@ -317,44 +318,59 @@ dflag = NULL ; num_files = 0 ; [...121 lines suppressed...] { - files[ ifile ] = new char[ strlen(dp->d_name)+4 ] ; - strcpy ( files [ ifile ], "[" ) ; - strcat ( files [ ifile ], dp->d_name ) ; - strcat ( files [ ifile ], "]" ) ; + files[ ifile ] = new char[ name_len + 3 ] ; + + files [ ifile ] [ 0 ] = '[' ; + memcpy ( files [ ifile ] + 1, dp->d_name, name_len ) ; + strcpy ( files [ ifile ] + 1 + name_len, "]" ) ; } else { - files[ ifile ] = new char[ strlen(dp->d_name)+1 ] ; - strcpy ( files [ ifile ], dp->d_name ) ; + files[ ifile ] = new char[ name_len + 1 ] ; + memcpy ( files [ ifile ], dp->d_name, name_len + 1 ) ; /* Plus one to include the final '\0' */ } ifile++ ; Index: puInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puInput.cxx,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- puInput.cxx 19 Sep 2002 23:32:58 -0000 1.29 +++ puInput.cxx 24 Sep 2002 22:18:07 -0000 1.30 @@ -389,16 +389,18 @@ break ; case 0x16 /* ^V */ : /* Paste buffer into text */ - if ( select_start_position != select_end_position ) - removeSelectRegion () ; + { + if ( select_start_position != select_end_position ) + removeSelectRegion () ; - p = new char [ strlen ( getStringValue () ) - + strlen ( puGetPasteBuffer () ) - + 1 ] ; - strncpy ( p, getStringValue (), cursor_position ) ; - strcpy ( p + cursor_position, puGetPasteBuffer () ) ; - strcat ( p, getStringValue () + cursor_position ) ; - cursor_position += strlen ( puGetPasteBuffer () ) ; + int str_val_len = strlen ( getStringValue () ) ; + int paste_len = strlen ( puGetPasteBuffer () ) ; + p = new char [ str_val_len + paste_len + 1 ] ; + memcpy ( p, getStringValue (), cursor_position ) ; + memcpy ( p + cursor_position, puGetPasteBuffer (), paste_len ) ; + memcpy ( p + cursor_position + paste_len, getStringValue () + cursor_position, str_val_len - cursor_position + 1 ) ; + cursor_position += paste_len ; + } break ; @@ -432,4 +434,41 @@ return TRUE ; } + +void puInput::addValidData ( const char *data ) +{ + int valid_len = valid_data != NULL ? strlen ( valid_data ) : 0 ; + int data_len = data != NULL ? strlen ( data ) : 0 ; + int new_data_len = valid_len + data_len ; + + char *new_data = new char [ new_data_len + 1 ] ; + + if ( valid_len != 0 ) + memcpy ( new_data, valid_data, valid_len ) ; + if ( data_len != 0 ) + memcpy ( new_data + valid_len, data, data_len ) ; + + new_data [ new_data_len ] = '\0' ; + delete [] valid_data ; + valid_data = new_data ; +} + + +puInput::puInput ( int minx, int miny, int maxx, int maxy ) : + puObject ( minx, miny, maxx, maxy ) +{ + type |= PUCLASS_INPUT ; + + accepting = FALSE ; + + cursor_position = 0 ; + select_start_position = -1 ; + select_end_position = -1 ; + + valid_data = NULL ; + input_disabled = FALSE ; + + setColourScheme ( 0.8f, 0.7f, 0.7f ) ; /* Yeukky Pink */ + setColour ( PUCOL_MISC, 0.1f, 0.1f, 1.0f ) ; /* Colour of 'I' bar cursor */ +} Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- puLargeInput.cxx 21 Sep 2002 17:47:09 -0000 1.42 +++ puLargeInput.cxx 24 Sep 2002 22:18:07 -0000 1.43 @@ -77,11 +77,11 @@ void puLargeInput::removeSelectRegion ( void ) { char *text = getStringValue () ; - char *p = new char [ strlen ( text ) + 1 - + int text_len = strlen ( text ) ; + char *p = new char [ text_len + 1 - ( select_end_position - select_start_position ) ] ; - strncpy ( p, text, select_start_position ) ; - p [ select_start_position ] = '\0' ; - strcat ( p, (text + select_end_position ) ) ; + memcpy ( p, text, select_start_position ) ; [...237 lines suppressed...] } +void puLargeInput::addValidData ( const char *data ) +{ + int valid_len = valid_data != NULL ? strlen ( valid_data ) : 0 ; + int data_len = data != NULL ? strlen ( data ) : 0 ; + int new_data_len = valid_len + data_len ; + + char *new_data = new char [ new_data_len + 1 ] ; + + if ( valid_len != 0 ) + memcpy ( new_data, valid_data, valid_len ) ; + if ( data_len != 0 ) + memcpy ( new_data + valid_len, data, data_len ) ; + + new_data [ new_data_len ] = '\0' ; + delete [] valid_data ; + valid_data = new_data ; +} |
From: Sebastian U. <ud...@us...> - 2002-09-22 22:05:45
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv6727 Modified Files: impl_guide.html Log Message: Improved HTML code Index: impl_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/impl_guide.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- impl_guide.html 22 Sep 2002 18:27:30 -0000 1.3 +++ impl_guide.html 22 Sep 2002 22:05:41 -0000 1.4 @@ -1,6 +1,9 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="keywords" content="PSL, PLIB, OpenGL, 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."> <title>The PLIB Scripting Language: Implementation Guide.</title> </head> <body text="#B5A642" bgcolor="#005000" link="#8FFF8F" vlink="#18A515" alink="#20336B" background="../marble.png"> @@ -35,236 +38,423 @@ <p> [...562 lines suppressed...] -<H3> OPCODE_DECREMENT_LVALUE <\H3> -INTRUCTION BYTES: 1 <br> -EFFECT: The index and dimension of a variable is on top of the stack. +<H3> OPCODE_INCREMENT_LVALUE </H3> +<H3> OPCODE_DECREMENT_LVALUE </H3> +INTRUCTION BYTES: 1 +<table> +<tr> +<td valign="top"> +EFFECT: +</td> +<td> The index and dimension of a variable is on top of the stack.<br> Increment/decrement the variable leaving the stack - contents undisturbed. + contents undisturbed.</td> +</tr> +</table> <hr> <address> |
From: Sebastian U. <ud...@us...> - 2002-09-22 20:49:10
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv17512 Modified Files: psl.h pslContext.cxx pslContext.h Log Message: Const-correctness Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- psl.h 22 Sep 2002 18:25:16 -0000 1.21 +++ psl.h 22 Sep 2002 20:49:05 -0000 1.22 @@ -307,7 +307,7 @@ pslCompiler *getCompiler () const { return compiler ; } const pslExtension *getExtensions () const { return extensions ; } - int getStackTraceFlag () { return force_stacktrace ; } + int getStackTraceFlag () const { return force_stacktrace ; } char *getProgName () const { return progName ; } Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- pslContext.cxx 22 Sep 2002 18:25:16 -0000 1.19 +++ pslContext.cxx 22 Sep 2002 20:49:05 -0000 1.20 @@ -843,7 +843,7 @@ } -void pslContext::printStack ( FILE *fd ) +void pslContext::printStack ( FILE *fd ) const { fprintf ( fd, "STACK [%d deep] : ", sp ) ; Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslContext.h 22 Sep 2002 18:25:16 -0000 1.14 +++ pslContext.h 22 Sep 2002 20:49:05 -0000 1.15 @@ -63,7 +63,7 @@ int getLineNo () const { return line_no ; } - void printStack ( FILE *fd ) ; + void printStack ( FILE *fd ) const ; void pushInt ( int x ) { stack [ sp++ ] . set ( x ) ; } void pushFloat ( float x ) { stack [ sp++ ] . set ( x ) ; } |
From: Steve B. <sj...@us...> - 2002-09-22 18:27:33
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv27742/plib/doc/psl Modified Files: impl_guide.html Log Message: Removed some redundant opcodes Index: impl_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/impl_guide.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- impl_guide.html 22 Sep 2002 18:25:16 -0000 1.2 +++ impl_guide.html 22 Sep 2002 18:27:30 -0000 1.3 @@ -227,14 +227,6 @@ The value is stored into the variable. The new value of the variable is left on the stack. -<H3> OPCODE_DECREMENT <\H3> -INTRUCTION BYTES: 1 <br> -**FIX ME** - -<H3> OPCODE_INCREMENT <\H3> -INTRUCTION BYTES: 1 <br> -**FIX ME** - <H3> OPCODE_SET_INT_ARRAY <\H3> <H3> OPCODE_SET_FLOAT_ARRAY <\H3> <H3> OPCODE_SET_STRING_ARRAY <\H3> |
From: Steve B. <sj...@us...> - 2002-09-22 18:26:59
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv27490/plib/doc/psl Modified Files: prog_guide.html Log Message: Updated documentation. Index: prog_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/prog_guide.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- prog_guide.html 22 Sep 2002 15:22:21 -0000 1.12 +++ prog_guide.html 22 Sep 2002 18:26:56 -0000 1.13 @@ -46,7 +46,7 @@ The following C features are implemented much as you'd expect: <ul> - <li> Types 'void', 'int' and 'float'. + <li> Types 'void', 'int' and 'float' (and arrays of those things). <li> Function definitions. <li> Global variable definitions. <li> Statement types: @@ -95,7 +95,7 @@ Some new features have been added that are not part of C: <ul> <li> "pause" -- Pause the program until next frame. - <li> "string" data type. + <li> "string" data type (and arrays of strings). <li> Casts are unnecessary between compatible types. <li> C++ style '//' comments. <li> C++ style local variable declarations. @@ -123,10 +123,8 @@ The following features are "NOT IMPLEMENTED YET" - but will hopefully arrive soon: <ul> - <li> Multiple assignments (eg x = y = 0 ; ) - <li> Arrays & Structs. + <li> Structs. <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> |
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv26845/plib/src/psl Modified Files: psl.h pslCodeGen.cxx pslCompiler.cxx pslCompiler.h pslContext.cxx pslContext.h pslDump.cxx pslExpression.cxx pslOpcodes.h Log Message: Fixed arrays. Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- psl.h 22 Sep 2002 15:22:21 -0000 1.20 +++ psl.h 22 Sep 2002 18:25:16 -0000 1.21 @@ -130,12 +130,24 @@ class pslVariable : public pslNumber { + pslVariable *array ; + int array_size ; public: + pslVariable () { array = NULL ; array_size = 0 ; } + void setArrayType ( pslType _type, int arraysize ) { setType ( _type ) ; -/* SET THE ARRAY SIZE HERE */ + delete [] array ; + array_size = arraysize ; + array = new pslVariable [ array_size ] ; + + for ( int i = 0 ; i < array_size ; i++ ) + { + array [ i ] . setType ( getType () ) ; + array [ i ] . set ( 0 ) ; + } } virtual void set ( int v ) @@ -182,6 +194,48 @@ case PSL_STRING : set ( v -> getString () ) ; return ; case PSL_VOID : return ; } + } + + + pslVariable *getIndex ( int index ) + { + if ( index < 0 || index >= array_size || array == NULL ) + return this ; + + return & ( array [ index ] ) ; + } + + + virtual void set ( int v, int index ) + { + if ( index < 0 || index >= array_size || array == NULL ) + set ( v ) ; + + array [ index ] . set ( v ) ; + } + + virtual void set ( float v, int index ) + { + if ( index < 0 || index >= array_size || array == NULL ) + set ( v ) ; + + array [ index ] . set ( v ) ; + } + + virtual void set ( const char *v, int index ) + { + if ( index < 0 || index >= array_size || array == NULL ) + set ( v ) ; + + array [ index ] . set ( v ) ; + } + + virtual void set ( const pslNumber *v, int index ) + { + if ( index < 0 || index >= array_size || array == NULL ) + set ( v ) ; + + array [ index ] . set ( v ) ; } } ; Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- pslCodeGen.cxx 22 Sep 2002 15:22:21 -0000 1.28 +++ pslCodeGen.cxx 22 Sep 2002 18:25:16 -0000 1.29 @@ -126,23 +126,6 @@ genCodeByte ( argpos ) ; } - -void pslCompiler::genIncrement ( const char *c ) -{ - int a = getVarSymbol ( c ) ; - - genCodeByte ( OPCODE_INCREMENT ) ; - genCodeByte ( a ) ; -} - -void pslCompiler::genDecrement ( const char *c ) -{ - int a = getVarSymbol ( c ) ; - - genCodeByte ( OPCODE_DECREMENT ) ; - genCodeByte ( a ) ; -} - int pslCompiler::genMakeIntArray ( const char *c ) { int a = getVarSymbol ( c ) ; @@ -198,10 +181,11 @@ } -void pslCompiler::genVariable ( const char *c ) +void pslCompiler::genVariable ( const char *c, int array_ref ) { int a = getVarSymbol ( c ) ; + genIntConstant ( array_ref ) ; genIntConstant ( a ) ; } Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- pslCompiler.cxx 22 Sep 2002 15:22:21 -0000 1.26 +++ pslCompiler.cxx 22 Sep 2002 18:25:16 -0000 1.27 @@ -651,18 +651,16 @@ return TRUE ; } - int v ; - switch ( t ) { - case PSL_FLOAT : v = genMakeFloatVariable ( s ) ; break ; - case PSL_STRING : v = genMakeStringVariable ( s ) ; break ; - default : v = genMakeIntVariable ( s ) ; break ; + case PSL_FLOAT : genMakeFloatVariable ( s ) ; break ; + case PSL_STRING : genMakeStringVariable ( s ) ; break ; + default : genMakeIntVariable ( s ) ; break ; } if ( strcmp ( c, "=" ) == 0 ) { - genIntConstant ( v ) ; + genVariable ( s, FALSE ) ; genExpression () ; genAssignment () ; genPop () ; @@ -708,18 +706,16 @@ } else { - int v ; - switch ( t ) { - case PSL_FLOAT : v = genMakeFloatVariable ( s ) ; break ; - case PSL_STRING : v = genMakeStringVariable ( s ) ; break ; - default : v = genMakeIntVariable ( s ) ; break ; + case PSL_FLOAT : genMakeFloatVariable ( s ) ; break ; + case PSL_STRING : genMakeStringVariable ( s ) ; break ; + default : genMakeIntVariable ( s ) ; break ; } if ( strcmp ( c, "=" ) == 0 ) { - genIntConstant ( v ) ; + genVariable ( s, FALSE ) ; genExpression () ; genAssignment () ; genPop () ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- pslCompiler.h 22 Sep 2002 15:22:21 -0000 1.30 +++ pslCompiler.h 22 Sep 2002 18:25:16 -0000 1.31 @@ -110,9 +110,6 @@ void genGetParameter ( pslAddress var, int argpos ) ; - void genIncrement ( const char *s ) ; - void genDecrement ( const char *s ) ; - int genMakeIntVariable ( const char *s ) ; int genMakeFloatVariable ( const char *s ) ; int genMakeStringVariable ( const char *s ) ; @@ -137,7 +134,7 @@ void genIncrementFetch () ; void genDecrementFetch () ; - void genVariable ( const char *s ) ; + void genVariable ( const char *s, int dimension ) ; void genAssignment () ; void genAddAssignment () ; void genSubAssignment () ; Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- pslContext.cxx 22 Sep 2002 15:22:21 -0000 1.18 +++ pslContext.cxx 22 Sep 2002 18:25:16 -0000 1.19 @@ -24,6 +24,30 @@ #include "pslLocal.h" +pslVariable *pslContext::peekLValue () +{ + return ( stack[sp-2].getInt() == 0 ) ? + & ( variable [ stack[sp-1].getInt() ] ) : + variable [ stack[sp-1].getInt() ] . getIndex ( stack [ sp-3 ].getInt() ) ; +} + + [...318 lines suppressed...] if ( v -> getType () == PSL_INT ) v -> set ( v -> getInt () - 1 ) ; @@ -814,7 +809,7 @@ case OPCODE_INCREMENT_FETCH : { - pslVariable *v = & ( variable [ stack[--sp].getInt() ] ) ; + pslVariable *v = popLValue () ; pushNumber ( v ) ; if ( v -> getType () == PSL_INT ) @@ -828,7 +823,7 @@ case OPCODE_DECREMENT_FETCH : { - pslVariable *v = & ( variable [ stack[--sp].getInt() ] ) ; + pslVariable *v = popLValue () ; pushNumber ( v ) ; if ( v -> getType () == PSL_INT ) Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslContext.h 22 Sep 2002 15:22:21 -0000 1.13 +++ pslContext.h 22 Sep 2002 18:25:16 -0000 1.14 @@ -45,6 +45,9 @@ void error ( const char *fmt, ... ) ; void warning ( const char *fmt, ... ) ; + pslVariable *popLValue () ; + pslVariable *peekLValue () ; + public: pslContext ( pslProgram *p ) Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- pslDump.cxx 22 Sep 2002 15:22:21 -0000 1.21 +++ pslDump.cxx 22 Sep 2002 18:25:16 -0000 1.22 @@ -68,9 +68,6 @@ { "SET_STRING_VARIABLE", OPCODE_SET_STRING_VARIABLE, 1 }, { "GET_PARAMETER" , OPCODE_GET_PARAMETER , 2 }, - { "INC" , OPCODE_INCREMENT , 1 }, - { "DEC" , OPCODE_DECREMENT , 1 }, - /* Flow Control */ { "CALLEXT", OPCODE_CALLEXT , 2 }, Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- pslExpression.cxx 22 Sep 2002 15:22:21 -0000 1.17 +++ pslExpression.cxx 22 Sep 2002 18:25:16 -0000 1.18 @@ -49,7 +49,7 @@ if ( ! isArray && ! isStruct ) { ungetToken ( n ) ; - genVariable ( c ) ; + genVariable ( c, FALSE ) ; return TRUE ; } @@ -63,10 +63,10 @@ getToken ( n ) ; - if ( n[0] == ']' ) + if ( n[0] != ']' ) return error ( "Missing ']' after array index." ) ; - genVariable ( c ) ; + genVariable ( c, TRUE ) ; return TRUE ; } Index: pslOpcodes.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslOpcodes.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslOpcodes.h 22 Sep 2002 15:22:21 -0000 1.13 +++ pslOpcodes.h 22 Sep 2002 18:25:16 -0000 1.14 @@ -67,8 +67,7 @@ #define OPCODE_SET_STRING_VARIABLE 0x26 #define OPCODE_STACK_DUPLICATE 0x27 #define OPCODE_GET_PARAMETER 0x28 -#define OPCODE_INCREMENT 0x29 -#define OPCODE_DECREMENT 0x2A + #define OPCODE_PEEK_JUMP_FALSE 0x2B #define OPCODE_PEEK_JUMP_TRUE 0x2C #define OPCODE_LINE_NUMBER 0x2D |
From: Steve B. <sj...@us...> - 2002-09-22 18:25:20
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv26845/plib/doc/psl Modified Files: impl_guide.html Log Message: Fixed arrays. Index: impl_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/impl_guide.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- impl_guide.html 22 Sep 2002 15:22:21 -0000 1.1 +++ impl_guide.html 22 Sep 2002 18:25:16 -0000 1.2 @@ -210,18 +210,20 @@ <H3> OPCODE_POP_SHL_VARIABLE <\H3> <H3> OPCODE_POP_SHR_VARIABLE <\H3> INTRUCTION BYTES: 1 <br> -EFFECT: Two things are on the stack when this function is called. +EFFECT: Three things are on the stack when this function is called. The thing on top is the result of an expression evaluation. The thing beneath that is the index of a variable. + The thing beneath that is the dimension of the variable. The value is added to/subtracted from/multiplied by/etc the variable - and stored back into the variable. The new value of the variable is left on the stack. <H3> OPCODE_POP_VARIABLE <\H3> INTRUCTION BYTES: 1 <br> -EFFECT: Two things are on the stack when this function is called. +EFFECT: Three things are on the stack when this function is called. The thing on top is the result of an expression evaluation. The thing beneath that is the index of a variable. + The thing beneath that is the dimension of the variable. The value is stored into the variable. The new value of the variable is left on the stack. @@ -252,20 +254,23 @@ <H3> OPCODE_FETCH <\H3> INTRUCTION BYTES: 1 <br> -EFFECT: The index of a variable is on top of the stack, replace it - with the value of that variable. +EFFECT: The index of a variable is on top of the stack + The thing beneath that is the dimension of the variable. + Replace those with the value of that variable. <H3> OPCODE_INCREMENT_FETCH <\H3> <H3> OPCODE_DECREMENT_FETCH <\H3> INTRUCTION BYTES: 1 <br> -EFFECT: The index of a variable is on top of the stack, replace it +EFFECT: The index of a variable is on top of the stack + The thing beneath that is the dimension of the variable. + Replace those with the value of that variable. Post-increment/decrement the variable. <H3> OPCODE_INCREMENT_LVALUE <\H3> <H3> OPCODE_DECREMENT_LVALUE <\H3> INTRUCTION BYTES: 1 <br> -EFFECT: The index of a variable is on top of the stack. +EFFECT: The index and dimension of a variable is on top of the stack. Increment/decrement the variable leaving the stack contents undisturbed. |
From: Steve B. <sj...@us...> - 2002-09-22 15:22:24
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv23622/plib/doc/psl Modified Files: prog_guide.html Added Files: impl_guide.html Log Message: Changed the expression handler to handle the difference between an lvalue and an rvalue. This enabled the assignment statement code to be moved down into expression handling where it belongs. Hence multiple assignments - and assignments tucked away in weird places should now work. --- NEW FILE: impl_guide.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>The PLIB Scripting Language: Implementation Guide.</title> </head> <body text="#B5A642" bgcolor="#005000" link="#8FFF8F" vlink="#18A515" alink="#20336B" background="../marble.png"> <table> <tr> <td> <center> <h1>The PSL Implementation Guide.</h1></center> <center>By Steve Baker</center> </td> </tr> </table> <H1>Introduction</H1> This document describes the virtual machine that the PSL byte code interpreter implements. [...237 lines suppressed...] <H3> OPCODE_INCREMENT_FETCH <\H3> <H3> OPCODE_DECREMENT_FETCH <\H3> INTRUCTION BYTES: 1 <br> EFFECT: The index of a variable is on top of the stack, replace it with the value of that variable. Post-increment/decrement the variable. <H3> OPCODE_INCREMENT_LVALUE <\H3> <H3> OPCODE_DECREMENT_LVALUE <\H3> INTRUCTION BYTES: 1 <br> EFFECT: The index of a variable is on top of the stack. Increment/decrement the variable leaving the stack contents undisturbed. <hr> <address> <a href="http://www.sjbaker.org">Steve J. Baker.</a> <<a href="mailto:sjb...@ai...">sjb...@ai...</a>></address> </body> </html> Index: prog_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/prog_guide.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- prog_guide.html 15 Sep 2002 17:45:52 -0000 1.11 +++ prog_guide.html 22 Sep 2002 15:22:21 -0000 1.12 @@ -125,8 +125,6 @@ <ul> <li> Multiple assignments (eg x = y = 0 ; ) <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. @@ -193,6 +191,17 @@ inserted into the byte code to enable the PSL interpreter to produce debug indicating which lines of the source code are being traced. +<H3> Byte-Code Stack Display </H3> +If you have PSL_TRACE turned on (either via the config variable or +by the application program), then the shell variable 'PSL_STACK' +can be set to display the contents of the top eight stack locations +as the program is traced. If PSL_TRACE is disabled then PSL_STACK +has no effect. +<ul> +<li> <b>never</b> (the default) -- Never produce stack dumps + within a trace. +<li> <b>always</b> -- Always produce a stack dump within trace. +</ul> <hr> <address> <a href="http://www.sjbaker.org">Steve J. Baker.</a> <<a href="mailto:sjb...@ai...">sjb...@ai...</a>></address> |
From: Steve B. <sj...@us...> - 2002-09-22 15:22:24
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv23622/plib/src/psl Modified Files: psl.h pslCodeGen.cxx pslCompiler.cxx pslCompiler.h pslContext.cxx pslContext.h pslDump.cxx pslExpression.cxx pslOpcodes.h pslProgram.cxx Log Message: Changed the expression handler to handle the difference between an lvalue and an rvalue. This enabled the assignment statement code to be moved down into expression handling where it belongs. Hence multiple assignments - and assignments tucked away in weird places should now work. Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- psl.h 17 Sep 2002 23:16:43 -0000 1.19 +++ psl.h 22 Sep 2002 15:22:21 -0000 1.20 @@ -124,43 +124,20 @@ /* - psValues can change their type as needed. + psVariables can change value - but their type is + fixed once set. */ -class pslValue : public pslNumber +class pslVariable : public pslNumber { [...73 lines suppressed...] } ; @@ -231,6 +239,7 @@ char *progName ; int force_trace ; + int force_stacktrace ; public: @@ -243,6 +252,8 @@ pslOpcode *getCode () const { return code ; } pslCompiler *getCompiler () const { return compiler ; } const pslExtension *getExtensions () const { return extensions ; } + + int getStackTraceFlag () { return force_stacktrace ; } char *getProgName () const { return progName ; } Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- pslCodeGen.cxx 15 Sep 2002 17:45:53 -0000 1.27 +++ pslCodeGen.cxx 22 Sep 2002 15:22:21 -0000 1.28 @@ -25,7 +25,7 @@ #include "pslLocal.h" -void pslCompiler::pushCodeByte ( pslOpcode op ) +void pslCompiler::genCodeByte ( pslOpcode op ) { if ( next_code >= MAX_CODE - 1 ) error ( "Program too big!" ) ; @@ -34,34 +34,34 @@ } [...500 lines suppressed...] - pushCodeByte ( OPCODE_JUMP ) ; + genCodeByte ( OPCODE_JUMP ) ; int res = next_code ; - pushCodeAddr ( l ) ; + genCodeAddr ( l ) ; return res ; } -int pslCompiler::pushPauseStatement() +int pslCompiler::genPauseStatement() { - pushCodeByte ( OPCODE_PAUSE ) ; + genCodeByte ( OPCODE_PAUSE ) ; return TRUE ; } Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- pslCompiler.cxx 15 Sep 2002 14:32:53 -0000 1.25 +++ pslCompiler.cxx 22 Sep 2002 15:22:21 -0000 1.26 @@ -49,7 +49,7 @@ init () ; _pslPushDefaultFile ( fd, (fname == NULL) ? progName : fname ) ; - pushProgram () ; + genProgram () ; _pslPopDefaultFile () ; if ( num_errors != 0 || num_warnings != 0 ) @@ -65,7 +65,7 @@ dump () ; [...649 lines suppressed...] @@ -837,7 +843,7 @@ return error ( "Missing '{' in function '%s'", fn ) ; } - if ( ! pushCompoundStatement () ) + if ( ! genCompoundStatement () ) { popLocality () ; return error ( "Missing '}' in function '%s'", fn ) ; @@ -847,8 +853,8 @@ /* If we fall off the end of the function, we still need a return value */ - pushConstant ( "0.0" ) ; - pushReturn () ; + genConstant ( "0.0" ) ; + genReturn () ; code [ jump_target ] = next_code & 0xFF ; code [ jump_target+1 ] = (next_code >> 8) & 0xFF ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- pslCompiler.h 15 Sep 2002 17:45:53 -0000 1.29 +++ pslCompiler.h 22 Sep 2002 15:22:21 -0000 1.30 @@ -69,113 +69,126 @@ /* Write data into Code space */ - void pushCodeByte ( unsigned char b ) ; - void pushCodeAddr ( pslAddress a ) ; + void genCodeByte ( unsigned char b ) ; + void genCodeAddr ( pslAddress a ) ; int printOpcode ( FILE *fd, int addr ) const ; - void pushLineNumber ( int l ) ; + void genLineNumber ( int l ) ; [...180 lines suppressed...] + int genStatement () ; - int pushLocalVarDecl ( pslType t ) ; - int pushGlobalVarDecl ( const char *fn, pslType t ) ; - int pushStaticVarDecl () ; + int genLocalVarDecl ( pslType t ) ; + int genGlobalVarDecl ( const char *fn, pslType t ) ; + int genStaticVarDecl () ; /* Top level constructs */ - int pushFunctionDeclaration ( const char *fn ) ; - int pushGlobalDeclaration () ; - void pushProgram () ; + int genFunctionDeclaration ( const char *fn ) ; + int genGlobalDeclaration () ; + void genProgram () ; /* The symbol tables for variables, code and define's */ Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- pslContext.cxx 15 Sep 2002 19:12:01 -0000 1.17 +++ pslContext.cxx 22 Sep 2002 15:22:21 -0000 1.18 @@ -28,7 +28,7 @@ { switch ( code [ pc ] ) { - case OPCODE_NOOP : + case OPCODE_BAD : error ( "Suspicious opcode 0x00?!", code[pc] ) ; pc++ ; return PSL_PROGRAM_END ; @@ -504,12 +504,21 @@ pc++ ; return PSL_PROGRAM_CONTINUE ; [...348 lines suppressed...] + +void pslContext::printStack ( FILE *fd ) +{ + fprintf ( fd, "STACK [%d deep] : ", sp ) ; + + if ( sp >= 8 ) fprintf ( stderr, "..." ) ; + + for ( int i = (sp<8)? 0 : (sp-8) ; i < sp ; i++ ) + switch ( stack[i].getType () ) + { + case PSL_INT : fprintf ( fd, "%d " , stack[i].getInt () ) ; break ; + case PSL_FLOAT : fprintf ( fd, "%gf " , stack[i].getFloat () ) ; break ; + case PSL_STRING : fprintf ( fd, "'%s' ", stack[i].getString() ) ; break ; + case PSL_VOID : fprintf ( fd, "<void> " ) ; break ; + } + + fprintf ( fd, "\n" ) ; } Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslContext.h 15 Sep 2002 14:32:53 -0000 1.12 +++ pslContext.h 22 Sep 2002 15:22:21 -0000 1.13 @@ -60,6 +60,7 @@ int getLineNo () const { return line_no ; } + void printStack ( FILE *fd ) ; void pushInt ( int x ) { stack [ sp++ ] . set ( x ) ; } void pushFloat ( float x ) { stack [ sp++ ] . set ( x ) ; } @@ -81,6 +82,7 @@ pslResult trace () { + if ( program -> getStackTraceFlag () ) printStack ( stdout ) ; program -> getCompiler () -> printInstruction ( stdout, pc ) ; fflush ( stdout ) ; return step () ; Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- pslDump.cxx 15 Sep 2002 06:36:24 -0000 1.20 +++ pslDump.cxx 22 Sep 2002 15:22:21 -0000 1.21 @@ -36,7 +36,7 @@ static const OpcodeDecode opcodeDecode [] = { - { "NO_OP" , OPCODE_NOOP , 0 }, + { "**BAD_INSTRUCTION**", OPCODE_BAD , 0 }, { "SOURCE LINE NUMBER:", OPCODE_LINE_NUMBER, 2 }, @@ -45,15 +45,24 @@ { "PUSH_INT_CONSTANT" , OPCODE_PUSH_INT_CONSTANT , sizeof(int) }, { "PUSH_FLOAT_CONSTANT", OPCODE_PUSH_FLOAT_CONSTANT, sizeof(float) }, [...91 lines suppressed...] - case OPCODE_POP_VARIABLE : - case OPCODE_INCREMENT : - case OPCODE_DECREMENT : - fprintf ( fd, "\t[%d]", code [ addr+1 ] ) ; - break ; - case OPCODE_PUSH_INT_CONSTANT : { int f ; @@ -274,8 +272,8 @@ case OPCODE_PEEK_JUMP_FALSE : case OPCODE_PEEK_JUMP_TRUE : - case OPCODE_JUMP_FALSE : - case OPCODE_JUMP_TRUE : + case OPCODE_JUMP_FALSE : + case OPCODE_JUMP_TRUE : fprintf ( fd, "\t\t%d", code[addr+1] + ( code[addr+2] << 8 ) ) ; break ; Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- pslExpression.cxx 15 Sep 2002 17:45:53 -0000 1.16 +++ pslExpression.cxx 22 Sep 2002 15:22:21 -0000 1.17 @@ -25,14 +25,94 @@ #include "pslLocal.h" -int pslCompiler::pushPrimitive () + +int pslCompiler::genLValue () +{ + /* + Expect: + + variable ...or... [...530 lines suppressed...] } - if ( ! pushBoolExpression () ) + if ( ! genBoolExpression () ) return error ( "Missing expression following '&&' or '||'" ) ; code [ shortcut ] = next_code & 0xFF ; @@ -369,9 +510,10 @@ } -int pslCompiler::pushExpression () +int pslCompiler::genExpression () { - return pushBoolExpression () ; + /* All expressions can be bool expressions */ + return genBoolExpression () ; } Index: pslOpcodes.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslOpcodes.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslOpcodes.h 15 Sep 2002 06:36:24 -0000 1.12 +++ pslOpcodes.h 22 Sep 2002 15:22:21 -0000 1.13 @@ -24,7 +24,7 @@ /* Code Opcodes */ -#define OPCODE_NOOP 0x00 +#define OPCODE_BAD 0x00 #define OPCODE_PUSH_INT_CONSTANT 0x01 #define OPCODE_PUSH_FLOAT_CONSTANT 0x02 #define OPCODE_PUSH_STRING_CONSTANT 0x03 @@ -73,6 +73,8 @@ #define OPCODE_PEEK_JUMP_TRUE 0x2C #define OPCODE_LINE_NUMBER 0x2D + + #define OPCODE_POP_ADD_VARIABLE 0x30 #define OPCODE_POP_SUB_VARIABLE 0x31 #define OPCODE_POP_MUL_VARIABLE 0x32 @@ -83,4 +85,17 @@ #define OPCODE_POP_XOR_VARIABLE 0x37 #define OPCODE_POP_SHL_VARIABLE 0x38 #define OPCODE_POP_SHR_VARIABLE 0x39 +#define OPCODE_EXCHANGE 0x3A +#define OPCODE_SET_INT_ARRAY 0x3B +#define OPCODE_SET_FLOAT_ARRAY 0x3C +#define OPCODE_SET_STRING_ARRAY 0x3D + + + +#define OPCODE_FETCH 0x40 +#define OPCODE_INCREMENT_FETCH 0x41 +#define OPCODE_DECREMENT_FETCH 0x42 +#define OPCODE_INCREMENT_LVALUE 0x43 +#define OPCODE_DECREMENT_LVALUE 0x44 + Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslProgram.cxx 15 Sep 2002 14:32:53 -0000 1.14 +++ pslProgram.cxx 22 Sep 2002 15:22:21 -0000 1.15 @@ -47,9 +47,12 @@ context -> reset () ; const char *force_trace_env = getenv ( "PSL_TRACE" ) ; + const char *force_stack_env = getenv ( "PSL_STACK" ) ; force_trace = ( force_trace_env != NULL && ulStrEqual ( force_trace_env, "always" ) ) ; + force_stacktrace = ( force_stack_env != NULL && + ulStrEqual ( force_stack_env, "always" ) ) ; if ( force_trace ) compiler -> generateLineNumbers () ; |
From: Steve B. <sj...@us...> - 2002-09-22 15:22:24
|
Update of /cvsroot/plib/plib/demos/simon/src In directory usw-pr-cvs1:/tmp/cvs-serv23622/plib/demos/simon/src Modified Files: simon.cxx Log Message: Changed the expression handler to handle the difference between an lvalue and an rvalue. This enabled the assignment statement code to be moved down into expression handling where it belongs. Hence multiple assignments - and assignments tucked away in weird places should now work. Index: simon.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- simon.cxx 15 Sep 2002 17:45:52 -0000 1.7 +++ simon.cxx 22 Sep 2002 15:22:21 -0000 1.8 @@ -193,6 +193,7 @@ ck.update () ; fprintf(stderr, "Compile Time: %fs.\n", ck.getDeltaTime () ) ; + fprintf(stderr, "-------------------------------\n" ) ; siRun () ; return 0 ; } |
From: Steve B. <sj...@us...> - 2002-09-22 15:22:24
|
Update of /cvsroot/plib/plib/demos/simon/astropong In directory usw-pr-cvs1:/tmp/cvs-serv23622/plib/demos/simon/astropong Modified Files: astropong.psl Log Message: Changed the expression handler to handle the difference between an lvalue and an rvalue. This enabled the assignment statement code to be moved down into expression handling where it belongs. Hence multiple assignments - and assignments tucked away in weird places should now work. Index: astropong.psl =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/astropong/astropong.psl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- astropong.psl 15 Sep 2002 02:31:49 -0000 1.2 +++ astropong.psl 22 Sep 2002 15:22:21 -0000 1.3 @@ -148,13 +148,12 @@ ballSZ = -fabs ( hitZ / 2.0 ) ; ballSY = -ballSY ; - // printf("Blue hit the planet!\n"); } else { scoreR++ ; - // printf("The score is Red:%d Blue:%d\n", scoreR, scoreB ) ; + print ("The score is Red:", scoreR, " Blue:", scoreB, "\n" ) ; ballSX = 0.1 ; ballSY = 0.1 ; @@ -163,7 +162,7 @@ ballX = 0.0 ; ballY = 0.0 ; ballZ = 0.0; - // sleep(1); + for ( int i = 0 ; i < 60 ; i++ ) pause ; } } @@ -189,20 +188,19 @@ ballSZ = -fabs ( hitZ / 2.0 ) ; ballSY = -ballSY ; - // printf("Red hit the planet!\n") ; } else { scoreB++ ; - // printf("The score is Red:%d Blue:%d\n", scoreR, scoreB ) ; + print ("The score is Red:", scoreR, " Blue:", scoreB, "\n" ) ; ballSX = .1 ; ballSY = .1 ; ballSZ = .1; ballSY = -ballSY ; - // sleep(1); ballX = 0.0 ; ballY = 0.0 ; ballZ = 0.0; + for ( int i = 0 ; i < 60 ; i++ ) pause ; } } |
From: Sebastian U. <ud...@us...> - 2002-09-21 17:47:14
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv14959 Modified Files: pu.h puComboBox.cxx puDial.cxx puFilePicker.cxx puFileSelector.cxx puLargeInput.cxx puScrollBar.cxx Log Message: Added trailing 'f' to some floating-point constants Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.133 retrieving revision 1.134 diff -u -d -r1.133 -r1.134 --- pu.h 21 Sep 2002 15:59:56 -0000 1.133 +++ pu.h 21 Sep 2002 17:47:09 -0000 1.134 @@ -1202,8 +1202,8 @@ setMaxValue ( 1.0f ) ; setMinValue ( 0.0f ) ; setStepSize ( 1.0f ) ; - current_max = 1.0 ; - current_min = 0.0 ; + current_max = 1.0f ; + current_min = 0.0f ; active_button = 0 ; } @@ -1216,8 +1216,8 @@ setMaxValue ( 1.0f ) ; setMinValue ( 0.0f ) ; setStepSize ( 1.0f ) ; - current_max = 1.0 ; - current_min = 0.0 ; + current_max = 1.0f ; + current_min = 0.0f ; active_button = 0 ; } Index: puComboBox.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puComboBox.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- puComboBox.cxx 2 Sep 2002 06:05:45 -0000 1.13 +++ puComboBox.cxx 21 Sep 2002 17:47:09 -0000 1.14 @@ -238,7 +238,7 @@ type |= PUCLASS_COMBOBOX ; char *stringval ; - int arrow_width = (int) ( (maxy-miny) / 1.5 ) ; + int arrow_width = (int) ( (maxy-miny) / 1.5f ) ; input = new puInput ( 0, 0, maxx-minx - arrow_width, maxy-miny ) ; input -> setUserData ( this ) ; Index: puDial.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puDial.cxx,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- puDial.cxx 21 Sep 2002 15:59:56 -0000 1.25 +++ puDial.cxx 21 Sep 2002 17:47:09 -0000 1.26 @@ -86,8 +86,8 @@ getValue ( &val ) ; val = ( val - minimum_value) / (maximum_value - minimum_value) ; - if ( val < 0.0 ) val = 0.0 ; - if ( val > 1.0 ) val = 1.0 ; + if ( val < 0.0f ) val = 0.0f ; + if ( val > 1.0f ) val = 1.0f ; val = ( 2.0f * val - 1.0f ) * SG_PI ; @@ -133,9 +133,9 @@ // Move to within the (0,1) interval if ( angle < -1.0f ) - angle += 2.0 ; + angle += 2.0f ; else if (angle > 1.0f ) - angle -= 2.0 ; + angle -= 2.0f ; angle = ( angle + 1.0f ) / 2.0f ; @@ -143,10 +143,10 @@ // of the widget) if ( !wrap ) { - if ( ( angle > 0.75 ) && ( getFloatValue () < 0.25 ) ) - angle = 0.0 ; - else if ( ( angle < 0.25 ) && ( getFloatValue () > 0.75 ) ) - angle = 1.0 ; + if ( ( angle > 0.75f ) && ( getFloatValue () < 0.25f ) ) + angle = 0.0f ; + else if ( ( angle < 0.25f ) && ( getFloatValue () > 0.75f ) ) + angle = 1.0f ; } angle = angle * (maximum_value - minimum_value) + minimum_value ; Index: puFilePicker.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFilePicker.cxx,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- puFilePicker.cxx 15 Sep 2002 01:00:23 -0000 1.30 +++ puFilePicker.cxx 21 Sep 2002 17:47:09 -0000 1.31 @@ -81,7 +81,7 @@ int num_items = list_box->getNumItems () - 1 ; if ( num_items > 0 ) { - int idx = int ( num_items * val + 0.5 ) + inc ; + int idx = int ( num_items * val + 0.5f ) + inc ; if ( idx > num_items ) idx = num_items ; if ( idx < 0 ) idx = 0 ; Index: puFileSelector.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFileSelector.cxx,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- puFileSelector.cxx 20 Sep 2002 00:30:10 -0000 1.29 +++ puFileSelector.cxx 21 Sep 2002 17:47:09 -0000 1.30 @@ -82,7 +82,7 @@ int num_items = list_box->getNumItems () - 1 ; if ( num_items > 0 ) { - int idx = int ( num_items * val + 0.5 ) + inc ; + int idx = int ( num_items * val + 0.5f ) + inc ; if ( idx > num_items ) idx = num_items ; if ( idx < 0 ) idx = 0 ; Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- puLargeInput.cxx 19 Sep 2002 23:32:58 -0000 1.41 +++ puLargeInput.cxx 21 Sep 2002 17:47:09 -0000 1.42 @@ -38,7 +38,7 @@ int num_lines = text->getNumLines () ; if ( num_lines > 0 ) - text->setTopLineInWindow ( int ( val + 0.5 ) ) ; + text->setTopLineInWindow ( int ( val + 0.5f ) ) ; } // Private function from the widget itself @@ -320,8 +320,8 @@ void puLargeInput::setValue ( const char *s ) [...79 lines suppressed...] int current_line_in_window = 0; /* Current line # in window */ char *line_end = 0 ; char* p = new char[ strlen(old_text)+1 ] ; - float bottom_value = bottom_slider ? bottom_slider->getFloatValue () : 0.0 ; /* Value of the bottom slider */ + float bottom_value = bottom_slider ? bottom_slider->getFloatValue () : 0.0f ; /* Value of the bottom slider */ if ( old_text[1] != '\0' ) /* Ensure that we don't delete something that doesn't exist! - JCJ 22 July 2002 */ { /*Count how many characters from the beginning of the line the cursor is*/ @@ -1215,10 +1215,8 @@ { // Wrap the text in "text" and put it in "wrapped_text" - int l_len = strlen ( getStringValue () ) ; delete [] wrapped_text ; - wrapped_text = new char[l_len + 1] ; - memcpy(wrapped_text, getStringValue (), l_len + 1) ; + wrapped_text = ulStrDup ( getStringValue () ) ; char *wrapped_text_wp = wrapped_text, *space_ptr, Index: puScrollBar.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puScrollBar.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- puScrollBar.cxx 2 Sep 2002 06:05:46 -0000 1.3 +++ puScrollBar.cxx 21 Sep 2002 17:47:09 -0000 1.4 @@ -151,7 +151,7 @@ float next_value = getFloatValue () ; float step = getStepSize () ; - if ( step == 0.0 ) step = ( getMaxValue () - getMinValue () ) / 10.0 ; + if ( step == 0.0f ) step = ( getMaxValue () - getMinValue () ) / 10.0f ; /* Check for hitting a button */ @@ -161,10 +161,10 @@ if( arrow_count == 2 ) { if ( coord < abox.min[sd] + width ) /* Fast down button */ - next_value -= 10.0 * step ; + next_value -= 10.0f * step ; if ( coord > abox.max[sd] - width ) /* Fast up button */ - next_value += 10.0 * step ; + next_value += 10.0f * step ; } if ( arrow_count > 0 ) |