put system shared into unix shared

master
Allen Webster 2017-06-30 18:09:18 -04:00
parent b32d31152b
commit d901d3e50a
4 changed files with 43 additions and 8 deletions

View File

@ -42,9 +42,12 @@
#include "4ed_rendering.h"
#include "4ed.h"
#include "4ed_file_track.h"
#include "4ed_font_interface_to_os.h"
#include "4ed_system_shared.h"
#include "unix_4ed_functions.cpp"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
@ -103,10 +106,6 @@
#define InterlockedCompareExchange(dest, ex, comp) __sync_val_compare_and_swap((dest), (comp), (ex))
#include "4ed_file_track.h"
#include "4ed_font_interface_to_os.h"
#include "4ed_system_shared.h"
//
// Linux structs / enums
//
@ -247,6 +246,7 @@ internal Sys_Release_Lock_Sig(system_release_lock);
internal void system_wait_cv(i32, i32);
internal void system_signal_cv(i32, i32);
#if 0
//
// Shared system functions (system_shared.h)
//
@ -272,6 +272,7 @@ Sys_Get_Binary_Path_Sig(system_get_binary_path){
return size;
}
#endif
//
// Files

View File

@ -1,7 +1,7 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 06.28.2017
* 28.06.2017
*
* Mac C++ layer for 4coder
*
@ -39,6 +39,10 @@
#include "4ed_rendering.h"
#include "4ed.h"
#include "4ed_file_track.h"
#include "4ed_font_interface_to_os.h"
#include "4ed_system_shared.h"
#include "unix_4ed_functions.cpp"
#include "osx_objective_c_to_cpp_links.h"

View File

@ -1,7 +1,7 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 06.28.2017
* 28.06.2017
*
* Mac Objective C layer for 4coder
*

View File

@ -1,7 +1,7 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 06.30.2017
* 30.06.2017
*
* General unix functions
*
@ -17,6 +17,10 @@
#include <unistd.h>
#if defined(USE_LOG)
# include <stdio.h>
#endif
struct Unix_Vars{
b32 do_logging;
};
@ -44,6 +48,32 @@ Sys_Log_Sig(system_log){
}
}
//
// Shared system functions (system_shared.h)
//
internal
Sys_File_Can_Be_Made_Sig(system_file_can_be_made){
b32 result = access((char*)filename, W_OK) == 0;
LOGF("%s = %d", filename, result);
return(result);
}
internal
Sys_Get_Binary_Path_Sig(system_get_binary_path){
ssize_t size = readlink("/proc/self/exe", out->str, out->memory_size - 1);
if(size != -1 && size < out->memory_size - 1){
out->size = size;
remove_last_folder(out);
terminate_with_null(out);
size = out->size;
} else {
size = 0;
}
return size;
}
//
// Memory
//