Added empty implementations of all the system api functions to mac_4ed_functions.cpp

master
Yuval Dolev 2019-12-24 22:31:24 +02:00
parent 54f5e72aa5
commit e3e5f857ea
9 changed files with 518 additions and 109 deletions

View File

@ -94,7 +94,7 @@ char *includes[] = { "custom", FOREIGN "/freetype2", 0, };
char *windows_platform_layer[] = { "platform_win32/win32_4ed.cpp", 0 };
char *linux_platform_layer[] = { "platform_linux/linux_4ed.cpp", 0 };
char *mac_platform_layer[] = { "platform_mac/mac_4ed.mm", 0 };
char *mac_platform_layer[] = { "platform_mac/mac_4ed.mm", "platform_mac/mac_4ed.cpp", 0 };
char **platform_layers[Platform_COUNT] = {
windows_platform_layer,

View File

@ -1 +1,93 @@
/* Mac C++ layer for 4coder */
#include "4coder_base_types.h"
#include "4coder_version.h"
#include "4coder_events.h"
#include "4coder_table.h"
#include "4coder_types.h"
#include "4coder_default_colors.h"
#include "4coder_system_types.h"
#define STATIC_LINK_API
#include "generated/system_api.h"
#include "4ed_font_interface.h"
#define STATIC_LINK_API
#include "generated/graphics_api.h"
#define STATIC_LINK_API
#include "generated/font_api.h"
#include "4ed_font_set.h"
#include "4ed_render_target.h"
#include "4ed_search_list.h"
#include "4ed.h"
#include "generated/system_api.cpp"
#include "generated/graphics_api.cpp"
#include "generated/font_api.cpp"
#include "4coder_base_types.cpp"
#include "4coder_stringf.cpp"
#include "4coder_events.cpp"
#include "4coder_hash_functions.cpp"
#include "4coder_table.cpp"
#include "4coder_log.cpp"
#include "4ed_search_list.cpp"
////////////////////////////////
#define SLASH '\\'
#define DLL "dll"
#include "4coder_hash_functions.cpp"
#include "4coder_system_allocator.cpp"
#include "4coder_codepoint_map.cpp"
#include "4ed_mem.cpp"
#include "4ed_font_set.cpp"
////////////////////////////////
struct Mac_Vars {
Thread_Context *tctx;
Arena* frame_arena;
};
////////////////////////////////
Mac_Vars global_mac_vars;
global Render_Target global_target;
////////////////////////////////
#include "mac_4ed_functions.cpp"
////////////////////////////////
external void
mac_init() {
// NOTE(yuval): Context Setup
Thread_Context _tctx = {};
thread_ctx_init(&_tctx, ThreadKind_Main,
get_base_allocator_system(),
get_base_allocator_system());
block_zero_struct(&global_mac_vars);
global_mac_vars.tctx = &_tctx;
API_VTable_system system_vtable = {};
system_api_fill_vtable(&system_vtable);
API_VTable_graphics graphics_vtable = {};
graphics_api_fill_vtable(&graphics_vtable);
API_VTable_font font_vtable = {};
font_api_fill_vtable(&font_vtable);
// NOTE(yuval): Memory
global_mac_vars.frame_arena = reserve_arena(global_mac_vars.tctx);
global_target.arena = make_arena_system(KB(256));
}

View File

@ -1,35 +1,13 @@
/* Mac Objective C layer for 4coder */
#include <Cocoa/Cocoa.h>
#define FPS 60
#define frame_useconds (1000000 / FPS)
#include "4coder_base_types.h"
#include "4coder_version.h"
#include "4coder_events.h"
#include "mac_objective_c_to_cpp_links.h"
#include "4coder_system_types.h"
#define STATIC_LINK_API
#include "generated/system_api.h"
#include "generated/system_api.cpp"
#include "4coder_base_types.cpp"
////////////////////////////////
#define SLASH '\\'
#define DLL "dll"
#include "4coder_hash_functions.cpp"
#include "4coder_system_allocator.cpp"
#include "4coder_codepoint_map.cpp"
#include "4ed_mem.cpp"
#include "4ed_font_set.cpp"
////////////////////////////////
#undef function
#undef internal
#undef global
#undef external
#include <Cocoa/Cocoa.h>
@interface App_Delegate : NSObject<NSApplicationDelegate, NSWindowDelegate>
@end
@ -67,32 +45,14 @@ main(int arg_count, char **args){
[NSApp finishLaunching];
// NOTE(yuval): Context Setup
Thread_Context _tctx = {};
thread_ctx_init(&_tctx, ThreadKind_Main,
get_base_allocator_system(),
get_base_allocator_system());
block_zero_struct(&global_mac_vars);
global_mac_vars.tctx = &_tctx;
API_VTable_system system_vtable = {};
system_api_fill_vtable(&system_vtable);
API_VTable_graphics graphics_vtable = {};
graphics_api_fill_vtable(&graphics_vtable);
API_VTable_font font_vtable = {};
font_api_fill_vtable(&font_vtable);
// NOTE(yuval): Memory
global_mac_vars.frame_arena = reserve_arena(global_mac_vars.tctx);
global_target.arean = make_arena_system(KB(256));
mac_init();
#if 0
// NOTE(yuval): Application Core Update
Application_Step_Result result = {};
if (app.step != 0){
result = app.step(mac_vars.tctx, &target, base_ptr, &input);
}
#endif
}
}

