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