XEmacs 21.2.36 "Notos"
[chise/xemacs-chise.git.1] / src / dumper.c
index 0f42642..4aa59b5 100644 (file)
@@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include <config.h>
 #include "lisp.h"
+
 #include "dump-id.h"
 #include "specifier.h"
 #include "alloc.h"
@@ -30,10 +31,8 @@ Boston, MA 02111-1307, USA.  */
 #include "console-stream.h"
 #include "dumper.h"
 
-#ifdef WINDOWSNT
-#define WINDOWS_LEAN_AND_MEAN
-#include <windows.h>
-#define PATH_MAX MAXPATHLEN
+#ifdef WIN32_NATIVE
+#include "nt.h"
 #else
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
@@ -107,7 +106,7 @@ typedef struct
 char *pdump_start, *pdump_end;
 static size_t pdump_length;
 
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
 // Handle for the dump file
 HANDLE pdump_hFile = INVALID_HANDLE_VALUE;
 // Handle for the file mapping object for the dump file
@@ -669,7 +668,7 @@ pdump_reloc_one (void *data, EMACS_INT delta, const struct lrecord_description *
 
            if (POINTER_TYPE_P (XTYPE (*pobj))
                && ! EQ (*pobj, Qnull_pointer))
-             XSETOBJ (*pobj, XTYPE (*pobj), (char *) XPNTR (*pobj) + delta);
+             XSETOBJ (*pobj, (char *) XPNTR (*pobj) + delta);
 
            break;
          }
@@ -687,7 +686,7 @@ pdump_reloc_one (void *data, EMACS_INT delta, const struct lrecord_description *
 
                if (POINTER_TYPE_P (XTYPE (*pobj))
                    && ! EQ (*pobj, Qnull_pointer))
-                 XSETOBJ (*pobj, XTYPE (*pobj), (char *) XPNTR (*pobj) + delta);
+                 XSETOBJ (*pobj, (char *) XPNTR (*pobj) + delta);
              }
            break;
          }
@@ -1024,7 +1023,7 @@ static int pdump_load_finish (void)
     {
       Lisp_Object obj = PDUMP_READ (p, Lisp_Object);
       if (POINTER_TYPE_P (XTYPE (obj)))
-       XSETOBJ (obj, XTYPE (obj), (char *) XPNTR (obj) + delta);
+       XSETOBJ (obj, (char *) XPNTR (obj) + delta);
       *staticvec[i] = obj;
     }
 
@@ -1082,7 +1081,7 @@ static int pdump_load_finish (void)
       Lisp_Object  obj = PDUMP_READ (p, Lisp_Object);
 
       if (POINTER_TYPE_P (XTYPE (obj)))
-       XSETOBJ (obj, XTYPE (obj), (char *) XPNTR (obj) + delta);
+       XSETOBJ (obj, (char *) XPNTR (obj) + delta);
 
       *var = obj;
     }
@@ -1104,13 +1103,10 @@ static int pdump_load_finish (void)
          p += sizeof (Lisp_Object) * rt.count;
     }
 
-  /* Put back noninteractive1 to its real value */
-  noninteractive1 = noninteractive;
-
   return 1;
 }
 
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
 /* Free the mapped file if we decide we don't want it after all */
 static void pdump_file_unmap(void)
 {
@@ -1122,11 +1118,11 @@ static void pdump_file_unmap(void)
 static int pdump_file_get(const char *path)
 {
 
-  pdump_hFile = CreateFile (path, 
+  pdump_hFile = CreateFile (path,
                            GENERIC_READ + GENERIC_WRITE,  /* Required for copy on write */
                            0,                      /* Not shared */
                            NULL,                   /* Not inheritable */
-                           OPEN_EXISTING, 
+                           OPEN_EXISTING,
                            FILE_ATTRIBUTE_NORMAL,
                            NULL);                  /* No template file */
   if (pdump_hFile == INVALID_HANDLE_VALUE)
@@ -1198,7 +1194,7 @@ static int pdump_resource_get (void)
   return 1;
 }
 
-#else /* !WINDOWSNT */
+#else /* !WIN32_NATIVE */
 
 static void *pdump_mallocadr;
 
@@ -1247,7 +1243,7 @@ static int pdump_file_get(const char *path)
   close (pdump_fd);
   return 1;
 }
-#endif /* !WINDOWSNT */
+#endif /* !WIN32_NATIVE */
 
 
 static int pdump_file_try(char *exe_path)
@@ -1264,7 +1260,7 @@ static int pdump_file_try(char *exe_path)
            return 1;
          pdump_free();
        }
-      
+
       sprintf (w, "-%08x.dmp", dump_id);
       if (pdump_file_get (exe_path))
        {
@@ -1272,7 +1268,7 @@ static int pdump_file_try(char *exe_path)
            return 1;
          pdump_free();
        }
-      
+
       sprintf (w, ".dmp");
       if (pdump_file_get (exe_path))
        {
@@ -1280,10 +1276,10 @@ static int pdump_file_try(char *exe_path)
            return 1;
          pdump_free();
        }
-      
+
       do
        w--;
-      while (w>exe_path && !IS_DIRECTORY_SEP (*w) && (*w != '-') && (*w != '.'));      
+      while (w>exe_path && !IS_DIRECTORY_SEP (*w) && (*w != '-') && (*w != '.'));
     }
   while (w>exe_path && !IS_DIRECTORY_SEP (*w));
   return 0;
@@ -1292,9 +1288,9 @@ static int pdump_file_try(char *exe_path)
 int pdump_load(const char *argv0)
 {
   char exe_path[PATH_MAX];
-#ifdef WINDOWSNT
-  GetModuleFileName (NULL, exe_path, PATH_MAX);  
-#else /* !WINDOWSNT */
+#ifdef WIN32_NATIVE
+  GetModuleFileName (NULL, exe_path, PATH_MAX);
+#else /* !WIN32_NATIVE */
   char *w;
   const char *dir, *p;
 
@@ -1307,7 +1303,7 @@ int pdump_load(const char *argv0)
 
   p = dir + strlen(dir);
   while (p != dir && !IS_ANY_SEP (p[-1])) p--;
-  
+
   if (p != dir)
     {
       /* invocation-name includes a directory component -- presumably it
@@ -1338,12 +1334,12 @@ int pdump_load(const char *argv0)
              *w++ = '/';
            }
          strcpy(w, name);
-         
+
          /* ### #$%$#^$^@%$^#%@$ ! */
 #ifdef access
 #undef access
 #endif
-         
+
          if (!access (exe_path, X_OK))
            break;
          if (!*p)
@@ -1352,10 +1348,10 @@ int pdump_load(const char *argv0)
              sprintf (exe_path, "./%s", name);
              break;
            }
-         path = p+1;       
+         path = p+1;
        }
     }
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
 
   if (pdump_file_try (exe_path))
     {
@@ -1363,7 +1359,7 @@ int pdump_load(const char *argv0)
       return 1;
     }
 
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
   if (pdump_resource_get ())
     {
       if (pdump_load_check ())