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