From: <hba...@us...> - 2010-09-04 12:56:30
|
Revision: 11159 http://plplot.svn.sourceforge.net/plplot/?rev=11159&view=rev Author: hbabcock Date: 2010-09-04 12:56:24 +0000 (Sat, 04 Sep 2010) Log Message: ----------- Add a stream_closed flag to plstrm. Once this is set the device driver dispatch functions become nops. It is initialized to FALSE when plinit is called. Modified Paths: -------------- trunk/include/plstrm.h trunk/src/plcore.c Modified: trunk/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2010-09-01 10:53:16 UTC (rev 11158) +++ trunk/include/plstrm.h 2010-09-04 12:56:24 UTC (rev 11159) @@ -87,6 +87,8 @@ * debug PLINT Generate debugging output * initialized PLINT Set if the stream has been initialized * dev_initialized PLINT Set if the device driver has been loaded + * stream_closed PLBOOL Set if the stream was closed or if there + * was some sort of error * *************************************************************************** * @@ -517,6 +519,7 @@ /* Misc control information */ PLINT ipls, level, verbose, debug, initialized, dev_initialized; + PLBOOL stream_closed; const char *program; /* Plot-wide coordinate transform */ Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-09-01 10:53:16 UTC (rev 11158) +++ trunk/src/plcore.c 2010-09-04 12:56:24 UTC (rev 11159) @@ -134,6 +134,7 @@ { char * save_locale; plsc->page_status = AT_EOP; + plsc->stream_closed = FALSE; save_locale = plsave_set_locale(); ( *plsc->dispatch_table->pl_init )( (struct PLStream_struct *) plsc ); @@ -168,7 +169,9 @@ if ( !skip_driver_eop ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_eop )( (struct PLStream_struct *) plsc ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_eop )( (struct PLStream_struct *) plsc ); + } plrestore_locale( save_locale ); } } @@ -198,7 +201,9 @@ if ( !skip_driver_bop ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_bop )( (struct PLStream_struct *) plsc ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_bop )( (struct PLStream_struct *) plsc ); + } plrestore_locale( save_locale ); } @@ -220,7 +225,9 @@ } save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_tidy )( (struct PLStream_struct *) plsc ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_tidy )( (struct PLStream_struct *) plsc ); + } plrestore_locale( save_locale ); if ( plsc->plbuf_write ) @@ -240,7 +247,9 @@ if ( plsc->plbuf_write ) plbuf_state( plsc, op ); save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_state )( (struct PLStream_struct *) plsc, op ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_state )( (struct PLStream_struct *) plsc, op ); + } plrestore_locale( save_locale ); } @@ -269,7 +278,9 @@ } save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, op, ptr ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, op, ptr ); + } plrestore_locale( save_locale ); } @@ -321,8 +332,10 @@ if ( plsc->dev_swin ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_SWIN, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_SWIN, NULL ); + } plrestore_locale( save_locale ); } } @@ -1213,8 +1226,10 @@ grline( short *x, short *y, PLINT npts ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_line )( (struct PLStream_struct *) plsc, - x[0], y[0], x[1], y[1] ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_line )( (struct PLStream_struct *) plsc, + x[0], y[0], x[1], y[1] ); + } plrestore_locale( save_locale ); } @@ -1222,8 +1237,10 @@ grpolyline( short *x, short *y, PLINT npts ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_polyline )( (struct PLStream_struct *) plsc, - x, y, npts ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_polyline )( (struct PLStream_struct *) plsc, + x, y, npts ); + } plrestore_locale( save_locale ); } @@ -1236,8 +1253,10 @@ plsc->dev_y = y; save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_FILL, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_FILL, NULL ); + } plrestore_locale( save_locale ); } @@ -1250,8 +1269,10 @@ plsc->dev_y = y; save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_GRADIENT, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_GRADIENT, NULL ); + } plrestore_locale( save_locale ); } @@ -1647,8 +1668,10 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_DI, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_DI, NULL ); + } plrestore_locale( save_locale ); } @@ -1733,8 +1756,10 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_DI, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_DI, NULL ); + } plrestore_locale( save_locale ); } @@ -1856,8 +1881,10 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_DI, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_DI, NULL ); + } plrestore_locale( save_locale ); } @@ -2040,8 +2067,10 @@ if ( plsc->dev_flush ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_FLUSH, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_FLUSH, NULL ); + } plrestore_locale( save_locale ); } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |