Add -m32 and -x c to Makefile for 64-bit Snow Leopard.
[pforth] / csrc / pf_main.c
index a779560..6b07f33 100644 (file)
 #define TRUE (1)\r
 #define FALSE (0)\r
 #endif\r
 #define TRUE (1)\r
 #define FALSE (0)\r
 #endif\r
+
+static const char *gErrorMsg32Bit = "ERROR - A long is not 4 bytes. Are we running on a 64-bit machine?!\n";
 \r
 #ifdef PF_EMBEDDED\r
 int main( void )\r
 {\r
     char IfInit = 0; \r
     const char *DicName = NULL;\r
 \r
 #ifdef PF_EMBEDDED\r
 int main( void )\r
 {\r
     char IfInit = 0; \r
     const char *DicName = NULL;\r
-    const char *SourceName = NULL;\r
+    const char *SourceName = NULL;
+       // Check to make sure we are running in 32-bit mode.
+       if( sizeof(long) != 4 )
+       {
+               pfMessage(gErrorMsg32Bit);
+               return 1;
+       }\r
     pfMessage("\npForth Embedded\n");\r
     return pfDoForth( DicName, SourceName, IfInit);\r
 }\r
     pfMessage("\npForth Embedded\n");\r
     return pfDoForth( DicName, SourceName, IfInit);\r
 }\r
@@ -68,7 +76,14 @@ int main( int argc, char **argv )
        char *s;\r
        int32 i;\r
        int Result;\r
        char *s;\r
        int32 i;\r
        int Result;\r
-\r
+
+       // Check to make sure we are running in 32-bit mode.
+       if( sizeof(long) != 4 )
+       {
+               ERR((gErrorMsg32Bit));
+               return 1;
+       }
+       \r
 /* For Metroworks on Mac */\r
 #ifdef __MWERKS__\r
        argc = ccommand(&argv);\r
 /* For Metroworks on Mac */\r
 #ifdef __MWERKS__\r
        argc = ccommand(&argv);\r