Fixed compilation errors and tested system_get_canonical.

master
Yuval Dolev 2019-12-26 00:19:50 +02:00
parent 9b0708a40c
commit 2f9a4dbe3a
3 changed files with 30 additions and 12 deletions

View File

@ -48,6 +48,7 @@
#include "4coder_hash_functions.cpp"
#include "4coder_system_allocator.cpp"
#include "4coder_malloc_allocator.cpp"
#include "4coder_codepoint_map.cpp"
#include "4ed_mem.cpp"
@ -74,8 +75,20 @@ global Render_Target target;
////////////////////////////////
external String_Const_u8
mac_SCu8(u8* str, u64 size){
String_Const_u8 result = SCu8(str, size);
return(result);
}
external String_Const_u8
mac_push_string_copy(Arena *arena, String_Const_u8 src){
String_Const_u8 result = push_string_copy(arena, src);
return(result);
}
external void
mac_init() {
mac_init(){
// NOTE(yuval): Context Setup
Thread_Context _tctx = {};
thread_ctx_init(&_tctx, ThreadKind_Main,

View File

@ -47,13 +47,13 @@ mac_standardize_path(Arena* arena, String_Const_u8 path){
[[NSString alloc] initWithBytes:path.data length:path.size encoding:NSUTF8StringEncoding];
NSString *standardized_path_ns_str = [path_ns_str stringByStandardizingPath];
String_Const_u8 standardized_path = SCu8([standardized_path_ns_str UTF8String],[standardized_path_ns_str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
String_Const_u8 standardized_path = mac_SCu8((u8*)[standardized_path_ns_str UTF8String],[standardized_path_ns_str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
String_Const_u8 result = push_string_copy(arena, standardized_path);
String_Const_u8 result = mac_push_string_copy(arena, standardized_path);
[path release];
[path_ns_str release];
return result;
return(result);
}
external i32
@ -61,16 +61,12 @@ mac_get_binary_path(void *buffer, u32 size){
pid_t pid = getpid();
i32 bytes_read = proc_pidpath(pid, buffer, size);
return bytes_read;
return(bytes_read);
}
int
main(int arg_count, char **args){
@autoreleasepool{
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSString *displayNameAtPath = [fileManager displayNameAtPath:@"build"];
NSLog(@"Display Name: %@", displayNameAtPath);
// NOTE(yuval): Create NSApplication & Delegate
NSApplication* app = [NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];

View File

@ -3,13 +3,22 @@
#if !defined(MAC_OBJECTIVE_C_TO_CPP_LINKS_H)
#define MAC_OBJECTIVE_C_TO_CPP_LINKS_H
// In C++ layer.
// In C++ layer
external String_Const_u8
mac_SCu8(u8* str, u64 size);
external String_Const_u8
mac_push_string_copy(Arena *arena, String_Const_u8 src);
external void
mac_init();
// In Objective-C layer.
// In Objective-C layer
external i32
mac_get_binary_path(void* buffer, u32 size);
external String_Const_u8
mac_standardize_path(Arena* arena, String_Const_u8 path);
#endif