PLplot  5.10.0
pdf.h
Go to the documentation of this file.
00001 //  Copyright (C) 1992 by Maurice J. LeBrun
00002 //
00003 //  Macros and prototypes for the PDF package.
00004 //
00005 //  This software may be freely copied, modified and redistributed without
00006 //  fee provided that this copyright notice is preserved intact on all
00007 //  copies and modified copies.
00008 //
00009 //  There is no warranty or other guarantee of fitness of this software.
00010 //  It is provided solely "as is". The author(s) disclaim(s) all
00011 //  responsibility and liability with respect to this software's usage or
00012 //  its effect upon hardware or computer systems.
00013 //
00014 
00015 #ifndef __PDF_H__
00016 #define __PDF_H__
00017 
00018 //--------------------------------------------------------------------------
00019 // dll functions
00020 //--------------------------------------------------------------------------
00021 #include "pldll.h"
00022 
00023 // Some unsigned types
00024 
00025 #ifndef U_CHAR
00026 #define U_CHAR    unsigned char
00027 #endif
00028 
00029 #ifndef U_SHORT
00030 #define U_SHORT    unsigned short
00031 #endif
00032 
00033 #ifndef U_INT
00034 #define U_INT    unsigned int
00035 #endif
00036 
00037 #ifndef U_LONG
00038 #define U_LONG    unsigned long
00039 #endif
00040 
00041 #ifdef PLPLOT_USE_TCL_CHANNELS
00042 #include <tcl.h>
00043 #endif
00044 
00045 // PDFstrm definition
00046 // The low level PDF i/o routines use the transfer method appropriate for
00047 // the first non-null type below
00048 
00049 typedef struct
00050 {
00051     FILE          *file;                // Filesystem
00052     unsigned char *buffer;              // Memory buffer
00053 #ifdef PLPLOT_USE_TCL_CHANNELS
00054     Tcl_Channel   tclChan;              // Tcl channel
00055 #endif
00056     size_t        bp, bufmax;           // Buffer pointer and max size
00057 } PDFstrm;
00058 
00059 // Info for the i/o device.  Only used by Tcl/TK/dp drivers for now
00060 
00061 typedef struct
00062 {
00063     int        fd;                      // I/O device file descriptor
00064     FILE       *file;                   // File handle
00065     const char *fileName;               // Fifo or socket name (if needed)
00066     const char *fileHandle;             // Handle for use from interpreter
00067     int        type;                    // Communication channel type
00068     const char *typeName;               // As above, but in string form
00069 } PLiodev;
00070 
00071 // Error numbers
00072 
00073 #define PDF_ERROR       1               // Unknown error
00074 #define PDF_FNOPEN      2               // File not open
00075 #define PDF_FAOPEN      3               // File already open
00076 #define PDF_BADUN       4               // Bad unit number
00077 #define PDF_BADNBITS    5               // Invalid # of bits
00078 #define PDF_RDERR       6               // Read error
00079 #define PDF_WRERR       7               // Write error
00080 #define PDF_NOTPDF      8               // Not a valid PDF file
00081 
00082 // Prototypes
00083 // Use a wrapper for the prototypes for use from K&R C
00084 
00085 void pdf_set( char *option, int value );
00086 PLDLLIMPEXP PDFstrm *pdf_fopen( const char *fileName, const char *mode );
00087 PLDLLIMPEXP PDFstrm *pdf_bopen( U_CHAR * buffer, size_t bufmax );
00088 PLDLLIMPEXP PDFstrm *pdf_finit( FILE * file );
00089 PDFstrm *plLibOpenPdfstrm( const char * fn );
00090 PLDLLIMPEXP int pdf_close( PDFstrm * pdfs );
00091 
00092 int pdf_putc( int c, PDFstrm * pdfs );
00093 PLDLLIMPEXP int pdf_getc( PDFstrm * pdfs );
00094 PLDLLIMPEXP int pdf_ungetc( int c, PDFstrm * pdfs );
00095 int pdf_rdx( U_CHAR * x, long nitems, PDFstrm * pdfs );
00096 
00097 PLDLLIMPEXP int pdf_rd_header( PDFstrm * pdfs, char *header );
00098 PLDLLIMPEXP int pdf_wr_header( PDFstrm * pdfs, const char *header );
00099 int pdf_wr_string( PDFstrm * pdfs, const char *string );
00100 int pdf_rd_string( PDFstrm * pdfs, char *string, int nmax );
00101 PLDLLIMPEXP int pdf_wr_1byte( PDFstrm * pdfs, U_CHAR s );
00102 PLDLLIMPEXP int pdf_rd_1byte( PDFstrm * pdfs, U_CHAR * ps );
00103 PLDLLIMPEXP int pdf_wr_2bytes( PDFstrm * pdfs, U_SHORT s );
00104 PLDLLIMPEXP int pdf_rd_2bytes( PDFstrm * pdfs, U_SHORT * ps );
00105 PLDLLIMPEXP int pdf_wr_2nbytes( PDFstrm * pdfs, U_SHORT * s, PLINT n );
00106 PLDLLIMPEXP int pdf_rd_2nbytes( PDFstrm * pdfs, U_SHORT * s, PLINT n );
00107 PLDLLIMPEXP int pdf_wr_4bytes( PDFstrm * pdfs, U_LONG s );
00108 PLDLLIMPEXP int pdf_rd_4bytes( PDFstrm * pdfs, U_LONG * ps );
00109 PLDLLIMPEXP int pdf_wr_ieeef( PDFstrm * pdfs, float f );
00110 PLDLLIMPEXP int pdf_rd_ieeef( PDFstrm * pdfs, float *pf );
00111 
00112 #endif  // __PDF_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines