|
Last change
on this file since 410 was 2, checked in by bird, 23 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
|
File size:
1.7 KB
|
| Line | |
|---|
| 1 | #include "f2c.h"
|
|---|
| 2 | #include "fio.h"
|
|---|
| 3 | #include "lio.h"
|
|---|
| 4 | #include "fmt.h" /* for f__doend */
|
|---|
| 5 |
|
|---|
| 6 | extern flag f__lquit;
|
|---|
| 7 | extern int f__lcount;
|
|---|
| 8 | extern char *f__icptr;
|
|---|
| 9 | extern char *f__icend;
|
|---|
| 10 | extern icilist *f__svic;
|
|---|
| 11 | extern int f__icnum, f__recpos;
|
|---|
| 12 |
|
|---|
| 13 | static int i_getc(Void)
|
|---|
| 14 | {
|
|---|
| 15 | if(f__recpos >= f__svic->icirlen) {
|
|---|
| 16 | if (f__recpos++ == f__svic->icirlen)
|
|---|
| 17 | return '\n';
|
|---|
| 18 | z_rnew();
|
|---|
| 19 | }
|
|---|
| 20 | f__recpos++;
|
|---|
| 21 | if(f__icptr >= f__icend)
|
|---|
| 22 | return EOF;
|
|---|
| 23 | return(*f__icptr++);
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | static
|
|---|
| 27 | #ifdef KR_headers
|
|---|
| 28 | int i_ungetc(ch, f) int ch; FILE *f;
|
|---|
| 29 | #else
|
|---|
| 30 | int i_ungetc(int ch, FILE *f)
|
|---|
| 31 | #endif
|
|---|
| 32 | {
|
|---|
| 33 | if (--f__recpos == f__svic->icirlen)
|
|---|
| 34 | return '\n';
|
|---|
| 35 | if (f__recpos < -1)
|
|---|
| 36 | err(f__svic->icierr,110,"recend");
|
|---|
| 37 | /* *--icptr == ch, and icptr may point to read-only memory */
|
|---|
| 38 | return *--f__icptr /* = ch */;
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | static void
|
|---|
| 42 | #ifdef KR_headers
|
|---|
| 43 | c_lir(a) icilist *a;
|
|---|
| 44 | #else
|
|---|
| 45 | c_lir(icilist *a)
|
|---|
| 46 | #endif
|
|---|
| 47 | {
|
|---|
| 48 | extern int l_eof;
|
|---|
| 49 | if(f__init != 1) f_init();
|
|---|
| 50 | f__init = 3;
|
|---|
| 51 | f__reading = 1;
|
|---|
| 52 | f__external = 0;
|
|---|
| 53 | f__formatted = 1;
|
|---|
| 54 | f__svic = a;
|
|---|
| 55 | L_len = a->icirlen;
|
|---|
| 56 | f__recpos = -1;
|
|---|
| 57 | f__icnum = f__recpos = 0;
|
|---|
| 58 | f__cursor = 0;
|
|---|
| 59 | l_getc = i_getc;
|
|---|
| 60 | l_ungetc = i_ungetc;
|
|---|
| 61 | l_eof = 0;
|
|---|
| 62 | f__icptr = a->iciunit;
|
|---|
| 63 | f__icend = f__icptr + a->icirlen*a->icirnum;
|
|---|
| 64 | f__cf = 0;
|
|---|
| 65 | f__curunit = 0;
|
|---|
| 66 | f__elist = (cilist *)a;
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 | #ifdef KR_headers
|
|---|
| 71 | integer s_rsli(a) icilist *a;
|
|---|
| 72 | #else
|
|---|
| 73 | integer s_rsli(icilist *a)
|
|---|
| 74 | #endif
|
|---|
| 75 | {
|
|---|
| 76 | f__lioproc = l_read;
|
|---|
| 77 | f__lquit = 0;
|
|---|
| 78 | f__lcount = 0;
|
|---|
| 79 | c_lir(a);
|
|---|
| 80 | f__doend = 0;
|
|---|
| 81 | return(0);
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | integer e_rsli(Void)
|
|---|
| 85 | { f__init = 1; return 0; }
|
|---|
| 86 |
|
|---|
| 87 | #ifdef KR_headers
|
|---|
| 88 | integer s_rsni(a) icilist *a;
|
|---|
| 89 | #else
|
|---|
| 90 | extern int x_rsne(cilist*);
|
|---|
| 91 |
|
|---|
| 92 | integer s_rsni(icilist *a)
|
|---|
| 93 | #endif
|
|---|
| 94 | {
|
|---|
| 95 | extern int nml_read;
|
|---|
| 96 | integer rv;
|
|---|
| 97 | cilist ca;
|
|---|
| 98 | ca.ciend = a->iciend;
|
|---|
| 99 | ca.cierr = a->icierr;
|
|---|
| 100 | ca.cifmt = a->icifmt;
|
|---|
| 101 | c_lir(a);
|
|---|
| 102 | rv = x_rsne(&ca);
|
|---|
| 103 | nml_read = 0;
|
|---|
| 104 | return rv;
|
|---|
| 105 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.