Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

rubyio.h File Reference

#include <stdio.h>
#include <errno.h>

Go to the source code of this file.

Data Structures

struct  OpenFile

Defines

#define FMODE_READABLE   1
#define FMODE_WRITABLE   2
#define FMODE_READWRITE   3
#define FMODE_APPEND   64
#define FMODE_CREATE   128
#define FMODE_BINMODE   4
#define FMODE_SYNC   8
#define FMODE_WBUF   16
#define FMODE_RBUF   32
#define FMODE_WSPLIT   0x200
#define FMODE_WSPLIT_INITIALIZED   0x400
#define GetOpenFile(obj, fp)   rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr)
#define MakeOpenFile(obj, fp)
#define GetReadFile(fptr)   ((fptr)->f)
#define GetWriteFile(fptr)   (((fptr)->f2) ? (fptr)->f2 : (fptr)->f)

Typedefs

typedef OpenFile OpenFile

Functions

FILE * rb_fopen (const char *, const char *)
FILE * rb_fdopen (int, const char *)
int rb_getc (FILE *)
long rb_io_fread (char *, long, FILE *)
long rb_io_fwrite (const char *, long, FILE *)
int rb_io_mode_flags (const char *)
int rb_io_modenum_flags (int)
void rb_io_check_writable (OpenFile *)
void rb_io_check_readable (OpenFile *)
void rb_io_fptr_finalize (OpenFile *)
void rb_io_synchronized (OpenFile *)
void rb_io_check_initialized (OpenFile *)
void rb_io_check_closed (OpenFile *)
int rb_io_wait_readable (int)
int rb_io_wait_writable (int)
VALUE rb_io_taint_check (VALUE)
void rb_eof_error (void)
void rb_read_check (FILE *)
int rb_read_pending (FILE *)


Define Documentation

#define FMODE_APPEND   64
 

Definition at line 36 of file rubyio.h.

Referenced by rb_io_flags_mode(), rb_io_mode_flags(), and rb_io_modenum_flags().

#define FMODE_BINMODE   4
 

Definition at line 38 of file rubyio.h.

Referenced by io_reopen(), next_argv(), rb_io_binmode(), rb_io_init_copy(), rb_io_mode_flags(), and rb_io_modenum_flags().

#define FMODE_CREATE   128
 

Definition at line 37 of file rubyio.h.

Referenced by rb_io_flags_mode(), rb_io_mode_flags(), and rb_io_modenum_flags().

#define FMODE_RBUF   32
 

Definition at line 41 of file rubyio.h.

Referenced by rb_io_check_readable(), rb_io_check_writable(), and rb_io_ungetc().

#define FMODE_READABLE   1
 

Definition at line 33 of file rubyio.h.

Referenced by Init_IO(), io_reopen(), next_argv(), pipe_open(), rb_io_check_readable(), rb_io_close_read(), rb_io_close_write(), rb_io_flags_mode(), rb_io_init_copy(), rb_io_mode_flags(), rb_io_mode_string(), rb_io_modenum_flags(), and rb_io_sysseek().

#define FMODE_READWRITE   3
 

Definition at line 35 of file rubyio.h.

Referenced by rb_io_flags_mode(), rb_io_init_copy(), rb_io_mode_flags(), rb_io_mode_string(), and rb_io_modenum_flags().

#define FMODE_SYNC   8
 

Definition at line 39 of file rubyio.h.

Referenced by io_fwrite(), io_write(), pipe_open(), rb_io_set_sync(), rb_io_sync(), and rb_io_synchronized().

#define FMODE_WBUF   16
 

Definition at line 40 of file rubyio.h.

Referenced by flush_before_seek(), fptr_finalize(), io_fflush(), io_write(), rb_io_check_readable(), rb_io_sysseek(), and rb_io_syswrite().

#define FMODE_WRITABLE   2
 

Definition at line 34 of file rubyio.h.

Referenced by Init_IO(), io_reopen(), next_argv(), pipe_open(), rb_file_flock(), rb_file_truncate(), rb_io_check_writable(), rb_io_close_read(), rb_io_close_write(), rb_io_flags_mode(), rb_io_fwrite(), rb_io_init_copy(), rb_io_mode_flags(), rb_io_mode_string(), rb_io_modenum_flags(), and rb_io_sysseek().

#define FMODE_WSPLIT   0x200
 

Definition at line 42 of file rubyio.h.

Referenced by rb_io_ctl(), and wsplit_p().

#define FMODE_WSPLIT_INITIALIZED   0x400
 

Definition at line 43 of file rubyio.h.

Referenced by rb_io_ctl(), and wsplit_p().

#define GetOpenFile obj,
fp   )     rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr)
 

Definition at line 45 of file rubyio.h.

Referenced by io_getpartial(), io_read(), io_reopen(), io_write(), next_argv(), prep_path(), rb_f_backquote(), rb_f_select(), rb_file_atime(), rb_file_chmod(), rb_file_chown(), rb_file_ctime(), rb_file_flock(), rb_file_lstat(), rb_file_mtime(), rb_file_truncate(), rb_io_binmode(), rb_io_close_read(), rb_io_close_write(), rb_io_ctl(), rb_io_each_byte(), rb_io_eof(), rb_io_fileno(), rb_io_flush(), rb_io_fsync(), rb_io_getc(), rb_io_getline(), rb_io_gets(), rb_io_init_copy(), rb_io_isatty(), rb_io_lineno(), rb_io_pid(), rb_io_rewind(), rb_io_seek(), rb_io_set_lineno(), rb_io_set_pos(), rb_io_set_sync(), rb_io_stat(), rb_io_sync(), rb_io_sysread(), rb_io_sysseek(), rb_io_syswrite(), rb_io_tell(), rb_io_ungetc(), and rb_stat().

#define GetReadFile fptr   )     ((fptr)->f)
 

Definition at line 63 of file rubyio.h.

#define GetWriteFile fptr   )     (((fptr)->f2) ? (fptr)->f2 : (fptr)->f)
 

Definition at line 64 of file rubyio.h.

Referenced by flush_before_seek(), io_fwrite(), io_reopen(), rb_file_flock(), rb_file_truncate(), rb_io_flush(), rb_io_fsync(), rb_io_syswrite(), and wsplit_p().

#define MakeOpenFile obj,
fp   ) 
 

Value:

do {\
    if (RFILE(obj)->fptr) {\
        rb_io_close(obj);\
        free(RFILE(obj)->fptr);\
        RFILE(obj)->fptr = 0;\
    }\
    fp = 0;\
    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)

Definition at line 47 of file rubyio.h.

Referenced by pipe_open(), prep_stdio(), rb_file_open_internal(), rb_file_sysopen_internal(), rb_io_init_copy(), and rb_io_initialize().


Typedef Documentation

typedef struct OpenFile OpenFile
 


Function Documentation

void rb_eof_error void   ) 
 

This function does not return.

Definition at line 188 of file io.c.

References rb_eEOFError, and rb_raise().

Referenced by argf_readchar(), io_readpartial(), r_byte(), rb_f_readline(), rb_io_readchar(), rb_io_readline(), and rb_io_sysread().

FILE* rb_fdopen int  ,
const char * 
 

Definition at line 2686 of file io.c.

References NULL, rb_gc(), rb_sys_fail(), rb_warn(), and VALUE.

Referenced by io_reopen(), pipe_open(), rb_file_sysopen_internal(), rb_io_init_copy(), and rb_io_initialize().

FILE* rb_fopen const char *  ,
const char * 
 

Referenced by next_argv(), rb_file_open_internal(), and rb_io_reopen().

int rb_getc FILE *   ) 
 

Definition at line 1931 of file io.c.

References rb_thread_wait_fd(), READ_DATA_PENDING, TRAP_BEG, and TRAP_END.

void rb_io_check_closed OpenFile  ) 
 

Definition at line 213 of file io.c.

