Go to the documentation of this file.
32 #if defined ( _MSC_VER ) && _MSC_VER <= 1500
36 typedef unsigned char uint8_t;
37 typedef unsigned short int uint16_t;
102 plexit(
"plbuf_init: Error allocating plot buffer." );
239 short xpl[2], ypl[2];
284 wr_data(
pls, xa,
sizeof (
short ) * (
size_t) npts );
285 wr_data(
pls, ya,
sizeof (
short ) * (
size_t) npts );
393 sizeof (
unsigned short )
444 if (
text->unicode_array_len )
454 len = strlen(
text->string ) + 1;
721 plabort(
"rdbuf_bop: Error reading first change state" );
730 plabort(
"rdbuf_bop: Error reading second change state" );
739 plabort(
"rdbuf_bop: Error reading third change state" );
748 plabort(
"rdbuf_bop: Error reading fourth change state" );
757 plabort(
"rdbuf_bop: Error reading fifth change state" );
766 plabort(
"rdbuf_bop: Error reading sixth change state" );
775 plabort(
"rdbuf_bop: Error reading seventh change state" );
926 "rdbuf_state: Invalid color map entry: %d",
960 PLINT patt, nps, inclin[2], delta[2];
963 rd_data(
pls, &inclin[0],
sizeof ( inclin ) );
978 size = (size_t) ncol *
sizeof (
PLColor );
992 plexit(
"Insufficient memory for colormap 0" );
1011 size = (size_t) ncol *
sizeof (
PLColor );
1025 plexit(
"Insufficient memory for colormap 1" );
1181 short *dev_ix, *dev_iy = NULL;
1182 unsigned short *dev_z = NULL, dev_zmin, dev_zmax;
1183 PLINT nptsX, nptsY, npts;
1184 PLFLT xmin, ymin, dx, dy;
1190 npts = nptsX * nptsY;
1204 if ( ( ( dev_ix = (
short *) malloc( (
size_t) npts *
sizeof (
short ) ) ) == NULL ) ||
1205 ( ( dev_iy = (
short *) malloc( (
size_t) npts *
sizeof (
short ) ) ) == NULL ) ||
1206 ( ( dev_z = (
unsigned short *) malloc( (
size_t) ( ( nptsX - 1 ) * ( nptsY - 1 ) ) *
sizeof (
unsigned short ) ) ) == NULL ) )
1207 plexit(
"rdbuf_image: Insufficient memory" );
1209 rd_data(
pls, dev_ix,
sizeof (
short ) * (
size_t) npts );
1210 rd_data(
pls, dev_iy,
sizeof (
short ) * (
size_t) npts );
1212 sizeof (
unsigned short )
1213 * (
size_t) ( ( nptsX - 1 ) * ( nptsY - 1 ) ) );
1266 PLFLT dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm;
1267 PLFLT dipxmin, dipymin, dipxmax, dipymax;
1268 PLFLT aspect, mar, jx, jy;
1270 rd_data(
pls, &dipxmin,
sizeof ( dipxmin ) );
1271 rd_data(
pls, &dipymin,
sizeof ( dipymin ) );
1272 rd_data(
pls, &dipxmax,
sizeof ( dipxmax ) );
1273 rd_data(
pls, &dipymax,
sizeof ( dipymax ) );
1279 rd_data(
pls, &dimxmin,
sizeof ( dimxmin ) );
1280 rd_data(
pls, &dimymin,
sizeof ( dimymin ) );
1281 rd_data(
pls, &dimxmax,
sizeof ( dimxmax ) );
1282 rd_data(
pls, &dimymax,
sizeof ( dimymax ) );
1283 rd_data(
pls, &dimxpmm,
sizeof ( dimxpmm ) );
1284 rd_data(
pls, &dimypmm,
sizeof ( dimypmm ) );
1286 c_plsdimap( dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm );
1290 c_plsdiplt( dipxmin, dipymin, dipxmax, dipymax );
1334 text.unicode_array_len = 0;
1335 text.unicode_array = NULL;
1347 if (
text.unicode_array_len )
1353 (
void **) ( &
text.unicode_array ),
1368 (
void **) ( &
text.string ),
1369 sizeof (
char ) * len );
1401 plsc->page_status =
AT_EOP;
1439 size_t finalReadPos;
1447 save_current_pls = plsc;
1473 plsc = save_current_pls;
1492 static U_CHAR esc_old = 0;
1556 pldebug(
"plbuf_control",
"Obsolete command %d, ignoring\n", c );
1560 pldebug(
"plbuf_control",
"Unrecognized command %d, previous %d\n",
1562 plexit(
"Unrecognized command" );
1585 count =
sizeof (
U_CHAR );
1638 size_t required_size;
1658 printf(
"Growing buffer to %d KB\n",
1664 plexit(
"plbuf buffer grow: Plot buffer grow failed" );
1700 pls->
plbuf_top += ( buf_size + ( buf_size %
sizeof ( uint16_t ) ) );
1750 save_size =
sizeof (
struct _state );
1756 if ( state != NULL )
1760 if ( plot_state->
size < save_size )
1763 if ( ( plot_state = (
struct _state *) realloc( state, save_size ) ) == NULL )
1769 plwarn(
"plbuf: Unable to reallocate sufficient memory to save state" );
1770 plot_state->
valid = 0;
1774 plot_state->
size = save_size;
1780 if ( ( plot_state = (
struct _state *) malloc( save_size ) ) == NULL )
1782 plwarn(
"plbuf: Unable to allocate sufficient memory to save state" );
1786 plot_state->
size = save_size;
1795 plot_state->
valid = 0;
1817 plwarn(
"plbuf: Got a NULL in memcpy!" );
1818 return (
void *) plot_state;
1824 plot_state->
valid = 1;
1825 return (
void *) plot_state;
1859 struct _state *prev_state;
1867 if ( state == NULL )
1870 if ( !new_state->
valid )
1872 plwarn(
"plbuf: Attempting to switch to an invalid saved state" );
1876 save_size =
sizeof (
struct _state );
1878 if ( ( prev_state = (
struct _state *) malloc( save_size ) ) == NULL )
1880 plwarn(
"plbuf: Unable to allocate memory to save state" );
1885 prev_state->
size = save_size;
1886 prev_state->
valid = 1;
1896 return (
void *) prev_state;
void c_plssub(PLINT nx, PLINT ny)
void c_plsdimap(PLINT dimxmin, PLINT dimxmax, PLINT dimymin, PLINT dimymax, PLFLT dimxpmm, PLFLT dimypmm)
void plbuf_tidy(PLStream *PL_UNUSED(pls))
void plP_esc(PLINT op, void *ptr)
static void plbuf_text(PLStream *pls, EscText *text)
void plabort(PLCHAR_VECTOR errormsg)
static void rdbuf_eop(PLStream *pls)
static void wr_data(PLStream *pls, void *buf, size_t buf_size)
void plwarn(PLCHAR_VECTOR errormsg)
static void rdbuf_state(PLStream *pls)
void plbuf_init(PLStream *pls)
static void rdbuf_clip(PLStream *pls)
void * plbuf_switch(PLStream *pls, void *state)
void c_plsdiori(PLFLT rot)
static void rdbuf_swin(PLStream *pls)
static void rdbuf_setsub(PLStream *pls)
void plP_swin(PLWindow *plwin)
void plbuf_restore(PLStream *pls, void *state)
void plP_line(short *x, short *y)
static void rdbuf_esc(PLStream *pls)
static void rdbuf_text_unicode(PLINT op, PLStream *pls)
void plbuf_bop(PLStream *pls)
void plexit(PLCHAR_VECTOR errormsg)
void plP_polyline(short *x, short *y, PLINT npts)
void plbuf_di(PLStream *pls)
static void plbuf_swin(PLStream *pls, PLWindow *plwin)
static PLStream * pls[PL_NSTREAMS]
static void rdbuf_fill(PLStream *pls)
static void rdbuf_ssub(PLStream *pls)
#define PLESC_FLUSH_REMAINING_BUFFER
static void plbuf_fill(PLStream *pls)
void c_plsdiplt(PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax)
static void rdbuf_polyline(PLStream *pls)
void xform(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data)
static void rd_data_no_copy(PLStream *pls, void **buf, size_t buf_size)
void plRemakePlot(PLStream *pls)
void plbuf_polyline(PLStream *pls, short *xa, short *ya, PLINT npts)
#define PLESC_APPEND_BUFFER
static void rdbuf_di(PLStream *pls)
void plbuf_write(PLStream *pls, void *data, size_t bytes)
static void check_buffer_size(PLStream *pls, size_t data_size)
void plbuf_esc(PLStream *pls, PLINT op, void *ptr)
#define PLESC_IMPORT_BUFFER
void * plbuf_save(PLStream *pls, void *state)
void plbuf_state(PLStream *pls, PLINT op)
static void rdbuf_line(PLStream *pls)
static void plbuf_image(PLStream *pls, IMG_DT *img_dt)
void plbuf_line(PLStream *pls, short x1a, short y1a, short x2a, short y2a)
#define PLESC_END_RASTERIZE
void plbuf_ssub(PLStream *pls)
void c_plsdidev(PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy)
void plFlushBuffer(PLStream *pls, PLBOOL restart, size_t amount)
void plbuf_setsub(PLStream *pls)
#define PLESC_START_RASTERIZE
static void wr_command(PLStream *pls, U_CHAR c)
void plP_fill(short *x, short *y, PLINT npts)
static int rd_command(PLStream *pls, U_CHAR *p_c)
static void rd_data(PLStream *pls, void *buf, size_t buf_size)
static void plbuf_control(PLStream *pls, U_CHAR c)
void plbuf_clip(PLStream *pls)
#define PLESC_CONTROL_CHAR
static void rdbuf_image(PLStream *pls)
void plbuf_eop(PLStream *pls)
void difilt(PLINT *xsc, PLINT *ysc, PLINT npts, PLINT *clpxmi, PLINT *clpxma, PLINT *clpymi, PLINT *clpyma)
static void rdbuf_init(PLStream *pls)
static void rdbuf_text(PLStream *pls)
static void plbuf_text_unicode(PLStream *pls, EscText *text)
void c_plpat(PLINT nlin, PLINT_VECTOR inc, PLINT_VECTOR del)
static void rdbuf_bop(PLStream *pls)