SSBM Decomp
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#include <stddef.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define SEEK_SET 0
13#define SEEK_CUR 1
14#define SEEK_END 2
15
16typedef unsigned long __file_handle;
17typedef unsigned long fpos_t;
18
19#define set_error(file) \
20 do { \
21 (file)->file_state.error = 1; \
22 (file)->buffer_length = 0; \
23 } while (0)
24
31
33 /* 0x0 */ UNORIENTED,
34 /* 0x1 */ CHAR_ORIENTED,
35 /* 0x2 */ WIDE_ORIENTED,
36};
37
38typedef struct _file_modes {
39 unsigned int open_mode : 2;
40 unsigned int io_mode : 3;
41 unsigned int buffer_mode : 2;
42 unsigned int file_kind : 3;
43 unsigned int file_orientation : 2;
44 unsigned int binary_io : 1;
46
53
60
66
67typedef struct _file_states {
68 unsigned int io_state : 3;
69 unsigned int free_buffer : 1;
70 unsigned char eof;
71 unsigned char error;
73
74typedef void (*__idle_proc)(void);
75typedef int (*__pos_proc)(__file_handle file, fpos_t* position, int mode,
76 __idle_proc idle_proc);
77typedef int (*__io_proc)(__file_handle file, unsigned char* buff,
78 size_t* count, __idle_proc idle_proc);
79typedef int (*__close_proc)(__file_handle file);
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;
104} FILE;
105
112
113#define _IONBF 0
114#define _IOLBF 1
115#define _IOFBF 2
116
117extern files __files;
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 */
__io_results
Definition ansi_files.h:61
@ __io_EOF
Definition ansi_files.h:64
@ __no_io_error
Definition ansi_files.h:62
@ __io_error
Definition ansi_files.h:63
__io_modes
Definition ansi_files.h:47
@ __write
Definition ansi_files.h:49
@ __read
Definition ansi_files.h:48
@ __read_write
Definition ansi_files.h:50
@ __append
Definition ansi_files.h:51
unsigned long fpos_t
Definition ansi_files.h:17
int(* __close_proc)(__file_handle file)
Definition ansi_files.h:79
void __close_all(void)
__io_states
Definition ansi_files.h:54
@ __reading
Definition ansi_files.h:57
@ __rereading
Definition ansi_files.h:58
@ __neutral
Definition ansi_files.h:55
@ __writing
Definition ansi_files.h:56
unsigned int __flush_all(void)
int(* __pos_proc)(__file_handle file, fpos_t *position, int mode, __idle_proc idle_proc)
Definition ansi_files.h:75
__file_kinds
Definition ansi_files.h:25
@ __unavailable_file
Definition ansi_files.h:29
@ __closed_file
Definition ansi_files.h:26
@ __disk_file
Definition ansi_files.h:27
@ __console_file
Definition ansi_files.h:28
void(* __idle_proc)(void)
Definition ansi_files.h:74
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:16
files __files
__file_orientation
Definition ansi_files.h:32
@ CHAR_ORIENTED
Definition ansi_files.h:34
@ WIDE_ORIENTED
Definition ansi_files.h:35
@ UNORIENTED
Definition ansi_files.h:33
Definition ansi_files.h:81
unsigned long buffer_size
Definition ansi_files.h:92
unsigned char is_dynamically_allocated
Definition ansi_files.h:85
__pos_proc position_fn
Definition ansi_files.h:98
unsigned long save_buffer_length
Definition ansi_files.h:96
unsigned char * buffer
Definition ansi_files.h:91
__close_proc close_fn
Definition ansi_files.h:101
__idle_proc idle_fn
Definition ansi_files.h:102
unsigned long position
Definition ansi_files.h:90
unsigned char * buffer_ptr
Definition ansi_files.h:93
file_modes file_mode
Definition ansi_files.h:83
char char_buffer
Definition ansi_files.h:86
__io_proc read_fn
Definition ansi_files.h:99
struct _FILE * next_file
Definition ansi_files.h:103
unsigned long buffer_alignment
Definition ansi_files.h:95
unsigned long buffer_length
Definition ansi_files.h:94
char char_buffer_overflow
Definition ansi_files.h:87
unsigned long buffer_position
Definition ansi_files.h:97
file_states file_state
Definition ansi_files.h:84
__file_handle handle
Definition ansi_files.h:82
__io_proc write_fn
Definition ansi_files.h:100
Definition ansi_files.h:38
unsigned int file_kind
Definition ansi_files.h:42
unsigned int file_orientation
Definition ansi_files.h:43
unsigned int buffer_mode
Definition ansi_files.h:41
unsigned int open_mode
Definition ansi_files.h:39
unsigned int io_mode
Definition ansi_files.h:40
unsigned int binary_io
Definition ansi_files.h:44
Definition ansi_files.h:67
unsigned char eof
Definition ansi_files.h:70
unsigned int free_buffer
Definition ansi_files.h:69
unsigned int io_state
Definition ansi_files.h:68
unsigned char error
Definition ansi_files.h:71
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