PLplot  5.15.0
pdf.h File Reference
#include "pldll.h"

Go to the source code of this file.

Classes

struct  PDFstrm
 
struct  PLiodev
 

Macros

#define U_CHAR   unsigned char
 
#define U_SHORT   unsigned short
 
#define U_INT   unsigned int
 
#define U_LONG   unsigned long
 
#define PDF_ERROR   1
 
#define PDF_FNOPEN   2
 
#define PDF_FAOPEN   3
 
#define PDF_BADUN   4
 
#define PDF_BADNBITS   5
 
#define PDF_RDERR   6
 
#define PDF_WRERR   7
 
#define PDF_NOTPDF   8
 

Functions

void pdf_set (char *option, int value)
 
PLDLLIMPEXP PDFstrmpdf_fopen (const char *fileName, const char *mode)
 
PLDLLIMPEXP PDFstrmpdf_bopen (U_CHAR *buffer, size_t bufmax)
 
PLDLLIMPEXP PDFstrmpdf_finit (FILE *file)
 
PDFstrmplLibOpenPdfstrm (const char *fn)
 
PLDLLIMPEXP int pdf_close (PDFstrm *pdfs)
 
int pdf_putc (int c, PDFstrm *pdfs)
 
PLDLLIMPEXP int pdf_getc (PDFstrm *pdfs)
 
PLDLLIMPEXP int pdf_ungetc (int c, PDFstrm *pdfs)
 
int pdf_rdx (U_CHAR *x, long nitems, PDFstrm *pdfs)
 
PLDLLIMPEXP int pdf_rd_header (PDFstrm *pdfs, char *header)
 
PLDLLIMPEXP int pdf_wr_header (PDFstrm *pdfs, const char *header)
 
int pdf_wr_string (PDFstrm *pdfs, const char *string)
 
int pdf_rd_string (PDFstrm *pdfs, char *string, int nmax)
 
PLDLLIMPEXP int pdf_wr_1byte (PDFstrm *pdfs, U_CHAR s)
 
PLDLLIMPEXP int pdf_rd_1byte (PDFstrm *pdfs, U_CHAR *ps)
 
PLDLLIMPEXP int pdf_wr_2bytes (PDFstrm *pdfs, U_SHORT s)
 
PLDLLIMPEXP int pdf_rd_2bytes (PDFstrm *pdfs, U_SHORT *ps)
 
PLDLLIMPEXP int pdf_wr_2nbytes (PDFstrm *pdfs, U_SHORT *s, PLINT n)
 
PLDLLIMPEXP int pdf_rd_2nbytes (PDFstrm *pdfs, U_SHORT *s, PLINT n)
 
PLDLLIMPEXP int pdf_wr_4bytes (PDFstrm *pdfs, U_LONG s)
 
PLDLLIMPEXP int pdf_rd_4bytes (PDFstrm *pdfs, U_LONG *ps)
 
PLDLLIMPEXP int pdf_wr_ieeef (PDFstrm *pdfs, float f)
 
PLDLLIMPEXP int pdf_rd_ieeef (PDFstrm *pdfs, float *pf)
 

Macro Definition Documentation

◆ PDF_BADNBITS

#define PDF_BADNBITS   5

Definition at line 77 of file pdf.h.

◆ PDF_BADUN

#define PDF_BADUN   4

Definition at line 76 of file pdf.h.

◆ PDF_ERROR

#define PDF_ERROR   1

Definition at line 73 of file pdf.h.

◆ PDF_FAOPEN

#define PDF_FAOPEN   3

Definition at line 75 of file pdf.h.

◆ PDF_FNOPEN

#define PDF_FNOPEN   2

Definition at line 74 of file pdf.h.

◆ PDF_NOTPDF

#define PDF_NOTPDF   8

Definition at line 80 of file pdf.h.

◆ PDF_RDERR

#define PDF_RDERR   6

Definition at line 78 of file pdf.h.

◆ PDF_WRERR

#define PDF_WRERR   7

Definition at line 79 of file pdf.h.

◆ U_CHAR

#define U_CHAR   unsigned char

Definition at line 26 of file pdf.h.

◆ U_INT

#define U_INT   unsigned int

Definition at line 34 of file pdf.h.

◆ U_LONG

#define U_LONG   unsigned long

Definition at line 38 of file pdf.h.

◆ U_SHORT

#define U_SHORT   unsigned short

Definition at line 30 of file pdf.h.

Function Documentation

