• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

pdf.h

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

Generated on Wed Oct 12 2011 20:42:22 for PLplot by  doxygen 1.7.1