iio.c
Go to the documentation of this file.
00001 #include "f2c.h"
00002 #include "fio.h"
00003 #include "fmt.h"
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007 extern char *f__icptr;
00008 char *f__icend;
00009 extern icilist *f__svic;
00010 int f__icnum;
00011 
00012  int
00013 z_getc(Void)
00014 {
00015         if(f__recpos++ < f__svic->icirlen) {
00016                 if(f__icptr >= f__icend) err(f__svic->iciend,(EOF),"endfile");
00017                 return(*(unsigned char *)f__icptr++);
00018                 }
00019         return '\n';
00020 }
00021 
00022  void
00023 #ifdef KR_headers
00024 z_putc(c)
00025 #else
00026 z_putc(int c)
00027 #endif
00028 {
00029         if (f__icptr < f__icend && f__recpos++ < f__svic->icirlen)
00030                 *f__icptr++ = c;
00031 }
00032 
00033  int
00034 z_rnew(Void)
00035 {
00036         f__icptr = f__svic->iciunit + (++f__icnum)*f__svic->icirlen;
00037         f__recpos = 0;
00038         f__cursor = 0;
00039         f__hiwater = 0;
00040         return 1;
00041 }
00042 
00043  static int
00044 z_endp(Void)
00045 {
00046         (*f__donewrec)();
00047         return 0;
00048         }
00049 
00050  int
00051 #ifdef KR_headers
00052 c_si(a) icilist *a;
00053 #else
00054 c_si(icilist *a)
00055 #endif
00056 {
00057         f__elist = (cilist *)a;
00058         f__fmtbuf=a->icifmt;
00059         f__curunit = 0;
00060         f__sequential=f__formatted=1;
00061         f__external=0;
00062         if(pars_f(f__fmtbuf)<0)
00063                 err(a->icierr,100,"startint");
00064         fmt_bg();
00065         f__cblank=f__cplus=f__scale=0;
00066         f__svic=a;
00067         f__icnum=f__recpos=0;
00068         f__cursor = 0;
00069         f__hiwater = 0;
00070         f__icptr = a->iciunit;
00071         f__icend = f__icptr + a->icirlen*a->icirnum;
00072         f__cf = 0;
00073         return(0);
00074 }
00075 
00076  int
00077 iw_rev(Void)
00078 {
00079         if(f__workdone)
00080                 z_endp();
00081         f__hiwater = f__recpos = f__cursor = 0;
00082         return(f__workdone=0);
00083         }
00084 
00085 #ifdef KR_headers
00086 integer s_rsfi(a) icilist *a;
00087 #else
00088 integer s_rsfi(icilist *a)
00089 #endif
00090 {       int n;
00091         if(n=c_si(a)) return(n);
00092         f__reading=1;
00093         f__doed=rd_ed;
00094         f__doned=rd_ned;
00095         f__getn=z_getc;
00096         f__dorevert = z_endp;
00097         f__donewrec = z_rnew;
00098         f__doend = z_endp;
00099         return(0);
00100 }
00101 
00102  int
00103 z_wnew(Void)
00104 {
00105         if (f__recpos < f__hiwater) {
00106                 f__icptr += f__hiwater - f__recpos;
00107                 f__recpos = f__hiwater;
00108                 }
00109         while(f__recpos++ < f__svic->icirlen)
00110                 *f__icptr++ = ' ';
00111         f__recpos = 0;
00112         f__cursor = 0;
00113         f__hiwater = 0;
00114         f__icnum++;
00115         return 1;
00116 }
00117 #ifdef KR_headers
00118 integer s_wsfi(a) icilist *a;
00119 #else
00120 integer s_wsfi(icilist *a)
00121 #endif
00122 {       int n;
00123         if(n=c_si(a)) return(n);
00124         f__reading=0;
00125         f__doed=w_ed;
00126         f__doned=w_ned;
00127         f__putn=z_putc;
00128         f__dorevert = iw_rev;
00129         f__donewrec = z_wnew;
00130         f__doend = z_endp;
00131         return(0);
00132 }
00133 integer e_rsfi(Void)
00134 {       int n = en_fio();
00135         f__fmtbuf = NULL;
00136         return(n);
00137 }
00138 integer e_wsfi(Void)
00139 {
00140         int n;
00141         n = en_fio();
00142         f__fmtbuf = NULL;
00143         if(f__svic->icirnum != 1
00144          && (f__icnum >  f__svic->icirnum
00145          || (f__icnum == f__svic->icirnum && (f__recpos | f__hiwater))))
00146                 err(f__svic->icierr,110,"inwrite");
00147         if (f__recpos < f__hiwater)
00148                 f__recpos = f__hiwater;
00149         if (f__recpos >= f__svic->icirlen)
00150                 err(f__svic->icierr,110,"recend");
00151         if (!f__recpos && f__icnum)
00152                 return n;
00153         while(f__recpos++ < f__svic->icirlen)
00154                 *f__icptr++ = ' ';
00155         return n;
00156 }
00157 #ifdef __cplusplus
00158 }
00159 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:50