dfe.c File Reference

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

Include dependency graph for dfe.c:

Go to the source code of this file.

Functions

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


Function Documentation

int c_dfe ( cilist a  ) 

Definition at line 73 of file dfe.c.

References a, DIR, err, f__cf, f__cursor, f__curunit, f__elist, f__external, f__fmtbuf, f__formatted, f__recpos, f__scale, f__sequential, f__units, fk_open(), FMT, FSEEK, MXUNIT, NULL, OFF_T, SEEK_SET, unit::uend, unit::ufd, unit::ufmt, unit::url, and unit::useek.

Referenced by s_rdfe(), and s_wdfe().

00075 {
00076         f__sequential=0;
00077         f__formatted=f__external=1;
00078         f__elist=a;
00079         f__cursor=f__scale=f__recpos=0;
00080         f__curunit = &f__units[a->ciunit];
00081         if(a->ciunit>MXUNIT || a->ciunit<0)
00082                 err(a->cierr,101,"startchk");
00083         if(f__curunit->ufd==NULL && fk_open(DIR,FMT,a->ciunit))
00084                 err(a->cierr,104,"dfe");
00085         f__cf=f__curunit->ufd;
00086         if(!f__curunit->ufmt) err(a->cierr,102,"dfe")
00087         if(!f__curunit->useek) err(a->cierr,104,"dfe")
00088         f__fmtbuf=a->cifmt;
00089         if(a->cirec <= 0)
00090                 err(a->cierr,130,"dfe")
00091         FSEEK(f__cf,(OFF_T)f__curunit->url * (a->cirec-1),SEEK_SET);
00092         f__curunit->uend = 0;
00093         return(0);
00094 }

Here is the call graph for this function:

Here is the caller graph for this function:

integer e_rdfe ( Void   ) 

Definition at line 140 of file dfe.c.

References en_fio().

00141 {
00142         en_fio();
00143         return 0;
00144 }

Here is the call graph for this function:

integer e_wdfe ( Void   ) 

Definition at line 145 of file dfe.c.

References en_fio().

00146 {
00147         return en_fio();
00148 }

Here is the call graph for this function:

integer s_rdfe ( cilist a  ) 

Definition at line 98 of file dfe.c.

References a, c_dfe(), err, errno, f__curunit, f__doed, f__doend, f__doned, f__donewrec, f__dorevert, f__fmtbuf, f__getn, f__init, f__nowreading(), f__reading, f_init(), fmt_bg(), n, pars_f(), rd_ed(), rd_ned(), unit::uwrt, y_err(), y_getc(), and y_rsk().

00100 {
00101         int n;
00102         if(!f__init) f_init();
00103         f__reading=1;
00104         if(n=c_dfe(a))return(n);
00105         if(f__curunit->uwrt && f__nowreading(f__curunit))
00106                 err(a->cierr,errno,"read start");
00107         f__getn = y_getc;
00108         f__doed = rd_ed;
00109         f__doned = rd_ned;
00110         f__dorevert = f__donewrec = y_err;
00111         f__doend = y_rsk;
00112         if(pars_f(f__fmtbuf)<0)
00113                 err(a->cierr,100,"read start");
00114         fmt_bg();
00115         return(0);
00116 }

Here is the call graph for this function:

integer s_wdfe ( cilist a  ) 

Definition at line 120 of file dfe.c.

References a, c_dfe(), err, errno, f__curunit, f__doed, f__doend, f__doned, f__donewrec, f__dorevert, f__fmtbuf, f__init, f__nowwriting(), f__putn, f__reading, f_init(), fmt_bg(), n, pars_f(), unit::uwrt, w_ed(), w_ned(), x_putc(), y_err(), y_newrec(), and y_rev().

00122 {
00123         int n;
00124         if(!f__init) f_init();
00125         f__reading=0;
00126         if(n=c_dfe(a)) return(n);
00127         if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
00128                 err(a->cierr,errno,"startwrt");
00129         f__putn = x_putc;
00130         f__doed = w_ed;
00131         f__doned= w_ned;
00132         f__dorevert = y_err;
00133         f__donewrec = y_newrec;
00134         f__doend = y_rev;
00135         if(pars_f(f__fmtbuf)<0)
00136                 err(a->cierr,100,"startwrt");
00137         fmt_bg();
00138         return(0);
00139 }

Here is the call graph for this function:

static int y_err ( Void   )  [static]

Definition at line 56 of file dfe.c.

References cilist::cierr, err, and f__elist.

Referenced by s_rdfe(), and s_wdfe().

00057 {
00058         err(f__elist->cierr, 110, "dfe");
00059 }

Here is the caller graph for this function:

int y_getc ( Void   ) 

Definition at line 20 of file dfe.c.

References cilist::cierr, err, errno, f__cf, f__curunit, f__elist, f__recpos, unit::uend, and unit::url.

Referenced by s_rdfe().

00021 {
00022         int ch;
00023         if(f__curunit->uend) return(-1);
00024         if((ch=getc(f__cf))!=EOF)
00025         {
00026                 f__recpos++;
00027                 if(f__curunit->url>=f__recpos ||
00028                         f__curunit->url==1)
00029                         return(ch);
00030                 else    return(' ');
00031         }
00032         if(feof(f__cf))
00033         {
00034                 f__curunit->uend=1;
00035                 errno=0;
00036                 return(-1);
00037         }
00038         err(f__elist->cierr,errno,"readingd");
00039 }

Here is the caller graph for this function:

static int y_newrec ( Void   )  [static]

Definition at line 62 of file dfe.c.

References f__cursor, f__hiwater, and y_rev().

Referenced by s_wdfe().

00063 {
00064         y_rev();
00065         f__hiwater = f__cursor = 0;
00066         return(1);
00067 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int y_rev ( Void   )  [static]

Definition at line 42 of file dfe.c.

References f__curunit, f__hiwater, f__putbuf(), f__recpos, and unit::url.

Referenced by s_wdfe(), and y_newrec().

00043 {
00044         if (f__recpos < f__hiwater)
00045                 f__recpos = f__hiwater;
00046         if (f__curunit->url > 1)
00047                 while(f__recpos < f__curunit->url)
00048                         (*f__putn)(' ');
00049         if (f__recpos)
00050                 f__putbuf(0);
00051         f__recpos = 0;
00052         return(0);
00053 }

Here is the call graph for this function:

Here is the caller graph for this function:

int y_rsk ( Void   ) 

Definition at line 9 of file dfe.c.

References f__cf, f__curunit, f__recpos, unit::uend, and unit::url.

Referenced by s_rdfe().

00010 {
00011         if(f__curunit->uend || f__curunit->url <= f__recpos
00012                 || f__curunit->url == 1) return 0;
00013         do {
00014                 getc(f__cf);
00015         } while(++f__recpos < f__curunit->url);
00016         return 0;
00017 }

Here is the caller graph for this function:


Generated on Sun Mar 4 15:04:18 2007 for Scilab [trunk] by  doxygen 1.5.1