# dylib_io.h

Go to the documentation of this file.

    00001 #ifndef _DYLIB_IO_H
    00002 #define _DYLIB_IO_H
    00003
    00004 /*
    00005   This file is part of the support library for the Dylp LP distribution.
    00006
    00007         Copyright (C) 2005 -- 2007 Lou Hafer
    00008
    00009         School of Computing Science
    00010         Simon Fraser University
    00011         Burnaby, B.C., V5A 1S6, Canada
    00012         lou@cs.sfu.ca
    00013
    00014   This code is licensed under the terms of the Eclipse Public License (EPL).
    00015 */
    00016
    00017 /*
    00018   @(#)io.h      2.4     03/18/04
    00019   svn/cvs: $Id: dylib_io.h 407 2010-12-31 20:48:48Z lou $
    00020 */
    00021
    00022 #include "dylib_std.h"
    00023 #ifdef _DYLIB_FORTRAN
    00024 #include "dylib_fortran.h"
    00025 #endif
    00026
    00027
    00028 /*
    00029   Common definitions for the i/o library packages.
    00030 */
    00031
    00032 /*
    00033   The file i/o routines in io.c use an integer i/o id to specify a stream.
    00034   The only reason to have this typedef is clarity in the code (and the off
    00035   chance that it might someday become a more complex type). i/o id's are
    00036   positive integers, between 1 and FOPEN_MAX-2 (see io.c for details).
    00037 */
    00038
    00039 typedef int ioid ;
    00040
    00041 #define IOID_NOSTRM ((ioid) 0)
    00042 #define IOID_INV ((ioid) -1)
    00043
    00044 /*
    00045   The lexeme structure, used for strings.
    00046
    00047   Field         Description
    00048   -----         -----------
    00049   class         The class of the lexeme.
    00050   string        The value of the lexeme.
    00051
    00052   The values for class are drawn from the following set, defined below as the
    00053   enum lexclass.
    00054
    00055   Value         Description
    00056   -----         -----------
    00057   DY_LCNIL      Null lexeme.
    00058   DY_LCNUM      A number.
    00059   DY_LCID       An identifier.
    00060   DY_LCDEL      A delimiter.
    00061   DY_LCFS       A fixed-length string.
    00062   DY_LCQS       A quoted string.
    00063   DY_LCEOF      Indicates end-of-file while trying to assemble a lexeme.
    00064   DY_LCERR      Indicates I/O error while trying to assemble a lexeme.
    00065 */
    00066
    00067 typedef enum {DY_LCNIL,DY_LCNUM,DY_LCID,DY_LCDEL,DY_LCFS,DY_LCQS,
    00068               DY_LCEOF,DY_LCERR} lexclass ;
    00069
    00070 #ifdef  __cplusplus
    00071 typedef struct { lexclass clazz ;
    00072                  char *string ; } lex_struct ;
    00073 #else
    00074 typedef struct { lexclass class ;
    00075                  char *string ; } lex_struct ;
    00076 #endif
    00077
    00078 extern bool dyio_ioinit(void) ;
    00079 extern void dyio_ioterm(void) ;
    00080
    00081 extern ioid dyio_openfile(const char *path, const char *mode) ;
    00082 extern bool dyio_isactive(ioid id) ;
    00083 extern bool dyio_closefile(ioid id) ;
    00084 extern bool dyio_setmode(ioid id, char mode), dyio_ttyq(ioid id) ;
    00085
    00086 extern bool dyio_chgerrlog(const char *path, bool echo) ;
    00087
    00088 extern const char *dyio_idtopath(ioid id) ;
    00089 extern ioid dyio_pathtoid(const char *path, const char *mode) ;
    00090
    00091 extern long dyio_mark(ioid id) ;
    00092 extern bool dyio_backup(ioid id, long there) ;
    00093
    00094 extern bool dyio_scan(ioid id, const char pattern[], bool rwnd, bool wrap) ;
    00095 extern lex_struct *dyio_scanlex(ioid id),
    00096                   *dyio_scanstr(ioid id, lexclass stype,
    00097                                 int fslen, char qschr, char qechr) ;
    00098
    00099 extern void dyio_flushio(ioid id, bool echo),
    00100             dyio_outfmt(ioid id, bool echo, const char *pattern, ... ),
    00101             dyio_outchr(ioid id, bool echo, char chr) ;
    00102 extern int dyio_outfxd(char *buffer, int fldsze, char lcr,
    00103                        const char *pattern, ... ) ;
    00104
    00105 #ifdef _DYLIB_FORTRAN
    00106 extern void dyio_outfmt_(integer *ftnid,
    00107                          logical *ftnecho, char *pattern, ... ) ;
    00108 #endif
    00109
    00110 #endif /* _DYLIB_IO_H */

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines