DyLP 1.10.4
Loading...
Searching...
No Matches
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
39typedef 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
71typedef struct { lexclass clazz ;
72 char *string ; } lex_struct ;
73#else
74typedef struct { lexclass class ;
75 char *string ; } lex_struct ;
76#endif
77
78extern bool dyio_ioinit(void) ;
79extern void dyio_ioterm(void) ;
80
81extern ioid dyio_openfile(const char *path, const char *mode) ;
82extern bool dyio_isactive(ioid id) ;
83extern bool dyio_closefile(ioid id) ;
84extern bool dyio_setmode(ioid id, char mode), dyio_ttyq(ioid id) ;
85
86extern bool dyio_chgerrlog(const char *path, bool echo) ;
87
88extern const char *dyio_idtopath(ioid id) ;
89extern ioid dyio_pathtoid(const char *path, const char *mode) ;
90
91extern long dyio_mark(ioid id) ;
92extern bool dyio_backup(ioid id, long there) ;
93
94extern bool dyio_scan(ioid id, const char pattern[], bool rwnd, bool wrap) ;
97 int fslen, char qschr, char qechr) ;
98
99extern 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) ;
102extern int dyio_outfxd(char *buffer, int fldsze, char lcr,
103 const char *pattern, ... ) ;
104
105#ifdef _DYLIB_FORTRAN
106extern void dyio_outfmt_(integer *ftnid,
107 logical *ftnecho, char *pattern, ... ) ;
108#endif
109
110#endif /* _DYLIB_IO_H */
long int integer
long int logical
bool dyio_scan(ioid id, const char pattern[], bool rwnd, bool wrap)
ioid dyio_pathtoid(const char *path, const char *mode)
void dyio_outfmt(ioid id, bool echo, const char *pattern,...)
lex_struct * dyio_scanlex(ioid id)
bool dyio_ioinit(void)
int dyio_outfxd(char *buffer, int fldsze, char lcr, const char *pattern,...)
ioid dyio_openfile(const char *path, const char *mode)
lex_struct * dyio_scanstr(ioid id, lexclass stype, int fslen, char qschr, char qechr)
const char * dyio_idtopath(ioid id)
bool dyio_closefile(ioid id)
bool dyio_ttyq(ioid id)
long dyio_mark(ioid id)
lexclass
Definition dylib_io.h:67
@ DY_LCFS
Definition dylib_io.h:67
@ DY_LCDEL
Definition dylib_io.h:67
@ DY_LCERR
Definition dylib_io.h:68
@ DY_LCQS
Definition dylib_io.h:67
@ DY_LCID
Definition dylib_io.h:67
@ DY_LCEOF
Definition dylib_io.h:68
@ DY_LCNUM
Definition dylib_io.h:67
@ DY_LCNIL
Definition dylib_io.h:67
void dyio_outchr(ioid id, bool echo, char chr)
void dyio_flushio(ioid id, bool echo)
bool dyio_backup(ioid id, long there)
bool dyio_setmode(ioid id, char mode)
int ioid
Definition dylib_io.h:39
bool dyio_chgerrlog(const char *path, bool echo)
bool dyio_isactive(ioid id)
void dyio_ioterm(void)
char * string
Definition dylib_io.h:74