public: reserve identifier for WebAssembly port

This commit is contained in:
Alibek Omarov 2024-10-10 15:45:08 +03:00
parent 5d8923d69c
commit 514fc9fe43
4 changed files with 24 additions and 0 deletions

View File

@ -119,6 +119,8 @@ const char *Q_PlatformStringByID( const int platform )
return "nswitch";
case PLATFORM_PSVITA:
return "psvita";
case PLATFORM_WASI:
return "wasi";
}
assert( 0 );
@ -204,6 +206,8 @@ const char *Q_ArchitectureStringByID( const int arch, const uint abi, const int
return is64 ? "riscv64d" : "riscv32d";
}
break;
case ARCHITECTURE_WASM:
return is64 ? "wasm64" : "wasm32";
}
assert( 0 );

View File

@ -85,6 +85,8 @@ Then you can use another oneliner to query all variables:
#undef XASH_X86
#undef XASH_NSWITCH
#undef XASH_PSVITA
#undef XASH_WASI
#undef XASH_WASM
//================================================================
//
@ -126,6 +128,8 @@ Then you can use another oneliner to query all variables:
#define XASH_NSWITCH 1
#elif defined __vita__
#define XASH_PSVITA 1
#elif defined __wasi__
#define XASH_WASI 1
#else
#error
#endif
@ -234,6 +238,11 @@ Then you can use another oneliner to query all variables:
#else
#error "Unknown RISC-V float ABI"
#endif
#elif defined __wasm__
#if defined __wasm64__
#define XASH_64BIT 1
#endif
#define XASH_WASM 1
#else
#error "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug"
#endif

View File

@ -41,6 +41,7 @@ GNU General Public License for more details.
#define PLATFORM_IRIX 12
#define PLATFORM_NSWITCH 13
#define PLATFORM_PSVITA 14
#define PLATFORM_WASI 15
#if XASH_WIN32
#define XASH_PLATFORM PLATFORM_WIN32
@ -70,6 +71,8 @@ GNU General Public License for more details.
#define XASH_PLATFORM PLATFORM_NSWITCH
#elif XASH_PSVITA
#define XASH_PLATFORM PLATFORM_PSVITA
#elif XASH_WASI
#define XASH_PLATFORM PLATFORM_WASI
#else
#error
#endif
@ -87,6 +90,7 @@ GNU General Public License for more details.
#define ARCHITECTURE_E2K 7
#define ARCHITECTURE_RISCV 8
#define ARCHITECTURE_PPC 9
#define ARCHITECTURE_WASM 10
#if XASH_AMD64
#define XASH_ARCHITECTURE ARCHITECTURE_AMD64
@ -104,6 +108,8 @@ GNU General Public License for more details.
#define XASH_ARCHITECTURE ARCHITECTURE_RISCV
#elif XASH_PPC
#define XASH_ARCHITECTURE ARCHITECTURE_PPC
#elif XASH_WASM
#define XASH_ARCHITECTURE ARCHITECTURE_WASM
#else
#error
#endif

View File

@ -24,6 +24,7 @@ static struct
{ PLATFORM_IRIX, "irix" },
{ PLATFORM_NSWITCH, "nswitch" },
{ PLATFORM_PSVITA, "psvita" },
{ PLATFORM_WASI, "wasi" },
};
static struct
@ -40,6 +41,10 @@ static struct
{ ARCHITECTURE_E2K, 0, -1, -1, "e2k" },
{ ARCHITECTURE_JS, 0, -1, -1, "javascript" },
// all possible WebAssembly names
{ ARCHITECTURE_WASM, 0, -1, true, "wasm64" },
{ ARCHITECTURE_WASM, 0, -1, false, "wasm32" },
// all possible MIPS names
{ ARCHITECTURE_MIPS, 0, ENDIANNESS_BIG, true, "mips64" },
{ ARCHITECTURE_MIPS, 0, ENDIANNESS_BIG, false, "mips" },