Back to index

plt-scheme  4.2.1
pdf.h
Go to the documentation of this file.
00001 /* $Id: pdf.h,v 1.1 2004/03/01 20:54:50 cozmic Exp $
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 /* Some unsigned types */
00021 
00022 #ifndef U_CHAR
00023 #define U_CHAR unsigned char
00024 #endif
00025 
00026 #ifndef U_SHORT
00027 #define U_SHORT unsigned short
00028 #endif
00029 
00030 #ifndef U_INT
00031 #define U_INT unsigned int
00032 #endif
00033 
00034 #ifndef U_LONG
00035 #define U_LONG unsigned long
00036 #endif
00037 
00038 #ifdef PLPLOT_USE_TCL_CHANNELS
00039 #include <tcl.h>
00040 #endif
00041 
00042 /* PDFstrm definition */
00043 /* The low level PDF i/o routines use the transfer method appropriate for */
00044 /* the first non-null type below */
00045 
00046 typedef struct {
00047     FILE *file;                           /* Filesystem */
00048     unsigned char *buffer;         /* Memory buffer */
00049 #ifdef PLPLOT_USE_TCL_CHANNELS
00050     Tcl_Channel tclChan;            /* Tcl channel */
00051 #endif
00052     long bp, bufmax;               /* Buffer pointer and max size */
00053 } PDFstrm;
00054 
00055 /* Info for the i/o device.  Only used by Tcl/TK/dp drivers for now */
00056 
00057 typedef struct {
00058     int   fd;                      /* I/O device file descriptor */
00059     FILE  *file;                   /* File handle */
00060     char  *fileName;               /* Fifo or socket name (if needed) */
00061     char  *fileHandle;                    /* Handle for use from interpreter */
00062     int   type;                           /* Communication channel type */
00063     char  *typeName;               /* As above, but in string form */
00064 } PLiodev;
00065 
00066 /* Error numbers */
00067 
00068 #define PDF_ERROR           1      /* Unknown error     */
00069 #define PDF_FNOPEN          2      /* File not open     */
00070 #define PDF_FAOPEN          3      /* File already open */
00071 #define PDF_BADUN           4      /* Bad unit number   */
00072 #define PDF_BADNBITS        5      /* Invalid # of bits */
00073 #define PDF_RDERR           6      /* Read error        */
00074 #define PDF_WRERR           7      /* Write error              */
00075 #define PDF_NOTPDF          8      /* Not a valid PDF file */
00076 
00077 /* Prototypes */
00078 /* Use a wrapper for the prototypes for use from K&R C */
00079 
00080 void pdf_set         PLARGS((char *option, int value));
00081 PDFstrm *pdf_fopen   PLARGS((char *fileName, char *mode));
00082 PDFstrm *pdf_bopen   PLARGS((U_CHAR *buffer, long bufmax));
00083 PDFstrm *pdf_finit   PLARGS((FILE *file));
00084 PDFstrm *plLibOpenPdfstrm PLARGS((char *fn));
00085 int  pdf_close              PLARGS((PDFstrm *pdfs));
00086 
00087 int  pdf_putc        PLARGS((int c, PDFstrm *pdfs));
00088 int  pdf_getc        PLARGS((PDFstrm *pdfs));
00089 int  pdf_ungetc             PLARGS((int c, PDFstrm *pdfs));
00090 int  pdf_rdx          PLARGS((U_CHAR *x, long nitems, PDFstrm *pdfs));
00091 
00092 int  pdf_rd_header   PLARGS((PDFstrm *pdfs, char *header));
00093 int  pdf_wr_header   PLARGS((PDFstrm *pdfs, char *header));
00094 int  pdf_wr_string   PLARGS((PDFstrm *pdfs, const char *string));
00095 int  pdf_rd_string   PLARGS((PDFstrm *pdfs, char *string, int nmax));
00096 int  pdf_wr_1byte    PLARGS((PDFstrm *pdfs, U_CHAR s));
00097 int  pdf_rd_1byte    PLARGS((PDFstrm *pdfs, U_CHAR *ps));
00098 int  pdf_wr_2bytes   PLARGS((PDFstrm *pdfs, U_SHORT s));
00099 int  pdf_rd_2bytes   PLARGS((PDFstrm *pdfs, U_SHORT *ps));
00100 int  pdf_wr_2nbytes  PLARGS((PDFstrm *pdfs, U_SHORT *s, PLINT n));
00101 int  pdf_rd_2nbytes  PLARGS((PDFstrm *pdfs, U_SHORT *s, PLINT n));
00102 int  pdf_wr_4bytes   PLARGS((PDFstrm *pdfs, U_LONG s));
00103 int  pdf_rd_4bytes   PLARGS((PDFstrm *pdfs, U_LONG *ps));
00104 int  pdf_wr_ieeef    PLARGS((PDFstrm *pdfs, float f));
00105 int  pdf_rd_ieeef    PLARGS((PDFstrm *pdfs, float *pf));
00106 
00107 #endif /* __PDF_H__ */