]> granicus.if.org Git - nethack/commitdiff
runtime port identification
authornethack.allison <nethack.allison>
Wed, 19 Feb 2003 11:44:14 +0000 (11:44 +0000)
committernethack.allison <nethack.allison>
Wed, 19 Feb 2003 11:44:14 +0000 (11:44 +0000)
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.

include/extern.h
include/wceconf.h
src/version.c
sys/wince/winhack.c

index eb9cd735bb122375b35e5bf07644656806a846f1..b2e5b302e78feeccb1b9c15709a6811ab8c16f82 100644 (file)
@@ -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 ### */
 
index c7b0ec6ec198e55acd595e08f0217c67936d742f..787f18a247eac57518b36e7c769bfd1758628e90 100644 (file)
 
 #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 <string.h>    /* Provides prototypes of strncmpi(), etc.     */
 #ifdef STRNCMPI
 #define strncmpi(a,b,c) _strnicmp(a,b,c)
index d3b5bbf985add948433e14029ed634c3dc5d15eb..09c358f981f3c832510c52d26815c1a2e019d68d 100644 (file)
@@ -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;
 }
index 3c2e18f23efe4e4a192196944c2d45fc141cd406..d77dbebfe641339a7d914073c376703f38debce6 100644 (file)
@@ -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);
+}