Doxygen Source Code Documentation
rsli.c
Go to the documentation of this file.00001 #include "f2c.h" 00002 #include "fio.h" 00003 #include "lio.h" 00004 #include "fmt.h" /* for f__doend */ 00005 00006 extern flag f__lquit; 00007 extern int f__lcount; 00008 extern char *f__icptr; 00009 extern char *f__icend; 00010 extern icilist *f__svic; 00011 extern int f__icnum, f__recpos; 00012 00013 static int i_getc(Void) 00014 { 00015 if(f__recpos >= f__svic->icirlen) { 00016 if (f__recpos++ == f__svic->icirlen) 00017 return '\n'; 00018 z_rnew(); 00019 } 00020 f__recpos++; 00021 if(f__icptr >= f__icend) 00022 return EOF; 00023 return(*f__icptr++); 00024 } 00025 00026 static 00027 #ifdef KR_headers 00028 int i_ungetc(ch, f) int ch; FILE *f; 00029 #else 00030 int i_ungetc(int ch, FILE *f) 00031 #endif 00032 { 00033 if (--f__recpos == f__svic->icirlen) 00034 return '\n'; 00035 if (f__recpos < -1) 00036 err(f__svic->icierr,110,"recend"); 00037 /* *--icptr == ch, and icptr may point to read-only memory */ 00038 return *--f__icptr /* = ch */; 00039 } 00040 00041 static void 00042 #ifdef KR_headers 00043 c_lir(a) icilist *a; 00044 #else 00045 c_lir(icilist *a) 00046 #endif 00047 { 00048 extern int l_eof; 00049 f__reading = 1; 00050 f__external = 0; 00051 f__formatted = 1; 00052 f__svic = a; 00053 L_len = a->icirlen; 00054 f__recpos = -1; 00055 f__icnum = f__recpos = 0; 00056 f__cursor = 0; 00057 l_getc = i_getc; 00058 l_ungetc = i_ungetc; 00059 l_eof = 0; 00060 f__icptr = a->iciunit; 00061 f__icend = f__icptr + a->icirlen*a->icirnum; 00062 f__cf = 0; 00063 f__curunit = 0; 00064 f__elist = (cilist *)a; 00065 } 00066 00067 00068 #ifdef KR_headers 00069 integer s_rsli(a) icilist *a; 00070 #else 00071 integer s_rsli(icilist *a) 00072 #endif 00073 { 00074 f__lioproc = l_read; 00075 f__lquit = 0; 00076 f__lcount = 0; 00077 c_lir(a); 00078 f__doend = 0; 00079 return(0); 00080 } 00081 00082 integer e_rsli(Void) 00083 { return 0; } 00084 00085 #ifdef KR_headers 00086 integer s_rsni(a) icilist *a; 00087 #else 00088 extern int x_rsne(cilist*); 00089 00090 integer s_rsni(icilist *a) 00091 #endif 00092 { 00093 extern int nml_read; 00094 integer rv; 00095 cilist ca; 00096 ca.ciend = a->iciend; 00097 ca.cierr = a->icierr; 00098 ca.cifmt = a->icifmt; 00099 c_lir(a); 00100 rv = x_rsne(&ca); 00101 nml_read = 0; 00102 return rv; 00103 }