PLplot 5.15.0
Loading...
Searching...
No Matches
pdf.h
Go to the documentation of this file.
1// Copyright (C) 1992 by Maurice J. LeBrun
2//
3// Macros and prototypes for the PDF package.
4//
5// This software may be freely copied, modified and redistributed without
6// fee provided that this copyright notice is preserved intact on all
7// copies and modified copies.
8//
9// There is no warranty or other guarantee of fitness of this software.
10// It is provided solely "as is". The author(s) disclaim(s) all
11// responsibility and liability with respect to this software's usage or
12// its effect upon hardware or computer systems.
13//
14
15#ifndef __PDF_H__
16#define __PDF_H__
17
18//--------------------------------------------------------------------------
19// dll functions
20//--------------------------------------------------------------------------
21#include "pldll.h"
22
23// Some unsigned types
24
25#ifndef U_CHAR
26#define U_CHAR unsigned char
27#endif
28
29#ifndef U_SHORT
30#define U_SHORT unsigned short
31#endif
32
33#ifndef U_INT
34#define U_INT unsigned int
35#endif
36
37#ifndef U_LONG
38#define U_LONG unsigned long
39#endif
40
41#ifdef PLPLOT_USE_TCL_CHANNELS
42#include <tcl.h>
43#endif
44
45// PDFstrm definition
46// The low level PDF i/o routines use the transfer method appropriate for
47// the first non-null type below
48
49typedef struct
50{
51 FILE *file; // Filesystem
52 unsigned char *buffer; // Memory buffer
53#ifdef PLPLOT_USE_TCL_CHANNELS
54 Tcl_Channel tclChan; // Tcl channel
55#endif
56 size_t bp, bufmax; // Buffer pointer and max size
57} PDFstrm;
58
59// Info for the i/o device. Only used by Tcl/TK/dp drivers for now
60
61typedef struct
62{
63 int fd; // I/O device file descriptor
64 FILE *file; // File handle
65 const char *fileName; // Fifo or socket name (if needed)
66 const char *fileHandle; // Handle for use from interpreter
67 int type; // Communication channel type
68 const char *typeName; // As above, but in string form
69} PLiodev;
70
71// Error numbers
72
73#define PDF_ERROR 1 // Unknown error
74#define PDF_FNOPEN 2 // File not open
75#define PDF_FAOPEN 3 // File already open
76#define PDF_BADUN 4 // Bad unit number
77#define PDF_BADNBITS 5 // Invalid # of bits
78#define PDF_RDERR 6 // Read error
79#define PDF_WRERR 7 // Write error
80#define PDF_NOTPDF 8 // Not a valid PDF file
81
82// Prototypes
83// Use a wrapper for the prototypes for use from K&R C
84
85void pdf_set( char *option, int value );
86PLDLLIMPEXP PDFstrm *pdf_fopen( const char *fileName, const char *mode );
87PLDLLIMPEXP PDFstrm *pdf_bopen( U_CHAR * buffer, size_t bufmax );
88PLDLLIMPEXP PDFstrm *pdf_finit( FILE * file );
89PDFstrm *plLibOpenPdfstrm( const char * fn );
90PLDLLIMPEXP int pdf_close( PDFstrm * pdfs );
91
92int pdf_putc( int c, PDFstrm * pdfs );
93PLDLLIMPEXP int pdf_getc( PDFstrm * pdfs );
94PLDLLIMPEXP int pdf_ungetc( int c, PDFstrm * pdfs );
95int pdf_rdx( U_CHAR * x, long nitems, PDFstrm * pdfs );
96
97PLDLLIMPEXP int pdf_rd_header( PDFstrm * pdfs, char *header );
98PLDLLIMPEXP int pdf_wr_header( PDFstrm * pdfs, const char *header );
99int pdf_wr_string( PDFstrm * pdfs, const char *string );
100int pdf_rd_string( PDFstrm * pdfs, char *string, int nmax );
101PLDLLIMPEXP int pdf_wr_1byte( PDFstrm * pdfs, U_CHAR s );
102PLDLLIMPEXP int pdf_rd_1byte( PDFstrm * pdfs, U_CHAR * ps );
104PLDLLIMPEXP int pdf_rd_2bytes( PDFstrm * pdfs, U_SHORT * ps );
105PLDLLIMPEXP int pdf_wr_2nbytes( PDFstrm * pdfs, U_SHORT * s, PLINT n );
106PLDLLIMPEXP int pdf_rd_2nbytes( PDFstrm * pdfs, U_SHORT * s, PLINT n );
107PLDLLIMPEXP int pdf_wr_4bytes( PDFstrm * pdfs, U_LONG s );
108PLDLLIMPEXP int pdf_rd_4bytes( PDFstrm * pdfs, U_LONG * ps );
109PLDLLIMPEXP int pdf_wr_ieeef( PDFstrm * pdfs, float f );
110PLDLLIMPEXP int pdf_rd_ieeef( PDFstrm * pdfs, float *pf );
111
112#endif // __PDF_H__
const char header[]
Definition deltaT-gen.c:41
PLDLLIMPEXP int pdf_wr_ieeef(PDFstrm *pdfs, float f)
Definition pdfutils.c:916
PLDLLIMPEXP PDFstrm * pdf_bopen(U_CHAR *buffer, size_t bufmax)
Definition pdfutils.c:152
PLDLLIMPEXP int pdf_close(PDFstrm *pdfs)
Definition pdfutils.c:238
PLDLLIMPEXP int pdf_rd_2nbytes(PDFstrm *pdfs, U_SHORT *s, PLINT n)
Definition pdfutils.c:771
PLDLLIMPEXP PDFstrm * pdf_fopen(const char *fileName, const char *mode)
Definition pdfutils.c:74
void pdf_set(char *option, int value)
Definition pdfutils.c:56
#define U_LONG
Definition pdf.h:38
PLDLLIMPEXP int pdf_wr_4bytes(PDFstrm *pdfs, U_LONG s)
Definition pdfutils.c:804
#define U_SHORT
Definition pdf.h:30
PDFstrm * plLibOpenPdfstrm(const char *fn)
Definition plctrl.c:2263
PLDLLIMPEXP int pdf_rd_2bytes(PDFstrm *pdfs, U_SHORT *ps)
Definition pdfutils.c:710
PLDLLIMPEXP int pdf_rd_1byte(PDFstrm *pdfs, U_CHAR *ps)
Definition pdfutils.c:660
int pdf_putc(int c, PDFstrm *pdfs)
Definition pdfutils.c:276
PLDLLIMPEXP int pdf_ungetc(int c, PDFstrm *pdfs)
Definition pdfutils.c:365
PLDLLIMPEXP int pdf_wr_1byte(PDFstrm *pdfs, U_CHAR s)
Definition pdfutils.c:636
int pdf_rdx(U_CHAR *x, long nitems, PDFstrm *pdfs)
Definition pdfutils.c:464
PLDLLIMPEXP int pdf_wr_2nbytes(PDFstrm *pdfs, U_SHORT *s, PLINT n)
Definition pdfutils.c:741
PLDLLIMPEXP int pdf_wr_2bytes(PDFstrm *pdfs, U_SHORT s)
Definition pdfutils.c:684
PLDLLIMPEXP int pdf_rd_header(PDFstrm *pdfs, char *header)
Definition pdfutils.c:542
int pdf_wr_string(PDFstrm *pdfs, const char *string)
Definition pdfutils.c:574
PLDLLIMPEXP int pdf_rd_ieeef(PDFstrm *pdfs, float *pf)
Definition pdfutils.c:992
int pdf_rd_string(PDFstrm *pdfs, char *string, int nmax)
Definition pdfutils.c:604
PLDLLIMPEXP int pdf_rd_4bytes(PDFstrm *pdfs, U_LONG *ps)
Definition pdfutils.c:832
PLDLLIMPEXP PDFstrm * pdf_finit(FILE *file)
Definition pdfutils.c:204
PLDLLIMPEXP int pdf_getc(PDFstrm *pdfs)
Definition pdfutils.c:325
PLDLLIMPEXP int pdf_wr_header(PDFstrm *pdfs, const char *header)
Definition pdfutils.c:509
#define U_CHAR
Definition pdf.h:26
static PLFLT value(double n1, double n2, double hue)
Definition plctrl.c:1219
#define PLDLLIMPEXP
Definition pldll.h:49
static PLINT * buffer
Definition plfill.c:74
int PLINT
Definition plplot.h:181
Definition pdf.h:50
size_t bufmax
Definition pdf.h:56
unsigned char * buffer
Definition pdf.h:52
size_t bp
Definition pdf.h:56
FILE * file
Definition pdf.h:51
Definition pdf.h:62
int fd
Definition pdf.h:63
int type
Definition pdf.h:67
FILE * file
Definition pdf.h:64
const char * fileHandle
Definition pdf.h:66
const char * fileName
Definition pdf.h:65
const char * typeName
Definition pdf.h:68
static const char * fileName
Definition tkMain.c:134