Annotation of researchv10no/libI77/old1/dfe.c, revision 1.1.1.1

1.1       root        1: #include "f2c.h"
                      2: #include "fio.h"
                      3: #include "fmt.h"
                      4: 
                      5: y_rsk(Void)
                      6: {
                      7:        if(f__curunit->uend || f__curunit->url <= f__recpos
                      8:                || f__curunit->url == 1) return 0;
                      9:        do {
                     10:                getc(f__cf);
                     11:        } while(++f__recpos < f__curunit->url);
                     12:        return 0;
                     13: }
                     14: y_getc(Void)
                     15: {
                     16:        int ch;
                     17:        if(f__curunit->uend) return(-1);
                     18:        if((ch=getc(f__cf))!=EOF)
                     19:        {
                     20:                f__recpos++;
                     21:                if(f__curunit->url>=f__recpos ||
                     22:                        f__curunit->url==1)
                     23:                        return(ch);
                     24:                else    return(' ');
                     25:        }
                     26:        if(feof(f__cf))
                     27:        {
                     28:                f__curunit->uend=1;
                     29:                errno=0;
                     30:                return(-1);
                     31:        }
                     32:        err(f__elist->cierr,errno,"readingd");
                     33: }
                     34: #ifdef KR_headers
                     35: y_putc(c)
                     36: #else
                     37: y_putc(int c)
                     38: #endif
                     39: {
                     40:        f__recpos++;
                     41:        if(f__recpos <= f__curunit->url || f__curunit->url==1)
                     42:                putc(c,f__cf);
                     43:        else
                     44:                err(f__elist->cierr,110,"dout");
                     45:        return(0);
                     46: }
                     47: y_rev(Void)
                     48: {      /*what about work done?*/
                     49:        if(f__curunit->url==1 || f__recpos==f__curunit->url)
                     50:                return(0);
                     51:        while(f__recpos<f__curunit->url)
                     52:                (*f__putn)(' ');
                     53:        f__recpos=0;
                     54:        return(0);
                     55: }
                     56: y_err(Void)
                     57: {
                     58:        err(f__elist->cierr, 110, "dfe");
                     59: }
                     60: 
                     61: y_newrec(Void)
                     62: {
                     63:        if(f__curunit->url == 1 || f__recpos == f__curunit->url) {
                     64:                f__hiwater = f__recpos = f__cursor = 0;
                     65:                return(1);
                     66:        }
                     67:        if(f__hiwater > f__recpos)
                     68:                f__recpos = f__hiwater;
                     69:        y_rev();
                     70:        f__hiwater = f__cursor = 0;
                     71:        return(1);
                     72: }
                     73: 
                     74: #ifdef KR_headers
                     75: c_dfe(a) cilist *a;
                     76: #else
                     77: c_dfe(cilist *a)
                     78: #endif
                     79: {
                     80:        f__sequential=0;
                     81:        f__formatted=f__external=1;
                     82:        f__elist=a;
                     83:        f__cursor=f__scale=f__recpos=0;
                     84:        if(a->ciunit>MXUNIT || a->ciunit<0)
                     85:                err(a->cierr,101,"startchk");
                     86:        f__curunit = &f__units[a->ciunit];
                     87:        if(f__curunit->ufd==NULL && fk_open(DIR,FMT,a->ciunit))
                     88:                err(a->cierr,104,"dfe");
                     89:        f__cf=f__curunit->ufd;
                     90:        if(!f__curunit->ufmt) err(a->cierr,102,"dfe")
                     91:        if(!f__curunit->useek) err(a->cierr,104,"dfe")
                     92:        f__fmtbuf=a->cifmt;
                     93:        (void) fseek(f__cf,(long)f__curunit->url * (a->cirec-1),SEEK_SET);
                     94:        f__curunit->uend = 0;
                     95:        return(0);
                     96: }
                     97: #ifdef KR_headers
                     98: integer s_rdfe(a) cilist *a;
                     99: #else
                    100: integer s_rdfe(cilist *a)
                    101: #endif
                    102: {
                    103:        int n;
                    104:        if(!f__init) f_init();
                    105:        if(n=c_dfe(a))return(n);
                    106:        f__reading=1;
                    107:        if(f__curunit->uwrt && f__nowreading(f__curunit))
                    108:                err(a->cierr,errno,"read start");
                    109:        f__getn = y_getc;
                    110:        f__doed = rd_ed;
                    111:        f__doned = rd_ned;
                    112:        f__dorevert = f__donewrec = y_err;
                    113:        f__doend = y_rsk;
                    114:        if(pars_f(f__fmtbuf)<0)
                    115:                err(a->cierr,100,"read start");
                    116:        fmt_bg();
                    117:        return(0);
                    118: }
                    119: #ifdef KR_headers
                    120: integer s_wdfe(a) cilist *a;
                    121: #else
                    122: integer s_wdfe(cilist *a)
                    123: #endif
                    124: {
                    125:        int n;
                    126:        if(!f__init) f_init();
                    127:        if(n=c_dfe(a)) return(n);
                    128:        f__reading=0;
                    129:        if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
                    130:                err(a->cierr,errno,"startwrt");
                    131:        f__putn = y_putc;
                    132:        f__doed = w_ed;
                    133:        f__doned= w_ned;
                    134:        f__dorevert = y_err;
                    135:        f__donewrec = y_newrec;
                    136:        f__doend = y_rev;
                    137:        if(pars_f(f__fmtbuf)<0)
                    138:                err(a->cierr,100,"startwrt");
                    139:        fmt_bg();
                    140:        return(0);
                    141: }
                    142: integer e_rdfe(Void)
                    143: {
                    144:        (void) en_fio();
                    145:        return(0);
                    146: }
                    147: integer e_wdfe(Void)
                    148: {
                    149:        (void) en_fio();
                    150:        return(0);
                    151: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.