1: /*
2: char id_dfe[] = "@(#)dfe.c 1.4";
3: *
4: * direct formatted external i/o
5: */
6:
7: #include "fio.h"
8:
9: extern int rd_ed(),rd_ned(),w_ed(),w_ned();
10: int y_tab();
11:
12: extern char rdfe[];
13: extern char wdfe[];
14:
15: e_rdfe()
16: {
17: en_fio();
18: return(OK);
19: }
20:
21: e_wdfe()
22: {
23: en_fio();
24: return(OK);
25: }
26:
27: c_dfe(a,flag) cilist *a;
28: { int n;
29: sequential = NO;
30: external = formatted = FORMATTED;
31: lfname = NULL;
32: elist = NO;
33: cursor=scale=recpos=reclen=0;
34: radix = 10;
35: signit = YES;
36: fmtbuf = a->cifmt;
37: errflag = a->cierr;
38: endflag = a->ciend;
39: lunit = a->ciunit;
40: if(not_legal(lunit)) err(errflag,F_ERUNIT,rdfe+5);
41: curunit = &units[lunit];
42: if(!curunit->ufd && (n=fk_open(flag,DIR,FMT,(ftnint)lunit)))
43: err(errflag,n,rdfe+5)
44: cf = curunit->ufd;
45: elist = YES;
46: lfname = curunit->ufnm;
47: if(!curunit->ufmt) err(errflag,F_ERNOFIO,rdfe+5)
48: if(!curunit->useek || !curunit->url) err(errflag,F_ERNODIO,rdfe+5)
49: recnum = a->cirec - 1;
50: fseek(cf, (long)curunit->url * recnum, 0);
51: cblank = curunit->ublnk;
52: cplus = NO;
53: return(OK);
54: }
55:
56: y_tab()
57: { int n;
58: if(curunit->url==1)
59: {
60: if(cursor < 0 && -cursor > ftell(cf)) rewind(cf);
61: else fseek(cf,(long)cursor,1);
62: return(cursor=0);
63: }
64: else
65: { if(reclen < recpos) reclen = recpos;
66: if((recpos + cursor) < 0) cursor = -recpos; /* BOR */
67: n = reclen - recpos; /* n >= 0 */
68: if(!reading && (cursor-n) > 0)
69: { recpos = reclen;
70: cursor -= n;
71: fseek(cf,(long)n,1);
72: while(cursor--) if(n=(*putn)(' ')) return(n);
73: return(cursor=0);
74: }
75: recpos += cursor;
76: if(recpos >= curunit->url) err(errflag,F_EREREC,rdfe+5)
77: }
78: fseek(cf,(long)cursor,1);
79: return(cursor=0);
80: }
81:
82: /*
83: /*y_rev()
84: /*{ /*what about work done?*/
85: /* if(curunit->url==1) return(0);
86: /* while(recpos<curunit->url) (*putn)(' ');
87: /* recpos=0;
88: /* return(0);
89: /*}
90: /*
91: /*y_err()
92: /*{
93: /* err(errflag, F_EREREC, rdfe+5);
94: /*}
95: */
Defined functions
c_dfe
defined in line
27; used 2 times
y_tab
defined in line
56; used 5 times