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  

dfe.c File Reference

#include "f2c.h"
#include "fio.h"
#include "fmt.h"

Go to the source code of this file.


Functions

 y_rsk (Void)
 y_getc (Void)
 y_putc (int c)
 y_rev (Void)
 y_err (Void)
 y_newrec (Void)
 c_dfe (cilist *a)
integer s_rdfe (cilist *a)
integer s_wdfe (cilist *a)
integer e_rdfe (Void)
integer e_wdfe (Void)

Function Documentation

c_dfe cilist   a
 

Definition at line 83 of file dfe.c.

References cilist::cierr, cilist::cifmt, cilist::cirec, cilist::ciunit, DIR, err, fk_open(), FMT, and MXUNIT.

Referenced by s_rdfe(), and s_wdfe().

00085 {
00086         f__sequential=0;
00087         f__formatted=f__external=1;
00088         f__elist=a;
00089         f__cursor=f__scale=f__recpos=0;
00090         if(a->ciunit>MXUNIT || a->ciunit<0)
00091                 err(a->cierr,101,"startchk");
00092         f__curunit = &f__units[a->ciunit];
00093         if(f__curunit->ufd==NULL && fk_open(DIR,FMT,a->ciunit))
00094                 err(a->cierr,104,"dfe");
00095         f__cf=f__curunit->ufd;
00096         if(!f__curunit->ufmt) err(a->cierr,102,"dfe")
00097         if(!f__curunit->useek) err(a->cierr,104,"dfe")
00098         f__fmtbuf=a->cifmt;
00099         (void) fseek(f__cf,(long)f__curunit->url * (a->cirec-1),SEEK_SET);
00100         f__curunit->uend = 0;
00101         return(0);
00102 }

integer e_rdfe Void   
 

Definition at line 148 of file dfe.c.

References en_fio().

00149 {
00150         (void) en_fio();
00151         return(0);
00152 }

integer e_wdfe Void   
 

Definition at line 153 of file dfe.c.

References en_fio().

00154 {
00155         return en_fio();
00156 }

integer s_rdfe cilist   a
 

Definition at line 106 of file dfe.c.

References c_dfe(), cilist::cierr, err, f__nowreading(), f_init(), fmt_bg(), pars_f(), y_err(), y_getc(), and y_rsk().

00108 {
00109         int n;
00110         if(!f__init) f_init();
00111         if(n=c_dfe(a))return(n);
00112         f__reading=1;
00113         if(f__curunit->uwrt && f__nowreading(f__curunit))
00114                 err(a->cierr,errno,"read start");
00115         f__getn = y_getc;
00116         f__doed = rd_ed;
00117         f__doned = rd_ned;
00118         f__dorevert = f__donewrec = y_err;
00119         f__doend = y_rsk;
00120         if(pars_f(f__fmtbuf)<0)
00121                 err(a->cierr,100,"read start");
00122         fmt_bg();
00123         return(0);
00124 }

integer s_wdfe cilist   a
 

Definition at line 128 of file dfe.c.

References c_dfe(), cilist::cierr, err, f__nowwriting(), f_init(), fmt_bg(), pars_f(), y_err(), y_newrec(), y_putc(), and y_rev().

00130 {
00131         int n;
00132         if(!f__init) f_init();
00133         if(n=c_dfe(a)) return(n);
00134         f__reading=0;
00135         if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
00136                 err(a->cierr,errno,"startwrt");
00137         f__putn = y_putc;
00138         f__doed = w_ed;
00139         f__doned= w_ned;
00140         f__dorevert = y_err;
00141         f__donewrec = y_newrec;
00142         f__doend = y_rev;
00143         if(pars_f(f__fmtbuf)<0)
00144                 err(a->cierr,100,"startwrt");
00145         fmt_bg();
00146         return(0);
00147 }

y_err Void   
 

Definition at line 59 of file dfe.c.

References err.

Referenced by s_rdfe(), and s_wdfe().

00060 {
00061         err(f__elist->cierr, 110, "dfe");
00062 #ifdef __cplusplus
00063         return 0;
00064 #endif
00065 }

y_getc Void   
 

Definition at line 14 of file dfe.c.

References err.

Referenced by s_rdfe().

00015 {
00016         int ch;
00017         if(f__curunit->uend) return(-1);
00018         if((ch=getc(f__cf))!=EOF)
00019         {
00020                 f__recpos++;
00021                 if(f__curunit->url>=f__recpos ||
00022                         f__curunit->url==1)
00023                         return(ch);
00024                 else    return(' ');
00025         }
00026         if(feof(f__cf))
00027         {
00028                 f__curunit->uend=1;
00029                 errno=0;
00030                 return(-1);
00031         }
00032         err(f__elist->cierr,errno,"readingd");
00033 #ifdef __cplusplus
00034         return 0;
00035 #endif
00036 }

y_newrec Void   
 

Definition at line 67 of file dfe.c.

References y_rev().

Referenced by s_wdfe().

00068 {
00069         if(f__curunit->url == 1 || f__recpos == f__curunit->url) {
00070                 f__hiwater = f__recpos = f__cursor = 0;
00071                 return(1);
00072         }
00073         if(f__hiwater > f__recpos)
00074                 f__recpos = f__hiwater;
00075         y_rev();
00076         f__hiwater = f__cursor = 0;
00077         return(1);
00078 }

y_putc int    c
 

Definition at line 40 of file dfe.c.

References c, and err.

Referenced by s_wdfe().

00042 {
00043         f__recpos++;
00044         if(f__recpos <= f__curunit->url || f__curunit->url==1)
00045                 putc(c,f__cf);
00046         else
00047                 err(f__elist->cierr,110,"dout");
00048         return(0);
00049 }

y_rev Void   
 

Definition at line 50 of file dfe.c.

Referenced by s_wdfe(), and y_newrec().

00051 {       /*what about work done?*/
00052         if(f__curunit->url==1 || f__recpos==f__curunit->url)
00053                 return(0);
00054         while(f__recpos<f__curunit->url)
00055                 (*f__putn)(' ');
00056         f__recpos=0;
00057         return(0);
00058 }

y_rsk Void   
 

Definition at line 5 of file dfe.c.

Referenced by s_rdfe().

00006 {
00007         if(f__curunit->uend || f__curunit->url <= f__recpos
00008                 || f__curunit->url == 1) return 0;
00009         do {
00010                 getc(f__cf);
00011         } while(++f__recpos < f__curunit->url);
00012         return 0;
00013 }
 

Powered by Plone

This site conforms to the following standards: