|
Last change
on this file since 603 was 2, checked in by bird, 23 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | /* read sequential formatted external */
|
|---|
| 2 | #include "config.h"
|
|---|
| 3 | #include "f2c.h"
|
|---|
| 4 | #include "fio.h"
|
|---|
| 5 | #include "fmt.h"
|
|---|
| 6 |
|
|---|
| 7 | xrd_SL(Void)
|
|---|
| 8 | { int ch;
|
|---|
| 9 | if(!f__curunit->uend)
|
|---|
| 10 | while((ch=getc(f__cf))!='\n')
|
|---|
| 11 | if (ch == EOF) {
|
|---|
| 12 | f__curunit->uend = 1;
|
|---|
| 13 | break;
|
|---|
| 14 | }
|
|---|
| 15 | f__cursor=f__recpos=0;
|
|---|
| 16 | return(1);
|
|---|
| 17 | }
|
|---|
| 18 | x_getc(Void)
|
|---|
| 19 | { int ch;
|
|---|
| 20 | if(f__curunit->uend) return(EOF);
|
|---|
| 21 | ch = getc(f__cf);
|
|---|
| 22 | if(ch!=EOF && ch!='\n')
|
|---|
| 23 | { f__recpos++;
|
|---|
| 24 | return(ch);
|
|---|
| 25 | }
|
|---|
| 26 | if(ch=='\n')
|
|---|
| 27 | { (void) ungetc(ch,f__cf);
|
|---|
| 28 | return(ch);
|
|---|
| 29 | }
|
|---|
| 30 | if(f__curunit->uend || feof(f__cf))
|
|---|
| 31 | { errno=0;
|
|---|
| 32 | f__curunit->uend=1;
|
|---|
| 33 | return(-1);
|
|---|
| 34 | }
|
|---|
| 35 | return(-1);
|
|---|
| 36 | }
|
|---|
| 37 | x_endp(Void)
|
|---|
| 38 | {
|
|---|
| 39 | xrd_SL();
|
|---|
| 40 | return f__curunit->uend == 1 ? EOF : 0;
|
|---|
| 41 | }
|
|---|
| 42 | x_rev(Void)
|
|---|
| 43 | {
|
|---|
| 44 | (void) xrd_SL();
|
|---|
| 45 | return(0);
|
|---|
| 46 | }
|
|---|
| 47 | #ifdef KR_headers
|
|---|
| 48 | integer s_rsfe(a) cilist *a; /* start */
|
|---|
| 49 | #else
|
|---|
| 50 | integer s_rsfe(cilist *a) /* start */
|
|---|
| 51 | #endif
|
|---|
| 52 | { int n;
|
|---|
| 53 | if(f__init != 1) f_init();
|
|---|
| 54 | f__init = 3;
|
|---|
| 55 | f__reading=1;
|
|---|
| 56 | f__sequential=1;
|
|---|
| 57 | f__formatted=1;
|
|---|
| 58 | f__external=1;
|
|---|
| 59 | if(n=c_sfe(a)) return(n);
|
|---|
| 60 | f__elist=a;
|
|---|
| 61 | f__cursor=f__recpos=0;
|
|---|
| 62 | f__scale=0;
|
|---|
| 63 | f__fmtbuf=a->cifmt;
|
|---|
| 64 | f__curunit= &f__units[a->ciunit];
|
|---|
| 65 | f__cf=f__curunit->ufd;
|
|---|
| 66 | if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
|
|---|
| 67 | f__getn= x_getc;
|
|---|
| 68 | f__doed= rd_ed;
|
|---|
| 69 | f__doned= rd_ned;
|
|---|
| 70 | fmt_bg();
|
|---|
| 71 | f__doend=x_endp;
|
|---|
| 72 | f__donewrec=xrd_SL;
|
|---|
| 73 | f__dorevert=x_rev;
|
|---|
| 74 | f__cblank=f__curunit->ublnk;
|
|---|
| 75 | f__cplus=0;
|
|---|
| 76 | if(f__curunit->uwrt && f__nowreading(f__curunit))
|
|---|
| 77 | err(a->cierr,errno,"read start");
|
|---|
| 78 | if(f__curunit->uend)
|
|---|
| 79 | err(f__elist->ciend,(EOF),"read start");
|
|---|
| 80 | return(0);
|
|---|
| 81 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.