plib-cvs Mailing List for PLIB (Page 24)
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-21 15:59:59
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv22158 Modified Files: pu.h puDial.cxx puRange.cxx puSlider.cxx puSpinBox.cxx Log Message: John F. Fay: Made puRange an independent class; puSpinBox is now a child of puGroup Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- pu.h 19 Sep 2002 23:32:58 -0000 1.132 +++ pu.h 21 Sep 2002 15:59:56 -0000 1.133 @@ -258,9 +258,8 @@ #define PUCLASS_LARGEINPUT 0x00400000 #define PUCLASS_COMBOBOX 0x00800000 #define PUCLASS_SELECTBOX 0x01000000 -#define PUCLASS_RANGE 0x02000000 -#define PUCLASS_SPINBOX 0x04000000 -#define PUCLASS_SCROLLBAR 0x08000000 +#define PUCLASS_SPINBOX 0x02000000 +#define PUCLASS_SCROLLBAR 0x04000000 /* This function is not required for GLUT programs */ void puSetWindowSize ( int width, int height ) ; [...232 lines suppressed...] + int ymid = ( ibox->max[1] + ibox->min[1] ) / 2 ; + up_arrow->setPosition ( xpos, ymid ) ; + down_arrow->setPosition ( xpos, ymid - size ) ; + recalc_bbox() ; } - ~puSpinBox () + float getArrowHeight ( void ) const { - puDeleteObject ( (puObject *)input_box ) ; + int awid, ahgt, iwid, ihgt ; + input_box->getSize ( &iwid, &ihgt ) ; + up_arrow->getSize ( &awid, &ahgt ) ; + return float(ahgt) / float(ihgt) ; } + + puSpinBox ( int minx, int miny, int maxx, int maxy, int arrow_pos = 1 ) ; void setValue ( float f ) { puValue::setValue ( f ) ; input_box->setValue ( f ) ; } void setValue ( int i ) { puValue::setValue ( i ) ; input_box->setValue ( i ) ; } Index: puDial.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puDial.cxx,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- puDial.cxx 2 Sep 2002 06:05:45 -0000 1.24 +++ puDial.cxx 21 Sep 2002 15:59:56 -0000 1.25 @@ -24,7 +24,7 @@ #include "puLocal.h" -UL_RTTI_DEF1(puDial,puRange) +UL_RTTI_DEF2(puDial,puRange,puObject) void puDial::draw ( int dx, int dy ) Index: puRange.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puRange.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- puRange.cxx 2 Sep 2002 06:05:46 -0000 1.3 +++ puRange.cxx 21 Sep 2002 15:59:56 -0000 1.4 @@ -23,5 +23,5 @@ #include "puLocal.h" -UL_RTTI_DEF1(puRange,puObject) +UL_RTTI_DEF(puRange) Index: puSlider.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puSlider.cxx,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- puSlider.cxx 2 Sep 2002 06:05:46 -0000 1.25 +++ puSlider.cxx 21 Sep 2002 15:59:56 -0000 1.26 @@ -24,7 +24,7 @@ #include "puLocal.h" -UL_RTTI_DEF1(puSlider,puRange) +UL_RTTI_DEF2(puSlider,puRange,puObject) void puSlider::draw_slider_box ( int dx, int dy, const puBox &box, float val, const char *box_label ) Index: puSpinBox.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puSpinBox.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- puSpinBox.cxx 2 Sep 2002 06:05:46 -0000 1.5 +++ puSpinBox.cxx 21 Sep 2002 15:59:56 -0000 1.6 @@ -24,116 +24,61 @@ #include "puLocal.h" -UL_RTTI_DEF1(puSpinBox,puRange) +UL_RTTI_DEF2(puSpinBox,puRange,puGroup) -void puSpinBox::draw ( int dx, int dy ) +puSpinBox::puSpinBox ( int minx, int miny, int maxx, int maxy, int arrow_pos ) : + puRange ( 1.0f, 10.0f, 1.0f ), puGroup ( minx, miny ) { [...126 lines suppressed...] - - invokeCallback () ; - return TRUE ; - } - else - return FALSE ; + puSpinBox *master = (puSpinBox *)(ob->getUserData ()) ; + float val = ob->getFloatValue () ; + if ( val > master->getMaxValue () ) val = master->getMaxValue () ; + if ( val < master->getMinValue () ) val = master->getMinValue () ; + master->setValue ( val ) ; + master->invokeCallback () ; } -void puSpinBox_handle_input (puObject *ob) -{ - puObject *master = (puObject *)(ob->getUserData()); - master->setValue(ob->getFloatValue()); - master->invokeCallback(); -} |
From: Sebastian U. <ud...@us...> - 2002-09-21 15:06:18
|
Update of /cvsroot/plib/plib/src/util In directory usw-pr-cvs1:/tmp/cvs-serv8251 Modified Files: ulRTTI.h Log Message: Added copyright notices and copying permission statement Index: ulRTTI.h =================================================================== RCS file: /cvsroot/plib/plib/src/util/ulRTTI.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ulRTTI.h 1 Sep 2002 08:57:34 -0000 1.3 +++ ulRTTI.h 21 Sep 2002 15:06:14 -0000 1.4 @@ -1,4 +1,25 @@ /* + PLIB - A Suite of Portable Game Libraries + Copyright (C) 1998,2002 Steve Baker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For further information visit http://plib.sourceforge.net */ + + +/* Originally written by: Alexandru C. Telea <al...@wi...> */ |
From: Sebastian U. <ud...@us...> - 2002-09-20 00:30:13
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv21559 Modified Files: puFileSelector.cxx Log Message: Fix to the previous change Index: puFileSelector.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFileSelector.cxx,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- puFileSelector.cxx 20 Sep 2002 00:26:07 -0000 1.28 +++ puFileSelector.cxx 20 Sep 2002 00:30:10 -0000 1.29 @@ -216,9 +216,9 @@ /* Replace trailing ']' with slash */ new_dst [ dst_len + src_len - 1 ] = SLASH[0] ; - file_selector -> find_files () ; file_selector -> __getInput() -> setValue ( new_dst ) ; delete [] new_dst ; + file_selector -> find_files () ; return ; } |
From: Sebastian U. <ud...@us...> - 2002-09-20 00:26:11
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv19613 Modified Files: puFileSelector.cxx Log Message: John F. Fay / me: Fixed puFileSelector bug with long path names Index: puFileSelector.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFileSelector.cxx,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- puFileSelector.cxx 2 Sep 2002 06:05:45 -0000 1.27 +++ puFileSelector.cxx 20 Sep 2002 00:26:07 -0000 1.28 @@ -204,31 +204,35 @@ { /* If this is a directory - then descend into it and refresh */ - if ( strlen ( dst ) + strlen ( src ) + 2 >= PUSTRING_MAX ) - { - ulSetError ( UL_WARNING, - "PUI: puFileSelector - path is too long, max is %d.", PUSTRING_MAX ) ; - return ; - } + src++ ; /* Remove leading '[' */ + + int dst_len = strlen ( dst ) ; + int src_len = strlen ( src ) ; + char *new_dst = new char [ dst_len + src_len + 1 ] ; + + memcpy ( new_dst, dst, dst_len ) ; + memcpy ( new_dst + dst_len, src, src_len + 1 ) ; /* Copy trailing '\0' */ + + /* Replace trailing ']' with slash */ + new_dst [ dst_len + src_len - 1 ] = SLASH[0] ; - strcat ( dst, &src[1] ) ; /* Remove leading '[' */ - dst [ strlen ( dst ) - 1 ] = SLASH[0] ; /* Replace trailing ']' with slash */ file_selector -> find_files () ; - file_selector -> __getInput() -> setValue ( dst ) ; + file_selector -> __getInput() -> setValue ( new_dst ) ; + delete [] new_dst ; return ; } /* If this is a regular file - then just append it to the string */ - if ( strlen ( dst ) + strlen ( src ) + 2 >= PUSTRING_MAX ) - { - ulSetError ( UL_WARNING, - "PUI: puFileSelector - path is too long, max is %d.", PUSTRING_MAX ) ; - return ; - } + int dst_len = strlen ( dst ) ; + int src_len = strlen ( src ) ; + char *new_dst = new char [ dst_len + src_len + 1 ] ; - strcat ( dst, src ) ; - file_selector -> __getInput() -> setValue ( dst ) ; + memcpy ( new_dst, dst, dst_len ) ; + memcpy ( new_dst + dst_len, src, src_len + 1 ) ; /* Copy trailing '\0' */ + + file_selector -> __getInput() -> setValue ( new_dst ) ; + delete [] new_dst ; } else { |
From: Sebastian U. <ud...@us...> - 2002-09-19 23:33:01
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv6238 Modified Files: pu.cxx pu.h puFont.cxx puInput.cxx puLargeInput.cxx puLocal.h puObject.cxx Log Message: Moved some internal stuff from pu.h to puLocal.h; Const-correctness Index: pu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.cxx,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- pu.cxx 19 Sep 2002 22:33:51 -0000 1.60 +++ pu.cxx 19 Sep 2002 23:32:57 -0000 1.61 @@ -101,16 +101,6 @@ #endif -puColour _puDefaultColourTable[] = -{ - { 0.5f, 0.5f, 0.5f, 1.0f }, /* PUCOL_FOREGROUND */ - { 0.3f, 0.3f, 0.3f, 1.0f }, /* PUCOL_BACKGROUND */ - { 0.7f, 0.7f, 0.7f, 1.0f }, /* PUCOL_HIGHLIGHT */ - { 0.0f, 0.0f, 0.0f, 1.0f }, /* PUCOL_LABEL */ - { 1.0f, 1.0f, 1.0f, 1.0f }, /* PUCOL_LEGEND */ - { 0.0f, 0.0f, 0.0f, 1.0f } /* PUCOL_MISC */ -} ; - static bool glIsValidContext ( void ) { @@ -256,9 +246,9 @@ // No GLUT fonts, try some corresponding textured fonts - if ( ( PUFONT_TXF_TYPEWRITER.load ( "Courier.txf" ) == FALSE ) | - ( PUFONT_TXF_TIMES.load ( "Times-Roman.txf" ) == FALSE ) | - ( PUFONT_TXF_HELVETICA.load ( "Helvetica.txf" ) == FALSE ) ) + if ( ( _puCourierFont.load ( "Courier.txf" ) == FALSE ) || + ( _puTimesFont.load ( "Times-Roman.txf" ) == FALSE ) || + ( _puHelveticaFont.load ( "Helvetica.txf" ) == FALSE ) ) { // Exit ulSetError ( UL_FATAL, "PUI: Could not load default fonts." ) ; @@ -460,7 +450,7 @@ puObject *puActiveWidget ( void ) { return active_widget ; } -void puSetPasteBuffer ( char *ch ) +void puSetPasteBuffer ( const char *ch ) { delete [] input_paste_buffer ; input_paste_buffer = ulStrDup ( ch ) ; Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.131 retrieving revision 1.132 diff -u -d -r1.131 -r1.132 --- pu.h 18 Sep 2002 14:38:26 -0000 1.131 +++ pu.h 19 Sep 2002 23:32:58 -0000 1.132 @@ -45,10 +45,6 @@ #ifdef _PU_USE_GLUT_FONTS typedef void *GlutFont ; -#else -extern fntTexFont PUFONT_TXF_TYPEWRITER ; -extern fntTexFont PUFONT_TXF_TIMES ; -extern fntTexFont PUFONT_TXF_HELVETICA ; #endif class puFont @@ -329,14 +325,12 @@ /* With many memory managers, allocating powers of two is more efficient */ #define PUSTRING_INITIAL 64 -extern puColour _puDefaultColourTable[] ; - -inline void puSetColour ( puColour dst, puColour src ) +inline void puSetColour ( puColour dst, const puColour src ) { dst[0] = src[0] ; dst[1] = src[1] ; dst[2] = src[2] ; dst[3] = src[3] ; } -inline void puSetColor ( puColour dst, puColour src ) +inline void puSetColor ( puColour dst, const puColour src ) { dst[0] = src[0] ; dst[1] = src[1] ; dst[2] = src[2] ; dst[3] = src[3] ; } Index: puFont.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFont.cxx,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- puFont.cxx 2 Sep 2002 06:05:45 -0000 1.21 +++ puFont.cxx 19 Sep 2002 23:32:58 -0000 1.22 @@ -40,17 +40,17 @@ #else // No GLUT fonts, try some corresponding textured fonts -fntTexFont PUFONT_TXF_TYPEWRITER ; -fntTexFont PUFONT_TXF_TIMES ; -fntTexFont PUFONT_TXF_HELVETICA ; +fntTexFont _puCourierFont ; +fntTexFont _puTimesFont ; +fntTexFont _puHelveticaFont ; -puFont PUFONT_8_BY_13 ( &PUFONT_TXF_TYPEWRITER, 13 ) ; -puFont PUFONT_9_BY_15 ( &PUFONT_TXF_TYPEWRITER, 15 ) ; -puFont PUFONT_TIMES_ROMAN_10 ( &PUFONT_TXF_TIMES, 10 ) ; -puFont PUFONT_TIMES_ROMAN_24 ( &PUFONT_TXF_TIMES, 24 ) ; -puFont PUFONT_HELVETICA_10 ( &PUFONT_TXF_HELVETICA, 10 ) ; -puFont PUFONT_HELVETICA_12 ( &PUFONT_TXF_HELVETICA, 12 ) ; -puFont PUFONT_HELVETICA_18 ( &PUFONT_TXF_HELVETICA, 18 ) ; +puFont PUFONT_8_BY_13 ( &_puCourierFont, 13 ) ; +puFont PUFONT_9_BY_15 ( &_puCourierFont, 15 ) ; +puFont PUFONT_TIMES_ROMAN_10 ( &_puTimesFont, 10 ) ; +puFont PUFONT_TIMES_ROMAN_24 ( &_puTimesFont, 24 ) ; +puFont PUFONT_HELVETICA_10 ( &_puHelveticaFont, 10 ) ; +puFont PUFONT_HELVETICA_12 ( &_puHelveticaFont, 12 ) ; +puFont PUFONT_HELVETICA_18 ( &_puHelveticaFont, 18 ) ; #endif // #ifdef _PU_USE_GLUT_FONTS @@ -61,7 +61,7 @@ glut_font_handle = GLUT_BITMAP_8_BY_13 ; fnt_font_handle = NULL ; #else - fnt_font_handle = &PUFONT_TXF_TYPEWRITER ; + fnt_font_handle = &_puCourierFont ; pointsize = 13 ; slant = 0 ; #endif Index: puInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puInput.cxx,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- puInput.cxx 2 Sep 2002 06:05:45 -0000 1.28 +++ puInput.cxx 19 Sep 2002 23:32:58 -0000 1.29 @@ -289,9 +289,6 @@ int puInput::checkKey ( int key, int /* updown */ ) { - extern void puSetPasteBuffer ( char *ch ) ; - extern char *puGetPasteBuffer ( void ) ; - if ( ! isAcceptingInput() || ! isActive () || ! isVisible () || ( window != puGetWindow () ) ) return FALSE ; Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- puLargeInput.cxx 17 Sep 2002 22:42:12 -0000 1.40 +++ puLargeInput.cxx 19 Sep 2002 23:32:58 -0000 1.41 @@ -871,9 +871,6 @@ int puLargeInput::checkKey ( int key, int /* updown */ ) { - extern void puSetPasteBuffer ( char *ch ) ; - extern char *puGetPasteBuffer () ; - if ( !isAcceptingInput () || !isActive () || !isVisible () || ( window != puGetWindow () ) ) return FALSE ; Index: puLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLocal.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- puLocal.h 2 Sep 2002 06:05:46 -0000 1.10 +++ puLocal.h 19 Sep 2002 23:32:58 -0000 1.11 @@ -40,3 +40,14 @@ # endif #endif + +#ifndef _PU_USE_GLUT_FONTS +extern fntTexFont _puCourierFont ; +extern fntTexFont _puTimesFont ; +extern fntTexFont _puHelveticaFont ; +#endif + + +void puSetPasteBuffer ( const char *ch ) ; +char *puGetPasteBuffer () ; + Index: puObject.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puObject.cxx,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- puObject.cxx 17 Sep 2002 22:48:28 -0000 1.48 +++ puObject.cxx 19 Sep 2002 23:32:58 -0000 1.49 @@ -27,10 +27,21 @@ UL_RTTI_DEF1(puObject,puValue) -inline float clamp01 ( float x ) +static inline float clamp01 ( float x ) { return (x >= 1.0f) ? 1.0f : x ; } + +static puColour _puDefaultColourTable[] = +{ + { 0.5f, 0.5f, 0.5f, 1.0f }, /* PUCOL_FOREGROUND */ + { 0.3f, 0.3f, 0.3f, 1.0f }, /* PUCOL_BACKGROUND */ + { 0.7f, 0.7f, 0.7f, 1.0f }, /* PUCOL_HIGHLIGHT */ + { 0.0f, 0.0f, 0.0f, 1.0f }, /* PUCOL_LABEL */ + { 1.0f, 1.0f, 1.0f, 1.0f }, /* PUCOL_LEGEND */ + { 0.0f, 0.0f, 0.0f, 1.0f } /* PUCOL_MISC */ +} ; + static void load_colour_scheme ( float col[][4], float r, float g, float b, float a ) |
From: Sebastian U. <ud...@us...> - 2002-09-19 22:33:56
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv22314 Modified Files: pu.cxx Log Message: John F. Fay: Undo of rev. 1.53 => 1.54 changes Index: pu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.cxx,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- pu.cxx 17 Sep 2002 22:45:38 -0000 1.59 +++ pu.cxx 19 Sep 2002 22:33:51 -0000 1.60 @@ -193,41 +193,27 @@ puGroup *parent = ob->getParent () ; - /*if ( !ob->IsItSubWidget() ) - {*/ - /* Add object to linked list to be deleted */ - if ( objects_to_delete == NULL ) - objects_to_delete = ob ; - else - { - /* Ensure that objects are deleted in the order of puDeleteObject calls */ + /* Add object to linked list to be deleted */ + if ( objects_to_delete == NULL ) + objects_to_delete = ob ; + else + { + /* Ensure that objects are deleted in the order of puDeleteObject calls */ - puObject *last ; + puObject *last ; - for ( last = objects_to_delete ; - last -> getNextObject() != NULL ; - last = last -> getNextObject() ) - /* Find last object. */ ; + for ( last = objects_to_delete ; + last -> getNextObject() != NULL ; + last = last -> getNextObject() ) + /* Find last object. */ ; - last -> setNextObject ( ob ) ; - } - /* Remove from parent interface */ - - if ( parent != ob && parent != NULL ) - parent -> remove ( ob ) ; /* Sets object's next and previous pointers to null as well */ + last -> setNextObject ( ob ) ; + } - /* If it is a group, then delete all child objects as well */ - if ( ob->getType () & PUCLASS_GROUP ) - { - puObject *child = ((puGroup *)ob)->getFirstChild () ; - while ( child ) - { - puObject *next = child->getNextObject () ; - puDeleteObject ( child ) ; - child = next ; - } - } - /*}*/ + /* Remove from parent interface */ + + if ( parent != ob && parent != NULL ) + parent -> remove ( ob ) ; /* Sets object's next and previous pointers to null as well */ } |
From: Sebastian U. <ud...@us...> - 2002-09-18 14:38:31
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv30675 Modified Files: pu.h Log Message: puRange changes for const-correctness Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.130 retrieving revision 1.131 diff -u -d -r1.130 -r1.131 --- pu.h 17 Sep 2002 22:42:12 -0000 1.130 +++ pu.h 18 Sep 2002 14:38:26 -0000 1.131 @@ -1116,10 +1116,10 @@ float getMinValue ( void ) const { return minimum_value ; } virtual void setMinValue ( float f ) { minimum_value = f ; } - float getStepSize ( void ) { return step_size ; } + float getStepSize ( void ) const { return step_size ; } void setStepSize ( float f ) { step_size = f ; } - float checkStep ( float val_to_check ) + float checkStep ( float val_to_check ) const { float step = val_to_check ; |
From: Sebastian U. <ud...@us...> - 2002-09-17 23:16:46
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv7653 Modified Files: psl.h Log Message: Made psl.h safe against being #include'd multiple times Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- psl.h 15 Sep 2002 04:34:39 -0000 1.18 +++ psl.h 17 Sep 2002 23:16:43 -0000 1.19 @@ -21,6 +21,8 @@ $Id$ */ +#ifndef _PSL_H +#define _PSL_H 1 #include "ul.h" @@ -265,4 +267,5 @@ void pslInit () ; void pslSetErrorCallback ( void (*CB) ( pslProgram *, int, char *, int, char * ) ) ; +#endif |
From: Sebastian U. <ud...@us...> - 2002-09-17 22:48:31
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv439 Modified Files: puObject.cxx Log Message: John F. Fay: puLargeInput is a child of puGroup again Index: puObject.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puObject.cxx,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- puObject.cxx 2 Sep 2002 06:05:46 -0000 1.47 +++ puObject.cxx 17 Sep 2002 22:48:28 -0000 1.48 @@ -143,7 +143,6 @@ am_default = FALSE ; window = puGetWindow () ; v_status = 0 ; - isSubWidget = FALSE ; cb = NULL ; active_cb = NULL ; |
From: Sebastian U. <ud...@us...> - 2002-09-17 22:45:41
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv31964 Modified Files: pu.cxx Log Message: John F. Fay: puLargeInput is a child of puGroup again Index: pu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.cxx,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- pu.cxx 15 Sep 2002 01:00:21 -0000 1.58 +++ pu.cxx 17 Sep 2002 22:45:38 -0000 1.59 @@ -193,8 +193,8 @@ puGroup *parent = ob->getParent () ; - if ( !ob->IsItSubWidget() ) - { + /*if ( !ob->IsItSubWidget() ) + {*/ /* Add object to linked list to be deleted */ if ( objects_to_delete == NULL ) objects_to_delete = ob ; @@ -227,7 +227,7 @@ child = next ; } } - } + /*}*/ } |
From: Sebastian U. <ud...@us...> - 2002-09-17 22:42:17
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv30972 Modified Files: pu.h puLargeInput.cxx Log Message: John F. Fay: puLargeInput is a child of puGroup again Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.129 retrieving revision 1.130 diff -u -d -r1.129 -r1.130 --- pu.h 15 Sep 2002 01:00:23 -0000 1.129 +++ pu.h 17 Sep 2002 22:42:12 -0000 1.130 @@ -327,11 +327,7 @@ #define PUSTRING_MAX 80 /* With many memory managers, allocating powers of two is more efficient */ -// wk: This was 64. But in the viewer example, compiled as debug build with MSVC -// when you choose a file with a path/file name length more than 64, there will be -// a crash. Obviously, the right thing to do would be to find the real cause -// for this and fix it, but I could not find it and we need to release... -#define PUSTRING_INITIAL 128 +#define PUSTRING_INITIAL 64 extern puColour _puDefaultColourTable[] ; [...94 lines suppressed...] + int new_data_len = 1 ; + if ( valid_data ) new_data_len += strlen ( valid_data ) ; + if ( data ) new_data_len += strlen ( data ) ; + char *new_data = new char [ new_data_len ] ; + 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 ; + } + + int isValidCharacter ( char c ) const + { + if ( valid_data != NULL ) + return ( strchr ( valid_data, c ) != NULL ) ? 1 : 0 ; + else + return 1 ; } void invokeDownCallback ( void ) Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- puLargeInput.cxx 15 Sep 2002 01:00:23 -0000 1.39 +++ puLargeInput.cxx 17 Sep 2002 22:42:12 -0000 1.40 @@ -24,7 +24,7 @@ #include "puLocal.h" -UL_RTTI_DEF1(puLargeInput,puInput) +UL_RTTI_DEF1(puLargeInput,puGroup) // Callbacks from the internal widgets @@ -34,24 +34,37 @@ float val = ((puRange *)slider)->getMaxValue () - slider->getFloatValue () ; [...444 lines suppressed...] + strncpy ( p, getStringValue (), cursor_position ) ; p[cursor_position] = '\0' ; strcat ( p, puGetPasteBuffer () ) ; - strcat ( p, getText() + cursor_position ) ; + strcat ( p, getStringValue() + cursor_position ) ; temp_cursor += strlen ( puGetPasteBuffer () ) ; - setText ( p ) ; + setValue ( p ) ; setCursor ( temp_cursor ) ; delete [] p ; } @@ -1163,7 +1202,7 @@ } } - setText ( p ) ; + setValue ( p ) ; setCursor ( temp_cursor + 1 ) ; delete [] p ; |
From: Sebastian U. <ud...@us...> - 2002-09-15 19:12:08
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv16907 Modified Files: pslContext.cxx Log Message: Replaced two instances of 'delete' with 'delete []'; Only lazy programmers use strcat :) Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- pslContext.cxx 15 Sep 2002 17:45:53 -0000 1.16 +++ pslContext.cxx 15 Sep 2002 19:12:01 -0000 1.17 @@ -191,12 +191,15 @@ else if ( v1->getType() == PSL_STRING && v2->getType() == PSL_STRING ) { - char *s = new char [ strlen ( v1 -> getString () ) + - strlen ( v2 -> getString () ) + 1 ] ; - strcpy ( s, v2 -> getString () ) ; - strcat ( s, v1 -> getString () ) ; + int v1_len = strlen ( v1 -> getString () ) ; + int v2_len = strlen ( v2 -> getString () ) ; + char *s = new char [ v1_len + v2_len + 1 ] ; + + memcpy ( s, v2 -> getString (), v2_len ) ; + memcpy ( s+v2_len, v1 -> getString (), v1_len+1 ) ; + v2 -> set ( s ) ; - delete s ; + delete [] s ; } else v2 -> set ( v2 -> getInt () + v1 -> getInt () ) ; @@ -510,12 +513,15 @@ else if ( v -> getType () == PSL_STRING ) { - char *s = new char [ strlen ( v -> getString () ) + - strlen ( stack[sp-1] . getString () ) + 1 ] ; - strcpy ( s, v -> getString () ) ; - strcat ( s, stack[--sp] . getString () ) ; + int s1_len = strlen ( v -> getString () ) ; + int s2_len = strlen ( stack[sp-1] . getString () ) ; + char *s = new char [ s1_len + s2_len + 1 ] ; + + memcpy ( s, v -> getString (), s1_len ) ; + memcpy ( s+s1_len, stack[--sp] . getString (), s2_len+1 ) ; + v -> set ( s ) ; - delete s ; + delete [] s ; } else v -> set ( v -> getFloat() + stack[--sp].getFloat()) ; |
From: Sebastian U. <ud...@us...> - 2002-09-15 17:54:14
|
Update of /cvsroot/plib/plib/demos/ttt3d/src In directory usw-pr-cvs1:/tmp/cvs-serv26460 Modified Files: p3d.h Log Message: Don't need to include js.h Index: p3d.h =================================================================== RCS file: /cvsroot/plib/plib/demos/ttt3d/src/p3d.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- p3d.h 1 Sep 2002 07:10:09 -0000 1.5 +++ p3d.h 15 Sep 2002 17:54:09 -0000 1.6 @@ -46,7 +46,6 @@ #endif #include <plib/sl.h> -#include <plib/js.h> #include <plib/fnt.h> #ifndef M_PI |
From: Steve B. <sj...@us...> - 2002-09-15 17:45:56
|
Update of /cvsroot/plib/plib/demos/simon/src In directory usw-pr-cvs1:/tmp/cvs-serv23942/plib/demos/simon/src Modified Files: simon.cxx Log Message: Added character constants and string variable addition. Index: simon.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- simon.cxx 15 Sep 2002 04:34:39 -0000 1.6 +++ simon.cxx 15 Sep 2002 17:45:52 -0000 1.7 @@ -34,7 +34,7 @@ { case PSL_INT : printf ( "%d ", argv[i].getInt () ) ; break ; case PSL_FLOAT : printf ( "%f ", argv[i].getFloat () ) ; break ; - case PSL_STRING : printf ( "%s ", argv[i].getString () ) ; break ; + case PSL_STRING : printf ( "%s", argv[i].getString () ) ; break ; case PSL_VOID : printf ( "(void) " ) ; break ; } } |
From: Steve B. <sj...@us...> - 2002-09-15 17:45:56
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv23942/plib/src/psl Modified Files: pslCodeGen.cxx pslCompiler.h pslContext.cxx pslExpression.cxx pslToken.cxx Log Message: Added character constants and string variable addition. Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- pslCodeGen.cxx 15 Sep 2002 06:36:24 -0000 1.26 +++ pslCodeGen.cxx 15 Sep 2002 17:45:53 -0000 1.27 @@ -49,6 +49,18 @@ } +void pslCompiler::pushCharConstant ( char c ) +{ + /* A bit wasteful but... */ + + pushCodeByte ( OPCODE_PUSH_INT_CONSTANT ) ; + pushCodeByte ( c ) ; + pushCodeByte ( 0 ) ; + pushCodeByte ( 0 ) ; + pushCodeByte ( 0 ) ; +} + + void pslCompiler::pushConstant ( const char *c ) { int isInteger = TRUE ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- pslCompiler.h 15 Sep 2002 14:32:53 -0000 1.28 +++ pslCompiler.h 15 Sep 2002 17:45:53 -0000 1.29 @@ -119,6 +119,7 @@ void pushIntConstant ( const char *s ) ; void pushFloatConstant ( const char *s ) ; void pushStringConstant( const char *s ) ; + void pushCharConstant ( char c ) ; void pushIntConstant ( int i ) ; void pushVoidConstant () ; Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pslContext.cxx 15 Sep 2002 14:32:53 -0000 1.15 +++ pslContext.cxx 15 Sep 2002 17:45:53 -0000 1.16 @@ -189,6 +189,16 @@ if ( v1->getType() == PSL_FLOAT || v2->getType() == PSL_FLOAT ) v2 -> set ( v2 -> getFloat() + v1 -> getFloat() ) ; else + if ( v1->getType() == PSL_STRING && v2->getType() == PSL_STRING ) + { + char *s = new char [ strlen ( v1 -> getString () ) + + strlen ( v2 -> getString () ) + 1 ] ; + strcpy ( s, v2 -> getString () ) ; + strcat ( s, v1 -> getString () ) ; + v2 -> set ( s ) ; + delete s ; + } + else v2 -> set ( v2 -> getInt () + v1 -> getInt () ) ; popVoid () ; @@ -491,7 +501,6 @@ pc++ ; return PSL_PROGRAM_CONTINUE ; - case OPCODE_POP_ADD_VARIABLE : { pslVariable *v = & ( variable [ code[++pc] ] ) ; @@ -499,11 +508,20 @@ if ( v -> getType () == PSL_INT ) v -> set ( v -> getInt() + stack[--sp].getInt()) ; else + if ( v -> getType () == PSL_STRING ) + { + char *s = new char [ strlen ( v -> getString () ) + + strlen ( stack[sp-1] . getString () ) + 1 ] ; + strcpy ( s, v -> getString () ) ; + strcat ( s, stack[--sp] . getString () ) ; + v -> set ( s ) ; + delete s ; + } + else v -> set ( v -> getFloat() + stack[--sp].getFloat()) ; pc++ ; } return PSL_PROGRAM_CONTINUE ; - case OPCODE_POP_SUB_VARIABLE : { Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pslExpression.cxx 15 Sep 2002 04:34:39 -0000 1.15 +++ pslExpression.cxx 15 Sep 2002 17:45:53 -0000 1.16 @@ -102,6 +102,12 @@ } } + if ( c [ 0 ] == '\'' ) + { + pushCharConstant ( c [ 1 ] ) ; + return TRUE ; + } + if ( c [ 0 ] == '"' ) { pushStringConstant ( & c [ 1 ] ) ; Index: pslToken.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- pslToken.cxx 15 Sep 2002 01:05:18 -0000 1.20 +++ pslToken.cxx 15 Sep 2002 17:45:53 -0000 1.21 @@ -438,7 +438,7 @@ case 'f' : res [ tp++ ] = '\f' ; break ; case 'b' : res [ tp++ ] = '\b' ; break ; case 'a' : res [ tp++ ] = '\a' ; break ; - default: res [ tp++ ] = c ; break ; + default : res [ tp++ ] = c ; break ; } isBkSlash = FALSE ; @@ -460,6 +460,41 @@ error ( "Missing \\\" character" ) ; /* The trailing quotes character is not included into the string */ + res [ tp ] = '\0' ; + return ; + } + + if ( c == '\'' ) + { + res [ tp++ ] = '\'' ; + + c = getChar () ; + + if ( c == '\\' ) + { + c = getChar () ; + + switch ( c ) + { + case '0' : res [ tp++ ] = '\0' ; break ; + case 'r' : res [ tp++ ] = '\r' ; break ; + case 't' : res [ tp++ ] = '\t' ; break ; + case 'n' : res [ tp++ ] = '\n' ; break ; + case 'f' : res [ tp++ ] = '\f' ; break ; + case 'b' : res [ tp++ ] = '\b' ; break ; + case 'a' : res [ tp++ ] = '\a' ; break ; + default : res [ tp++ ] = c ; break ; + } + } + else + res [ tp++ ] = c ; + + c = getChar () ; + + if ( c != '\'' ) + error ( "Missing \\' character" ) ; + + /* The trailing quote character is not included into the string */ res [ tp ] = '\0' ; return ; } |
From: Steve B. <sj...@us...> - 2002-09-15 17:45:56
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv23942/plib/doc/psl Modified Files: prog_guide.html Log Message: Added character constants and string variable addition. Index: prog_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/prog_guide.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- prog_guide.html 15 Sep 2002 06:36:24 -0000 1.10 +++ prog_guide.html 15 Sep 2002 17:45:52 -0000 1.11 @@ -124,7 +124,6 @@ hopefully arrive soon: <ul> <li> Multiple assignments (eg x = y = 0 ; ) - <li> Character constants. <li> Arrays & Structs. <li> Operations on "string" variables. <li> String concatenation. |
From: Sebastian U. <ud...@us...> - 2002-09-15 14:32:57
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv28419 Modified Files: pslCompiler.cxx pslCompiler.h pslContext.cxx pslContext.h pslError.cxx pslFileIO.cxx pslFileIO.h pslProgram.cxx Log Message: Const-correctness Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- pslCompiler.cxx 15 Sep 2002 06:36:24 -0000 1.24 +++ pslCompiler.cxx 15 Sep 2002 14:32:53 -0000 1.25 @@ -44,7 +44,7 @@ int pslCompiler::compile ( FILE *fd, const char *fname ) { - char *dump_env = getenv ( "PSL_DUMP" ) ; + const char *dump_env = getenv ( "PSL_DUMP" ) ; init () ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- pslCompiler.h 15 Sep 2002 06:36:24 -0000 1.27 +++ pslCompiler.h 15 Sep 2002 14:32:53 -0000 1.28 @@ -281,7 +281,7 @@ char *progName ; - const char *getProgName () const { return progName ; } + char *getProgName () const { return progName ; } /* Major storage for symbols and byte-codes */ Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslContext.cxx 15 Sep 2002 06:36:24 -0000 1.14 +++ pslContext.cxx 15 Sep 2002 14:32:53 -0000 1.15 @@ -1,4 +1,5 @@ -/* PLIB - A Suite of Portable Game Libraries +/* + PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslContext.h 15 Sep 2002 06:36:24 -0000 1.11 +++ pslContext.h 15 Sep 2002 14:32:53 -0000 1.12 @@ -40,7 +40,7 @@ void bumpErrors () { num_errors++ ; } void bumpWarnings () { num_warnings++ ; } - const char *getProgName () const { return program -> getProgName () ; } + char *getProgName () const { return program -> getProgName () ; } void error ( const char *fmt, ... ) ; void warning ( const char *fmt, ... ) ; @@ -58,7 +58,7 @@ ~pslContext () {} ; - int getLineNo () { return line_no ; } + int getLineNo () const { return line_no ; } void pushInt ( int x ) { stack [ sp++ ] . set ( x ) ; } @@ -66,9 +66,9 @@ void pushString ( const char *x ) { stack [ sp++ ] . set ( x ) ; } void pushNumber ( const pslNumber *x ) { stack [ sp++ ] . set ( x ) ; } - int peekInt () { return stack [ sp-1 ] . getInt () ; } - float peekFloat () { return stack [ sp-1 ] . getFloat () ; } - char *peekString () { return stack [ sp-1 ] . getString () ; } + int peekInt () const { return stack [ sp-1 ] . getInt () ; } + float peekFloat () const { return stack [ sp-1 ] . getFloat () ; } + char *peekString () const { return stack [ sp-1 ] . getString () ; } void popVoid ( int n = 1 ) { sp -= n ; } int popInt () { return stack [ --sp ] . getInt () ; } Index: pslError.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslError.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pslError.cxx 15 Sep 2002 06:36:24 -0000 1.7 +++ pslError.cxx 15 Sep 2002 14:32:53 -0000 1.8 @@ -1,4 +1,3 @@ - /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker Index: pslFileIO.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslFileIO.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pslFileIO.cxx 10 Sep 2002 23:10:41 -0000 1.4 +++ pslFileIO.cxx 15 Sep 2002 14:32:53 -0000 1.5 @@ -1,4 +1,3 @@ - /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker Index: pslFileIO.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslFileIO.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pslFileIO.h 10 Sep 2002 23:02:08 -0000 1.2 +++ pslFileIO.h 15 Sep 2002 14:32:53 -0000 1.3 @@ -1,4 +1,3 @@ - /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslProgram.cxx 15 Sep 2002 06:36:24 -0000 1.13 +++ pslProgram.cxx 15 Sep 2002 14:32:53 -0000 1.14 @@ -46,7 +46,7 @@ compiler-> init () ; context -> reset () ; - char *force_trace_env = getenv ( "PSL_TRACE" ) ; + const char *force_trace_env = getenv ( "PSL_TRACE" ) ; force_trace = ( force_trace_env != NULL && ulStrEqual ( force_trace_env, "always" ) ) ; |
From: Steve B. <sj...@us...> - 2002-09-15 06:36:29
|
Update of /cvsroot/plib/plib/doc/psl In directory usw-pr-cvs1:/tmp/cvs-serv30590/plib/doc/psl Modified Files: prog_guide.html Log Message: Added line numbers to process tracing. Index: prog_guide.html =================================================================== RCS file: /cvsroot/plib/plib/doc/psl/prog_guide.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- prog_guide.html 15 Sep 2002 00:02:51 -0000 1.9 +++ prog_guide.html 15 Sep 2002 06:36:24 -0000 1.10 @@ -124,7 +124,6 @@ hopefully arrive soon: <ul> <li> Multiple assignments (eg x = y = 0 ; ) - <li> Logic operators "&&", "||". <li> Character constants. <li> Arrays & Structs. <li> Operations on "string" variables. @@ -152,11 +151,49 @@ WINDOWS USERS BEWARE: PSL IMPLEMENTS THIS CORRECTLY - *NOT* LIKE MSVC. -<H3>Hard Limits</H3> +<H1>Hard Limits</H1> 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. +<H1>Debugging PSL Programs</H1> + +Specific PSL-enabled applications may have their own +special features to assist with debugging - but all +PSL-enabled applications support several 'shell variables' +that enable certain debugging features. +<p> +When using a command line shell, you can set these +variables using one of the following commands before +you run your application: +<pre> + setenv VARIABLE value -- csh or tcsh + export VARIABLE=value -- bash or sh + set VARIABLE=value -- DOS shell +</pre> +<H3> Byte-Code Dump </H3> +It's possible to view the byte code that PSL generated +by setting the shell variable 'PSL_DUMP' to either: +<ul> +<li> <b>never</b> (the default) -- Never produce a dump unless + the application demands it. +<li> <b>on_error</b> -- Produce a dump whenever the PSL program + fails to compile for whatever reason. +<li> <b>always</b> -- Always produce a dump after the PSL program + finishes compiling. +</ul> +<H3> Byte-Code Execution Trace </H3> +It's possible to view the byte code as it's executed +by setting the shell variable 'PSL_TRACE' to either: +<ul> +<li> <b>never</b> (the default) -- Never produce a trace unless + the application demands it. +<li> <b>always</b> -- Always produce a trace. +</ul> +When the execution trace is enabled, extra instructions will be +inserted into the byte code to enable the PSL interpreter to +produce debug indicating which lines of the source code are +being traced. <hr> <address> <a href="http://www.sjbaker.org">Steve J. Baker.</a> <<a href="mailto:sjb...@ai...">sjb...@ai...</a>></address> |
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv30590/plib/src/psl Modified Files: pslCodeGen.cxx pslCompiler.cxx pslCompiler.h pslContext.cxx pslContext.h pslDump.cxx pslError.cxx pslOpcodes.h pslProgram.cxx Log Message: Added line numbers to process tracing. Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- pslCodeGen.cxx 15 Sep 2002 04:34:39 -0000 1.25 +++ pslCodeGen.cxx 15 Sep 2002 06:36:24 -0000 1.26 @@ -41,6 +41,14 @@ } +void pslCompiler::pushLineNumber ( int l ) +{ + pushCodeByte ( OPCODE_LINE_NUMBER ) ; + pushCodeByte ( l & 0xFF ) ; + pushCodeByte ( ( l >> 8 ) & 0xFF ) ; +} + + void pslCompiler::pushConstant ( const char *c ) { int isInteger = TRUE ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- pslCompiler.cxx 15 Sep 2002 04:34:39 -0000 1.23 +++ pslCompiler.cxx 15 Sep 2002 06:36:24 -0000 1.24 @@ -595,6 +595,9 @@ { char c [ MAX_TOKEN ] ; + if ( generate_line_numbers ) + pushLineNumber ( _pslGetLineNo () ) ; + getToken ( c ) ; if ( strcmp ( c, "static" ) == 0 ) return pushStaticVarDecl () ; Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- pslCompiler.h 15 Sep 2002 04:34:39 -0000 1.26 +++ pslCompiler.h 15 Sep 2002 06:36:24 -0000 1.27 @@ -73,6 +73,8 @@ void pushCodeAddr ( pslAddress a ) ; int printOpcode ( FILE *fd, int addr ) const ; + void pushLineNumber ( int l ) ; + /* Write single byte-coded instructions into code space. */ void pushStackDup () ; @@ -180,6 +182,8 @@ int next_code_symbol ; int next_define ; + int generate_line_numbers ; + char *define_token [ MAX_SYMBOL ] ; char *define_replacement [ MAX_SYMBOL ] ; @@ -297,6 +301,7 @@ program = prog ; progName = ulStrDup ( _progName ) ; + generate_line_numbers = FALSE ; code = _code ; extensions = _extn ; @@ -327,6 +332,13 @@ const pslExtension *getExtensions () const { return extensions ; } int printInstruction ( FILE *fd, int addr ) const ; + + + void generateLineNumbers () + { + generate_line_numbers = TRUE ; + } + void init () { Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pslContext.cxx 15 Sep 2002 04:34:39 -0000 1.13 +++ pslContext.cxx 15 Sep 2002 06:36:24 -0000 1.14 @@ -32,6 +32,11 @@ pc++ ; return PSL_PROGRAM_END ; + case OPCODE_LINE_NUMBER : + line_no = code [ pc + 1 ] + ( code [ pc + 2 ] << 8 ) ; + pc+=3 ; + return PSL_PROGRAM_CONTINUE ; + case OPCODE_PUSH_INT_CONSTANT : { int ii ; Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pslContext.h 15 Sep 2002 04:34:39 -0000 1.10 +++ pslContext.h 15 Sep 2002 06:36:24 -0000 1.11 @@ -35,6 +35,7 @@ int num_errors ; int num_warnings ; + int line_no ; void bumpErrors () { num_errors++ ; } void bumpWarnings () { num_warnings++ ; } @@ -57,6 +58,9 @@ ~pslContext () {} ; + int getLineNo () { return line_no ; } + + void pushInt ( int x ) { stack [ sp++ ] . set ( x ) ; } void pushFloat ( float x ) { stack [ sp++ ] . set ( x ) ; } void pushString ( const char *x ) { stack [ sp++ ] . set ( x ) ; } @@ -86,6 +90,8 @@ { for ( int i = 0 ; i < MAX_VARIABLE ; i++ ) variable [ i ] . reset () ; + + line_no = -1 ; sp = 0 ; pc = 0 ; Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- pslDump.cxx 15 Sep 2002 04:34:39 -0000 1.19 +++ pslDump.cxx 15 Sep 2002 06:36:24 -0000 1.20 @@ -38,6 +38,8 @@ { { "NO_OP" , OPCODE_NOOP , 0 }, + { "SOURCE LINE NUMBER:", OPCODE_LINE_NUMBER, 2 }, + /* Stack operations */ { "PUSH_INT_CONSTANT" , OPCODE_PUSH_INT_CONSTANT , sizeof(int) }, @@ -96,6 +98,7 @@ { "SHIFT_LEFT", OPCODE_SHIFTLEFT , 0 }, { "SHIFT_RIGHT", OPCODE_SHIFTRIGHT , 0 }, + /* Boolean operators */ { "LESS", OPCODE_LESS , 0 }, @@ -205,6 +208,11 @@ switch ( code [ addr ] ) { + case OPCODE_LINE_NUMBER : + fprintf ( fd, "%d =====================", + code[addr+1] + ( code[addr+2] << 8 ) ) ; + break ; + case OPCODE_SET_INT_VARIABLE : case OPCODE_SET_FLOAT_VARIABLE : case OPCODE_SET_STRING_VARIABLE : Index: pslError.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslError.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pslError.cxx 13 Sep 2002 22:32:15 -0000 1.6 +++ pslError.cxx 15 Sep 2002 06:36:24 -0000 1.7 @@ -48,12 +48,11 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( program, PSL_COMPILETIME_WARNING, _pslGetFname(), _pslGetLineNo(), - _pslErrorBuffer ) ; + (*_pslErrorCB)( program, PSL_COMPILETIME_WARNING, + _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: WARNING - %s\n", - _pslGetFname(), _pslGetLineNo(), - _pslErrorBuffer ) ; + _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; bumpWarnings () ; return FALSE ; @@ -69,12 +68,11 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( program, PSL_COMPILETIME_ERROR, _pslGetFname(), _pslGetLineNo(), - _pslErrorBuffer ) ; + (*_pslErrorCB)( program, PSL_COMPILETIME_ERROR, + _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; else fprintf ( stderr, "PSL: \"%s\" line %3d: *ERROR* - %s\n", - _pslGetFname(), _pslGetLineNo(), - _pslErrorBuffer ) ; + _pslGetFname(), _pslGetLineNo(), _pslErrorBuffer ) ; bumpErrors () ; return FALSE ; @@ -90,10 +88,15 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( program, PSL_RUNTIME_WARNING, getProgName(), pc, _pslErrorBuffer ) ; + (*_pslErrorCB)( program, PSL_RUNTIME_WARNING, + getProgName(), getLineNo(), _pslErrorBuffer ) ; else - fprintf ( stderr, "PSL: \"%s\" PC=%d: WARNING - %s\n", - getProgName(), pc, _pslErrorBuffer ) ; + if ( getLineNo () >= 0 ) + fprintf ( stderr, "PSL: \"%s\" Line %d: WARNING - %s\n", + getProgName(), getLineNo(), _pslErrorBuffer ) ; + else + fprintf ( stderr, "PSL: \"%s\": WARNING - %s\n", + getProgName(), _pslErrorBuffer ) ; bumpWarnings () ; } @@ -108,10 +111,15 @@ va_end ( argp ) ; if ( _pslErrorCB != NULL ) - (*_pslErrorCB)( program, PSL_RUNTIME_ERROR, getProgName(), pc, _pslErrorBuffer ) ; + (*_pslErrorCB)( program, PSL_RUNTIME_ERROR, + getProgName(), getLineNo(), _pslErrorBuffer ) ; else - fprintf ( stderr, "PSL: \"%s\" PC=%d: *ERROR* - %s\n", - getProgName(), pc, _pslErrorBuffer ) ; + if ( getLineNo () >= 0 ) + fprintf ( stderr, "PSL: \"%s\" Line %d: *ERROR* - %s\n", + getProgName(), getLineNo(), _pslErrorBuffer ) ; + else + fprintf ( stderr, "PSL: \"%s\": *ERROR* - %s\n", + getProgName(), _pslErrorBuffer ) ; bumpErrors () ; } Index: pslOpcodes.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslOpcodes.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslOpcodes.h 15 Sep 2002 04:34:39 -0000 1.11 +++ pslOpcodes.h 15 Sep 2002 06:36:24 -0000 1.12 @@ -71,6 +71,7 @@ #define OPCODE_DECREMENT 0x2A #define OPCODE_PEEK_JUMP_FALSE 0x2B #define OPCODE_PEEK_JUMP_TRUE 0x2C +#define OPCODE_LINE_NUMBER 0x2D #define OPCODE_POP_ADD_VARIABLE 0x30 #define OPCODE_POP_SUB_VARIABLE 0x31 Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslProgram.cxx 15 Sep 2002 04:34:39 -0000 1.12 +++ pslProgram.cxx 15 Sep 2002 06:36:24 -0000 1.13 @@ -50,6 +50,9 @@ force_trace = ( force_trace_env != NULL && ulStrEqual ( force_trace_env, "always" ) ) ; + + if ( force_trace ) + compiler -> generateLineNumbers () ; } |
From: Steve B. <sj...@us...> - 2002-09-15 05:01:27
|
Update of /cvsroot/plib/plib/demos/simon/astropong/data In directory usw-pr-cvs1:/tmp/cvs-serv16365/plib/demos/simon/astropong/data Added Files: Penguin_beak.rgb Penguin_body.rgb Penguin_body2.rgb Penguin_foot.rgba Scoreboard.ac Scoreboard.rgb arena2.ac ball3.ac bluepaddle2.ac embossed_herring.rgb redpaddle2.ac shadow2.ac Log Message: Added astropong's data files. --- NEW FILE: Penguin_beak.rgb --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Penguin_body.rgb --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Penguin_body2.rgb --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Penguin_foot.rgba --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Scoreboard.ac --- AC3Db MATERIAL "ac3dmat0" rgb 0 0 0 amb 0 0 0 emis 0 0 0 spec 0 0 0 shi 128 trans 0 MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 1 1 1 spec 0.502 0.502 0.502 shi 10 trans 0 OBJECT world kids 3 OBJECT poly name "cylinder" loc -2.5332e-07 0.000827358 0.00013657 texture "Scoreboard.rgb" numvert 162 0.5 -1.41445 0.499339 0.5 -1.3715 0.607445 0.5 -1.3203 0.7119 0.5 -1.26117 0.812075 0.5 -1.19445 0.90736 0.5 -1.12054 0.997195 0.5 -1.0399 1.08103 0.5 -0.952995 1.15836 0.5 -0.860365 1.22873 [...2255 lines suppressed...] 81 0.499812 0.5 SURF 0x20 mat 1 refs 3 78 0.986517 0.384671 79 0.993993 0.422726 81 0.499812 0.5 SURF 0x20 mat 1 refs 3 79 0.993993 0.422726 80 0.998496 0.461247 81 0.499812 0.5 SURF 0x20 mat 1 refs 3 80 0.998496 0.461247 0 1 0.5 81 0.499812 0.5 kids 0 --- NEW FILE: Scoreboard.rgb --- (This appears to be a binary file; contents omitted.) --- NEW FILE: arena2.ac --- AC3Db MATERIAL "ac3dmat8" rgb 0.627 0.753 0.878 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.502 0.502 0.502 shi 10 trans 0.655 OBJECT world kids 1 OBJECT poly numvert 96 4.975 -4.975 -4.975 4.975 -4.975 4.975 4 -5 5 4 -5 -5 4.975 4.975 -4.975 4 5 -5 4 5 5 4.975 4.975 4.975 4 5 -5 4 -5 -5 4 -5 5 4 5 5 4.975 4.975 4.975 [...233 lines suppressed...] refs 4 84 0 0 85 1 0 86 1 1 87 0 1 SURF 0x30 mat 0 refs 4 88 0 0 89 1 0 90 1 1 91 0 1 SURF 0x30 mat 0 refs 4 92 0 0 93 1 0 94 1 1 95 0 1 kids 0 --- NEW FILE: ball3.ac --- AC3Db MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 OBJECT world kids 2 OBJECT poly name "mesh" loc -0.010227 -0.145106 0.116565 texture "embossed_herring.rgb" texrep 0.8 0.55 texoff 0.09 0.22 numvert 176 0 0.245586 -1.12778 0 0.279383 -1.06301 0 0.30642 -0.972671 0 0.333458 -0.856768 0 0.407809 -0.669279 0 0.455123 -0.481792 0 0.482161 -0.294301 0 0.468643 -0.106812 [...2435 lines suppressed...] refs 4 157 0.936156 0.490978 173 0.889956 0.470085 172 0.861891 0.384615 156 0.904973 0.405508 SURF 0x30 mat 0 refs 4 158 0.984572 0.331586 174 0.93353 0.296111 173 0.889956 0.470085 157 0.936156 0.490978 SURF 0x30 mat 0 refs 4 159 1 0.280855 175 1 0.204701 174 0.93353 0.296111 158 0.984572 0.331586 kids 0 --- NEW FILE: bluepaddle2.ac --- AC3Db MATERIAL "ac3dmat0" rgb 0 0 0 amb 0 0 0 emis 0 0 0 spec 0 0 0 shi 128 trans 0.22 MATERIAL "ac3dmat8" rgb 0.478 0.502 1 amb 0.2 0.2 1 emis 0 0 0 spec 0.502 0.502 1 shi 10 trans 0.22 OBJECT world kids 6 OBJECT poly name "noname" loc -0.579657 -0.559209 0.472312 texture "Penguin_foot.rgba" numvert 7 0.207207 -0.401817 -0.0439492 -0.359605 -0.121745 0.0313728 0.0993607 -0.405379 -0.0423633 -0.115831 0.281581 0.116401 0.195658 -0.318231 -0.134527 0.359605 -0.221492 -0.00689447 0.319485 0.405379 0.134527 numsurf 7 SURF 0x10 [...12925 lines suppressed...] refs 4 1623 0.165435 0.0549999 31 0.164581 0.0549999 33 0.261984 0.0200004 1624 0.262589 0.0200004 SURF 0x30 mat 1 refs 4 1624 0.262589 0.0200004 33 0.261984 0.0200004 35 0.40641 0 1625 0.406649 0 SURF 0x30 mat 1 refs 4 1625 0.406649 0 35 0.40641 0 37 0.493738 0 1626 0.493755 0 kids 0 --- NEW FILE: embossed_herring.rgb --- (This appears to be a binary file; contents omitted.) --- NEW FILE: redpaddle2.ac --- AC3Db MATERIAL "ac3dmat0" rgb 0 0 0 amb 0 0 0 emis 0 0 0 spec 0 0 0 shi 128 trans 0.22 MATERIAL "ac3dmat8" rgb 0.478 0.502 1 amb 0.2 0.2 1 emis 0 0 0 spec 0.502 0.502 1 shi 10 trans 0.22 MATERIAL "ac3dmat3" rgb 1 0 0 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.502 0.502 0.502 shi 10 trans 0.22 OBJECT world kids 6 OBJECT poly name "noname" loc -0.514814 -0.559209 1.17231 texture "Penguin_foot.rgba" numvert 7 0.198701 -0.401817 -1.07875 -0.344844 -0.121745 -1.15407 0.0952821 -0.405379 -1.08033 -0.111076 0.281581 -1.2391 0.187626 -0.318231 -0.98817 0.344844 -0.221492 -1.1158 0.306371 0.405379 -1.25722 numsurf 7 [...12926 lines suppressed...] refs 4 1623 0.165435 0.0549999 31 0.164581 0.0549999 33 0.261984 0.0200004 1624 0.262589 0.0200004 SURF 0x30 mat 2 refs 4 1624 0.262589 0.0200004 33 0.261984 0.0200004 35 0.40641 0 1625 0.406649 0 SURF 0x30 mat 2 refs 4 1625 0.406649 0 35 0.40641 0 37 0.493738 0 1626 0.493755 0 kids 0 --- NEW FILE: shadow2.ac --- AC3Db MATERIAL "ac3dmat0" rgb 0 0 0 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 OBJECT world kids 1 OBJECT poly name "disk" numvert 82 0.5 0 0 0.498496 0 0.0387462 0.493995 0 0.0772594 0.486522 0 0.115308 0.476124 0 0.152663 0.462862 0 0.1891 0.446816 0 0.2244 0.428083 0 0.25835 0.406776 0 0.290746 0.383022 0 0.321394 0.356965 0 0.350109 0.328761 0 0.376718 [...538 lines suppressed...] 81 0.499812 0.5 SURF 0x20 mat 0 refs 3 78 0.986517 0.61533 79 0.993993 0.577274 81 0.499812 0.5 SURF 0x20 mat 0 refs 3 79 0.993993 0.577274 80 0.998496 0.538753 81 0.499812 0.5 SURF 0x20 mat 0 refs 3 80 0.998496 0.538753 0 1 0.5 81 0.499812 0.5 kids 0 |
From: Steve B. <sj...@us...> - 2002-09-15 04:34:46
|
Update of /cvsroot/plib/plib/demos/simon In directory usw-pr-cvs1:/tmp/cvs-serv11840/plib/demos/simon Modified Files: README Log Message: Added PSL_DUMP and PSL_TRACE environment vars. Fixed evaluation of && and || so they don't compute their right-hand sides unless they have to. Index: README =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/README,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- README 15 Sep 2002 00:02:51 -0000 1.2 +++ README 15 Sep 2002 04:34:39 -0000 1.3 @@ -22,6 +22,9 @@ Right now, you build SIMON by running 'make' and install it by running 'make install' as root. You must already have PLIB installed. +Simon installs into /usr/local/simon/libsimon.a /usr/local/simon/simon.h +and places an executable into /usr/local/bin/simon + RUNNING SIMON |
From: Steve B. <sj...@us...> - 2002-09-15 04:34:43
|
Update of /cvsroot/plib/plib/demos/simon/src In directory usw-pr-cvs1:/tmp/cvs-serv11840/plib/demos/simon/src Modified Files: Makefile simon.cxx Log Message: Added PSL_DUMP and PSL_TRACE environment vars. Fixed evaluation of && and || so they don't compute their right-hand sides unless they have to. Index: Makefile =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile 15 Sep 2002 01:46:33 -0000 1.4 +++ Makefile 15 Sep 2002 04:34:39 -0000 1.5 @@ -18,10 +18,12 @@ install: libsimon.a simon.h simon mkdir -p /usr/local/simon - cp simon libsimon.a simon.h /usr/local/simon + cp libsimon.a simon.h /usr/local/simon + cp simon /usr/local/bin uninstall: rm -r /usr/local/simon + rm /usr/local/bin/simon clean: rm -f simon libsimon.a *.o Index: simon.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- simon.cxx 15 Sep 2002 02:33:33 -0000 1.5 +++ simon.cxx 15 Sep 2002 04:34:39 -0000 1.6 @@ -25,6 +25,25 @@ #include <simon.h> #include <plib/psl.h> + +pslValue my_print ( int argc, pslValue *argv, pslProgram *p ) +{ + for ( int i = 0 ; i < argc ; i++ ) + { + switch ( argv[i].getType () ) + { + case PSL_INT : printf ( "%d ", argv[i].getInt () ) ; break ; + case PSL_FLOAT : printf ( "%f ", argv[i].getFloat () ) ; break ; + case PSL_STRING : printf ( "%s ", argv[i].getString () ) ; break ; + case PSL_VOID : printf ( "(void) " ) ; break ; + } + } + + pslValue ret ; + return ret ; +} + + pslValue my_siJoystickUD ( int, pslValue *, pslProgram * ) { pslValue ret ; @@ -142,6 +161,7 @@ { "siJoystickL" , 0, my_siJoystickL }, { "siJoystickR" , 0, my_siJoystickR }, { "fabs" , 1, my_fabs }, + { "print" ,-1, my_print }, { NULL, 0, NULL } } ; |
From: Steve B. <sj...@us...> - 2002-09-15 04:34:43
|
Update of /cvsroot/plib/plib/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv11840/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: Added PSL_DUMP and PSL_TRACE environment vars. Fixed evaluation of && and || so they don't compute their right-hand sides unless they have to. Index: psl.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/psl.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- psl.h 15 Sep 2002 01:34:24 -0000 1.17 +++ psl.h 15 Sep 2002 04:34:39 -0000 1.18 @@ -228,6 +228,8 @@ char *progName ; + int force_trace ; + public: pslProgram ( const pslExtension *ext, const char *_progName = NULL ) ; Index: pslCodeGen.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCodeGen.cxx,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- pslCodeGen.cxx 15 Sep 2002 00:02:51 -0000 1.24 +++ pslCodeGen.cxx 15 Sep 2002 04:34:39 -0000 1.25 @@ -302,6 +302,28 @@ void pslCompiler::pushStackDup () { pushCodeByte ( OPCODE_STACK_DUPLICATE ) ; } +int pslCompiler::pushPeekJumpIfTrue ( int l ) +{ + pushCodeByte ( OPCODE_PEEK_JUMP_TRUE ) ; + + int res = next_code ; + + pushCodeAddr ( l ) ; + + return res ; +} + +int pslCompiler::pushPeekJumpIfFalse ( int l ) +{ + pushCodeByte ( OPCODE_PEEK_JUMP_FALSE ) ; + + int res = next_code ; + + pushCodeAddr ( l ) ; + + return res ; +} + int pslCompiler::pushJumpIfTrue ( int l ) { pushCodeByte ( OPCODE_JUMP_TRUE ) ; Index: pslCompiler.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.cxx,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- pslCompiler.cxx 15 Sep 2002 00:02:51 -0000 1.22 +++ pslCompiler.cxx 15 Sep 2002 04:34:39 -0000 1.23 @@ -23,7 +23,7 @@ #include "pslLocal.h" - +#include "ul.h" int pslCompiler::compile ( const char *fname ) @@ -44,6 +44,8 @@ int pslCompiler::compile ( FILE *fd, const char *fname ) { + char *dump_env = getenv ( "PSL_DUMP" ) ; + init () ; _pslPushDefaultFile ( fd, (fname == NULL) ? progName : fname ) ; @@ -58,13 +60,21 @@ if ( num_errors != 0 ) { + if ( dump_env != NULL && + ulStrEqual ( dump_env, "on_error" ) ) + dump () ; + next_code = 0 ; pushCodeByte ( OPCODE_HALT ) ; } + else + if ( dump_env != NULL && + ulStrEqual ( dump_env, "always" ) ) + dump () ; return num_errors ; } - + int pslCompiler::pushReturnStatement () Index: pslCompiler.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslCompiler.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- pslCompiler.h 15 Sep 2002 01:34:24 -0000 1.25 +++ pslCompiler.h 15 Sep 2002 04:34:39 -0000 1.26 @@ -98,6 +98,8 @@ void pushGreaterEqual () ; void pushNotEqual () ; void pushEqual () ; + int pushPeekJumpIfFalse ( int l ) ; + int pushPeekJumpIfTrue ( int l ) ; int pushJumpIfFalse ( int l ) ; int pushJumpIfTrue ( int l ) ; int pushJump ( int l ) ; Index: pslContext.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- pslContext.cxx 14 Sep 2002 06:12:32 -0000 1.12 +++ pslContext.cxx 15 Sep 2002 04:34:39 -0000 1.13 @@ -1,5 +1,4 @@ -/* - PLIB - A Suite of Portable Game Libraries +/* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or @@ -442,6 +441,26 @@ case OPCODE_HALT : return PSL_PROGRAM_END ; /* Note: PC is *NOT* incremented. */ + + case OPCODE_PEEK_JUMP_TRUE : + if ( peekInt () ) + pc = code [ pc + 1 ] + ( code [ pc + 2 ] << 8 ) ; + else + { + sp-- ; + pc += 3 ; + } + return PSL_PROGRAM_CONTINUE ; + + case OPCODE_PEEK_JUMP_FALSE : + if ( peekInt () ) + { + sp-- ; + pc += 3 ; + } + else + pc = code [ pc + 1 ] + ( code [ pc + 2 ] << 8 ) ; + return PSL_PROGRAM_CONTINUE ; case OPCODE_JUMP_TRUE : if ( popInt () ) Index: pslContext.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslContext.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pslContext.h 15 Sep 2002 01:34:24 -0000 1.9 +++ pslContext.h 15 Sep 2002 04:34:39 -0000 1.10 @@ -62,6 +62,10 @@ void pushString ( const char *x ) { stack [ sp++ ] . set ( x ) ; } void pushNumber ( const pslNumber *x ) { stack [ sp++ ] . set ( x ) ; } + int peekInt () { return stack [ sp-1 ] . getInt () ; } + float peekFloat () { return stack [ sp-1 ] . getFloat () ; } + char *peekString () { return stack [ sp-1 ] . getString () ; } + void popVoid ( int n = 1 ) { sp -= n ; } int popInt () { return stack [ --sp ] . getInt () ; } float popFloat () { return stack [ --sp ] . getFloat () ; } Index: pslDump.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslDump.cxx,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- pslDump.cxx 14 Sep 2002 06:12:32 -0000 1.18 +++ pslDump.cxx 15 Sep 2002 04:34:39 -0000 1.19 @@ -65,6 +65,8 @@ { "CALLEXT", OPCODE_CALLEXT , 2 }, { "CALL", OPCODE_CALL , 3 }, { "RETURN", OPCODE_RETURN , 0 }, + { "PEEK_JUMP_FALSE", OPCODE_PEEK_JUMP_FALSE, 2 }, + { "PEEK_JUMP_TRUE", OPCODE_PEEK_JUMP_TRUE , 2 }, { "JUMP_FALSE", OPCODE_JUMP_FALSE , 2 }, { "JUMP_TRUE", OPCODE_JUMP_TRUE , 2 }, { "JUMP", OPCODE_JUMP , 2 }, @@ -262,6 +264,8 @@ code[addr+3] ) ; break ; + case OPCODE_PEEK_JUMP_FALSE : + case OPCODE_PEEK_JUMP_TRUE : case OPCODE_JUMP_FALSE : case OPCODE_JUMP_TRUE : fprintf ( fd, "\t\t%d", code[addr+1] + ( code[addr+2] << 8 ) ) ; Index: pslExpression.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslExpression.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pslExpression.cxx 15 Sep 2002 00:02:51 -0000 1.14 +++ pslExpression.cxx 15 Sep 2002 04:34:39 -0000 1.15 @@ -337,27 +337,29 @@ if ( ! pushRelExpression () ) return FALSE ; - while ( TRUE ) - { - char c [ MAX_TOKEN ] ; + char c [ MAX_TOKEN ] ; + int shortcut ; - getToken ( c ) ; + getToken ( c ) ; - if ( strcmp ( c, "&&" ) != 0 && - strcmp ( c, "||" ) != 0 ) - { - ungetToken ( c ) ; - return TRUE ; - } + if ( strcmp ( c, "&&" ) == 0 ) + shortcut = pushPeekJumpIfFalse ( 0 ) ; + else + if ( strcmp ( c, "||" ) == 0 ) + shortcut = pushPeekJumpIfTrue ( 0 ) ; + else + { + ungetToken ( c ) ; + return TRUE ; + } - if ( ! pushRelExpression () ) - return FALSE ; + if ( ! pushBoolExpression () ) + return error ( "Missing expression following '&&' or '||'" ) ; - if ( strcmp ( c, "&&" ) == 0 ) - pushAndAnd () ; - else - pushOrOr () ; - } + code [ shortcut ] = next_code & 0xFF ; + code [ shortcut+1 ] = ( next_code >> 8 ) & 0xFF ; + + return TRUE ; } Index: pslOpcodes.h =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslOpcodes.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pslOpcodes.h 14 Sep 2002 06:12:33 -0000 1.10 +++ pslOpcodes.h 15 Sep 2002 04:34:39 -0000 1.11 @@ -69,6 +69,8 @@ #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_POP_ADD_VARIABLE 0x30 #define OPCODE_POP_SUB_VARIABLE 0x31 Index: pslProgram.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/psl/pslProgram.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- pslProgram.cxx 15 Sep 2002 01:34:24 -0000 1.11 +++ pslProgram.cxx 15 Sep 2002 04:34:39 -0000 1.12 @@ -45,6 +45,11 @@ compiler-> init () ; context -> reset () ; + + char *force_trace_env = getenv ( "PSL_TRACE" ) ; + + force_trace = ( force_trace_env != NULL && + ulStrEqual ( force_trace_env, "always" ) ) ; } @@ -77,7 +82,9 @@ void pslProgram::dump () const { compiler-> dump () ; } void pslProgram::reset () { context -> reset () ; } -pslResult pslProgram::step () { return context -> step () ; } +pslResult pslProgram::step () { return force_trace ? + context -> trace () : + context -> step () ; } pslResult pslProgram::trace () { return context -> trace () ; } |
From: Sebastian U. <ud...@us...> - 2002-09-15 02:51:47
|
Update of /cvsroot/plib/plib/demos/simon/src In directory usw-pr-cvs1:/tmp/cvs-serv14443 Modified Files: simon.h Log Message: Mac OS-X compatibility Index: simon.h =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- simon.h 15 Sep 2002 02:33:33 -0000 1.4 +++ simon.h 15 Sep 2002 02:51:44 -0000 1.5 @@ -32,8 +32,18 @@ # include <unistd.h> #endif #include <math.h> + +#ifdef FREEGLUT_IS_PRESENT +# include <GL/freeglut.h> +#else +# ifdef __APPLE__ +# include <GLUT/glut.h> +# else +# include <GL/glut.h> +# endif +#endif + #include <plib/ssg.h> -#include <GL/glut.h> #define SI_MAX_MODELS 500 @@ -70,5 +80,4 @@ bool siJoystickD () ; bool siJoystickL () ; bool siJoystickR () ; - |
From: Sebastian U. <ud...@us...> - 2002-09-15 02:33:36
|
Update of /cvsroot/plib/plib/demos/simon/src In directory usw-pr-cvs1:/tmp/cvs-serv9024 Modified Files: simon.h simon_api.cxx simon.cxx Log Message: Added copyright notices and copying permission statement [2] Index: simon.h =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- simon.h 15 Sep 2002 01:59:23 -0000 1.3 +++ simon.h 15 Sep 2002 02:33:33 -0000 1.4 @@ -1,5 +1,5 @@ /* - PLIB - A Suite of Portable Game Libraries + S.I.M.O.N - Simple Interface for Making Oliver's programs Nice Copyright (C) 2002 Steve Baker This library is free software; you can redistribute it and/or modify Index: simon_api.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon_api.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- simon_api.cxx 15 Sep 2002 01:59:23 -0000 1.3 +++ simon_api.cxx 15 Sep 2002 02:33:33 -0000 1.4 @@ -1,5 +1,5 @@ /* - PLIB - A Suite of Portable Game Libraries + S.I.M.O.N - Simple Interface for Making Oliver's programs Nice Copyright (C) 2002 Steve Baker This library is free software; you can redistribute it and/or modify Index: simon.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- simon.cxx 15 Sep 2002 01:59:23 -0000 1.4 +++ simon.cxx 15 Sep 2002 02:33:33 -0000 1.5 @@ -1,5 +1,5 @@ /* - PLIB - A Suite of Portable Game Libraries + S.I.M.O.N - Simple Interface for Making Oliver's programs Nice Copyright (C) 2002 Steve Baker This program is free software; you can redistribute it and/or modify |