1: /* 2: char id_rwiio[] = "@(#)rwiio.c 1.1"; 3: * 4: * internal (character array) i/o 5: * common routines 6: */ 7: 8: #include "fio.h" 9: #include "lio.h" 10: 11: c_fi(a) icilist *a; 12: { 13: fmtbuf=a->icifmt; 14: formatted = FORMATTED; 15: external = NO; 16: cblank=cplus=NO; 17: scale=cursor=0; 18: radix = 10; 19: signit = YES; 20: elist = YES; 21: svic = a; 22: recpos=reclen=0; 23: icend = a->iciunit + a->icirnum*a->icirlen; 24: errflag = a->icierr; 25: endflag = a->iciend; 26: if(pars_f(fmtbuf)) err(errflag,F_ERFMT,"ifio") 27: fmt_bg(); 28: return(OK); 29: } 30: c_si(a) icilist *a; 31: { 32: sequential = YES; 33: recnum = 0; 34: icptr = a->iciunit; 35: return(c_fi(a)); 36: } 37: c_di(a) icilist *a; 38: { 39: sequential = NO; 40: recnum = a->icirec - 1; 41: icptr = a->iciunit + recnum*a->icirlen; 42: return(c_fi(a)); 43: } 44: z_tab() 45: { int n; 46: if(reclen < recpos) reclen = recpos; 47: if((recpos + cursor) < 0) cursor = -recpos; /* to BOR */ 48: n = reclen - recpos; 49: if(!reading && (cursor-n) > 0) 50: { icptr += n; 51: recpos = reclen; 52: cursor -= n; 53: while(cursor--) if(n=(*putn)(' ')) return(n); 54: } 55: else 56: { icptr += cursor; 57: recpos += cursor; 58: } 59: return(cursor=0); 60: } 61: c_li(a) icilist *a; 62: { 63: fmtbuf="int list io"; 64: sequential = formatted = LISTDIRECTED; 65: external = NO; 66: elist = YES; 67: svic = a; 68: recnum = recpos = 0; 69: cplus = cblank = NO; 70: icptr = a->iciunit; 71: icend = icptr + a->icirlen * a->icirnum; 72: errflag = a->icierr; 73: endflag = a->iciend; 74: leof = NO; 75: return(OK); 76: }