PLplot  5.15.0
plmetafile.c File Reference
#include "plplotP.h"
#include "metadefs.h"
#include <stddef.h>

Go to the source code of this file.

Classes

struct  _plm_format
 
struct  _plm_version
 

Macros

#define NEED_PLDEBUG
 
#define MAX_BUFFER   256
 
#define PLFLT2COORD(a)   ( (short) ceil( a ) )
 

Enumerations

enum  _plm_status {
  PLM_READ_ERROR = -7, PLM_UNKNOWN_DATATYPE = -6, PLM_INVALID_STATE = -5, PLM_INVALID_CMD = -4,
  PLM_FORMAT_ERROR = -3, PLM_UNKNOWN_VERSION = -2, PLM_NOT_PLMETA_FILE = -1, PLM_SUCCESS = 0
}
 
enum  _pdf_types {
  PDF_NULL = 0, PDF_UBYTE, PDF_USHORT, PDF_ULONG,
  PDF_IEEEF
}
 
enum  _plp_types {
  PLP_NULL = 0, PLP_UBYTE, PLP_UCHAR, PLP_USHORT,
  PLP_SHORT, PLP_PLINT, PLP_PLFLT, PLP_ULONG
}
 

Functions

static enum _plm_status set_ubyte_plp_value (uint8_t x, void *dest, enum _plp_types type)
 
static enum _plm_status set_ushort_plp_value (U_SHORT x, void *dest, enum _plp_types type)
 
static enum _plm_status set_ulong_plp_value (unsigned long x, void *dest, enum _plp_types type)
 
static enum _plm_status set_ieeef_plp_value (float x, void *dest, enum _plp_types type)
 
static enum _plm_status read_entry (PDFstrm *plm, enum _pdf_types from_type, enum _plp_types to_type, void *dest)
 
static enum _plm_status read_string (PDFstrm *plm, size_t bytes, char *dest)
 
static enum _plm_status read_metafile_header (PDFstrm *plm, PLmDev *dev)
 
static void check_buffer_size (PLmDev *dev, size_t need_size)
 
static enum _plm_status read_header (PDFstrm *plm, const struct _plm_format *header, uint8_t *dest)
 
static enum _plm_status read_line (PDFstrm *plm, PLmDev *dev, PLStream *pls)
 
static enum _plm_status read_lineto (PDFstrm *plm, PLmDev *dev, PLStream *pls)
 
static enum _plm_status read_polyline (PDFstrm *plm, PLmDev *dev, PLStream *pls)
 
static enum _plm_status read_escape (PDFstrm *plm, PLmDev *dev, PLStream *pls)
 
static enum _plm_status read_state (PDFstrm *plm, PLmDev *dev, PLStream *pls)
 
static enum _plm_status read_plot_commands (PDFstrm *plm, PLmDev *dev, PLStream *pls)
 
static void setup_page (PLmDev *mf_dev, PLStream *pls)
 
void plreadmetafile (char *infile)
 

Variables

static const struct _plm_format index_2005_header []
 
static const struct _plm_format dev_2005_header []
 
static const struct _plm_format plot_2005_header []
 
static const struct _plm_format page_2005_header []
 
static struct _plm_version metafile_format []
 

Macro Definition Documentation

◆ MAX_BUFFER

#define MAX_BUFFER   256

Definition at line 33 of file plmetafile.c.

◆ NEED_PLDEBUG

#define NEED_PLDEBUG

Definition at line 28 of file plmetafile.c.

◆ PLFLT2COORD

#define PLFLT2COORD (   a)    ( (short) ceil( a ) )

Definition at line 45 of file plmetafile.c.

Enumeration Type Documentation

◆ _pdf_types

enum _pdf_types
Enumerator
PDF_NULL 
PDF_UBYTE 
PDF_USHORT 
PDF_ULONG 
PDF_IEEEF 

Definition at line 61 of file plmetafile.c.

◆ _plm_status

Enumerator
PLM_READ_ERROR 
PLM_UNKNOWN_DATATYPE 
PLM_INVALID_STATE 
PLM_INVALID_CMD 
PLM_FORMAT_ERROR 
PLM_UNKNOWN_VERSION 
PLM_NOT_PLMETA_FILE 
PLM_SUCCESS 

Definition at line 48 of file plmetafile.c.

◆ _plp_types

enum _plp_types
Enumerator
PLP_NULL 
PLP_UBYTE 
PLP_UCHAR 
PLP_USHORT 
PLP_SHORT 
PLP_PLINT 
PLP_PLFLT 
PLP_ULONG 

Definition at line 71 of file plmetafile.c.

Function Documentation

◆ check_buffer_size()

static void check_buffer_size ( PLmDev dev,
size_t  need_size 
)
static

Definition at line 408 of file plmetafile.c.

◆ plreadmetafile()

void plreadmetafile ( char *  infile)

Reads a PLplot metafile and uses the current plot stream to display the contents. If the plot stream has not been initialized, this routine will attempt to intialize the plot stream via a plinit() call. For an initialized plot stream, the metafile will start at the current page/subpage.

Parameters
infileInput PLplot metafile name.

Pass NULL for infile to use the filename passed from the command line option -mfi.

Returns void

Definition at line 1122 of file plmetafile.c.

◆ read_entry()

static enum _plm_status read_entry ( PDFstrm plm,
enum _pdf_types  from_type,
enum _plp_types  to_type,
void *  dest 
)
static

Definition at line 303 of file plmetafile.c.

◆ read_escape()

static enum _plm_status read_escape ( PDFstrm plm,
PLmDev dev,
PLStream pls 
)
static

Definition at line 616 of file plmetafile.c.

◆ read_header()

static enum _plm_status read_header ( PDFstrm plm,
const struct _plm_format header,
uint8_t *  dest 
)
static

Definition at line 436 of file plmetafile.c.

◆ read_line()

static enum _plm_status read_line ( PDFstrm plm,
PLmDev dev,
PLStream pls 
)
static

Definition at line 473 of file plmetafile.c.

◆ read_lineto()

static enum _plm_status read_lineto ( PDFstrm plm,
PLmDev dev,
PLStream pls 
)
static

Definition at line 517 of file plmetafile.c.

◆ read_metafile_header()

static enum _plm_status read_metafile_header ( PDFstrm plm,
PLmDev dev 
)
static

Definition at line 376 of file plmetafile.c.

◆ read_plot_commands()

static enum _plm_status read_plot_commands ( PDFstrm plm,
PLmDev dev,
PLStream pls 
)
static

Definition at line 975 of file plmetafile.c.

◆ read_polyline()

static enum _plm_status read_polyline ( PDFstrm plm,
PLmDev dev,
PLStream pls 
)
static

Definition at line 557 of file plmetafile.c.

◆ read_state()

static enum _plm_status read_state ( PDFstrm plm,
PLmDev dev,
PLStream pls 
)
static

Definition at line 781 of file plmetafile.c.

◆ read_string()

static enum _plm_status read_string ( PDFstrm plm,
size_t  bytes,
char *  dest 
)
static

Definition at line 355 of file plmetafile.c.

◆ set_ieeef_plp_value()

static enum _plm_status set_ieeef_plp_value ( float  x,
void *  dest,
enum _plp_types  type 
)
static

Definition at line 263 of file plmetafile.c.

◆ set_ubyte_plp_value()

static enum _plm_status set_ubyte_plp_value ( uint8_t  x,
void *  dest,
enum _plp_types  type 
)
static

Definition at line 143 of file plmetafile.c.

◆ set_ulong_plp_value()

static enum _plm_status set_ulong_plp_value ( unsigned long  x,
void *  dest,
enum _plp_types  type 
)
static

Definition at line 223 of file plmetafile.c.

◆ set_ushort_plp_value()

static enum _plm_status set_ushort_plp_value ( U_SHORT  x,
void *  dest,
enum _plp_types  type 
)
static

Definition at line 183 of file plmetafile.c.

◆ setup_page()

static void setup_page ( PLmDev mf_dev,
PLStream pls 
)
static

Definition at line 1094 of file plmetafile.c.

Variable Documentation

◆ dev_2005_header

const struct _plm_format dev_2005_header[]
static
Initial value:
= {
{ "xmin", PDF_USHORT, PLP_PLINT, offsetof( PLmDev, xmin ) },
{ "xmax", PDF_USHORT, PLP_PLINT, offsetof( PLmDev, xmax ) },
{ "ymin", PDF_USHORT, PLP_PLINT, offsetof( PLmDev, ymin ) },
{ "ymax", PDF_USHORT, PLP_PLINT, offsetof( PLmDev, ymax ) },
{ "pxlx", PDF_IEEEF, PLP_PLFLT, offsetof( PLmDev, pxlx ) },
{ "pxly", PDF_IEEEF, PLP_PLFLT, offsetof( PLmDev, pxly ) },
{ NULL, PDF_NULL, PLP_NULL, 0 }
}

Definition at line 100 of file plmetafile.c.

◆ index_2005_header

const struct _plm_format index_2005_header[]
static
Initial value:
= {
{ "pages", PDF_USHORT, PLP_USHORT, offsetof( PLmIndex, pages ) },
{ NULL, PDF_NULL, PLP_NULL, 0 }
}

Definition at line 93 of file plmetafile.c.

◆ metafile_format

struct _plm_version metafile_format[]
static
Initial value:
= {
}
static const struct _plm_format dev_2005_header[]
Definition: plmetafile.c:100
#define PLMETA_VERSION
Definition: metadefs.h:17
static const struct _plm_format index_2005_header[]
Definition: plmetafile.c:93
static const struct _plm_format plot_2005_header[]
Definition: plmetafile.c:112

◆ page_2005_header

const struct _plm_format page_2005_header[]
static
Initial value:
= {
{ "", PDF_USHORT, PLP_PLINT, offsetof( PLmDev, page ) },
{ "", PDF_ULONG, PLP_PLINT, offsetof( PLmDev, lp_offset ) },
{ "", PDF_ULONG, PLP_NULL, 0 }
}

Definition at line 125 of file plmetafile.c.

◆ plot_2005_header

const struct _plm_format plot_2005_header[]
static
Initial value:
= {
{ "xdpi", PDF_IEEEF, PLP_PLFLT, offsetof( PLStream, xdpi ) },
{ "ydpi", PDF_IEEEF, PLP_PLFLT, offsetof( PLStream, ydpi ) },
{ "xlength", PDF_USHORT, PLP_PLINT, offsetof( PLStream, xlength ) },
{ "ylength", PDF_USHORT, PLP_PLINT, offsetof( PLStream, ylength ) },
{ "xoffset", PDF_USHORT, PLP_PLINT, offsetof( PLStream, xoffset ) },
{ "yoffset", PDF_USHORT, PLP_PLINT, offsetof( PLStream, yoffset ) },
{ "", PDF_NULL, PLP_NULL, 0 },
{ NULL, 0, 0 }
}

Definition at line 112 of file plmetafile.c.