View File

@ -0,0 +1,348 @@
/* General macOS Functions */
function
system_get_path_sig(){
String_Const_u8 result = {};
NotImplemented;
return result;
}
function
system_get_canonical_sig(){
String_Const_u8 result = {};
NotImplemented;
return result;
}
function
system_get_file_list_sig(){
File_List result = {};
NotImplemented;
return result;
}
function
system_quick_file_attributes_sig(){
File_Attributes result = {};
NotImplemented;
return result;
}
function
system_load_handle_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_load_attributes_sig(){
File_Attributes result = {};
NotImplemented;
return result;
}
function
system_load_file_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_load_close_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_save_file_sig(){
File_Attributes result = {};
NotImplemented;
return result;
}
function
system_load_library_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_release_library_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_get_proc_sig(){
Void_Func* result = 0;
NotImplemented;
return result;
}
function
system_now_time_sig(){
u64 result = 0;
NotImplemented;
return result;
}
function
system_wake_up_timer_create_sig(){
Plat_Handle result = {};
NotImplemented;
return result;
}
function
system_wake_up_timer_release_sig(){
NotImplemented;
}
function
system_wake_up_timer_set_sig(){
NotImplemented;
}
function
system_signal_step_sig(){
NotImplemented;
}
function
system_sleep_sig(){
NotImplemented;
}
function
system_post_clipboard_sig(){
NotImplemented;
}
function
system_cli_call_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_cli_begin_update_sig(){
NotImplemented;
}
function
system_cli_update_step_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_cli_end_update_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_open_color_picker_sig(){
NotImplemented;
}
function
system_get_screen_scale_factor_sig(){
f32 result = 0.0f;
NotImplemented;
return result;
}
function
system_thread_launch_sig(){
System_Thread result = {};
NotImplemented;
return result;
}
function
system_thread_join_sig(){
NotImplemented;
}
function
system_thread_free_sig(){
NotImplemented;
}
function
system_thread_get_id_sig(){
i32 result = 0;
NotImplemented;
return result;
}
function
system_acquire_global_frame_mutex_sig(){
NotImplemented;
}
function
system_release_global_frame_mutex_sig(){
NotImplemented;
}
function
system_mutex_make_sig(){
System_Mutex result = {};
NotImplemented;
return result;
}
function
system_mutex_acquire_sig(){
NotImplemented;
}
function
system_mutex_release_sig(){
NotImplemented;
}
function
system_mutex_free_sig(){
NotImplemented;
}
function
system_condition_variable_make_sig(){
System_Condition_Variable result = {};
NotImplemented;
return result;
}
function
system_condition_variable_wait_sig(){
NotImplemented;
}
function
system_condition_variable_signal_sig(){
NotImplemented;
}
function
system_condition_variable_free_sig(){
NotImplemented;
}
function
system_memory_allocate_sig(){
void* result = 0;
NotImplemented;
return result;
}
function
system_memory_set_protection_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_memory_free_sig(){
NotImplemented;
}
function
system_memory_annotation_sig(){
Memory_Annotation result = {};
NotImplemented;
return result;
}
function
system_show_mouse_cursor_sig(){
NotImplemented;
}
function
system_set_fullscreen_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_is_fullscreen_sig(){
b32 result = false;
NotImplemented;
return result;
}
function
system_get_keyboard_modifiers_sig(){
Input_Modifier_Set result = {};
NotImplemented;
return result;
}

View File

@ -9,7 +9,6 @@
// TOP
#if 0
#define IS_OBJC_LAYER
#include "4coder_base_types.h"
@ -24,8 +23,6 @@
#define external
#include "osx_objective_c_to_cpp_links.h"
#endif
#include <CoreServices/CoreServices.h>
#import <Cocoa/Cocoa.h>
@ -33,7 +30,7 @@
#import <IOKit/hid/IOHIDLib.h>
#import <OpenGL/OpenGL.h>
#import <OpenGL/gl.h>
#if 0
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
@ -843,10 +840,9 @@ OSX_Keyboard_Modifiers
osx_get_modifiers(void){
return(osx_mods_nsevent_to_struct([NSEvent modifierFlags]));
}
#endif
int
main(int argc, char **argv){
#if 0
memset(&osx_objc, 0, sizeof(osx_objc));
u32 clipboard_size = KB(16);
@ -891,7 +887,7 @@ main(int argc, char **argv){
[NSApp run];
}
#endif
return(0);
}

View File

@ -0,0 +1,13 @@
/* Types and functions for communication between C++ and Objective-C layers. */
#if !defined(MAC_OBJECTIVE_C_TO_CPP_LINKS_H)
#define MAC_OBJECTIVE_C_TO_CPP_LINKS_H
// In C++ layer.
external void*
mac_init();
// In Objective-C layer.
#endif