|
|
1.1 ! root 1: #include "fio.h" ! 2: #include "fmt.h" ! 3: char *icptr,*icend; ! 4: icilist *svic; ! 5: extern int rd_ed(),rd_ned(),w_ed(),w_ned(),y_ierr(); ! 6: extern int z_wnew(); ! 7: int icnum,icpos; ! 8: z_getc() ! 9: { ! 10: if(icptr >= icend) err(svic->iciend,(EOF),"endfile"); ! 11: if(icpos++ < svic->icirlen) ! 12: return(*icptr++); ! 13: else err(svic->icierr,110,"recend"); ! 14: } ! 15: z_putc(c) ! 16: { ! 17: if(icptr >= icend) err(svic->icierr,110,"inwrite"); ! 18: if(icpos++ < svic->icirlen) ! 19: *icptr++ = c; ! 20: else err(svic->icierr,110,"recend"); ! 21: return(0); ! 22: } ! 23: z_rnew() ! 24: { ! 25: icptr = svic->iciunit + (++icnum)*svic->icirlen; ! 26: icpos = 0; ! 27: } ! 28: s_rsfi(a) icilist *a; ! 29: { int n; ! 30: if(n=c_si(a)) return(n); ! 31: reading=1; ! 32: doed=rd_ed; ! 33: doned=rd_ned; ! 34: getn=z_getc; ! 35: dorevert = donewrec = y_ierr; ! 36: doend = z_rnew; ! 37: return(0); ! 38: } ! 39: s_wsfi(a) icilist *a; ! 40: { int n; ! 41: if(n=c_si(a)) return(n); ! 42: reading=0; ! 43: doed=w_ed; ! 44: doned=w_ned; ! 45: putn=z_putc; ! 46: dorevert = donewrec = y_ierr; ! 47: doend = z_wnew; ! 48: return(0); ! 49: } ! 50: c_si(a) icilist *a; ! 51: { ! 52: fmtbuf=a->icifmt; ! 53: if(pars_f(fmtbuf)<0) ! 54: err(a->icierr,100,"startint"); ! 55: fmt_bg(); ! 56: sequential=formatted=1; ! 57: external=0; ! 58: cblank=cplus=scale=0; ! 59: svic=a; ! 60: icnum=icpos=0; ! 61: icptr=svic->iciunit; ! 62: icend=icptr+svic->icirlen*svic->icirnum; ! 63: return(0); ! 64: } ! 65: z_wnew() ! 66: { ! 67: while(icpos++ < svic->icirlen) ! 68: *icptr++ = ' '; ! 69: icpos = 0; ! 70: icnum++; ! 71: } ! 72: e_rsfi() ! 73: { int n; ! 74: n = en_fio(); ! 75: fmtbuf = NULL; ! 76: return(n); ! 77: } ! 78: e_wsfi() ! 79: { ! 80: int n; ! 81: n = en_fio(); ! 82: fmtbuf = NULL; ! 83: if(icnum >= svic->icirnum) ! 84: return(n); ! 85: while(icpos++ < svic->icirlen) ! 86: *icptr++ = ' '; ! 87: return(n); ! 88: } ! 89: y_ierr() ! 90: { ! 91: err(elist->cierr, 110, "iio"); ! 92: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.