mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-13 09:22:22 -07:00
Merge branch 'master' of https://github.com/odin-lang/Odin
This commit is contained in:
@@ -633,13 +633,18 @@ heap_free :: proc(ptr: rawptr) {
|
||||
_unix_free(ptr)
|
||||
}
|
||||
|
||||
getenv :: proc(name: string) -> (string, bool) {
|
||||
path_str := strings.clone_to_cstring(name, context.temp_allocator)
|
||||
lookup_env :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) {
|
||||
path_str := strings.clone_to_cstring(key, context.temp_allocator)
|
||||
cstr := _unix_getenv(path_str)
|
||||
if cstr == nil {
|
||||
return "", false
|
||||
}
|
||||
return string(cstr), true
|
||||
return strings.clone(string(cstr), allocator), true
|
||||
}
|
||||
|
||||
get_env :: proc(key: string, allocator := context.allocator) -> (value: string) {
|
||||
value, _ = lookup_env(key, allocator)
|
||||
return
|
||||
}
|
||||
|
||||
get_current_directory :: proc() -> string {
|
||||
|
||||
@@ -618,13 +618,18 @@ heap_free :: proc(ptr: rawptr) {
|
||||
_unix_free(ptr)
|
||||
}
|
||||
|
||||
getenv :: proc(name: string) -> (string, bool) {
|
||||
path_str := strings.clone_to_cstring(name, context.temp_allocator)
|
||||
lookup_env :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) {
|
||||
path_str := strings.clone_to_cstring(key, context.temp_allocator)
|
||||
cstr := _unix_getenv(path_str)
|
||||
if cstr == nil {
|
||||
return "", false
|
||||
}
|
||||
return string(cstr), true
|
||||
return strings.clone(string(cstr), allocator), true
|
||||
}
|
||||
|
||||
get_env :: proc(key: string, allocator := context.allocator) -> (value: string) {
|
||||
value, _ = lookup_env(key, allocator)
|
||||
return
|
||||
}
|
||||
|
||||
get_current_directory :: proc() -> string {
|
||||
|
||||
@@ -620,13 +620,18 @@ heap_free :: proc(ptr: rawptr) {
|
||||
_unix_free(ptr)
|
||||
}
|
||||
|
||||
getenv :: proc(name: string) -> (string, bool) {
|
||||
path_str := strings.clone_to_cstring(name, context.temp_allocator)
|
||||
lookup_env :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) {
|
||||
path_str := strings.clone_to_cstring(key, context.temp_allocator)
|
||||
cstr := _unix_getenv(path_str)
|
||||
if cstr == nil {
|
||||
return "", false
|
||||
}
|
||||
return string(cstr), true
|
||||
return strings.clone(string(cstr), allocator), true
|
||||
}
|
||||
|
||||
get_env :: proc(key: string, allocator := context.allocator) -> (value: string) {
|
||||
value, _ = lookup_env(key, allocator)
|
||||
return
|
||||
}
|
||||
|
||||
get_current_directory :: proc() -> string {
|
||||
|
||||
@@ -1338,7 +1338,12 @@ bool init_build_paths(String init_filename) {
|
||||
} else {
|
||||
// Init filename was not 'current path'.
|
||||
// Contruct the output name from the path elements as usual.
|
||||
String output_name = remove_directory_from_path(init_filename);
|
||||
String output_name = init_filename;
|
||||
// If it ends with a trailing (back)slash, strip it before continuing.
|
||||
while (output_name.len > 0 && (output_name[output_name.len-1] == '/' || output_name[output_name.len-1] == '\\')) {
|
||||
output_name.len -= 1;
|
||||
}
|
||||
output_name = remove_directory_from_path(output_name);
|
||||
output_name = remove_extension_from_path(output_name);
|
||||
output_name = copy_string(ha, string_trim_whitespace(output_name));
|
||||
output_path = path_from_string(ha, output_name);
|
||||
|
||||
+1
-1
@@ -3211,7 +3211,7 @@ void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, Type *type_hint
|
||||
y->type != t_invalid) {
|
||||
gbString xt = type_to_string(x->type);
|
||||
gbString yt = type_to_string(y->type);
|
||||
gbString expr_str = expr_to_string(x->expr);
|
||||
gbString expr_str = expr_to_string(node);
|
||||
error(op, "Mismatched types in binary expression '%s' : '%s' vs '%s'", expr_str, xt, yt);
|
||||
gb_string_free(expr_str);
|
||||
gb_string_free(yt);
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ foreign stbtt {
|
||||
// (.ttf) files only contain one font. The number of fonts can be used for
|
||||
// indexing with the previous function where the index is between zero and one
|
||||
// less than the total fonts. If an error occurs, -1 is returned.
|
||||
GetNumberOfFonts :: proc(data: [^]byte) -> b32 ---
|
||||
GetNumberOfFonts :: proc(data: [^]byte) -> c.int ---
|
||||
|
||||
// Each .ttf/.ttc file may have more than one font. Each font has a sequential
|
||||
// index number starting from 0. Call this function to get the font offset for
|
||||
|
||||
Reference in New Issue
Block a user