Match MSL wide stream orientation
This commit is contained in:
@@ -1971,7 +1971,7 @@ config.libs = [
|
||||
Object(Matching, "MSL_Common/wmem.c"),
|
||||
Object(NonMatching, "MSL_Common/wprintf.c"),
|
||||
Object(NonMatching, "MSL_Common/wstring.c"),
|
||||
Object(NonMatching, "MSL_Common/wchar_io.c"),
|
||||
Object(Matching, "MSL_Common/wchar_io.c"),
|
||||
Object(Matching, "PPC_EABI/time.dolphin.c"),
|
||||
Object(Matching, "PPC_EABI/sysenv.GCN.c"),
|
||||
Object(Matching, "PPC_EABI/uart_console_io_gcn.c"),
|
||||
|
||||
44
libs/MSL/src/MSL_Common/wchar_io.c
Normal file
44
libs/MSL/src/MSL_Common/wchar_io.c
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "internal/file_struct.h"
|
||||
|
||||
enum file_kinds {
|
||||
file_closed
|
||||
};
|
||||
|
||||
enum file_orientation {
|
||||
file_unoriented,
|
||||
file_char_oriented,
|
||||
file_wide_oriented
|
||||
};
|
||||
|
||||
int fwide(FILE* file, int file_mode) {
|
||||
int orientation;
|
||||
int res;
|
||||
|
||||
if (file == NULL || file->mode.file_kind == file_closed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
orientation = file->mode.file_orientation;
|
||||
|
||||
switch (orientation) {
|
||||
case file_unoriented:
|
||||
if (file_mode > 0) {
|
||||
file->mode.file_orientation = file_wide_oriented;
|
||||
} else if (file_mode < 0) {
|
||||
file->mode.file_orientation = file_char_oriented;
|
||||
}
|
||||
|
||||
res = file_mode;
|
||||
break;
|
||||
|
||||
case file_wide_oriented:
|
||||
res = 1;
|
||||
break;
|
||||
|
||||
case file_char_oriented:
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user