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


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