1: /* 2: char id_riio[]= "@(#)riio.c 1.1"; 3: * 4: * read internal (character array) i/o 5: */ 6: 7: #include "fio.h" 8: #include "lio.h" 9: 10: int z_rnew(); 11: extern l_read(); 12: extern int rd_ed(), rd_ned(), z_tab(); 13: 14: z_getc() 15: { 16: if(icptr >= icend && !recpos) /* new rec beyond eof */ 17: { leof = EOF; 18: return(EOF); 19: } 20: if(recpos++ < svic->icirlen) return(*icptr++); 21: return(' '); 22: } 23: 24: z_ungetc(ch,cf) char ch; 25: { if(ch==EOF || --recpos >= svic->icirlen) return(OK); 26: if(--icptr < svic->iciunit || recpos < 0) err(errflag,F_ERBREC,"ilio") 27: *icptr = ch; 28: return(OK); 29: } 30: 31: s_rsfi(a) icilist *a; 32: { 33: reading = YES; 34: doed=rd_ed; 35: doned=rd_ned; 36: getn=z_getc; 37: doend = donewrec = z_rnew; 38: dorevert = z_rnew; 39: dotab = z_tab; 40: return(c_si(a)); 41: } 42: 43: s_rdfi(a) icilist *a; 44: { 45: reading = YES; 46: doed = rd_ed; 47: doned = rd_ned; 48: getn = z_getc; 49: donewrec = z_rnew; 50: dorevert = doend = z_rnew; 51: dotab = z_tab; 52: return(c_di(a)); 53: } 54: 55: z_rnew() 56: { 57: icptr = svic->iciunit + (++recnum)*svic->icirlen; 58: recpos = reclen = cursor = 0; 59: return(OK); 60: } 61: 62: e_rsfi() 63: { int n; 64: n = en_fio(); 65: fmtbuf = NULL; 66: return(n); 67: } 68: 69: e_rdfi() 70: { 71: return(e_rsfi()); 72: } 73: 74: s_rsli(a) icilist *a; 75: { 76: reading = YES; 77: lioproc = l_read; 78: getn = z_getc; 79: ungetn = z_ungetc; 80: l_first = YES; 81: lcount = 0; 82: lquit = NO; 83: return(c_li(a)); 84: } 85: 86: e_rsli() 87: { fmtbuf = NULL; 88: return(OK); 89: }