mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-20 08:26:47 +00:00
Merge remote-tracking branch 'offical/master'
This commit is contained in:
@@ -42,7 +42,7 @@ create_file_logger :: proc(h: os.Handle, lowest := Level.Debug, opt := Default_F
|
||||
return Logger{file_console_logger_proc, data, lowest, opt}
|
||||
}
|
||||
|
||||
destroy_file_logger :: proc(log: ^Logger) {
|
||||
destroy_file_logger :: proc(log: Logger) {
|
||||
data := cast(^File_Console_Logger_Data)log.data
|
||||
if data.file_handle != os.INVALID_HANDLE {
|
||||
os.close(data.file_handle)
|
||||
|
||||
@@ -12,11 +12,10 @@ create_multi_logger :: proc(logs: ..Logger) -> Logger {
|
||||
return Logger{multi_logger_proc, data, Level.Debug, nil}
|
||||
}
|
||||
|
||||
destroy_multi_logger :: proc(log : ^Logger) {
|
||||
destroy_multi_logger :: proc(log: Logger) {
|
||||
data := (^Multi_Logger_Data)(log.data)
|
||||
delete(data.loggers)
|
||||
free(log.data)
|
||||
log^ = nil_logger()
|
||||
free(data)
|
||||
}
|
||||
|
||||
multi_logger_proc :: proc(logger_data: rawptr, level: Level, text: string,
|
||||
|
||||
@@ -1188,9 +1188,6 @@ internal_random_prime :: proc(a: ^Int, size_in_bits: int, trials: int, flags :=
|
||||
flags := flags
|
||||
trials := trials
|
||||
|
||||
t := &Int{}
|
||||
defer internal_destroy(t)
|
||||
|
||||
/*
|
||||
Sanity check the input.
|
||||
*/
|
||||
|
||||
@@ -159,7 +159,7 @@ roll_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 {
|
||||
|
||||
@(require_results)
|
||||
pitch_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 {
|
||||
y := 2 * (q.y*q.z + q.w*q.w)
|
||||
y := 2 * (q.y*q.z + q.w*q.x)
|
||||
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
||||
|
||||
if abs(x) <= F16_EPSILON && abs(y) <= F16_EPSILON {
|
||||
|
||||
@@ -159,7 +159,7 @@ roll_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 {
|
||||
|
||||
@(require_results)
|
||||
pitch_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 {
|
||||
y := 2 * (q.y*q.z + q.w*q.w)
|
||||
y := 2 * (q.y*q.z + q.w*q.x)
|
||||
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
||||
|
||||
if abs(x) <= F32_EPSILON && abs(y) <= F32_EPSILON {
|
||||
|
||||
@@ -159,7 +159,7 @@ roll_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 {
|
||||
|
||||
@(require_results)
|
||||
pitch_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 {
|
||||
y := 2 * (q.y*q.z + q.w*q.w)
|
||||
y := 2 * (q.y*q.z + q.w*q.x)
|
||||
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
||||
|
||||
if abs(x) <= F64_EPSILON && abs(y) <= F64_EPSILON {
|
||||
|
||||
@@ -538,7 +538,7 @@ Foreign_Import_Decl :: struct {
|
||||
import_tok: tokenizer.Token,
|
||||
name: ^Ident,
|
||||
collection_name: string,
|
||||
fullpaths: []string,
|
||||
fullpaths: []^Expr,
|
||||
comment: ^Comment_Group,
|
||||
}
|
||||
|
||||
|
||||
@@ -1190,12 +1190,12 @@ parse_foreign_decl :: proc(p: ^Parser) -> ^ast.Decl {
|
||||
error(p, name.pos, "illegal foreign import name: '_'")
|
||||
}
|
||||
|
||||
fullpaths: [dynamic]string
|
||||
fullpaths: [dynamic]^ast.Expr
|
||||
if allow_token(p, .Open_Brace) {
|
||||
for p.curr_tok.kind != .Close_Brace &&
|
||||
p.curr_tok.kind != .EOF {
|
||||
path := expect_token(p, .String)
|
||||
append(&fullpaths, path.text)
|
||||
path := parse_expr(p, false)
|
||||
append(&fullpaths, path)
|
||||
|
||||
allow_token(p, .Comma) or_break
|
||||
}
|
||||
@@ -1203,7 +1203,9 @@ parse_foreign_decl :: proc(p: ^Parser) -> ^ast.Decl {
|
||||
} else {
|
||||
path := expect_token(p, .String)
|
||||
reserve(&fullpaths, 1)
|
||||
append(&fullpaths, path.text)
|
||||
bl := ast.new(ast.Basic_Lit, path.pos, end_pos(path))
|
||||
bl.tok = tok
|
||||
append(&fullpaths, bl)
|
||||
}
|
||||
|
||||
if len(fullpaths) == 0 {
|
||||
|
||||
@@ -448,14 +448,14 @@ foreign libc {
|
||||
@(link_name="write") _unix_write :: proc(handle: Handle, buffer: rawptr, count: c.size_t) -> int ---
|
||||
@(link_name="pread") _unix_pread :: proc(handle: Handle, buffer: rawptr, count: c.size_t, offset: i64) -> int ---
|
||||
@(link_name="pwrite") _unix_pwrite :: proc(handle: Handle, buffer: rawptr, count: c.size_t, offset: i64) -> int ---
|
||||
@(link_name="lseek") _unix_lseek :: proc(fs: Handle, offset: int, whence: int) -> int ---
|
||||
@(link_name="lseek") _unix_lseek :: proc(fs: Handle, offset: int, whence: c.int) -> int ---
|
||||
@(link_name="gettid") _unix_gettid :: proc() -> u64 ---
|
||||
@(link_name="getpagesize") _unix_getpagesize :: proc() -> i32 ---
|
||||
@(link_name="stat64") _unix_stat :: proc(path: cstring, stat: ^OS_Stat) -> c.int ---
|
||||
@(link_name="lstat64") _unix_lstat :: proc(path: cstring, stat: ^OS_Stat) -> c.int ---
|
||||
@(link_name="fstat64") _unix_fstat :: proc(fd: Handle, stat: ^OS_Stat) -> c.int ---
|
||||
@(link_name="readlink") _unix_readlink :: proc(path: cstring, buf: ^byte, bufsiz: c.size_t) -> c.ssize_t ---
|
||||
@(link_name="access") _unix_access :: proc(path: cstring, mask: int) -> int ---
|
||||
@(link_name="access") _unix_access :: proc(path: cstring, mask: c.int) -> c.int ---
|
||||
@(link_name="fsync") _unix_fsync :: proc(handle: Handle) -> c.int ---
|
||||
|
||||
@(link_name="fdopendir$INODE64") _unix_fdopendir_amd64 :: proc(fd: Handle) -> Dir ---
|
||||
@@ -639,7 +639,7 @@ write_at :: proc(fd: Handle, data: []byte, offset: i64) -> (int, Errno) {
|
||||
seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) {
|
||||
assert(fd != -1)
|
||||
|
||||
final_offset := i64(_unix_lseek(fd, int(offset), whence))
|
||||
final_offset := i64(_unix_lseek(fd, int(offset), c.int(whence)))
|
||||
if final_offset == -1 {
|
||||
return 0, 1
|
||||
}
|
||||
@@ -892,7 +892,7 @@ absolute_path_from_relative :: proc(rel: string) -> (path: string, err: Errno) {
|
||||
access :: proc(path: string, mask: int) -> bool {
|
||||
runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD()
|
||||
cstr := strings.clone_to_cstring(path, context.temp_allocator)
|
||||
return _unix_access(cstr, mask) == 0
|
||||
return _unix_access(cstr, c.int(mask)) == 0
|
||||
}
|
||||
|
||||
flush :: proc(fd: Handle) -> Errno {
|
||||
|
||||
Reference in New Issue
Block a user