◆ pdf_bopen()

PLDLLIMPEXP PDFstrm* pdf_bopen ( U_CHAR buffer,
size_t  bufmax 
)

Initializes a PDFstrm for reading/writing to a memory buffer. If buffer is NULL, a standard buffer is allocated.

Parameters
bufferUser allocated memory, can be NULL.
bufmaxSize of buffer, or the desired buffer.
Returns
A PDFstrm structure.

Definition at line 152 of file pdfutils.c.

◆ pdf_close()

PLDLLIMPEXP int pdf_close ( PDFstrm pdfs)

Closes a PDFstrm. Used exactly like fclose().

Parameters
pdfsThe file stream to close.
Returns
0

Definition at line 238 of file pdfutils.c.

◆ pdf_finit()

PLDLLIMPEXP PDFstrm* pdf_finit ( FILE *  file)

Initializes a PDFstrm for a file oriented device. Like pdf_fopen() but an existing file handle is specified.

Parameters
fileA open file handle.
Returns
A PDFstrm structure.

Definition at line 204 of file pdfutils.c.

◆ pdf_fopen()

PLDLLIMPEXP PDFstrm* pdf_fopen ( PLCHAR_VECTOR  filename,
PLCHAR_VECTOR  mode 
)

Initializes a PDFstrm for a file oriented device. Used exactly like fopen().

Parameters
filenameThe filename of the file to open.
modeFile access mode, as would be used by fopen.

Definition at line 74 of file pdfutils.c.

◆ pdf_getc()

PLDLLIMPEXP int pdf_getc ( PDFstrm pdfs)

Reads a single character.

Parameters
pdfsThe stream to read the character from.
Returns
The character read or EOF.

Definition at line 325 of file pdfutils.c.

◆ pdf_putc()

int pdf_putc ( int  c,
PDFstrm pdfs 
)

Writes a single character.

Parameters
cThe character to write.
pdfsThe stream to write it to.
Returns
The character written or EOF.

Definition at line 276 of file pdfutils.c.

◆ pdf_rd_1byte()

PLDLLIMPEXP int pdf_rd_1byte ( PDFstrm pdfs,
U_CHAR ps 
)

Reads a single byte, storing into a U_CHAR.

Parameters
pdfsThe stream to read the byte from.
psStorage for the byte.
Returns
0 if successful.

Definition at line 660 of file pdfutils.c.

◆ pdf_rd_2bytes()

PLDLLIMPEXP int pdf_rd_2bytes ( PDFstrm pdfs,
U_SHORT ps 
)

Reads a U_SHORT from two single bytes, low end first.

Parameters
pdfsThe stream to read the two bytes from.
psPre-allocated storage for the two bytes.
Returns
0 if successful.

Definition at line 710 of file pdfutils.c.

◆ pdf_rd_2nbytes()

PLDLLIMPEXP int pdf_rd_2nbytes ( PDFstrm pdfs,
U_SHORT s,
PLINT  n 
)

Reads n U_SHORT's from 2n single bytes, low end first.

Parameters
pdfsThe stream to read the shorts from.
sPre-allocated storage for the shorts.
nSize of s.
Returns
0 if successful.

Definition at line 771 of file pdfutils.c.

◆ pdf_rd_4bytes()

PLDLLIMPEXP int pdf_rd_4bytes ( PDFstrm pdfs,
U_LONG ps 
)

Reads an unsigned long from 4 single bytes, low end first.

Parameters
pdfsThe stream to read the unsigned long from.
psPre-allocated storage for the unsigned long.
Returns
0 is successful.

Definition at line 832 of file pdfutils.c.

◆ pdf_rd_header()

PLDLLIMPEXP int pdf_rd_header ( PDFstrm pdfs,
char *  header 
)

Reads a newline-terminated header string from PDFstrm *pdfs, and converts to a usual NULL-terminated string. 80 chars maximum assumed.

Parameters
pdfsThe stream to read the header from.
headerPre-allocated storage for the header.
Returns
0 if successful.

Definition at line 542 of file pdfutils.c.

◆ pdf_rd_ieeef()

PLDLLIMPEXP int pdf_rd_ieeef ( PDFstrm pdfs,
float *  pf 
)

Reads a float from a IEEE single precision (32 bit) format.

Parameters
pdfsThe stream to read the float from.
pfPre-allocated storage for the float.
Returns
0 if successful.

Definition at line 992 of file pdfutils.c.

◆ pdf_rd_string()