References rb_eIOError, rb_io_check_initialized(), and rb_raise().

Referenced by appendline(), io_fflush(), io_fread(), io_fwrite(), rb_io_check_readable(), rb_io_check_writable(), rb_io_close_m(), rb_io_eof(), rb_io_sysread(), rb_io_syswrite(), rb_thread_flock(), and swallow().

void rb_io_check_initialized OpenFile  ) 
 

Definition at line 204 of file io.c.

References rb_eIOError, and rb_raise().

Referenced by rb_file_path(), rb_io_check_closed(), and rb_io_closed().

void rb_io_check_readable OpenFile  ) 
 

Definition at line 246 of file io.c.

References FMODE_RBUF, FMODE_READABLE, FMODE_SYNCWRITE, FMODE_WBUF, io_seek, rb_eIOError, rb_io_check_closed(), rb_raise(), and SEEK_CUR.

Referenced by io_getpartial(), io_read(), rb_io_each_byte(), rb_io_eof(), rb_io_getc(), rb_io_getline(), rb_io_gets(), rb_io_lineno(), rb_io_set_lineno(), rb_io_sysread(), and rb_io_ungetc().

void rb_io_check_writable OpenFile  ) 
 

Definition at line 265 of file io.c.

References FMODE_RBUF, FMODE_WRITABLE, io_seek, rb_eIOError, rb_io_check_closed(), rb_raise(), and SEEK_CUR.

Referenced by io_write(), rb_io_flush(), and rb_io_syswrite().

void rb_io_fptr_finalize OpenFile  ) 
 

Definition at line 2083 of file io.c.

References free, Qtrue, and rb_io_fptr_cleanup().

Referenced by obj_free(), and rb_gc_call_finalizer_at_exit().

long rb_io_fread char *  ,
long  ,
FILE * 
 

Definition at line 1093 of file io.c.

References OpenFile::f, OpenFile::f2, io_fread(), and NULL.

long rb_io_fwrite const char *  ,
long  ,
FILE * 
 

int rb_io_mode_flags const char *   ) 
 

Referenced by pipe_open(), rb_file_open_internal(), rb_io_reopen(), and rb_io_s_popen().

int rb_io_modenum_flags int   ) 
 

Definition at line 2536 of file io.c.

References FMODE_APPEND, FMODE_BINMODE, FMODE_CREATE, FMODE_READABLE, FMODE_READWRITE, and FMODE_WRITABLE.

Referenced by rb_file_sysopen_internal(), and rb_io_initialize().

void rb_io_synchronized OpenFile  ) 
 

Definition at line 2862 of file io.c.

References FMODE_SYNC.

Referenced by pipe_open(), rb_io_s_pipe(), and rb_io_unbuffered().

VALUE rb_io_taint_check VALUE   ) 
 

Definition at line 194 of file io.c.

References OBJ_TAINTED, rb_check_frozen(), rb_eSecurityError, rb_raise(), rb_safe_level, and VALUE.

Referenced by rb_file_path(), rb_io_inspect(), and rb_io_reopen().

int rb_io_wait_readable int   ) 
 

Definition at line 350 of file io.c.

References NULL, Qfalse, Qtrue, rb_thread_select(), and rb_thread_wait_fd().

Referenced by appendline(), io_getpartial(), rb_io_each_byte(), and rb_io_getc().

int rb_io_wait_writable int   ) 
 

Definition at line 378 of file io.c.

References NULL, Qfalse, Qtrue, rb_thread_fd_writable(), and rb_thread_select().

Referenced by fptr_finalize(), io_fflush(), and io_fwrite().

void rb_read_check FILE *   ) 
 

Definition at line 288 of file io.c.

References rb_thread_wait_fd(), and READ_DATA_PENDING.

int rb_read_pending FILE *   ) 
 

Definition at line 281 of file io.c.

References READ_DATA_PENDING.


Generated on Wed Jan 18 23:32:11 2006 for Ruby by doxygen 1.3.5