Remove context.std* parameters; Fix unary boolean not

This commit is contained in:
gingerBill
2020-03-19 15:03:02 +00:00
parent fc0002ab67
commit 93955a0fd8
5 changed files with 153 additions and 160 deletions
+6 -6
View File
@@ -59,13 +59,13 @@ fprintf :: proc(fd: os.Handle, fmt: string, args: ..any) -> int {
// print* procedures return the number of bytes written
print :: proc(args: ..any) -> int { return fprint(context.stdout, ..args); }
println :: proc(args: ..any) -> int { return fprintln(context.stdout, ..args); }
printf :: proc(fmt: string, args: ..any) -> int { return fprintf(context.stdout, fmt, ..args); }
print :: proc(args: ..any) -> int { return fprint(os.stdout, ..args); }
println :: proc(args: ..any) -> int { return fprintln(os.stdout, ..args); }
printf :: proc(fmt: string, args: ..any) -> int { return fprintf(os.stdout, fmt, ..args); }
eprint :: proc(args: ..any) -> int { return fprint(context.stderr, ..args); }
eprintln :: proc(args: ..any) -> int { return fprintln(context.stderr, ..args); }
eprintf :: proc(fmt: string, args: ..any) -> int { return fprintf(context.stderr, fmt, ..args); }
eprint :: proc(args: ..any) -> int { return fprint(os.stderr, ..args); }
eprintln :: proc(args: ..any) -> int { return fprintln(os.stderr, ..args); }
eprintf :: proc(fmt: string, args: ..any) -> int { return fprintf(os.stderr, fmt, ..args); }
@(deprecated="prefer eprint") print_err :: proc(args: ..any) -> int { return eprint(..args); }
+1 -1
View File
@@ -201,7 +201,7 @@ stdout := get_std_handle(win32.STD_OUTPUT_HANDLE);
stderr := get_std_handle(win32.STD_ERROR_HANDLE);
get_std_handle :: proc(h: int) -> Handle {
get_std_handle :: proc "contextless" (h: int) -> Handle {
fd := win32.get_std_handle(i32(h));
win32.set_handle_information(fd, win32.HANDLE_FLAG_INHERIT, 0);
return Handle(fd);
+7 -7
View File
@@ -288,9 +288,9 @@ Context :: struct {
assertion_failure_proc: Assertion_Failure_Proc,
logger: Logger,
stdin: os.Handle,
stdout: os.Handle,
stderr: os.Handle,
// stdin: os.Handle,
// stdout: os.Handle,
// stderr: os.Handle,
thread_id: int,
@@ -463,9 +463,9 @@ __init_context :: proc "contextless" (c: ^Context) {
c.logger.procedure = default_logger_proc;
c.logger.data = nil;
c.stdin = os.stdin;
c.stdout = os.stdout;
c.stderr = os.stderr;
// c.stdin = os.stdin;
// c.stdout = os.stdout;
// c.stderr = os.stderr;
}
@builtin
@@ -474,7 +474,7 @@ init_global_temporary_allocator :: proc(data: []byte, backup_allocator := contex
}
default_assertion_failure_proc :: proc(prefix, message: string, loc: Source_Code_Location) {
fd := context.stderr;
fd := os.stderr;
print_caller_location(fd, loc);
os.write_string(fd, " ");
os.write_string(fd, prefix);