|
|
1.1 root 1: #include "f2c.h"
2: #include "fio.h"
3: #include "fmt.h"
4: extern char *f__icptr;
5: char *f__icend;
6: extern icilist *f__svic;
7: int f__icnum;
8: extern int f__hiwater;
9: z_getc(Void)
10: {
11: if(f__recpos++ < f__svic->icirlen) {
12: if(f__icptr >= f__icend) err(f__svic->iciend,(EOF),"endfile");
13: return(*f__icptr++);
14: }
15: err(f__svic->icierr,110,"recend");
16: #ifdef __cplusplus
17: return 0;
18: #endif
19: }
20: #ifdef KR_headers
21: z_putc(c)
22: #else
23: z_putc(int c)
24: #endif
25: {
26: if(f__icptr >= f__icend) err(f__svic->icierr,110,"inwrite");
27: if(f__recpos++ < f__svic->icirlen)
28: *f__icptr++ = c;
29: else err(f__svic->icierr,110,"recend");
30: return 0;
31: }
32: z_rnew(Void)
33: {
34: f__icptr = f__svic->iciunit + (++f__icnum)*f__svic->icirlen;
35: f__recpos = 0;
36: f__cursor = 0;
37: f__hiwater = 0;
38: return 1;
39: }
40:
41: static int
42: z_endp(Void)
43: {
44: (*f__donewrec)();
45: return 0;
46: }
47:
48: #ifdef KR_headers
49: c_si(a) icilist *a;
50: #else
51: c_si(icilist *a)
52: #endif
53: {
54: f__elist = (cilist *)a;
55: f__fmtbuf=a->icifmt;
56: if(pars_f(f__fmtbuf)<0)
57: err(a->icierr,100,"startint");
58: fmt_bg();
59: f__sequential=f__formatted=1;
60: f__external=0;
61: f__cblank=f__cplus=f__scale=0;
62: f__svic=a;
63: f__icnum=f__recpos=0;
64: f__cursor = 0;
65: f__hiwater = 0;
66: f__icptr = a->iciunit;
67: f__icend = f__icptr + a->icirlen*a->icirnum;
68: f__curunit = 0;
69: f__cf = 0;
70: return(0);
71: }
72:
73: y_ierr(Void)
74: {
75: err(f__elist->cierr, 110, "iio");
76: #ifdef __cplusplus
77: return 0;
78: #endif
79: }
80:
81: int
82: iw_rev(Void)
83: {
84: if(f__workdone)
85: z_endp();
86: f__hiwater = f__recpos = f__cursor = 0;
87: return(f__workdone=0);
88: }
89:
90: #ifdef KR_headers
91: integer s_rsfi(a) icilist *a;
92: #else
93: integer s_rsfi(icilist *a)
94: #endif
95: { int n;
96: if(n=c_si(a)) return(n);
97: f__reading=1;
98: f__doed=rd_ed;
99: f__doned=rd_ned;
100: f__getn=z_getc;
101: f__dorevert = y_ierr;
102: f__donewrec = z_rnew;
103: f__doend = z_endp;
104: return(0);
105: }
106:
107: z_wnew(Void)
108: {
109: while(f__recpos++ < f__svic->icirlen)
110: *f__icptr++ = ' ';
111: f__recpos = 0;
112: f__cursor = 0;
113: f__hiwater = 0;
114: f__icnum++;
115: return 1;
116: }
117: #ifdef KR_headers
118: integer s_wsfi(a) icilist *a;
119: #else
120: integer s_wsfi(icilist *a)
121: #endif
122: { int n;
123: if(n=c_si(a)) return(n);
124: f__reading=0;
125: f__doed=w_ed;
126: f__doned=w_ned;
127: f__putn=z_putc;
128: f__dorevert = iw_rev;
129: f__donewrec = z_wnew;
130: f__doend = z_endp;
131: return(0);
132: }
133: integer e_rsfi(Void)
134: { int n;
135: n = en_fio();
136: f__fmtbuf = NULL;
137: return(n);
138: }
139: integer e_wsfi(Void)
140: {
141: int n;
142: n = en_fio();
143: f__fmtbuf = NULL;
144: if(f__icnum >= f__svic->icirnum)
145: return(n);
146: while(f__recpos++ < f__svic->icirlen)
147: *f__icptr++ = ' ';
148: return(n);
149: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.