Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

rsfe.c

Go to the documentation of this file.
00001 /* read sequential formatted external */
00002 #include "f2c.h"
00003 #include "fio.h"
00004 #include "fmt.h"
00005 
00006 xrd_SL(Void)
00007 {       int ch;
00008         if(!f__curunit->uend)
00009                 while((ch=getc(f__cf))!='\n')
00010                         if (ch == EOF) {
00011                                 f__curunit->uend = 1;
00012                                 break;
00013                                 }
00014         f__cursor=f__recpos=0;
00015         return(1);
00016 }
00017 x_getc(Void)
00018 {       int ch;
00019         if(f__curunit->uend) return(EOF);
00020         ch = getc(f__cf);
00021         if(ch!=EOF && ch!='\n')
00022         {       f__recpos++;
00023                 return(ch);
00024         }
00025         if(ch=='\n')
00026         {       (void) ungetc(ch,f__cf);
00027                 return(ch);
00028         }
00029         if(f__curunit->uend || feof(f__cf))
00030         {       errno=0;
00031                 f__curunit->uend=1;
00032                 return(-1);
00033         }
00034         return(-1);
00035 }
00036 x_endp(Void)
00037 {
00038         xrd_SL();
00039         return f__curunit->uend == 1 ? EOF : 0;
00040 }
00041 x_rev(Void)
00042 {
00043         (void) xrd_SL();
00044         return(0);
00045 }
00046 #ifdef KR_headers
00047 integer s_rsfe(a) cilist *a; /* start */
00048 #else
00049 integer s_rsfe(cilist *a) /* start */
00050 #endif
00051 {       int n;
00052         if(!f__init) f_init();
00053         if(n=c_sfe(a)) return(n);
00054         f__reading=1;
00055         f__sequential=1;
00056         f__formatted=1;
00057         f__external=1;
00058         f__elist=a;
00059         f__cursor=f__recpos=0;
00060         f__scale=0;
00061         f__fmtbuf=a->cifmt;
00062         f__curunit= &f__units[a->ciunit];
00063         f__cf=f__curunit->ufd;
00064         if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
00065         f__getn= x_getc;
00066         f__doed= rd_ed;
00067         f__doned= rd_ned;
00068         fmt_bg();
00069         f__doend=x_endp;
00070         f__donewrec=xrd_SL;
00071         f__dorevert=x_rev;
00072         f__cblank=f__curunit->ublnk;
00073         f__cplus=0;
00074         if(f__curunit->uwrt && f__nowreading(f__curunit))
00075                 err(a->cierr,errno,"read start");
00076         if(f__curunit->uend)
00077                 err(f__elist->ciend,(EOF),"read start");
00078         return(0);
00079 }
 

Powered by Plone

This site conforms to the following standards: