91 plexit(
"plbuf_init: Error allocating plot buffer." );
184 short xpl[2], ypl[2];
195 wr_data( pls, xpl,
sizeof (
short ) * 2 );
196 wr_data( pls, ypl,
sizeof (
short ) * 2 );
214 wr_data( pls, xa,
sizeof (
short ) * (
size_t) npts );
215 wr_data( pls, ya,
sizeof (
short ) * (
size_t) npts );
314 wr_data( pls, pls->
dev_ix, sizeof (
short ) * (
size_t) npts );
315 wr_data( pls, pls->
dev_iy, sizeof (
short ) * (
size_t) npts );
317 sizeof (
unsigned short )
350 wr_data( pls, &text->
x, sizeof ( text->
x ) );
351 wr_data( pls, &text->
y, sizeof ( text->
y ) );
365 wr_data( pls, &fci,
sizeof ( fci ) );
377 len = strlen( text->
string );
378 wr_data( pls, &len,
sizeof ( len ) );
380 wr_data( pls, (
void *) text->
string, sizeof (
char ) * len );
464 plexit(
"plbuf_esc: Failed to reallocate buffer during PLESC_SET_BUFFER case" );
656 rd_data_no_copy( pls, (
void **) &xpl,
sizeof (
short ) * (
size_t) npts );
657 rd_data_no_copy( pls, (
void **) &ypl,
sizeof (
short ) * (
size_t) npts );
680 rd_data_no_copy( pls, (
void **) &xpl,
sizeof (
short ) * (
size_t) npts );
681 rd_data_no_copy( pls, (
void **) &ypl,
sizeof (
short ) * (
size_t) npts );
728 "rdbuf_state: Invalid color map entry: %d",
762 PLINT patt, nps, inclin[2], delta[2];
763 rd_data( pls, &patt,
sizeof ( patt ) );
764 rd_data( pls, &nps,
sizeof ( nps ) );
765 rd_data( pls, &inclin[0],
sizeof ( inclin ) );
766 rd_data( pls, &delta[0],
sizeof ( delta ) );
777 rd_data( pls, &ncol,
sizeof ( ncol ) );
780 size = (size_t) ncol *
sizeof (
PLColor );
789 if ( pls->
cmap0 != NULL )
792 if ( ( pls->
cmap0 = (
PLColor *) malloc( size ) ) == NULL )
794 plexit(
"Insufficient memory for colormap 0" );
810 rd_data( pls, &ncol,
sizeof ( ncol ) );
813 size = (size_t) ncol *
sizeof (
PLColor );
822 if ( pls->
cmap1 != NULL )
825 if ( ( pls->
cmap1 = (
PLColor *) malloc( size ) ) == NULL )
827 plexit(
"Insufficient memory for colormap 1" );
942 rd_data_no_copy( pls, (
void **) &xpl,
sizeof (
short ) * (
size_t) npts );
943 rd_data_no_copy( pls, (
void **) &ypl,
sizeof (
short ) * (
size_t) npts );
963 short *dev_ix, *dev_iy = NULL;
964 unsigned short *dev_z = NULL, dev_zmin, dev_zmax;
965 PLINT nptsX, nptsY, npts;
972 npts = nptsX * nptsY;
979 rd_data( pls, &dev_zmin,
sizeof (
short ) );
980 rd_data( pls, &dev_zmax,
sizeof (
short ) );
986 if ( ( ( dev_ix = (
short *) malloc( (
size_t) npts *
sizeof (
short ) ) ) == NULL ) ||
987 ( ( dev_iy = (
short *) malloc( (
size_t) npts *
sizeof (
short ) ) ) == NULL ) ||
988 ( ( dev_z = (
unsigned short *) malloc( (
size_t) ( ( nptsX - 1 ) * ( nptsY - 1 ) ) *
sizeof (
unsigned short ) ) ) == NULL ) )
989 plexit(
"rdbuf_image: Insufficient memory" );
991 rd_data( pls, dev_ix,
sizeof (
short ) * (
size_t) npts );
992 rd_data( pls, dev_iy,
sizeof (
short ) * (
size_t) npts );
994 sizeof (
unsigned short )
995 * (
size_t) ( ( nptsX - 1 ) * ( nptsY - 1 ) ) );
1048 PLFLT dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm;
1049 PLFLT dipxmin, dipymin, dipxmax, dipymax;
1050 PLFLT aspect, mar, jx, jy;
1051 rd_data( pls, &difilt,
sizeof ( difilt ) );
1052 rd_data( pls, &dipxmin,
sizeof ( dipxmin ) );
1053 rd_data( pls, &dipymin,
sizeof ( dipymin ) );
1054 rd_data( pls, &dipxmax,
sizeof ( dipxmax ) );
1055 rd_data( pls, &dipymax,
sizeof ( dipymax ) );
1056 rd_data( pls, &aspect,
sizeof ( aspect ) );
1057 rd_data( pls, &mar,
sizeof ( mar ) );
1058 rd_data( pls, &jx,
sizeof ( jx ) );
1059 rd_data( pls, &jy,
sizeof ( jy ) );
1060 rd_data( pls, &rot,
sizeof ( rot ) );
1061 rd_data( pls, &dimxmin,
sizeof ( dimxmin ) );
1062 rd_data( pls, &dimymin,
sizeof ( dimymin ) );
1063 rd_data( pls, &dimxmax,
sizeof ( dimxmax ) );
1064 rd_data( pls, &dimymax,
sizeof ( dimymax ) );
1065 rd_data( pls, &dimxpmm,
sizeof ( dimxpmm ) );
1066 rd_data( pls, &dimypmm,
sizeof ( dimypmm ) );
1068 c_plsdimap( dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm );
1072 c_plsdiplt( dipxmin, dipymin, dipxmax, dipymax );
1107 rd_data( pls, &text.
x, sizeof ( text.
x ) );
1108 rd_data( pls, &text.
y, sizeof ( text.
y ) );
1118 rd_data( pls, &fci,
sizeof ( fci ) );
1140 rd_data( pls, &len,
sizeof ( len ) );
1147 (
void **) ( &text.
string ),
1148 sizeof (
char ) * len );
1212 save_current_pls = plsc;
1232 plsc = save_current_pls;
1301 pldebug(
"plbuf_control",
"Obsolete command %d, ignoring\n", c );
1305 pldebug(
"plbuf_control",
"Unrecognized command %d, previous %d\n",
1307 plexit(
"Unrecognized command" );
1330 count =
sizeof (
U_CHAR );
1352 pls->
plbuf_readpos += ( buf_size + ( buf_size %
sizeof ( uint16_t ) ) );
1371 pls->
plbuf_readpos += ( buf_size + ( buf_size % sizeof ( uint16_t ) ) );
1383 size_t required_size;
1385 required_size = pls->
plbuf_top + data_size;
1403 printf(
"Growing buffer to %d KB\n",
1409 plexit(
"plbuf buffer grow: Plot buffer grow failed" );
1445 pls->
plbuf_top += ( buf_size + ( buf_size %
sizeof ( uint16_t ) ) );
1496 save_size =
sizeof (
struct _state );
1502 if ( state != NULL )
1506 if ( plot_state->
size < save_size )
1509 if ( ( plot_state = (
struct _state *) realloc( state, save_size ) ) == NULL )
1515 plwarn(
"plbuf: Unable to reallocate sufficient memory to save state" );
1516 plot_state->
valid = 0;
1520 plot_state->
size = save_size;
1526 if ( ( plot_state = (
struct _state *) malloc( save_size ) ) == NULL )
1528 plwarn(
"plbuf: Unable to allocate sufficient memory to save state" );
1532 plot_state->
size = save_size;
1541 plot_state->
valid = 0;
1544 buf = (
U_CHAR *) ( plot_state + 1 );
1563 plwarn(
"plbuf: Got a NULL in memcpy!" );
1564 return (
void *) plot_state;
1570 plot_state->
valid = 1;
1571 return (
void *) plot_state;
1605 struct _state *prev_state;
1613 if ( state == NULL )
1616 if ( !new_state->
valid )
1618 plwarn(
"plbuf: Attempting to switch to an invalid saved state" );
1622 save_size =
sizeof (
struct _state );
1624 if ( ( prev_state = (
struct _state *) malloc( save_size ) ) == NULL )
1626 plwarn(
"plbuf: Unable to allocate memory to save state" );
1631 prev_state->
size = save_size;
1632 prev_state->
valid = 1;
1642 return (
void *) prev_state;