36 PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_plmeta =
"plmeta:PLplot Native Meta-File:0:plmeta:26:plm\n";
42 void plD_line_plm(
PLStream *,
short,
short,
short,
short );
54 #define BUFFER_LEN 256
58 static void WriteFileHeader(
PLStream *pls );
59 static void UpdatePrevPagehdr(
PLStream *pls );
62 static void plm_fill(
PLStream *pls );
63 static void plm_swin(
PLStream *pls );
69 #define DEBUG_PRINT_LOCATION( a ) PrintLocation( pls, a )
71 static void PrintLocation(
PLStream *pls,
char *tag )
80 plexit(
"PrintLocation (plmeta.c): fgetpos call failed" );
82 pldebug( tag,
"at offset %d in file %s\n",
83 (
int) current_offset, pls->
FileName );
87 #define DEBUG_PRINT_LOCATION( a )
92 #ifndef ENABLE_DYNDRIVERS
155 pls->
dev = calloc( 1, (
size_t)
sizeof (
PLmDev ) );
156 if ( pls->
dev == NULL )
157 plexit(
"plD_init_plm: Out of memory." );
177 WriteFileHeader( pls );
186 DEBUG_PRINT_LOCATION(
"before init" );
197 plD_line_plm(
PLStream *pls,
short x1,
short y1,
short x2,
short y2 )
207 if ( x1 < dev->
xmin || x1 > dev->
xmax ||
212 pldebug(
"plD_line_plm",
213 "coordinates out of bounds -- \nActual: (%i,%i), (%i,%i) Bounds: (%i,%i,%i,%i)\n",
228 if ( x1 == dev->
xold && y1 == dev->
yold )
257 plD_polyline_plm(
PLStream *pls,
short *xa,
short *ya,
PLINT npts )
270 dev->
xold = xa[npts - 1];
271 dev->
yold = ya[npts - 1];
317 UpdatePrevPagehdr( pls );
330 WritePageInfo( pls, pp_offset );
392 for ( i = 0; i < pls->
ncol0; i++ )
402 for ( i = 0; i < pls->
ncol1; i++ )
463 plm_text( pls, (
EscText *) ptr );
473 plwarn(
"plmeta: Alternate Unicode text handling is not implemented" );
545 if ( args->
xform != NULL )
554 plwarn(
"plmeta: transformation matrix undefined, using a guess" );
572 len = strlen( args->
string );
592 handle_fsetpos_failed(
const char *where,
const char *which,
FPOS_T position )
598 "%s: fsetpos to %s (%lu) failed",
601 (
unsigned long) position );
619 dbug_enter(
"WriteFileHeader(PLStream *pls" );
632 plexit(
"WriteFileHeader: fgetpos call failed" );
705 plexit(
"WritePageInfo (plmeta.c): fgetpos call failed" );
707 UpdateIndex( pls, cp_offset );
752 plexit(
"plD_bop_plm: fgetpos call failed" );
760 pldebug(
"UpdatePrevPagehdr 1 (plmeta.c)",
761 "Location: %d, seeking to: %d\n",
768 handle_fsetpos_failed(
"UpdatePrevPagehdr",
769 "fwbyte_offset", fwbyte_offset );
776 plexit(
"UpdatePrevPagehdr (plmeta.c): fgetpos call failed" );
778 pldebug(
"UpdatePrevPagehdr 2 (plmeta.c)",
779 "Now at: %d, to write: %d\n",
780 (
int) fwbyte_offset, (
int) cp_offset );
793 handle_fsetpos_failed(
"UpdatePrevPagehdr",
794 "fwbyte_offset", fwbyte_offset );
799 pldebug(
"UpdatePrevPagehdr 3 (plmeta.c)",
800 "Value read as: %d\n", read_offset );
808 handle_fsetpos_failed(
"UpdatePrevPagehdr",
809 "cp_offset", cp_offset );
831 pldebug(
"UpdateIndex (plmeta.c)",
832 "Location: %d, seeking to: %d\n",
837 handle_fsetpos_failed(
"UpdateIndex",
843 pldebug(
"UpdateIndex (plmeta.c)",
844 "Location: %d, seeking to: %d\n",
849 handle_fsetpos_failed(
"UpdateIndex",
850 "cp_offset", cp_offset );