gb_internal a lot

This commit is contained in:
gingerBill
2022-12-18 21:17:07 +00:00
parent ff6b76986a
commit ac5f5a33e9
25 changed files with 1078 additions and 1128 deletions
+20 -20
View File
@@ -58,40 +58,40 @@ struct Find_Result {
String vs_library_path;
};
String mc_wstring_to_string(wchar_t const *str) {
gb_internal String mc_wstring_to_string(wchar_t const *str) {
return string16_to_string(mc_allocator, make_string16_c(str));
}
String16 mc_string_to_wstring(String str) {
gb_internal String16 mc_string_to_wstring(String str) {
return string_to_string16(mc_allocator, str);
}
String mc_concat(String a, String b) {
gb_internal String mc_concat(String a, String b) {
return concatenate_strings(mc_allocator, a, b);
}
String mc_concat(String a, String b, String c) {
gb_internal String mc_concat(String a, String b, String c) {
return concatenate3_strings(mc_allocator, a, b, c);
}
String mc_concat(String a, String b, String c, String d) {
gb_internal String mc_concat(String a, String b, String c, String d) {
return concatenate4_strings(mc_allocator, a, b, c, d);
}
String mc_get_env(String key) {
gb_internal String mc_get_env(String key) {
char const * value = gb_get_env((char const *)key.text, mc_allocator);
return make_string_c(value);
}
void mc_free(String str) {
gb_internal void mc_free(String str) {
if (str.len) gb_free(mc_allocator, str.text);
}
void mc_free(String16 str) {
gb_internal void mc_free(String16 str) {
if (str.len) gb_free(mc_allocator, str.text);
}
void mc_free_all() {
gb_internal void mc_free_all() {
gb_free_all(mc_allocator);
}
@@ -101,7 +101,7 @@ typedef struct _MC_Find_Data {
} MC_Find_Data;
HANDLE mc_find_first(String wildcard, MC_Find_Data *find_data) {
gb_internal HANDLE mc_find_first(String wildcard, MC_Find_Data *find_data) {
WIN32_FIND_DATAW _find_data;
String16 wildcard_wide = mc_string_to_wstring(wildcard);
@@ -115,7 +115,7 @@ HANDLE mc_find_first(String wildcard, MC_Find_Data *find_data) {
return handle;
}
bool mc_find_next(HANDLE handle, MC_Find_Data *find_data) {
gb_internal bool mc_find_next(HANDLE handle, MC_Find_Data *find_data) {
WIN32_FIND_DATAW _find_data;
bool success = !!FindNextFileW(handle, &_find_data);
@@ -124,7 +124,7 @@ bool mc_find_next(HANDLE handle, MC_Find_Data *find_data) {
return success;
}
void mc_find_close(HANDLE handle) {
gb_internal void mc_find_close(HANDLE handle) {
FindClose(handle);
}
@@ -216,7 +216,7 @@ struct Version_Data {
};
typedef void (*MC_Visit_Proc)(String short_name, String full_name, Version_Data *data);
bool mc_visit_files(String dir_name, Version_Data *data, MC_Visit_Proc proc) {
gb_internal bool mc_visit_files(String dir_name, Version_Data *data, MC_Visit_Proc proc) {
// Visit everything in one folder (non-recursively). If it's a directory
// that doesn't start with ".", call the visit proc on it. The visit proc
@@ -246,7 +246,7 @@ bool mc_visit_files(String dir_name, Version_Data *data, MC_Visit_Proc proc) {
return true;
}
String find_windows_kit_root(HKEY key, String const version) {
gb_internal String find_windows_kit_root(HKEY key, String const version) {
// Given a key to an already opened registry entry,
// get the value stored under the 'version' subkey.
// If that's not the right terminology, hey, I never do registry stuff.
@@ -275,7 +275,7 @@ String find_windows_kit_root(HKEY key, String const version) {
return value;
}
void win10_best(String short_name, String full_name, Version_Data *data) {
gb_internal void win10_best(String short_name, String full_name, Version_Data *data) {
// Find the Windows 10 subdirectory with the highest version number.
int i0, i1, i2, i3;
@@ -307,7 +307,7 @@ void win10_best(String short_name, String full_name, Version_Data *data) {
}
}
void find_windows_kit_paths(Find_Result *result) {
gb_internal void find_windows_kit_paths(Find_Result *result) {
bool sdk_found = false;
HKEY main_key;
@@ -355,7 +355,7 @@ void find_windows_kit_paths(Find_Result *result) {
}
}
bool find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *result) {
gb_internal bool find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *result) {
// The name of this procedure is kind of cryptic. Its purpose is
// to fight through Microsoft craziness. The things that the fine
// Visual Studio team want you to do, JUST TO FIND A SINGLE FOLDER
@@ -519,7 +519,7 @@ bool find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
// NOTE(WalterPlinge): Environment variables can help to find Visual C++ and WinSDK paths for both
// official and portable installations (like mmozeiko's portable msvc script).
void find_windows_kit_paths_from_env_vars(Find_Result *result) {
gb_internal void find_windows_kit_paths_from_env_vars(Find_Result *result) {
if (build_context.metrics.arch != TargetArch_amd64 && build_context.metrics.arch != TargetArch_i386) {
return;
}
@@ -669,7 +669,7 @@ void find_windows_kit_paths_from_env_vars(Find_Result *result) {
// NOTE(WalterPlinge): Environment variables can help to find Visual C++ and WinSDK paths for both
// official and portable installations (like mmozeiko's portable msvc script). This will only use
// the first paths it finds, and won't overwrite any values that `result` already has.
void find_visual_studio_paths_from_env_vars(Find_Result *result) {
gb_internal void find_visual_studio_paths_from_env_vars(Find_Result *result) {
if (build_context.metrics.arch != TargetArch_amd64 && build_context.metrics.arch != TargetArch_i386) {
return;
}
@@ -756,7 +756,7 @@ void find_visual_studio_paths_from_env_vars(Find_Result *result) {
}
}
Find_Result find_visual_studio_and_windows_sdk() {
gb_internal Find_Result find_visual_studio_and_windows_sdk() {
Find_Result r = {};
find_windows_kit_paths(&r);
find_visual_studio_by_fighting_through_microsoft_craziness(&r);