mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-06 07:38:45 +00:00
adding prefixes to source
They'll be removed on demand in libgen repo
This commit is contained in:
+67
-67
@@ -6,110 +6,110 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Toolchain/Environment Enums
|
||||
|
||||
typedef enum OperatingSystem OperatingSystem;
|
||||
enum OperatingSystem
|
||||
typedef enum MD_OperatingSystem MD_OperatingSystem;
|
||||
enum MD_OperatingSystem
|
||||
{
|
||||
OperatingSystem_Null,
|
||||
OperatingSystem_Windows,
|
||||
OperatingSystem_Linux,
|
||||
OperatingSystem_Mac,
|
||||
OperatingSystem_COUNT,
|
||||
MD_OperatingSystem_Null,
|
||||
MD_OperatingSystem_Windows,
|
||||
MD_OperatingSystem_Linux,
|
||||
MD_OperatingSystem_Mac,
|
||||
MD_OperatingSystem_COUNT,
|
||||
};
|
||||
|
||||
typedef enum ImageType ImageType;
|
||||
enum ImageType
|
||||
typedef enum MD_ImageType MD_ImageType;
|
||||
enum MD_ImageType
|
||||
{
|
||||
Image_Null,
|
||||
Image_CoffPe,
|
||||
Image_Elf32,
|
||||
Image_Elf64,
|
||||
Image_Macho
|
||||
MD_Image_Null,
|
||||
MD_Image_CoffPe,
|
||||
MD_Image_Elf32,
|
||||
MD_Image_Elf64,
|
||||
MD_Image_Macho
|
||||
};
|
||||
|
||||
typedef enum Arch Arch;
|
||||
enum Arch
|
||||
typedef enum MD_Arch MD_Arch;
|
||||
enum MD_Arch
|
||||
{
|
||||
Arch_Null,
|
||||
Arch_x64,
|
||||
Arch_x86,
|
||||
Arch_arm64,
|
||||
Arch_arm32,
|
||||
Arch_COUNT,
|
||||
MD_Arch_Null,
|
||||
MD_Arch_x64,
|
||||
MD_Arch_x86,
|
||||
MD_Arch_arm64,
|
||||
MD_Arch_arm32,
|
||||
MD_Arch_COUNT,
|
||||
};
|
||||
|
||||
typedef enum Compiler Compiler;
|
||||
enum Compiler
|
||||
typedef enum MD_Compiler MD_Compiler;
|
||||
enum MD_Compiler
|
||||
{
|
||||
Compiler_Null,
|
||||
Compiler_msvc,
|
||||
Compiler_gcc,
|
||||
Compiler_clang,
|
||||
Compiler_COUNT,
|
||||
MD_Compiler_Null,
|
||||
MD_Compiler_msvc,
|
||||
MD_Compiler_gcc,
|
||||
MD_Compiler_clang,
|
||||
MD_Compiler_COUNT,
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Toolchain/Environment Enum Functions
|
||||
|
||||
inline U64
|
||||
bit_size_from_arch(Arch arch)
|
||||
inline MD_U64
|
||||
md_bit_size_from_arch(MD_Arch arch)
|
||||
{
|
||||
// TODO(rjf): metacode
|
||||
U64 arch_bitsize = 0;
|
||||
MD_U64 arch_bitsize = 0;
|
||||
switch(arch)
|
||||
{
|
||||
case Arch_x64: arch_bitsize = 64; break;
|
||||
case Arch_x86: arch_bitsize = 32; break;
|
||||
case Arch_arm64: arch_bitsize = 64; break;
|
||||
case Arch_arm32: arch_bitsize = 32; break;
|
||||
case MD_Arch_x64: arch_bitsize = 64; break;
|
||||
case MD_Arch_x86: arch_bitsize = 32; break;
|
||||
case MD_Arch_arm64: arch_bitsize = 64; break;
|
||||
case MD_Arch_arm32: arch_bitsize = 32; break;
|
||||
default: break;
|
||||
}
|
||||
return arch_bitsize;
|
||||
}
|
||||
|
||||
inline U64
|
||||
max_instruction_size_from_arch(Arch arch)
|
||||
inline MD_U64
|
||||
md_max_instruction_size_from_arch(MD_Arch arch)
|
||||
{
|
||||
// TODO(rjf): make this real
|
||||
return 64;
|
||||
}
|
||||
|
||||
inline OperatingSystem
|
||||
operating_system_from_context(void) {
|
||||
OperatingSystem os = OperatingSystem_Null;
|
||||
#if OS_WINDOWS
|
||||
os = OperatingSystem_Windows;
|
||||
#elif OS_LINUX
|
||||
os = OperatingSystem_Linux;
|
||||
#elif OS_MAC
|
||||
os = OperatingSystem_Mac;
|
||||
inline MD_OperatingSystem
|
||||
md_operating_system_from_context(void) {
|
||||
MD_OperatingSystem os = MD_OperatingSystem_Null;
|
||||
#if MD_OS_WINDOWS
|
||||
os = MD_OperatingSystem_Windows;
|
||||
#elif MD_OS_LINUX
|
||||
os = MD_OperatingSystem_Linux;
|
||||
#elif MD_OS_MAC
|
||||
os = MD_OperatingSystem_Mac;
|
||||
#endif
|
||||
return os;
|
||||
}
|
||||
|
||||
inline Arch
|
||||
arch_from_context(void) {
|
||||
Arch arch = Arch_Null;
|
||||
#if ARCH_X64
|
||||
arch = Arch_x64;
|
||||
#elif ARCH_X86
|
||||
arch = Arch_x86;
|
||||
#elif ARCH_ARM64
|
||||
arch = Arch_arm64;
|
||||
#elif ARCH_ARM32
|
||||
arch = Arch_arm32;
|
||||
inline MD_Arch
|
||||
md_arch_from_contexto(void) {
|
||||
MD_Arch arch = MD_Arch_Null;
|
||||
#if MD_ARCH_X64
|
||||
arch = MD_Arch_x64;
|
||||
#elif MD_ARCH_X86
|
||||
arch = MD_Arch_x86;
|
||||
#elif MD_ARCH_ARM64
|
||||
arch = MD_Arch_arm64;
|
||||
#elif MD_ARCH_ARM32
|
||||
arch = MD_Arch_arm32;
|
||||
#endif
|
||||
return arch;
|
||||
}
|
||||
|
||||
inline Compiler
|
||||
compiler_from_context(void) {
|
||||
Compiler compiler = Compiler_Null;
|
||||
#if COMPILER_MSVC
|
||||
compiler = Compiler_msvc;
|
||||
#elif COMPILER_GCC
|
||||
compiler = Compiler_gcc;
|
||||
#elif COMPILER_CLANG
|
||||
compiler = Compiler_clang;
|
||||
inline MD_Compiler
|
||||
md_compiler_from_context(void) {
|
||||
MD_Compiler compiler = MD_Compiler_Null;
|
||||
#if MD_COMPILER_MSVC
|
||||
compiler = MD_Compiler_msvc;
|
||||
#elif MD_COMPILER_GCC
|
||||
compiler = MD_Compiler_gcc;
|
||||
#elif MD_COMPILER_CLANG
|
||||
compiler = MD_Compiler_clang;
|
||||
#endif
|
||||
return compiler;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user