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