int pdf_rd_string ( PDFstrm pdfs,
char *  string,
int  nmax 
)

Reads a null-terminated string from PDFstrm *pdfs. A max of nmax chars are read.

Parameters
pdfsThe stream to read the string from.
stringPre-allocated storage for the string.
nmaxThe size of string.
Returns
0 if successful.

Definition at line 604 of file pdfutils.c.

◆ pdf_rdx()

int pdf_rdx ( U_CHAR x,
long  nitems,
PDFstrm pdfs 
)

Reads a record.

Parameters
xStorage for the data to read.
nitemsThe length of the x.
pdfsThe stream to read it from.
Returns
The number of bytes read.

Definition at line 464 of file pdfutils.c.

◆ pdf_set()

void pdf_set ( char *  option,
int  value 
)

Set an option. Pretty sparse right now but you never know.

Parameters
optionThe option string.
valueThe value to set it to.

Definition at line 56 of file pdfutils.c.

◆ pdf_ungetc()

PLDLLIMPEXP int pdf_ungetc ( int  c,
PDFstrm pdfs 
)

Push back the last command read.

Parameters
cThe character to pushback.
pdfsThe stream to push it back into.
Returns
The character pushed back, or EOF.

Definition at line 365 of file pdfutils.c.

◆ pdf_wr_1byte()

PLDLLIMPEXP int pdf_wr_1byte ( PDFstrm pdfs,
U_CHAR  s 
)

Writes a U_CHAR as a single byte.

Parameters
pdfsThe stream to write the byte too.
sThe byte to write.
Returns
0 if successful.

Definition at line 636 of file pdfutils.c.

◆ pdf_wr_2bytes()

PLDLLIMPEXP int pdf_wr_2bytes ( PDFstrm pdfs,
U_SHORT  s 
)

Writes a U_SHORT as two single bytes, low end first.

Parameters
pdfsThe stream to write the two bytes to.
sThe two bytes to write.
Returns
0 if successful.

Definition at line 684 of file pdfutils.c.

◆ pdf_wr_2nbytes()

PLDLLIMPEXP int pdf_wr_2nbytes ( PDFstrm pdfs,
U_SHORT s,
PLINT  n 
)

Writes n U_SHORT's as 2n single bytes, low end first.

Parameters
pdfsThe stream to write the shorts to.
sAn array of shorts.
nSize of s.
Returns
0 if successful.

Definition at line 741 of file pdfutils.c.

◆ pdf_wr_4bytes()

PLDLLIMPEXP int pdf_wr_4bytes ( PDFstrm pdfs,
U_LONG  s 
)

Writes an unsigned long as four single bytes, low end first.

Parameters
pdfsThe stream to write the unsigned long to.
sThe unsigned long to write.
Returns
0 if successful.

Definition at line 804 of file pdfutils.c.

◆ pdf_wr_header()

PLDLLIMPEXP int pdf_wr_header ( PDFstrm pdfs,
PLCHAR_VECTOR  header 
)

Writes a header string. Input string must be NULL-terminated. The written string is terminated by a new-line, not a NULL. This is done so you can type e.g. "% strings <file> | head" and get sensible output.

Parameters
pdfsThe stream to which to write the header.
headerThe header.
Returns
0 if there was no error.

Definition at line 509 of file pdfutils.c.

◆ pdf_wr_ieeef()

PLDLLIMPEXP int pdf_wr_ieeef ( PDFstrm pdfs,
float  f 
)

Writes a float in IEEE single precision (32 bit) format.

Parameters
pdfsThe stream to write the float to.
fThe float.
Returns
0 if successful.

Definition at line 916 of file pdfutils.c.

◆ pdf_wr_string()

int pdf_wr_string ( PDFstrm pdfs,
PLCHAR_VECTOR  string 
)

Writes a null-terminated string.

Parameters
pdfsThe stream to write the string to.
stringThe string to write.
Returns
0 if successful.

Definition at line 574 of file pdfutils.c.

◆ plLibOpenPdfstrm()

PDFstrm* plLibOpenPdfstrm ( PLCHAR_VECTOR  fn)

Return file PDFstrm * to a file (originally used for loading fonts?). Locations checked: PLPLOT_LIB_ENV = current directory PLPLOT_HOME_ENV/lib = /lib DATA_DIR PLLIBDEV

Parameters
fnName of the file.
Returns
A open PDFstrm file pointer (if successful)

Definition at line 2263 of file plctrl.c.