#include "sysdep1.h"
#include "stdio.h"
#include "errno.h"
#include "stddef.h"
Include dependency graph for fio.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | unit |
Defines | |
#define | SEEK_SET 0 |
#define | SEEK_CUR 1 |
#define | SEEK_END 2 |
#define | FOPEN fopen |
#define | FREOPEN freopen |
#define | FSEEK fseek |
#define | FSTAT fstat |
#define | FTELL ftell |
#define | OFF_T long |
#define | STAT_ST stat |
#define | STAT stat |
#define | Void void |
#define | err(f, m, s) {if(f) errno= m; else f__fatal(m,s); return(m);} |
#define | errfl(f, m, s) return err__fl((int)f,m,s) |
#define | MXUNIT 100 |
#define | WRITE 1 |
#define | READ 2 |
#define | SEQ 3 |
#define | DIR 4 |
#define | FMT 5 |
#define | UNF 6 |
#define | EXT 7 |
#define | INT 8 |
#define | buf_end(x) (x->_flag & _IONBF ? x->_ptr : x->_base + BUFSIZ) |
Typedefs | |
typedef long | uiolen |
Functions | |
void | x_putc (int) |
long | f__inode (char *, int *) |
void | sig_die (char *, int) |
void | f__fatal (int, char *) |
int | t_runc (alist *) |
int | f__nowreading (unit *) |
int | f__nowwriting (unit *) |
int | fk_open (int, int, ftnint) |
int | en_fio (void) |
void | f_init (void) |
void | b_char (char *, char *, ftnlen) |
void | g_char (char *, ftnlen, char *) |
int | c_sfe (cilist *) |
int | z_rnew (void) |
int | isatty (int) |
int | err__fl (int, int, char *) |
int | xrd_SL (void) |
int | f__putbuf (int) |
Variables | |
flag | f__init |
cilist * | f__elist |
flag | f__reading |
flag | f__external |
flag | f__sequential |
flag | f__formatted |
int(*) | f__getn (void) |
void(*) | f__putn (int) |
int(* | f__donewrec )(void) |
int(* | t_putc )(int) |
int(*) | x_wSL (void) |
int(*) | f__doend (Void) |
FILE * | f__cf |
unit * | f__curunit |
unit | f__units [] |
int | f__recpos |
OFF_T | f__cursor |
OFF_T | f__hiwater |
#define DIR 4 |
Definition at line 138 of file fio.h.
Referenced by c_dfe(), c_due(), CheckGraphName(), DeleteDirectory(), fk_open(), loadg(), MakeFileList(), OpenTCLsci(), and saveg().
Definition at line 125 of file fio.h.
Referenced by __PARAMS(), addinter(), analyz(), badchleng(), C2F(), c_dfe(), c_due(), c_le(), c_sfe(), c_si(), c_sue(), CallDynInterf(), ccalc12(), ccalc6b(), ccalc8(), cktype(), compgoto_out(), conspower(), contourif(), convci(), CreateCppShared(), CreateShared(), crunch(), data_value(), dataval(), dclerr(), displaynumbers_1(), do_fio(), do_init_data(), do_p1_addr(), do_p1_charp(), do_p1_comp_goto(), do_p1_const(), do_p1_expr(), do_p1_extern(), do_p1_goto(), do_p1_head(), do_p1_ident(), do_p1_label(), do_p1_list(), do_p1_literal(), do_p1_name_pointer(), do_p1_set_line(), do_ud(), do_us(), doentry(), dofclose(), dofinquire(), dofmove(), dofopen(), doio(), doiolist(), drawarcs_1(), drawarrows_1(), drawpolyline_1(), drawpolylines_1(), drawpolymark_1(), drawrectangles_1(), drawsegments_1(), dyninit_(), dynload(), e_rdue(), e_wdue(), e_wsfe(), e_wsfi(), e_wsle(), e_wsue(), endioctl(), endproc(), erri(), errl(), errstr(), exarif(), exasgoto(), exassign(), exdo(), execerr(), execlab(), exenddo(), exequals(), expr_out(), exreturn(), ext14ce(), ext15ce(), ext16ce(), f_back(), f_end(), f_open(), f_rew(), fillarcs_1(), fillpolyline_1(), fillpolylines_1(), fixexpr(), fixtype(), get_rhs_real_hmat(), GetFileWindow(), getname(), handle_onprompt(), hexcheck(), i_ungetc(), int_objfscanf(), int_trunc(), intovfl(), intscicosimc(), intsmget(), intsmgetstr(), intsmput(), intsmputstr(), intsmseek(), intsmtell(), ioclause(), iosetc(), l_C(), l_L(), l_read(), lencat(), lengtype(), list_arg_types(), mkbitcon(), mkcxcon(), mkfunct(), mkpower(), mkstfunct(), mktmpn(), mseek(), mtell(), mv_cur(), new_endif(), nextdata(), opconv(), out_asgoto(), out_call(), p1_const(), parse(), primchk(), putcall(), putif(), putlhsvar(), putwhile(), rd_ed(), s_rdfe(), s_rdue(), s_rsfe(), s_rsle(), s_rsne(), s_rsue(), s_wdfe(), s_wdue(), s_wsfe(), s_wsle(), s_wsne(), s_wsue(), sameconst(), sci2var(), sciblk2(), sciblk2i(), sciblk4(), scichdir(), scigetcwd(), SciLink(), set_externs(), setdata(), setimpl(), start_formatting(), startrw(), stfcall(), str2sci(), syncexec(), t_runc(), var2sci(), wr_ardecls(), wr_char_len(), wr_one_init(), wr_struct(), write_char_init(), x_rsne(), y_err(), y_getc(), yyerror(), yyparse(), and z_getc().
#define FMT 5 |
#define FOPEN fopen |
#define FREOPEN freopen |
#define FSEEK fseek |
Definition at line 26 of file fio.h.
Referenced by c_dfe(), c_due(), e_rdue(), e_rsue(), e_wsue(), f__nowreading(), f__nowwriting(), f_back(), f_open(), fseek64_(), rd_ed(), s_wsue(), and t_runc().
#define FSTAT fstat |
#define FTELL ftell |
Definition at line 34 of file fio.h.
Referenced by e_rdue(), e_wsue(), f__nowreading(), f__nowwriting(), f_back(), ftell64_(), s_wsue(), and t_runc().
#define INT 8 |
Definition at line 142 of file fio.h.
Referenced by C2F(), CheckBMATRIX(), CreBMATRIX(), CreDIMFOREXT(), GetBMATRIX(), GetPOLYNOM(), OutPOLYNOM(), putch1(), putop(), putx(), SciPalette(), WriteCallConvertion(), WriteCallRest(), and WriteVariableOutput().
#define MXUNIT 100 |
#define OFF_T long |
Definition at line 38 of file fio.h.
Referenced by c_dfe(), c_due(), e_rdue(), e_rsue(), e_wsue(), f__nowreading(), f__nowwriting(), f_back(), fseek64_(), s_wsue(), and t_runc().
#define SEEK_CUR 1 |
Definition at line 13 of file fio.h.
Referenced by e_rdue(), e_rsue(), f__nowwriting(), f_back(), fseek64_(), fseek_(), LineRead(), mseek(), rd_ed(), and s_wsue().
#define SEEK_END 2 |
#define SEEK_SET 0 |
Definition at line 12 of file fio.h.
Referenced by c_dfe(), c_due(), e_wsue(), f__nowreading(), f__nowwriting(), f_back(), fseek64_(), fseek_(), int_objfscanf(), mseek(), and OLE_get_block().
#define SEQ 3 |
#define STAT stat |
#define STAT_ST stat |
void b_char | ( | char * | , | |
char * | , | |||
ftnlen | ||||
) |
int en_fio | ( | void | ) |
Definition at line 278 of file err.c.
References errno, f__doend, and f__fatal().
Referenced by Lfinish().
00280 { 00281 if (!f) 00282 f__fatal(m, s); 00283 if (f__doend) 00284 (*f__doend)(); 00285 return errno = m; 00286 }
Here is the call graph for this function:
Here is the caller graph for this function:
void f__fatal | ( | int | , | |
char * | ||||
) |
Definition at line 150 of file err.c.
References f__curunit, f__units, MAXERR, sig_die(), and unit::ufnm.
Referenced by err__fl(), f__bufadj(), l_write(), opn_err(), and unit_chk().
00152 { 00153 if(n<100 && n>=0) perror(s); /*SYSDEP*/ 00154 else if(n >= (int)MAXERR || n < -1) 00155 { fprintf(stderr,"%s: illegal error number %d\n",s,n); 00156 } 00157 else if(n == -1) fprintf(stderr,"%s: end of file\n",s); 00158 else 00159 fprintf(stderr,"%s: %s\n",s,F_err[n-100]); 00160 if (f__curunit) { 00161 fprintf(stderr,"apparent state: unit %d ", 00162 (int)(f__curunit-f__units)); 00163 fprintf(stderr, f__curunit->ufnm ? "named %s\n" : "(unnamed)\n", 00164 f__curunit->ufnm); 00165 } 00166 else 00167 fprintf(stderr,"apparent state: internal I/O\n"); 00168 if (f__fmtbuf) 00169 fprintf(stderr,"last format: %s\n",f__fmtbuf); 00170 fprintf(stderr,"lately %s %s %s %s",f__reading?"reading":"writing", 00171 f__sequential?"sequential":"direct",f__formatted?"formatted":"unformatted", 00172 f__external?"external":"internal"); 00173 sig_die(" IO", 1); 00174 }
Here is the call graph for this function:
Here is the caller graph for this function:
Definition at line 235 of file err.c.
References done, errno, f__w_mode, FREOPEN, FSEEK, FTELL, NULL, OFF_T, SEEK_CUR, SEEK_SET, unit::ufd, unit::ufmt, unit::ufnm, unit::url, unit::urw, and unit::uwrt.
Referenced by s_wdfe(), s_wdue(), s_wsfe(), s_wsle(), s_wsne(), and s_wsue().
00237 { 00238 OFF_T loc; 00239 int ufmt; 00240 extern char *f__w_mode[]; 00241 00242 if (x->urw & 2) { 00243 if (x->urw & 1) 00244 FSEEK(x->ufd, (OFF_T)0, SEEK_CUR); 00245 goto done; 00246 } 00247 if (!x->ufnm) 00248 goto cantwrite; 00249 ufmt = x->url ? 0 : x->ufmt; 00250 if (x->uwrt == 3) { /* just did write, rewind */ 00251 if (!(f__cf = x->ufd = 00252 FREOPEN(x->ufnm,f__w_mode[ufmt],x->ufd))) 00253 goto cantwrite; 00254 x->urw = 2; 00255 } 00256 else { 00257 loc=FTELL(x->ufd); 00258 if (!(f__cf = x->ufd = 00259 FREOPEN(x->ufnm, f__w_mode[ufmt | 2], x->ufd))) 00260 { 00261 x->ufd = NULL; 00262 cantwrite: 00263 errno = 127; 00264 return(1); 00265 } 00266 x->urw = 3; 00267 FSEEK(x->ufd,loc,SEEK_SET); 00268 } 00269 done: 00270 x->uwrt = 1; 00271 return 0; 00272 }
Here is the caller graph for this function:
Definition at line 72 of file open.c.
References f__bufadj(), f__cf, f__hiwater, f__recpos, and s.
Referenced by e_wsle(), x_wSL(), xw_end(), xw_rev(), and y_rev().
00074 { 00075 char *s, *se; 00076 int n; 00077 00078 if (f__hiwater > f__recpos) 00079 f__recpos = f__hiwater; 00080 n = f__recpos + 1; 00081 if (n >= f__buflen) 00082 f__bufadj(n, f__recpos); 00083 s = f__buf; 00084 se = s + f__recpos; 00085 if (c) 00086 *se++ = c; 00087 *se = 0; 00088 for(;;) { 00089 fputs(s, f__cf); 00090 s += strlen(s); 00091 if (s >= se) 00092 break; /* normally happens the first time */ 00093 putc(*s++, f__cf); 00094 } 00095 return 0; 00096 }
Here is the call graph for this function:
Here is the caller graph for this function:
void f_init | ( | void | ) |
Definition at line 285 of file open.c.
References a, DIR, f_open(), FMT, NULL, SEQ, and void().
Referenced by c_dfe(), c_due(), c_le(), c_sfe(), c_sue(), and f_back().
00287 { char nbuf[10]; 00288 olist a; 00289 (void) sprintf(nbuf,"fort.%ld",(long)n); 00290 a.oerr=1; 00291 a.ounit=n; 00292 a.ofnm=nbuf; 00293 a.ofnmlen=strlen(nbuf); 00294 a.osta=NULL; 00295 a.oacc= (char*)(seq==SEQ?"s":"d"); 00296 a.ofm = (char*)(fmt==FMT?"f":"u"); 00297 a.orl = seq==DIR?1:0; 00298 a.oblnk=NULL; 00299 return(f_open(&a)); 00300 }
Here is the call graph for this function:
Here is the caller graph for this function:
void g_char | ( | char * | , | |
ftnlen | , | |||
char * | ||||
) |
Definition at line 12 of file util.c.
Referenced by f_inqu(), f_open(), and opn_err().
00014 { 00015 char *x = a + alen, *y = b + alen; 00016 00017 for(;; y--) { 00018 if (x <= a) { 00019 *b = 0; 00020 return; 00021 } 00022 if (*--x != ' ') 00023 break; 00024 } 00025 *y-- = 0; 00026 do *y-- = *x; 00027 while(x-- > a); 00028 }
Here is the caller graph for this function:
void sig_die | ( | char * | , | |
int | ||||
) |
Definition at line 79 of file endfile.c.
References a, b, done, err, f__cf, f__units, FOPEN, FREOPEN, FSEEK, FTELL, FTRUNCATE, NULL, OFF_T, SEEK_END, and tf.
Referenced by f_back(), f_clos(), f_end(), and f_rew().
00081 { 00082 OFF_T loc, len; 00083 unit *b; 00084 int rc; 00085 FILE *bf; 00086 #ifdef NO_TRUNCATE 00087 FILE *tf; 00088 #endif 00089 00090 b = &f__units[a->aunit]; 00091 if(b->url) 00092 return(0); /*don't truncate direct files*/ 00093 loc=FTELL(bf = b->ufd); 00094 FSEEK(bf,(OFF_T)0,SEEK_END); 00095 len=FTELL(bf); 00096 if (loc >= len || b->useek == 0) 00097 return(0); 00098 #ifdef NO_TRUNCATE 00099 if (b->ufnm == NULL) 00100 return 0; 00101 rc = 0; 00102 fclose(b->ufd); 00103 if (!loc) { 00104 if (!(bf = FOPEN(b->ufnm, f__w_mode[b->ufmt]))) 00105 rc = 1; 00106 if (b->uwrt) 00107 b->uwrt = 1; 00108 goto done; 00109 } 00110 if (!(bf = FOPEN(b->ufnm, f__r_mode[0])) 00111 || !(tf = tmpfile())) { 00112 #ifdef NON_UNIX_STDIO 00113 bad: 00114 #endif 00115 rc = 1; 00116 goto done; 00117 } 00118 if (copy(bf, (long)loc, tf)) { 00119 bad1: 00120 rc = 1; 00121 goto done1; 00122 } 00123 if (!(bf = FREOPEN(b->ufnm, f__w_mode[0], bf))) 00124 goto bad1; 00125 rewind(tf); 00126 if (copy(tf, (long)loc, bf)) 00127 goto bad1; 00128 b->uwrt = 1; 00129 b->urw = 2; 00130 #ifdef NON_UNIX_STDIO 00131 if (b->ufmt) { 00132 fclose(bf); 00133 if (!(bf = FOPEN(b->ufnm, f__w_mode[3]))) 00134 goto bad; 00135 FSEEK(bf,(OFF_T)0,SEEK_END); 00136 b->urw = 3; 00137 } 00138 #endif 00139 done1: 00140 fclose(tf); 00141 done: 00142 f__cf = b->ufd = bf; 00143 #else /* NO_TRUNCATE */ 00144 if (b->urw & 2) 00145 fflush(b->ufd); /* necessary on some Linux systems */ 00146 #ifndef FTRUNCATE 00147 #define FTRUNCATE ftruncate 00148 #endif 00149 rc = FTRUNCATE(fileno(b->ufd), loc); 00150 /* The following FSEEK is unnecessary on some systems, */ 00151 /* but should be harmless. */ 00152 FSEEK(b->ufd, (OFF_T)0, SEEK_END); 00153 #endif /* NO_TRUNCATE */ 00154 if (rc) 00155 err(a->aerr,111,"endfile"); 00156 return 0; 00157 }
Here is the caller graph for this function:
void x_putc | ( | int | ) |
Definition at line 102 of file open.c.
References f__bufadj(), and f__recpos.
Referenced by s_wdfe(), s_wsfe(), s_wsle(), and s_wsne().
00104 { 00105 if (f__recpos >= f__buflen) 00106 f__bufadj(f__recpos, f__buflen); 00107 f__buf[f__recpos++] = c; 00108 }
Here is the call graph for this function:
Here is the caller graph for this function:
int xrd_SL | ( | void | ) |
int z_rnew | ( | void | ) |
FILE* f__cf |
Definition at line 42 of file err.c.
Referenced by c_dfe(), c_due(), c_lir(), c_liw(), c_si(), c_sue(), do_ud(), do_us(), e_rdue(), e_rsue(), e_wdue(), e_wsfe(), e_wsle(), e_wsue(), f__putbuf(), getname(), print_ne(), rd_ed(), s_rsfe(), s_rsue(), s_wsfe(), s_wsue(), t_runc(), x_getc(), x_rsne(), xrd_SL(), xw_end(), y_getc(), and y_rsk().
OFF_T f__cursor |
Definition at line 43 of file err.c.
Referenced by c_dfe(), c_due(), c_le(), c_lir(), c_liw(), c_sfe(), c_si(), c_sue(), do_ud(), e_rdue(), e_rsle(), f__fatal(), f_back(), f_open(), opn_err(), print_ne(), rd_ed(), s_rdfe(), s_rdue(), s_rsfe(), s_rsle(), s_rsne(), s_rsue(), s_wdfe(), s_wdue(), s_wsfe(), s_wsle(), s_wsne(), s_wsue(), t_getc(), x_endp(), x_getc(), xrd_SL(), y_getc(), y_rev(), and y_rsk().
int(* f__donewrec)(void) |
Definition at line 23 of file err.c.
Referenced by ap_end(), c_dfe(), c_due(), c_le(), c_lir(), c_liw(), c_si(), c_sue(), do_fio(), do_ud(), do_us(), e_rdue(), e_wdue(), e_wsfe(), e_wsle(), e_wsue(), getname(), l_C(), l_CHAR(), l_L(), l_R(), l_read(), Lfinish(), mv_cur(), print_ne(), rd_ed(), s_rsfe(), s_rsle(), s_wsfe(), x_rsne(), y_err(), and y_getc().
OFF_T f__hiwater |
int(*) x_wSL(void) |