Debian Codegraph @

debian/external_deps/fetk/punc/src/vf2c/rsli.c

raw
1 #include "f2c.h"
2 #include "fio.h"
3 #include "lio.h"
4 #include "fmt.h" /* for f__doend */
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 extern flag f__lquit;
10 extern int f__lcount;
11 extern char *f__icptr;
12 extern char *f__icend;
13 extern icilist *f__svic;
14 extern int f__icnum, f__recpos;
15
16 static int i_getc(Void)
17 {
18 if(f__recpos >= f__svic->icirlen) {
19 if (f__recpos++ == f__svic->icirlen)
20 return '\n';
21 z_rnew();
22 }
23 f__recpos++;
24 if(f__icptr >= f__icend)
25 return EOF;
26 return(*f__icptr++);
27 }
28
29 static
30 #ifdef KR_headers
31 int i_ungetc(ch, f) int ch; FILE *f;
32 #else
33 int i_ungetc(int ch, FILE *f)
34 #endif
35 {
36 if (--f__recpos == f__svic->icirlen)
37 return '\n';
38 if (f__recpos < -1)
39 err(f__svic->icierr,110,"recend");
40 /* *--icptr == ch, and icptr may point to read-only memory */
41 return *--f__icptr /* = ch */;
42 }
43
44 static void
45 #ifdef KR_headers
46 c_lir(a) icilist *a;
47 #else
48 c_lir(icilist *a)
49 #endif
50 {
51 extern int l_eof;
52 f__reading = 1;
53 f__external = 0;
54 f__formatted = 1;
55 f__svic = a;
56 L_len = a->icirlen;
57 f__recpos = -1;
58 f__icnum = f__recpos = 0;
59 f__cursor = 0;
60 l_getc = i_getc;
61 l_ungetc = i_ungetc;
62 l_eof = 0;
63 f__icptr = a->iciunit;
64 f__icend = f__icptr + a->icirlen*a->icirnum;
65 f__cf = 0;
66 f__curunit = 0;
67 f__elist = (cilist *)a;
68 }
69
70
71 #ifdef KR_headers
72 integer s_rsli(a) icilist *a;
73 #else
74 integer s_rsli(icilist *a)
75 #endif
76 {
77 f__lioproc = l_read;
78 f__lquit = 0;
79 f__lcount = 0;
80 c_lir(a);
81 f__doend = 0;
82 return(0);
83 }
84
85 integer e_rsli(Void)
86 { return 0; }
87
88 #ifdef KR_headers
89 integer s_rsni(a) icilist *a;
90 #else
91 extern int x_rsne(cilist*);
92
93 integer s_rsni(icilist *a)
94 #endif
95 {
96 extern int nml_read;
97 integer rv;
98 cilist ca;
99 ca.ciend = a->iciend;
100 ca.cierr = a->icierr;
101 ca.cifmt = a->icifmt;
102 c_lir(a);
103 rv = x_rsne(&ca);
104 nml_read = 0;
105 return rv;
106 }
107 #ifdef __cplusplus
108 }
109 #endif