DyLP  1.10.4
dylib_io.h
Go to the documentation of this file.
1 #ifndef _DYLIB_IO_H
2 #define _DYLIB_IO_H
3 
4 /*
5  This file is part of the support library for the Dylp LP distribution.
6 
7  Copyright (C) 2005 -- 2007 Lou Hafer
8 
9  School of Computing Science
10  Simon Fraser University
11  Burnaby, B.C., V5A 1S6, Canada
12  lou@cs.sfu.ca
13 
14  This code is licensed under the terms of the Eclipse Public License (EPL).
15 */
16 
17 /*
18  @(#)io.h 2.4 03/18/04
19  svn/cvs: $Id: dylib_io.h 407 2010-12-31 20:48:48Z lou $
20 */
21 
22 #include "dylib_std.h"
23 #ifdef _DYLIB_FORTRAN
24 #include "dylib_fortran.h"
25 #endif
26 
27 
28 /*
29  Common definitions for the i/o library packages.
30 */
31 
32 /*
33  The file i/o routines in io.c use an integer i/o id to specify a stream.
34  The only reason to have this typedef is clarity in the code (and the off
35  chance that it might someday become a more complex type). i/o id's are
36  positive integers, between 1 and FOPEN_MAX-2 (see io.c for details).
37 */
38 
39 typedef int ioid ;
40 
41 #define IOID_NOSTRM ((ioid) 0)
42 #define IOID_INV ((ioid) -1)
43 
44 /*
45  The lexeme structure, used for strings.
46 
47  Field Description
48  ----- -----------
49  class The class of the lexeme.
50  string The value of the lexeme.
51 
52  The values for class are drawn from the following set, defined below as the
53  enum lexclass.
54 
55  Value Description
56  ----- -----------
57  DY_LCNIL Null lexeme.
58  DY_LCNUM A number.
59  DY_LCID An identifier.
60  DY_LCDEL A delimiter.
61  DY_LCFS A fixed-length string.
62  DY_LCQS A quoted string.
63  DY_LCEOF Indicates end-of-file while trying to assemble a lexeme.
64  DY_LCERR Indicates I/O error while trying to assemble a lexeme.
65 */
66 
69 
70 #ifdef __cplusplus
71 typedef struct { lexclass clazz ;
72  char *string ; } lex_struct ;
73 #else
74 typedef struct { lexclass class ;
75  char *string ; } lex_struct ;
76 #endif
77 
78 extern bool dyio_ioinit(void) ;
79 extern void dyio_ioterm(void) ;
80 
81 extern ioid dyio_openfile(const char *path, const char *mode) ;
82 extern bool dyio_isactive(ioid id) ;
83 extern bool dyio_closefile(ioid id) ;
84 extern bool dyio_setmode(ioid id, char mode), dyio_ttyq(ioid id) ;
85 
86 extern bool dyio_chgerrlog(const char *path, bool echo) ;
87 
88 extern const char *dyio_idtopath(ioid id) ;
89 extern ioid dyio_pathtoid(const char *path, const char *mode) ;
90 
91 extern long dyio_mark(ioid id) ;
92 extern bool dyio_backup(ioid id, long there) ;
93 
94 extern bool dyio_scan(ioid id, const char pattern[], bool rwnd, bool wrap) ;
95 extern lex_struct *dyio_scanlex(ioid id),
96  *dyio_scanstr(ioid id, lexclass stype,
97  int fslen, char qschr, char qechr) ;
98 
99 extern void dyio_flushio(ioid id, bool echo),
100  dyio_outfmt(ioid id, bool echo, const char *pattern, ... ),
101  dyio_outchr(ioid id, bool echo, char chr) ;
102 extern int dyio_outfxd(char *buffer, int fldsze, char lcr,
103  const char *pattern, ... ) ;
104 
105 #ifdef _DYLIB_FORTRAN
106 extern void dyio_outfmt_(integer *ftnid,
107  logical *ftnecho, char *pattern, ... ) ;
108 #endif
109 
110 #endif /* _DYLIB_IO_H */
dyio_outfmt
void dyio_outfmt(ioid id, bool echo, const char *pattern,...)
DY_LCQS
Definition: dylib_io.h:67
dyio_scan
bool dyio_scan(ioid id, const char pattern[], bool rwnd, bool wrap)
dyio_scanstr
lex_struct * dyio_scanstr(ioid id, lexclass stype, int fslen, char qschr, char qechr)
DY_LCNIL
Definition: dylib_io.h:67
integer
long int integer
Definition: dylib_fortran.h:31
dyio_ioinit
bool dyio_ioinit(void)
dyio_outfxd
int dyio_outfxd(char *buffer, int fldsze, char lcr, const char *pattern,...)
dyio_scanlex
lex_struct * dyio_scanlex(ioid id)
dylib_std.h
lex_struct
Definition: dylib_io.h:74
dyio_pathtoid
ioid dyio_pathtoid(const char *path, const char *mode)
dyio_isactive
bool dyio_isactive(ioid id)
DY_LCERR
Definition: dylib_io.h:68
dylib_fortran.h
DY_LCID
Definition: dylib_io.h:67
dyio_flushio
void dyio_flushio(ioid id, bool echo)
dyio_idtopath
const char * dyio_idtopath(ioid id)
dyio_mark
long dyio_mark(ioid id)
DY_LCEOF
Definition: dylib_io.h:68
dyio_outchr
void dyio_outchr(ioid id, bool echo, char chr)
dyio_ttyq
bool dyio_ttyq(ioid id)
dyio_closefile
bool dyio_closefile(ioid id)
DY_LCNUM
Definition: dylib_io.h:67
ioid
int ioid
Definition: dylib_io.h:39
dyio_ioterm
void dyio_ioterm(void)
dyio_openfile
ioid dyio_openfile(const char *path, const char *mode)
dyio_chgerrlog
bool dyio_chgerrlog(const char *path, bool echo)
DY_LCDEL
Definition: dylib_io.h:67
logical
long int logical
Definition: dylib_fortran.h:32
dyio_setmode
bool dyio_setmode(ioid id, char mode)
DY_LCFS
Definition: dylib_io.h:67
lexclass
lexclass
Definition: dylib_io.h:67
lex_struct::string
char * string
Definition: dylib_io.h:74
dyio_backup
bool dyio_backup(ioid id, long there)