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 "stddef.h"
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#ifndef __cplusplus
17typedef unsigned short wchar_t;
18#endif
19
20#define set_error(file) \
21 do { \
22 (file)->file_state.error = 1; \
23 (file)->buffer_length = 0; \
24 } while (0)
25
32
34 /* 0x0 */ UNORIENTED,
35 /* 0x1 */ CHAR_ORIENTED,
36 /* 0x2 */ WIDE_ORIENTED,
37};
38
39typedef struct _file_modes {
40 unsigned int open_mode : 2;
41 unsigned int io_mode : 3;
42 unsigned int buffer_mode : 2;
43 unsigned int file_kind : 3;
44 unsigned int file_orientation : 2;
45 unsigned int binary_io : 1;
47
54
61
67
68typedef struct _file_states {
69 unsigned int io_state : 3;
70 unsigned int free_buffer : 1;
71 unsigned char eof;
72 unsigned char error;
74
75typedef void (*__idle_proc)(void);
76typedef int (*__pos_proc)(__file_handle file, fpos_t* position, int mode, __idle_proc idle_proc);
77typedef int (*__io_proc)(__file_handle file, unsigned char* buff, size_t* count,
80
81typedef struct _FILE {
85 /* 0x0C */ unsigned char is_dynamically_allocated;
86 /* 0x0D */ char char_buffer;
87 /* 0x0E */ char char_buffer_overflow;
88 /* 0x0F */ char ungetc_buffer[2];
89 /* 0x12 */ wchar_t ungetc_wide_buffer[2];
90 /* 0x18 */ unsigned long position;
91 /* 0x1C */ unsigned char* buffer;
92 /* 0x20 */ unsigned long buffer_size;
93 /* 0x24 */ unsigned char* buffer_ptr;
94 /* 0x28 */ unsigned long buffer_length;
95 /* 0x2C */ unsigned long buffer_alignment;
96 /* 0x30 */ unsigned long save_buffer_length;
97 /* 0x34 */ unsigned long buffer_position;
99 /* 0x3C */ __io_proc read_fn;
100 /* 0x40 */ __io_proc write_fn;
103 /* 0x4C */ struct _FILE* next_file;
105
112
113#define _IONBF 0
114#define _IOLBF 1
115#define _IOFBF 2
116
117extern files __files;
119extern int __write_console(__file_handle file, unsigned char* buf, size_t* count, __idle_proc idle_fn);
120extern int __read_console(__file_handle file, unsigned char* buf, size_t* count, __idle_proc idle_fn);
121
122unsigned int __flush_all(void);
123void __close_all(void);
124
125#ifdef __cplusplus
126};
127#endif
128
129#endif /* _MSL_COMMON_ANSI_FILES_H */
struct _FILE FILE
__io_results
Definition ansi_files.h:62
@ __io_EOF
Definition ansi_files.h:65
@ __no_io_error
Definition ansi_files.h:63
@ __io_error
Definition ansi_files.h:64
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:10
struct _file_states file_states
int __close_console(__file_handle file)
Definition uart_console_io_gcn.c:39
__io_modes
Definition ansi_files.h:48
@ __write
Definition ansi_files.h:50
@ __read
Definition ansi_files.h:49
@ __read_write
Definition ansi_files.h:51
@ __append
Definition ansi_files.h:52
unsigned long fpos_t
Definition ansi_files.h:15
int(* __close_proc)(__file_handle file)
Definition ansi_files.h:79
struct _files files
unsigned short wchar_t
Definition ansi_files.h:17
void __close_all(void)
Definition ansi_files.c:118
__io_states
Definition ansi_files.h:55
@ __reading
Definition ansi_files.h:58
@ __rereading
Definition ansi_files.h:59
@ __neutral
Definition ansi_files.h:56
@ __writing
Definition ansi_files.h:57
unsigned int __flush_all(void)
Definition ansi_files.c:146
int(* __pos_proc)(__file_handle file, fpos_t *position, int mode, __idle_proc idle_proc)
Definition ansi_files.h:76
int __read_console(__file_handle file, unsigned char *buf, size_t *count, __idle_proc idle_fn)
__file_kinds
Definition ansi_files.h:26
@ __unavailable_file
Definition ansi_files.h:30
@ __closed_file
Definition ansi_files.h:27
@ __disk_file
Definition ansi_files.h:28
@ __console_file
Definition ansi_files.h:29
void(* __idle_proc)(void)
Definition ansi_files.h:75
int(* __io_proc)(__file_handle file, unsigned char *buff, size_t *count, __idle_proc idle_proc)
Definition ansi_files.h:77
unsigned long __file_handle
Definition ansi_files.h:14
files __files
__file_orientation
Definition ansi_files.h:33
@ CHAR_ORIENTED
Definition ansi_files.h:35
@ WIDE_ORIENTED
Definition ansi_files.h:36
@ UNORIENTED
Definition ansi_files.h:34
T cLib_calcTimer(T *value)
Definition c_lib.h:74
Definition ansi_files.h:81
unsigned char is_dynamically_allocated
Definition ansi_files.h:85
char ungetc_buffer[2]
Definition ansi_files.h:88
unsigned long buffer_alignment
Definition ansi_files.h:95
unsigned long save_buffer_length
Definition ansi_files.h:96
__io_proc read_fn
Definition ansi_files.h:99
file_states file_state
Definition ansi_files.h:84
unsigned long position
Definition ansi_files.h:90
unsigned long buffer_size
Definition ansi_files.h:92
char char_buffer_overflow
Definition ansi_files.h:87
__file_handle handle
Definition ansi_files.h:82
__close_proc close_fn
Definition ansi_files.h:101
struct _FILE * next_file
Definition ansi_files.h:103
char char_buffer
Definition ansi_files.h:86
unsigned long buffer_length
Definition ansi_files.h:94
__pos_proc position_fn
Definition ansi_files.h:98
__idle_proc idle_fn
Definition ansi_files.h:102
__io_proc write_fn
Definition ansi_files.h:100
unsigned char * buffer_ptr
Definition ansi_files.h:93
unsigned long buffer_position
Definition ansi_files.h:97
unsigned char * buffer
Definition ansi_files.h:91
wchar_t ungetc_wide_buffer[2]
Definition ansi_files.h:89
file_modes file_mode
Definition ansi_files.h:83
Definition ansi_files.h:39
unsigned int open_mode
Definition ansi_files.h:40
unsigned int buffer_mode
Definition ansi_files.h:42
unsigned int io_mode
Definition ansi_files.h:41
unsigned int file_kind
Definition ansi_files.h:43
unsigned int binary_io
Definition ansi_files.h:45
unsigned int file_orientation
Definition ansi_files.h:44
Definition ansi_files.h:68
unsigned char eof
Definition ansi_files.h:71
unsigned int io_state
Definition ansi_files.h:69
unsigned char error
Definition ansi_files.h:72
unsigned int free_buffer
Definition ansi_files.h:70
Definition ansi_files.h:106
FILE _stdout
Definition ansi_files.h:108
FILE _stderr
Definition ansi_files.h:109
FILE _stdin
Definition ansi_files.h:107
FILE empty
Definition ansi_files.h:110