PLplot: pdf.h Source File

PLplot 5.10.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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__