xref: /original-bsd/usr.bin/f77/libI77/fiodefs.h (revision f3455753)
1 /*-
2  * Copyright (c) 1980 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  *
7  *	@(#)fiodefs.h	5.3 (Berkeley) 04/12/91
8  */
9 
10 /*
11  * fortran file i/o type definitions
12  */
13 
14 #include <stdio.h>
15 #include "f_errno.h"
16 
17 /* Logical Unit Table Size */
18 #define MXUNIT 100
19 
20 #define GLITCH '\2'	/* special quote for Stu, generated in f77pass1 */
21 
22 #define NAMELIST      -2
23 #define LISTDIRECTED  -1
24 #define FORMATTED      1
25 
26 #define ERROR	1
27 #define OK	0
28 #define YES	1
29 #define NO	0
30 
31 #define STDERR	0
32 #define STDIN	5
33 #define STDOUT	6
34 
35 #define WRITE	1
36 #define READ	2
37 #define SEQ	3
38 #define DIR	4
39 #define FMT	5
40 #define UNF	6
41 #define EXT	7
42 #define INT	8
43 
44 typedef char ioflag;
45 typedef long ftnint;
46 typedef ftnint flag;
47 typedef long ftnlen;
48 
49 typedef struct		/*external read, write*/
50 {	flag cierr;
51 	ftnint ciunit;
52 	flag ciend;
53 	char *cifmt;
54 	ftnint cirec;
55 } cilist;
56 
57 typedef struct		/*internal read, write*/
58 {	flag icierr;
59 	char *iciunit;
60 	flag iciend;
61 	char *icifmt;
62 	ftnint icirlen;
63 	ftnint icirnum;
64 	ftnint icirec;
65 } icilist;
66 
67 typedef struct		/*open*/
68 {	flag oerr;
69 	ftnint ounit;
70 	char *ofnm;
71 	ftnlen ofnmlen;
72 	char *osta;
73 	char *oacc;
74 	char *ofm;
75 	ftnint orl;
76 	char *oblnk;
77 } olist;
78 
79 typedef struct		/*close*/
80 {	flag cerr;
81 	ftnint cunit;
82 	char *csta;
83 } cllist;
84 
85 typedef struct		/*rewind, backspace, endfile*/
86 {	flag aerr;
87 	ftnint aunit;
88 } alist;
89 
90 typedef struct		/*units*/
91 {	FILE *ufd;	/*0=unconnected*/
92 	char *ufnm;
93 	long uinode;
94 	int url;	/*0=sequential*/
95 	flag useek;	/*true=can backspace, use dir, ...*/
96 	flag ufmt;
97 	flag uprnt;
98 	flag ublnk;
99 	flag uend;
100 	flag uwrt;	/*last io was write*/
101 	flag uscrtch;
102 } unit;
103 
104 typedef struct		/* inquire */
105 {	flag inerr;
106 	ftnint inunit;
107 	char *infile;
108 	ftnlen infilen;
109 	ftnint	*inex;	/*parameters in standard's order*/
110 	ftnint	*inopen;
111 	ftnint	*innum;
112 	ftnint	*innamed;
113 	char	*inname;
114 	ftnlen	innamlen;
115 	char	*inacc;
116 	ftnlen	inacclen;
117 	char	*inseq;
118 	ftnlen	inseqlen;
119 	char 	*indir;
120 	ftnlen	indirlen;
121 	char	*inform;
122 	ftnlen	informlen;
123 	char	*infmt;
124 	ftnint	infmtlen;
125 	char	*inunf;
126 	ftnlen	inunflen;
127 	ftnint	*inrecl;
128 	ftnint	*innrec;
129 	char	*inblank;
130 	ftnlen	inblanklen;
131 } inlist;
132 
133 typedef union
134 {	float pf;
135 	double pd;
136 } ufloat;
137 
138 typedef union
139 {	short is;
140 	char ic;
141 	long il;
142 } uint;
143 
144 struct ioiflg {
145 	short if_oeof;
146 	short if_ctrl;
147 	short if_bzro;
148 };
149 #define	opneof	ioiflg_.if_oeof
150 #define	ccntrl	ioiflg_.if_ctrl
151 #define	blzero	ioiflg_.if_bzro
152