Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
ansi_files.h
Go to the documentation of this file.
1#ifndef _MSL_COMMON_ANSI_FILES_H
2#define _MSL_COMMON_ANSI_FILES_H
3
4#include <cstddef>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#define SEEK_SET 0
11#define SEEK_CUR 1
12#define SEEK_END 2
13
14typedef unsigned long __file_handle;
15typedef unsigned long fpos_t;
16
17#define set_error(file) \
18 do { \
19 (file)->file_state.error = 1; \
20 (file)->buffer_length = 0; \
21 } while (0)
22
29
35
36typedef struct _file_modes {
37 unsigned int open_mode : 2;
38 unsigned int io_mode : 3;
39 unsigned int buffer_mode : 2;
40 unsigned int file_kind : 3;
41 unsigned int file_orientation : 2;
42 unsigned int binary_io : 1;
44
51
58
64
65typedef struct _file_states {
66 unsigned int io_state : 3;
67 unsigned int free_buffer : 1;
68 unsigned char eof;
69 unsigned char error;
71
72typedef void (*__idle_proc)(void);
73typedef int (*__pos_proc)(__file_handle file, fpos_t* position, int mode, __idle_proc idle_proc);
74typedef int (*__io_proc)(__file_handle file, unsigned char* buff, size_t* count,
75 __idle_proc idle_proc);
76typedef int (*__close_proc)(__file_handle file);
77
78typedef struct _FILE {
82 /* 0x0C */ unsigned char is_dynamically_allocated;
83 /* 0x0D */ char char_buffer;
84 /* 0x0E */ char char_buffer_overflow;
85 /* 0x0F */ char ungetc_buffer[2];
86 /* 0x12 */ wchar_t ungetc_wide_buffer[2];
87 /* 0x18 */ unsigned long position;
88 /* 0x1C */ unsigned char* buffer;
89 /* 0x20 */ unsigned long buffer_size;
90 /* 0x24 */ unsigned char* buffer_ptr;
91 /* 0x28 */ unsigned long buffer_length;
92 /* 0x2C */ unsigned long buffer_alignment;
93 /* 0x30 */ unsigned long save_buffer_length;
94 /* 0x34 */ unsigned long buffer_position;
96 /* 0x3C */ __io_proc read_fn;
97 /* 0x40 */ __io_proc write_fn;
99 /* 0x48 */ __idle_proc idle_fn;
100 /* 0x4C */ struct _FILE* next_file;
102
109
110#define _IONBF 0
111#define _IOLBF 1
112#define _IOFBF 2
113
114extern files __files;
115extern int __close_console(__file_handle file);
116extern int __write_console(__file_handle file, unsigned char* buf, size_t* count, __idle_proc idle_fn);
117extern int __read_console(__file_handle file, unsigned char* buf, size_t* count, __idle_proc idle_fn);
118
119unsigned int __flush_all(void);
120void __close_all(void);
121
122#ifdef __cplusplus
123};
124#endif
125
126#endif /* _MSL_COMMON_ANSI_FILES_H */
struct _FILE FILE
__io_results
Definition ansi_files.h:59
@ __io_EOF
Definition ansi_files.h:62
@ __no_io_error
Definition ansi_files.h:60
@ __io_error
Definition ansi_files.h:61
struct _file_modes file_modes
int __write_console(__file_handle file, unsigned char *buf, size_t *count, __idle_proc idle_fn)
Definition uart_console_io_gcn.c:9
struct _file_states file_states
int __close_console(__file_handle file)
Definition uart_console_io_gcn.c:37
__io_modes
Definition ansi_files.h:45
@ __write
Definition ansi_files.h:47
@ __read
Definition ansi_files.h:46
@ __read_write
Definition ansi_files.h:48
@ __append
Definition ansi_files.h:49
unsigned long fpos_t
Definition ansi_files.h:15
int(* __close_proc)(__file_handle file)
Definition ansi_files.h:76
struct _files files
void __close_all(void)
Definition ansi_files.c:116
__io_states
Definition ansi_files.h:52
@ __reading
Definition ansi_files.h:55
@ __rereading
Definition ansi_files.h:56
@ __neutral
Definition ansi_files.h:53
@ __writing
Definition ansi_files.h:54
unsigned int __flush_all(void)
Definition ansi_files.c:143
int(* __pos_proc)(__file_handle file, fpos_t *position, int mode, __idle_proc idle_proc)
Definition ansi_files.h:73
int __read_console(__file_handle file, unsigned char *buf, size_t *count, __idle_proc idle_fn)
__file_kinds
Definition ansi_files.h:23
@ __unavailable_file
Definition ansi_files.h:27
@ __closed_file
Definition ansi_files.h:24
@ __disk_file
Definition ansi_files.h:25
@ __console_file
Definition ansi_files.h:26
void(* __idle_proc)(void)
Definition ansi_files.h:72
int(* __io_proc)(__file_handle file, unsigned char *buff, size_t *count, __idle_proc idle_proc)
Definition ansi_files.h:74
unsigned long __file_handle
Definition ansi_files.h:14
files __files
__file_orientation
Definition ansi_files.h:30
@ __wide_oriented
Definition ansi_files.h:33
@ __char_oriented
Definition ansi_files.h:32
@ __unoriented
Definition ansi_files.h:31
u32 mode
Definition GXTev.c:56
IOSResourceRequest * buf[RESPONSE_REQ_BUF_LEN]
Definition ipcclt.c:47
Definition ansi_files.h:78
unsigned char is_dynamically_allocated
Definition ansi_files.h:82
char ungetc_buffer[2]
Definition ansi_files.h:85
unsigned long buffer_alignment
Definition ansi_files.h:92
unsigned long save_buffer_length
Definition ansi_files.h:93
__io_proc read_fn
Definition ansi_files.h:96
file_states file_state
Definition ansi_files.h:81
unsigned long position
Definition ansi_files.h:87
unsigned long buffer_size
Definition ansi_files.h:89
char char_buffer_overflow
Definition ansi_files.h:84
__file_handle handle
Definition ansi_files.h:79
__close_proc close_fn
Definition ansi_files.h:98
struct _FILE * next_file
Definition ansi_files.h:100
char char_buffer
Definition ansi_files.h:83
unsigned long buffer_length
Definition ansi_files.h:91
__pos_proc position_fn
Definition ansi_files.h:95
__idle_proc idle_fn
Definition ansi_files.h:99
__io_proc write_fn
Definition ansi_files.h:97
unsigned char * buffer_ptr
Definition ansi_files.h:90
unsigned long buffer_position
Definition ansi_files.h:94
unsigned char * buffer
Definition ansi_files.h:88
wchar_t ungetc_wide_buffer[2]
Definition ansi_files.h:86
file_modes file_mode
Definition ansi_files.h:80
Definition ansi_files.h:36
unsigned int open_mode
Definition ansi_files.h:37
unsigned int buffer_mode
Definition ansi_files.h:39
unsigned int io_mode
Definition ansi_files.h:38
unsigned int file_kind
Definition ansi_files.h:40
unsigned int binary_io
Definition ansi_files.h:42
unsigned int file_orientation
Definition ansi_files.h:41
Definition ansi_files.h:65
unsigned char eof
Definition ansi_files.h:68
unsigned int io_state
Definition ansi_files.h:66
unsigned char error
Definition ansi_files.h:69
unsigned int free_buffer
Definition ansi_files.h:67
Definition ansi_files.h:103
FILE _stdout
Definition ansi_files.h:105
FILE _stderr
Definition ansi_files.h:106
FILE _stdin
Definition ansi_files.h:104
FILE empty
Definition ansi_files.h:107