dynwind fixes
[bpt/emacs.git] / src / dosfns.c
index d4b96e9..c517a0e 100644 (file)
@@ -1,6 +1,7 @@
 /* MS-DOS specific Lisp utilities.  Coded by Manabu Higashida, 1991.
    Major changes May-July 1993 Morten Welinder (only 10% original code left)
-   Copyright (C) 1991, 1993, 1996-1998, 2001-2012 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1993, 1996-1998, 2001-2014 Free Software
+   Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -23,9 +24,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* The entire file is within this conditional */
 
 #include <stdio.h>
+/* gettime and settime in dos.h clash with their namesakes from
+   gnulib, so we move out of our way the prototypes in dos.h.  */
+#define gettime dos_h_gettime_
+#define settime dos_h_settime_
 #include <dos.h>
-#include <setjmp.h>
+#undef gettime
+#undef settime
+
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "termchar.h"
 #include "frame.h"
@@ -35,7 +43,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dosfns.h"
 #include "msdos.h"
 #include "dispextern.h"
-#include "character.h"
 #include "coding.h"
 #include "process.h"
 #include <dpmi.h>
@@ -65,27 +72,27 @@ REGISTERS should be a vector produced by `make-register' and
   if (no < 0 || no > 0xff || ASIZE (registers) != 8)
     return Qnil;
   for (i = 0; i < 8; i++)
-    CHECK_NUMBER (XVECTOR (registers)->contents[i]);
+    CHECK_NUMBER (AREF (registers, i));
 
-  inregs.x.ax    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[0]);
-  inregs.x.bx    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[1]);
-  inregs.x.cx    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[2]);
-  inregs.x.dx    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[3]);
-  inregs.x.si    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[4]);
-  inregs.x.di    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[5]);
-  inregs.x.cflag = (unsigned long) XFASTINT (XVECTOR (registers)->contents[6]);
-  inregs.x.flags = (unsigned long) XFASTINT (XVECTOR (registers)->contents[7]);
+  inregs.x.ax    = (unsigned long) XFASTINT (AREF (registers, 0));
+  inregs.x.bx    = (unsigned long) XFASTINT (AREF (registers, 1));
+  inregs.x.cx    = (unsigned long) XFASTINT (AREF (registers, 2));
+  inregs.x.dx    = (unsigned long) XFASTINT (AREF (registers, 3));
+  inregs.x.si    = (unsigned long) XFASTINT (AREF (registers, 4));
+  inregs.x.di    = (unsigned long) XFASTINT (AREF (registers, 5));
+  inregs.x.cflag = (unsigned long) XFASTINT (AREF (registers, 6));
+  inregs.x.flags = (unsigned long) XFASTINT (AREF (registers, 7));
 
   int86 (no, &inregs, &outregs);
 
-  XVECTOR (registers)->contents[0] = make_number (outregs.x.ax);
-  XVECTOR (registers)->contents[1] = make_number (outregs.x.bx);
-  XVECTOR (registers)->contents[2] = make_number (outregs.x.cx);
-  XVECTOR (registers)->contents[3] = make_number (outregs.x.dx);
-  XVECTOR (registers)->contents[4] = make_number (outregs.x.si);
-  XVECTOR (registers)->contents[5] = make_number (outregs.x.di);
-  XVECTOR (registers)->contents[6] = make_number (outregs.x.cflag);
-  XVECTOR (registers)->contents[7] = make_number (outregs.x.flags);
+  ASET (registers, 0, make_number (outregs.x.ax));
+  ASET (registers, 1, make_number (outregs.x.bx));
+  ASET (registers, 2, make_number (outregs.x.cx));
+  ASET (registers, 3, make_number (outregs.x.dx));
+  ASET (registers, 4, make_number (outregs.x.si));
+  ASET (registers, 5, make_number (outregs.x.di));
+  ASET (registers, 6, make_number (outregs.x.cflag));
+  ASET (registers, 7, make_number (outregs.x.flags));
 
   return registers;
 }
@@ -109,7 +116,7 @@ Return the updated VECTOR.  */)
   dosmemget (offs, len, buf);
 
   for (i = 0; i < len; i++)
-    XVECTOR (vector)->contents[i] = make_number (buf[i]);
+    ASET (vector, i, make_number (buf[i]));
 
   return vector;
 }
@@ -132,8 +139,8 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
 
   for (i = 0; i < len; i++)
     {
-      CHECK_NUMBER (XVECTOR (vector)->contents[i]);
-      buf[i] = (unsigned char) XFASTINT (XVECTOR (vector)->contents[i]) & 0xFF;
+      CHECK_NUMBER (AREF (vector, i));
+      buf[i] = (unsigned char) XFASTINT (AREF (vector, i)) & 0xFF;
     }
 
   dosmemput (buf, len, offs);
@@ -395,7 +402,7 @@ msdos_stdcolor_idx (const char *name)
 {
   int i;
 
-  for (i = 0; i < sizeof (vga_colors) / sizeof (vga_colors[0]); i++)
+  for (i = 0; i < ARRAYELTS (vga_colors); i++)
     if (xstrcasecmp (name, vga_colors[i]) == 0)
       return i;
 
@@ -415,7 +422,7 @@ msdos_stdcolor_name (int idx)
     return build_string (unspecified_fg);
   else if (idx == FACE_TTY_DEFAULT_BG_COLOR)
     return build_string (unspecified_bg);
-  else if (idx >= 0 && idx < sizeof (vga_colors) / sizeof (vga_colors[0]))
+  else if (idx >= 0 && idx < ARRAYELTS (vga_colors))
     return build_string (vga_colors[idx]);
   else
     return Qunspecified;       /* meaning the default */
@@ -465,18 +472,18 @@ x_set_title (struct frame *f, Lisp_Object name)
   if (EQ (name, f->title))
     return;
 
-  update_mode_lines = 1;
+  update_mode_lines = 13;
 
-  f->title = name;
+  fset_title (f, name);
 
   if (NILP (name))
     name = f->name;
 
   if (FRAME_MSDOS_P (f))
     {
-      BLOCK_INPUT;
+      block_input ();
       w95_set_virtual_machine_title (SDATA (name));
-      UNBLOCK_INPUT;
+      unblock_input ();
     }
 }
 #endif /* !HAVE_X_WINDOWS */
@@ -540,7 +547,6 @@ system_process_attributes (Lisp_Object pid)
       int i;
       Lisp_Object cmd_str, decoded_cmd, tem;
       double pmem;
-      EXFUN (Fget_internal_run_time, 0);
 #ifndef SYSTEM_MALLOC
       extern unsigned long ret_lim_data ();
 #endif
@@ -557,7 +563,7 @@ system_process_attributes (Lisp_Object pid)
        attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
       strcpy (cmd, basename (__crt0_argv[0]));
       /* Command name is encoded in locale-coding-system; decode it.  */
-      cmd_str = make_unibyte_string (cmd, strlen (cmd));
+      cmd_str = build_unibyte_string (cmd);
       decoded_cmd = code_convert_string_norecord (cmd_str,
                                                  Vlocale_coding_system, 0);
       attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs);
@@ -625,7 +631,7 @@ system_process_attributes (Lisp_Object pid)
        q[-1] = '\0';
 
       /* Command line is encoded in locale-coding-system; decode it.  */
-      cmd_str = make_unibyte_string (cmdline, strlen (cmdline));
+      cmd_str = build_unibyte_string (cmdline);
       decoded_cmd = code_convert_string_norecord (cmd_str,
                                                  Vlocale_coding_system, 0);
       xfree (cmdline);
@@ -668,18 +674,7 @@ dos_cleanup (void)
 void
 syms_of_dosfns (void)
 {
-  defsubr (&Sint86);
-  defsubr (&Sdos_memget);
-  defsubr (&Sdos_memput);
-  defsubr (&Smsdos_mouse_init);
-  defsubr (&Smsdos_mouse_enable);
-  defsubr (&Smsdos_set_keyboard);
-  defsubr (&Sinsert_startup_screen);
-  defsubr (&Smsdos_mouse_disable);
-  defsubr (&Sfile_system_info);
-#ifndef HAVE_X_WINDOWS
-  defsubr (&Smsdos_mouse_p);
-#endif
+#include "dosfns.x"
 
   DEFVAR_INT ("dos-country-code", dos_country_code,
              doc: /* The country code returned by Dos when Emacs was started.
@@ -764,4 +759,3 @@ If zero, the decimal point key returns the country code specific value.  */);
   dos_decimal_point = 0;
 }
 #endif /* MSDOS */
-