diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-01-20 04:59:39 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-01-20 04:59:39 +0000 |
commit | 62e648e148b3cb9f96dcce808c55c02b7ccb4486 (patch) | |
tree | 9708892ece92e860d81559ab55e6b1f9400d7ffc /rubyio.h | |
parent | aeb049c573be4dc24dd20650f40e4777e0f698cf (diff) |
ruby 1.3 cycle
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/RUBY@372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rubyio.h')
-rw-r--r-- | rubyio.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/rubyio.h b/rubyio.h new file mode 100644 index 0000000000..5b8baf0f15 --- /dev/null +++ b/rubyio.h @@ -0,0 +1,60 @@ +/************************************************ + + rubyio.h - + + $Author$ + $Revision$ + $Date$ + created at: Fri Nov 12 16:47:09 JST 1993 + + Copyright (C) 1993-1998 Yukihiro Matsumoto + +************************************************/ + +#ifndef IO_H +#define IO_H + +#include <stdio.h> +#include <errno.h> + +typedef struct OpenFile { + FILE *f; /* stdio ptr for read/write */ + FILE *f2; /* additional ptr for rw pipes */ + int mode; /* mode flags */ + int pid; /* child's pid (for pipes) */ + int lineno; /* number of lines read */ + char *path; /* pathname for file */ + void (*finalize)(); /* finalize proc */ +} OpenFile; + +#define FMODE_READABLE 1 +#define FMODE_WRITABLE 2 +#define FMODE_READWRITE 3 +#define FMODE_BINMODE 4 +#define FMODE_SYNC 8 + +#define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(obj)->fptr) + +#define MakeOpenFile(obj, fp) do {\ + fp = RFILE(obj)->fptr = ALLOC(OpenFile);\ + fp->f = fp->f2 = NULL;\ + fp->mode = 0;\ + fp->pid = 0;\ + fp->lineno = 0;\ + fp->path = NULL;\ + fp->finalize = 0;\ +} while (0) + +#define GetReadFile(fptr) ((fptr)->f) +#define GetWriteFile(fptr) (((fptr)->f2) ? (fptr)->f2 : (fptr)->f) + +FILE *rb_fopen _((char *, char *)); +FILE *rb_fdopen _((int, char *)); +void rb_io_check_writable _((OpenFile *)); +void rb_io_check_readable _((OpenFile *)); +void rb_io_fptr_finalize _((OpenFile *)); +void rb_io_unbuffered _((OpenFile *)); +void rb_io_check_closed _((OpenFile *)); +void rb_eof_error _((void)); + +#endif |