From: nethack.allison Date: Wed, 19 Feb 2003 11:44:14 +0000 (+0000) Subject: runtime port identification X-Git-Tag: MOVE2GIT~2152 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c4bd6654500f4bcf4afb96dc30e6e15c61036f6;p=nethack runtime port identification The CE ports use makedefs hosted on another platform, so the version string generated at build time isn't really appropriate. Add a way to add information to the version string at runtime for such ports. --- diff --git a/include/extern.h b/include/extern.h index eb9cd735b..b2e5b302e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2084,6 +2084,9 @@ E boolean FDECL(check_version, (struct version_info *, const char *,BOOLEAN_P)); E unsigned long FDECL(get_feature_notice_ver, (char *)); E unsigned long NDECL(get_current_feature_ver); +#ifdef RUNTIME_PORT_ID +E void FDECL(append_port_id, (char *)); +#endif /* ### video.c ### */ diff --git a/include/wceconf.h b/include/wceconf.h index c7b0ec6ec..787f18a24 100644 --- a/include/wceconf.h +++ b/include/wceconf.h @@ -74,6 +74,37 @@ #define PORT_HELP "porthelp" +#if defined(WIN_CE_POCKETPC) +# define PORT_CE_PLATFORM "Pocket PC" +#elif defined(WIN_CE_PS2xx) +# define PORT_CE_PLATFORM "Palm-size PC 2.11" +#elif defined(WIN_CE_HPCPRO) +# define PORT_CE_PLATFORM "H/PC Pro 2.11" +#elif defined(WIN_CE_SMARTPHONE) +# define PORT_CE_PLATFORM "Smartphone 2002" +#endif + +#if defined(ARM) +# define PORT_CE_CPU "ARM" +#elif defined(PPC) +# define PORT_CE_CPU "PPC" +#elif defined(ALPHA) +# define PORT_CE_CPU "ALPHA" +#elif defined(SH3) +# define PORT_CE_CPU "SH3" +#elif defined(SH4) +# define PORT_CE_CPU "SH4" +#elif defined(MIPS) +# define PORT_CE_CPU "MIPS" +#elif defined(X86) +# define PORT_CE_CPU "X86" +#else +# error Only ARM, PPC, ALPHA, SH3, SH4, MIPS and X86 supported +#endif + +#define RUNTIME_PORT_ID /* trigger run-time port identification since + Makedefs is bootstrapped on a cross-platform. */ + #include /* Provides prototypes of strncmpi(), etc. */ #ifdef STRNCMPI #define strncmpi(a,b,c) _strnicmp(a,b,c) diff --git a/src/version.c b/src/version.c index d3b5bbf98..09c358f98 100644 --- a/src/version.c +++ b/src/version.c @@ -24,6 +24,9 @@ char *buf; Strcpy(buf, VERSION_ID); #if defined(BETA) && defined(BETA_INFO) Sprintf(eos(buf), " %s", BETA_INFO); +#endif +#if defined(RUNTIME_PORT_ID) + append_port_id(buf); #endif return buf; } diff --git a/sys/wince/winhack.c b/sys/wince/winhack.c index 3c2e18f23..d77dbebfe 100644 --- a/sys/wince/winhack.c +++ b/sys/wince/winhack.c @@ -340,4 +340,11 @@ void win32_abort() abort(); } +void +append_port_id(buf) +char *buf; +{ + char *portstr = PORT_CE_PLATFORM " " PORT_CE_CPU; + Sprintf(eos(buf), " %s", portstr); +}