aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1992-04-24 08:11:54 +0000
committerJim Blandy1992-04-24 08:11:54 +0000
commit4746118aca2d5cbdd054b4af4814d56550dfbc79 (patch)
tree370e07c6950794f936bc8d434cb0560d883e4a0b /src
parentd4327fecc103493bc8275c3580b05c06c9fcc019 (diff)
downloademacs-4746118aca2d5cbdd054b4af4814d56550dfbc79.tar.gz
emacs-4746118aca2d5cbdd054b4af4814d56550dfbc79.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bytecode.c7
-rw-r--r--src/callint.c7
-rw-r--r--src/callproc.c3
-rw-r--r--src/editfns.c6
-rw-r--r--src/fileio.c8
-rw-r--r--src/floatfns.c12
-rw-r--r--src/lisp.h14
-rw-r--r--src/lread.c20
-rw-r--r--src/print.c12
-rw-r--r--src/process.c10
-rw-r--r--src/ralloc.c1
-rw-r--r--src/s/hpux.h5
-rw-r--r--src/search.c65
-rw-r--r--src/sysdep.c44
-rw-r--r--src/systty.h46
-rw-r--r--src/term.c7
-rw-r--r--src/xfns.c7
-rw-r--r--src/xterm.c34
18 files changed, 188 insertions, 120 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index acde450299c..5ab689f1925 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1,11 +1,11 @@
1/* Execution of byte code produced by bytecomp.el. 1/* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -1077,8 +1077,7 @@ If the third argument is incorrect, Emacs may crash.")
1077 break; 1077 break;
1078 1078
1079 case Bnumberp: 1079 case Bnumberp:
1080 TOP = (XTYPE (TOP) == Lisp_Int || XTYPE (TOP) == Lisp_Float 1080 TOP = (NUMBERP (TOP) ? Qt : Qnil);
1081 ? Qt : Qnil);
1082 break; 1081 break;
1083 1082
1084 case Bintegerp: 1083 case Bintegerp:
diff --git a/src/callint.c b/src/callint.c
index ffee0785095..0075ef721dc 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -408,12 +408,7 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
408 case 'n': /* Read number from minibuffer. */ 408 case 'n': /* Read number from minibuffer. */
409 do 409 do
410 args[i] = Fread_minibuffer (build_string (prompt), Qnil); 410 args[i] = Fread_minibuffer (build_string (prompt), Qnil);
411#ifdef LISP_FLOAT_TYPE 411 while (! NUMBERP (args[i]));
412 while (XTYPE (args[i]) != Lisp_Int
413 && XTYPE (args[i]) != Lisp_Float);
414#else
415 while (XTYPE (args[i]) != Lisp_Int);
416#endif
417 visargs[i] = last_minibuf_string; 412 visargs[i] = last_minibuf_string;
418 break; 413 break;
419 414
diff --git a/src/callproc.c b/src/callproc.c
index d22393a2635..68b447d401d 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -200,7 +200,7 @@ If you quit, the process is killed with SIGKILL.")
200 env = environ; 200 env = environ;
201 201
202#if 0 /* Some systems don't have sigblock. */ 202#if 0 /* Some systems don't have sigblock. */
203 mask = sigblock (sigmask (SIGCHLD)); 203 EMACS_SIGBLOCK (sigmask (SIGCHLD), mask);
204#endif 204#endif
205 205
206 /* Record that we're about to create a synchronous process. */ 206 /* Record that we're about to create a synchronous process. */
@@ -511,6 +511,7 @@ This function consults the variable ``process-environment'' for its value.")
511 callable from C. */ 511 callable from C. */
512char * 512char *
513egetenv (var) 513egetenv (var)
514 char *var;
514{ 515{
515 char *value; 516 char *value;
516 int valuelen; 517 int valuelen;
diff --git a/src/editfns.c b/src/editfns.c
index d0db0837591..0ef059aa055 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1094,20 +1094,24 @@ Use %% to put a single % into the output.")
1094 /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ 1094 /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */
1095 else if (XTYPE (args[n]) == Lisp_Int && *format != 's') 1095 else if (XTYPE (args[n]) == Lisp_Int && *format != 's')
1096 { 1096 {
1097#ifdef LISP_FLOAT_TYPE
1097 /* The following loop issumes the Lisp type indicates 1098 /* The following loop issumes the Lisp type indicates
1098 the proper way to pass the argument. 1099 the proper way to pass the argument.
1099 So make sure we have a flonum if the argument should 1100 So make sure we have a flonum if the argument should
1100 be a double. */ 1101 be a double. */
1101 if (*format == 'e' || *format == 'f' || *format == 'g') 1102 if (*format == 'e' || *format == 'f' || *format == 'g')
1102 args[n] = Ffloat (args[n]); 1103 args[n] = Ffloat (args[n]);
1104#endif
1103 total += 10; 1105 total += 10;
1104 } 1106 }
1107#ifdef LISP_FLOAT_TYPE
1105 else if (XTYPE (args[n]) == Lisp_Float && *format != 's') 1108 else if (XTYPE (args[n]) == Lisp_Float && *format != 's')
1106 { 1109 {
1107 if (! (*format == 'e' || *format == 'f' || *format == 'g')) 1110 if (! (*format == 'e' || *format == 'f' || *format == 'g'))
1108 args[n] = Ftruncate (args[n]); 1111 args[n] = Ftruncate (args[n]);
1109 total += 20; 1112 total += 20;
1110 } 1113 }
1114#endif
1111 else 1115 else
1112 { 1116 {
1113 /* Anything but a string, convert to a string using princ. */ 1117 /* Anything but a string, convert to a string using princ. */
@@ -1131,6 +1135,7 @@ Use %% to put a single % into the output.")
1131 /* We checked above that the corresponding format effector 1135 /* We checked above that the corresponding format effector
1132 isn't %s, which would cause MPV. */ 1136 isn't %s, which would cause MPV. */
1133 strings[n] = (unsigned char *) XINT (args[n]); 1137 strings[n] = (unsigned char *) XINT (args[n]);
1138#ifdef LISP_FLOAT_TYPE
1134 else if (XTYPE (args[n]) == Lisp_Float) 1139 else if (XTYPE (args[n]) == Lisp_Float)
1135 { 1140 {
1136 union { double d; int half[2]; } u; 1141 union { double d; int half[2]; } u;
@@ -1139,6 +1144,7 @@ Use %% to put a single % into the output.")
1139 strings[n++] = (unsigned char *) u.half[0]; 1144 strings[n++] = (unsigned char *) u.half[0];
1140 strings[n] = (unsigned char *) u.half[1]; 1145 strings[n] = (unsigned char *) u.half[1];
1141 } 1146 }
1147#endif
1142 else 1148 else
1143 strings[n] = XSTRING (args[n])->data; 1149 strings[n] = XSTRING (args[n])->data;
1144 } 1150 }
diff --git a/src/fileio.c b/src/fileio.c
index ea7f8c6250f..f977ee0c623 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,11 +1,11 @@
1/* File IO for GNU Emacs. 1/* File IO for GNU Emacs.
2 Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -411,7 +411,7 @@ directory_file_name (src, dst)
411 /* Process as Unix format: just remove any final slash. 411 /* Process as Unix format: just remove any final slash.
412 But leave "/" unchanged; do not change it to "". */ 412 But leave "/" unchanged; do not change it to "". */
413 strcpy (dst, src); 413 strcpy (dst, src);
414 if (dst[slen - 1] == '/' && slen > 1) 414 if (slen > 1 && dst[slen - 1] == '/')
415 dst[slen - 1] = 0; 415 dst[slen - 1] = 0;
416 return 1; 416 return 1;
417} 417}
@@ -2478,7 +2478,7 @@ Auto-saving writes the buffer into a file\n\
2478so that your editing is not lost if the system crashes.\n\ 2478so that your editing is not lost if the system crashes.\n\
2479This file is not the file you visited; that changes only when you save.\n\n\ 2479This file is not the file you visited; that changes only when you save.\n\n\
2480Non-nil first argument means do not print any message if successful.\n\ 2480Non-nil first argument means do not print any message if successful.\n\
2481Non-nil second argumet means save only current buffer.") 2481Non-nil second argument means save only current buffer.")
2482 (nomsg) 2482 (nomsg)
2483 Lisp_Object nomsg; 2483 Lisp_Object nomsg;
2484{ 2484{
diff --git a/src/floatfns.c b/src/floatfns.c
index 12f14ffef72..ed94c9ebafe 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -1,11 +1,11 @@
1/* Primitive operations on floating point for GNU Emacs Lisp interpreter. 1/* Primitive operations on floating point for GNU Emacs Lisp interpreter.
2 Copyright (C) 1988 Free Software Foundation, Inc. 2 Copyright (C) 1988, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -42,7 +42,7 @@ extern int errno;
42#define sinh(x) ((exp(x)-exp(-x))*0.5) 42#define sinh(x) ((exp(x)-exp(-x))*0.5)
43#endif /* VMS */ 43#endif /* VMS */
44 44
45static float_error (); 45static SIGTYPE float_error ();
46 46
47/* Nonzero while executing in floating point. 47/* Nonzero while executing in floating point.
48 This tells float_error what to do. */ 48 This tells float_error what to do. */
@@ -60,8 +60,8 @@ static Lisp_Object float_error_arg;
60 Handle errors which may result in signals or may set errno. */ 60 Handle errors which may result in signals or may set errno. */
61 61
62#define IN_FLOAT(D, NUM) \ 62#define IN_FLOAT(D, NUM) \
63(in_float = 1, errno = 0, float_error_arg = NUM, (D), \ 63(in_float = 1, errno = 0, float_error_arg = NUM, (D), \
64 (errno == ERANGE || errno == EDOM ? float_error () : 0), \ 64 (errno == ERANGE || errno == EDOM ? float_error () : (SIGTYPE) 0), \
65 in_float = 0) 65 in_float = 0)
66 66
67/* Extract a Lisp number as a `double', or signal an error. */ 67/* Extract a Lisp number as a `double', or signal an error. */
@@ -498,7 +498,7 @@ Rounds the value toward zero.")
498 return num; 498 return num;
499} 499}
500 500
501static 501static SIGTYPE
502float_error (signo) 502float_error (signo)
503 int signo; 503 int signo;
504{ 504{
diff --git a/src/lisp.h b/src/lisp.h
index 1e5d4bf9365..c7dd07058eb 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1,11 +1,11 @@
1/* Fundamental definitions for GNU Emacs Lisp interpreter. 1/* Fundamental definitions for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -506,15 +506,19 @@ typedef unsigned char UCHAR;
506 506
507/* Data type checking */ 507/* Data type checking */
508 508
509#ifdef NULL
510#undef NULL
511#endif
512#define NILP(x) (XFASTINT (x) == XFASTINT (Qnil)) 509#define NILP(x) (XFASTINT (x) == XFASTINT (Qnil))
513 510
511#ifdef LISP_FLOAT_TYPE
512#define NUMBERP(x) (XTYPE (x) == Lisp_Int || XTYPE (x) == Lisp_Float)
513#else
514#define NUMBERP(x) (XTYPE (x) == Lisp_Int)
515#endif
516
514/* #define LISTP(x) (XTYPE ((x)) == Lisp_Cons)*/ 517/* #define LISTP(x) (XTYPE ((x)) == Lisp_Cons)*/
515#define CONSP(x) (XTYPE ((x)) == Lisp_Cons) 518#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
516#define EQ(x, y) (XFASTINT (x) == XFASTINT (y)) 519#define EQ(x, y) (XFASTINT (x) == XFASTINT (y))
517 520
521
518#define CHECK_LIST(x, i) \ 522#define CHECK_LIST(x, i) \
519 { if ((XTYPE ((x)) != Lisp_Cons) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } 523 { if ((XTYPE ((x)) != Lisp_Cons) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); }
520 524
diff --git a/src/lread.c b/src/lread.c
index 78d578758b0..c3157c8d618 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1448,14 +1448,15 @@ init_lread ()
1448 uses ../lisp, instead of the path of the installed elisp 1448 uses ../lisp, instead of the path of the installed elisp
1449 libraries. However, if it appears that Vload_path was changed 1449 libraries. However, if it appears that Vload_path was changed
1450 from the default before dumping, don't override that value. */ 1450 from the default before dumping, don't override that value. */
1451 { 1451 if (initialized)
1452 Lisp_Object normal_path; 1452 {
1453 1453 Lisp_Object dump_path;
1454 normal_path = decode_env_path ("", normal);
1455 1454
1456 if ( 1455 dump_path = decode_env_path ("", PATH_DUMPLOADSEARCH);
1457 if (initialized 1456 if (! NILP (Fequal (dump_path, Vload_path)))
1458 || EQ (Vload_path, initial_path)) 1457 Vload_path = decode_env_path ("", normal);
1458 }
1459 else
1459 Vload_path = decode_env_path ("", normal); 1460 Vload_path = decode_env_path ("", normal);
1460#endif 1461#endif
1461 1462
@@ -1487,11 +1488,6 @@ init_lread ()
1487 1488
1488 Vvalues = Qnil; 1489 Vvalues = Qnil;
1489 1490
1490 if (initialized)
1491 initial_path = Qnil;
1492 else
1493 initial_path = Vload_path;
1494
1495 load_in_progress = 0; 1491 load_in_progress = 0;
1496} 1492}
1497 1493
diff --git a/src/print.c b/src/print.c
index b65db9aedc6..8ab40735e38 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1,11 +1,11 @@
1/* Lisp object printing and output streams. 1/* Lisp object printing and output streams.
2 Copyright (C) 1985, 1986, 1988 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1988, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -566,12 +566,12 @@ Output stream is STREAM, or value of `standard-output' (which see).")
566 for the convenience of the debugger. */ 566 for the convenience of the debugger. */
567Lisp_Object Qexternal_debugging_output; 567Lisp_Object Qexternal_debugging_output;
568 568
569DEFUN ("external-debugging-output", 569DEFUN ("external-debugging-output", Fexternal_debugging_output, Sexternal_debugging_output, 1, 1, 0,
570 Fexternal_debugging_output, Sexternal_debugging_output, 570 "Write CHARACTER to stderr.\n\
571 1, 1, 0, "Write CHARACTER to stderr.\n\
572You can call print while debugging emacs, and pass it this function\n\ 571You can call print while debugging emacs, and pass it this function\n\
573to make it write to the debugging output.\n") 572to make it write to the debugging output.\n")
574 (Lisp_Object character) 573 (character)
574 Lisp_Object character;
575{ 575{
576 CHECK_NUMBER (character, 0); 576 CHECK_NUMBER (character, 0);
577 putc (XINT (character), stderr); 577 putc (XINT (character), stderr);
diff --git a/src/process.c b/src/process.c
index 1bdc27be91b..442cae6d159 100644
--- a/src/process.c
+++ b/src/process.c
@@ -403,7 +403,7 @@ status_message (status)
403} 403}
404 404
405#ifdef HAVE_PTYS 405#ifdef HAVE_PTYS
406static pty_process; 406static int pty_process;
407 407
408/* Open an available pty, returning a file descriptor. 408/* Open an available pty, returning a file descriptor.
409 Return -1 on failure. 409 Return -1 on failure.
@@ -1803,6 +1803,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1803 if (read_kbd && detect_input_pending ()) 1803 if (read_kbd && detect_input_pending ())
1804 break; 1804 break;
1805 1805
1806#ifdef SIGIO
1806 /* If we think we have keyboard input waiting, but didn't get SIGIO 1807 /* If we think we have keyboard input waiting, but didn't get SIGIO
1807 go read it. This can happen with X on BSD after logging out. 1808 go read it. This can happen with X on BSD after logging out.
1808 In that case, there really is no input and no SIGIO, 1809 In that case, there really is no input and no SIGIO,
@@ -1813,6 +1814,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1813 */ 1814 */
1814 if (read_kbd && interrupt_input && (FD_ISSET (fileno (stdin), &Available))) 1815 if (read_kbd && interrupt_input && (FD_ISSET (fileno (stdin), &Available)))
1815 kill (0, SIGIO); 1816 kill (0, SIGIO);
1817#endif
1816 1818
1817#ifdef vipc 1819#ifdef vipc
1818 /* Check for connection from other process */ 1820 /* Check for connection from other process */
@@ -2106,12 +2108,14 @@ send_process (proc, buf, len)
2106 while (len > 0) 2108 while (len > 0)
2107 { 2109 {
2108 int this = len; 2110 int this = len;
2111 SIGTYPE (*old_sigpipe)();
2112
2109 /* Don't send more than 500 bytes at a time. */ 2113 /* Don't send more than 500 bytes at a time. */
2110 if (this > 500) 2114 if (this > 500)
2111 this = 500; 2115 this = 500;
2112 signal (SIGPIPE, send_process_trap); 2116 old_sigpipe = signal (SIGPIPE, send_process_trap);
2113 rv = write (XFASTINT (XPROCESS (proc)->outfd), buf, this); 2117 rv = write (XFASTINT (XPROCESS (proc)->outfd), buf, this);
2114 signal (SIGPIPE, SIG_DFL); 2118 signal (SIGPIPE, old_sigpipe);
2115 if (rv < 0) 2119 if (rv < 0)
2116 { 2120 {
2117 if (0 2121 if (0
diff --git a/src/ralloc.c b/src/ralloc.c
index fe22ae4ffe1..927c2dd5477 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -27,6 +27,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
27#include "lisp.h" /* Needed for VALBITS. */ 27#include "lisp.h" /* Needed for VALBITS. */
28#undef NULL 28#undef NULL
29#include "mem_limits.h" 29#include "mem_limits.h"
30#include "getpagesize.h"
30 31
31#define NIL ((POINTER) 0) 32#define NIL ((POINTER) 0)
32 33
diff --git a/src/s/hpux.h b/src/s/hpux.h
index 33de0875602..e146501004c 100644
--- a/src/s/hpux.h
+++ b/src/s/hpux.h
@@ -228,6 +228,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
228#define HAVE_GETTIMEOFDAY 228#define HAVE_GETTIMEOFDAY
229#define HAVE_VFORK 229#define HAVE_VFORK
230#define HAVE_PERROR /* Delete this line for version 6. */ 230#define HAVE_PERROR /* Delete this line for version 6. */
231#define HAVE_RENAME
231 232
232/* The following maps shared exec file to demand loaded exec. 233/* The following maps shared exec file to demand loaded exec.
233 Don't do this as demand loaded exec is broken in hpux. */ 234 Don't do this as demand loaded exec is broken in hpux. */
@@ -253,8 +254,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
253 254
254/* This is how to get the device name of the tty end of a pty. */ 255/* This is how to get the device name of the tty end of a pty. */
255#define PTY_TTY_NAME_SPRINTF \ 256#define PTY_TTY_NAME_SPRINTF \
256 sprintf (ptyname, "/dev/pty/tty%c%x", c, i); 257 sprintf (pty_name, "/dev/pty/tty%c%x", c, i);
257 258
258/* This is how to get the device name of the control end of a pty. */ 259/* This is how to get the device name of the control end of a pty. */
259#define PTY_NAME_SPRINTF \ 260#define PTY_NAME_SPRINTF \
260 sprintf (ptyname, "/dev/ptym/pty%c%x", c, i); 261 sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);
diff --git a/src/search.c b/src/search.c
index cad14a47560..46ff1ec7e77 100644
--- a/src/search.c
+++ b/src/search.c
@@ -23,6 +23,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
23#include "syntax.h" 23#include "syntax.h"
24#include "buffer.h" 24#include "buffer.h"
25#include "commands.h" 25#include "commands.h"
26
26#include <sys/types.h> 27#include <sys/types.h>
27#include "regex.h" 28#include "regex.h"
28 29
@@ -39,9 +40,14 @@ char search_fastmap[0400];
39 40
40Lisp_Object last_regexp; 41Lisp_Object last_regexp;
41 42
42/* Every call to re_match, etc., must pass &search_regs as the regs argument 43/* Every call to re_match, etc., must pass &search_regs as the regs
43 unless you can show it is unnecessary (i.e., if re_match is certainly going 44 argument unless you can show it is unnecessary (i.e., if re_match
44 to be called again before region-around-match can be called). */ 45 is certainly going to be called again before region-around-match
46 can be called).
47
48 Since the registers are now dynamically allocated, we need to make
49 sure not to refer to the Nth register before checking that it has
50 been allocated. */
45 51
46static struct re_registers search_regs; 52static struct re_registers search_regs;
47 53
@@ -147,7 +153,7 @@ DEFUN ("looking-at", Flooking_at, Slooking_at, 1, 1, 0,
147 matcher_overflow (); 153 matcher_overflow ();
148 154
149 val = (0 <= i ? Qt : Qnil); 155 val = (0 <= i ? Qt : Qnil);
150 for (i = 0; i < RE_NREGS; i++) 156 for (i = 0; i < search_regs.num_regs; i++)
151 if (search_regs.start[i] >= 0) 157 if (search_regs.start[i] >= 0)
152 { 158 {
153 search_regs.start[i] += BEGV; 159 search_regs.start[i] += BEGV;
@@ -489,7 +495,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
489 /* generality of an RE search is */ 495 /* generality of an RE search is */
490 /* really needed. */ 496 /* really needed. */
491 /* first item is "exact match" */ 497 /* first item is "exact match" */
492 && *(searchbuf.buffer) == RE_EXACTN_VALUE 498 && *(searchbuf.buffer) == (char) RE_EXACTN_VALUE
493 && searchbuf.buffer[1] + 2 == searchbuf.used) /*first is ONLY item */ 499 && searchbuf.buffer[1] + 2 == searchbuf.used) /*first is ONLY item */
494 { 500 {
495 RE = 0; /* can do straight (non RE) search */ 501 RE = 0; /* can do straight (non RE) search */
@@ -542,7 +548,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
542 if (val >= 0) 548 if (val >= 0)
543 { 549 {
544 j = BEGV; 550 j = BEGV;
545 for (i = 0; i < RE_NREGS; i++) 551 for (i = 0; i < search_regs.num_regs; i++)
546 if (search_regs.start[i] >= 0) 552 if (search_regs.start[i] >= 0)
547 { 553 {
548 search_regs.start[i] += j; 554 search_regs.start[i] += j;
@@ -569,7 +575,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
569 if (val >= 0) 575 if (val >= 0)
570 { 576 {
571 j = BEGV; 577 j = BEGV;
572 for (i = 0; i < RE_NREGS; i++) 578 for (i = 0; i < search_regs.num_regs; i++)
573 if (search_regs.start[i] >= 0) 579 if (search_regs.start[i] >= 0)
574 { 580 {
575 search_regs.start[i] += j; 581 search_regs.start[i] += j;
@@ -996,6 +1002,10 @@ Leaves point at end of replacement text.")
996 1002
997 case_action = nochange; /* We tried an initialization */ 1003 case_action = nochange; /* We tried an initialization */
998 /* but some C compilers blew it */ 1004 /* but some C compilers blew it */
1005
1006 if (search_regs.num_regs <= 0)
1007 error ("replace-match called before any match found");
1008
999 if (search_regs.start[0] < BEGV 1009 if (search_regs.start[0] < BEGV
1000 || search_regs.start[0] > search_regs.end[0] 1010 || search_regs.start[0] > search_regs.end[0]
1001 || search_regs.end[0] > ZV) 1011 || search_regs.end[0] > ZV)
@@ -1068,7 +1078,7 @@ Leaves point at end of replacement text.")
1068 Finsert_buffer_substring (Fcurrent_buffer (), 1078 Finsert_buffer_substring (Fcurrent_buffer (),
1069 make_number (search_regs.start[0]), 1079 make_number (search_regs.start[0]),
1070 make_number (search_regs.end[0])); 1080 make_number (search_regs.end[0]));
1071 else if (c >= '1' && c <= RE_NREGS + '0') 1081 else if (c >= '1' && c <= search_regs.num_regs + '0')
1072 { 1082 {
1073 if (search_regs.start[c - '0'] >= 1) 1083 if (search_regs.start[c - '0'] >= 1)
1074 Finsert_buffer_substring (Fcurrent_buffer (), 1084 Finsert_buffer_substring (Fcurrent_buffer (),
@@ -1103,9 +1113,10 @@ match_limit (num, beginningp)
1103 1113
1104 CHECK_NUMBER (num, 0); 1114 CHECK_NUMBER (num, 0);
1105 n = XINT (num); 1115 n = XINT (num);
1106 if (n < 0 || n >= RE_NREGS) 1116 if (n < 0 || n >= search_regs.num_regs)
1107 args_out_of_range (num, make_number (RE_NREGS)); 1117 args_out_of_range (num, make_number (search_regs.num_regs));
1108 if (search_regs.start[n] < 0) 1118 if (search_regs.num_regs <= 0
1119 || search_regs.start[n] < 0)
1109 return Qnil; 1120 return Qnil;
1110 return (make_number ((beginningp) ? search_regs.start[n] 1121 return (make_number ((beginningp) ? search_regs.start[n]
1111 : search_regs.end[n])); 1122 : search_regs.end[n]));
@@ -1141,11 +1152,14 @@ if the last match was on a buffer; integers or nil if a string was matched.\n\
1141Use `store-match-data' to reinstate the data in this list.") 1152Use `store-match-data' to reinstate the data in this list.")
1142 () 1153 ()
1143{ 1154{
1144 Lisp_Object data[2 * RE_NREGS]; 1155 Lisp_Object *data;
1145 int i, len; 1156 int i, len;
1146 1157
1158 data = (Lisp_Object *) alloca ((2 * search_regs.num_regs)
1159 * sizeof (Lisp_Object));
1160
1147 len = -1; 1161 len = -1;
1148 for (i = 0; i < RE_NREGS; i++) 1162 for (i = 0; i < search_regs.num_regs; i++)
1149 { 1163 {
1150 int start = search_regs.start[i]; 1164 int start = search_regs.start[i];
1151 if (start >= 0) 1165 if (start >= 0)
@@ -1184,7 +1198,30 @@ LIST should have been created by calling `match-data' previously.")
1184 if (!CONSP (list) && !NILP (list)) 1198 if (!CONSP (list) && !NILP (list))
1185 list = wrong_type_argument (Qconsp, list, 0); 1199 list = wrong_type_argument (Qconsp, list, 0);
1186 1200
1187 for (i = 0; i < RE_NREGS; i++) 1201 /* Allocate registers if they don't already exist. */
1202 {
1203 int length = Flength (list) / 2;
1204
1205 if (length > search_regs.num_regs)
1206 {
1207 if (search_regs.start)
1208 search_regs.start =
1209 (regoff_t *) realloc (search_regs.start,
1210 length * sizeof (regoff_t));
1211 else
1212 search_regs.start = (regoff_t *) malloc (length * sizeof (regoff_t));
1213 if (search_regs.end)
1214 search_regs.end =
1215 (regoff_t *) realloc (search_regs.end,
1216 length * sizeof (regoff_t));
1217 else
1218 search_regs.end = (regoff_t *) malloc (length * sizeof (regoff_t));
1219
1220 search_regs.num_regs = length;
1221 }
1222 }
1223
1224 for (i = 0; i < search_regs.num_regs; i++)
1188 { 1225 {
1189 marker = Fcar (list); 1226 marker = Fcar (list);
1190 if (NILP (marker)) 1227 if (NILP (marker))
diff --git a/src/sysdep.c b/src/sysdep.c
index 1483898478d..03614f98cce 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -110,19 +110,6 @@ extern char *sys_errlist[];
110#endif /* not 4.1 */ 110#endif /* not 4.1 */
111#endif /* BSD */ 111#endif /* BSD */
112 112
113#ifdef AIX
114/* Get files for keyboard remapping */
115#define HFNKEYS 2
116#include <sys/hft.h>
117#include <sys/devinfo.h>
118#endif
119
120/* Get rid of LLITOUT in 4.1, since it is said to stimulate kernel bugs. */
121#ifdef BSD4_1
122#undef LLITOUT
123#define LLITOUT 0
124#endif /* 4.1 */
125
126#ifdef BROKEN_TIOCGWINSZ 113#ifdef BROKEN_TIOCGWINSZ
127#undef TIOCGWINSZ 114#undef TIOCGWINSZ
128#endif 115#endif
@@ -144,31 +131,6 @@ extern char *sys_errlist[];
144#endif /* TIOCGWINSZ */ 131#endif /* TIOCGWINSZ */
145#endif /* USG */ 132#endif /* USG */
146 133
147#ifdef NEED_BSDTTY
148#include <sys/bsdtty.h>
149#endif
150
151#if defined (HPUX) && defined (HAVE_PTYS)
152#include <sys/ptyio.h>
153#endif
154
155#ifdef AIX
156#include <sys/pty.h>
157#include <unistd.h>
158#endif /* AIX */
159
160#ifdef SYSV_PTYS
161#include <sys/tty.h>
162#include <sys/pty.h>
163#endif
164
165/* saka@pfu.fujitsu.co.JP writes:
166 FASYNC defined in this file. But, FASYNC don't working.
167 so no problem, because unrequest_sigio only need. */
168#if defined (pfa)
169#include <sys/file.h>
170#endif
171
172extern int quit_char; 134extern int quit_char;
173 135
174#include "screen.h" 136#include "screen.h"
@@ -2348,6 +2310,8 @@ getwd (pathname)
2348 * that files be of same type (regular->regular, dir->dir, etc). 2310 * that files be of same type (regular->regular, dir->dir, etc).
2349 */ 2311 */
2350 2312
2313#ifndef HAVE_RENAME
2314
2351rename (from, to) 2315rename (from, to)
2352 char *from; 2316 char *from;
2353 char *to; 2317 char *to;
@@ -2362,9 +2326,11 @@ rename (from, to)
2362 return (-1); 2326 return (-1);
2363} 2327}
2364 2328
2329#endif
2330
2365/* Set priority value to PRIO. */ 2331/* Set priority value to PRIO. */
2366 2332
2367void 2333int
2368setpriority (which, who, prio) 2334setpriority (which, who, prio)
2369 int which, who, prio; 2335 int which, who, prio;
2370{ 2336{
diff --git a/src/systty.h b/src/systty.h
index 07f12eb33d1..4bbf021595d 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -33,6 +33,44 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
33#endif /* not HAVE_TERMIOS */ 33#endif /* not HAVE_TERMIOS */
34#endif /* not HAVE_TERMIO */ 34#endif /* not HAVE_TERMIO */
35 35
36#ifdef AIX
37/* Get files for keyboard remapping */
38#define HFNKEYS 2
39#include <sys/hft.h>
40#include <sys/devinfo.h>
41#endif
42
43/* Get rid of LLITOUT in 4.1, since it is said to stimulate kernel bugs. */
44#ifdef BSD4_1
45#undef LLITOUT
46#define LLITOUT 0
47#endif /* 4.1 */
48
49#ifdef NEED_BSDTTY
50#include <sys/bsdtty.h>
51#endif
52
53#if defined (HPUX) && defined (HAVE_PTYS)
54#include <sys/ptyio.h>
55#endif
56
57#ifdef AIX
58#include <sys/pty.h>
59#include <unistd.h>
60#endif /* AIX */
61
62#ifdef SYSV_PTYS
63#include <sys/tty.h>
64#include <sys/pty.h>
65#endif
66
67/* saka@pfu.fujitsu.co.JP writes:
68 FASYNC defined in this file. But, FASYNC don't working.
69 so no problem, because unrequest_sigio only need. */
70#if defined (pfa)
71#include <sys/file.h>
72#endif
73
36 74
37/* Special cases - inhibiting the use of certain features. */ 75/* Special cases - inhibiting the use of certain features. */
38 76
@@ -184,6 +222,13 @@ struct emacs_tty {
184 (tcsetattr ((fd), (waitp) ? TCSAFLUSH : TCSADRAIN, &(p)->main) != -1) 222 (tcsetattr ((fd), (waitp) ? TCSAFLUSH : TCSADRAIN, &(p)->main) != -1)
185 223
186#else 224#else
225#ifdef HAVE_TERMIO
226
227#define EMACS_GET_TTY_1(fd, p) (ioctl ((fd), TCGETA, &(p)->main) != -1)
228#define EMACS_SET_TTY_1(fd, p, waitp) \
229 (ioctl ((fd), (waitp) ? TCSETAW : TCSETAF, &(p)->main) != -1)
230
231#else
187#ifdef VMS 232#ifdef VMS
188 233
189/* These definitions will really only work in sysdep.c, because of their 234/* These definitions will really only work in sysdep.c, because of their
@@ -203,6 +248,7 @@ struct emacs_tty {
203 248
204#endif 249#endif
205#endif 250#endif
251#endif
206 252
207#ifdef TIOCGLTC 253#ifdef TIOCGLTC
208 struct ltchars ltchars; 254 struct ltchars ltchars;
diff --git a/src/term.c b/src/term.c
index c23723217e5..e9f7ddbcd18 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1,11 +1,11 @@
1/* terminal control module for terminals described by TERMCAP 1/* terminal control module for terminals described by TERMCAP
2 Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -465,6 +465,7 @@ change_line_highlight (new_highlight, vpos, first_unused_hpos)
465/* Move to absolute position, specified origin 0 */ 465/* Move to absolute position, specified origin 0 */
466 466
467cursor_to (row, col) 467cursor_to (row, col)
468 int row, col;
468{ 469{
469 if (! SCREEN_IS_TERMCAP ((updating_screen 470 if (! SCREEN_IS_TERMCAP ((updating_screen
470 ? updating_screen 471 ? updating_screen
@@ -488,6 +489,7 @@ cursor_to (row, col)
488/* Similar but don't take any account of the wasted characters. */ 489/* Similar but don't take any account of the wasted characters. */
489 490
490raw_cursor_to (row, col) 491raw_cursor_to (row, col)
492 int row, col;
491{ 493{
492 if (! SCREEN_IS_TERMCAP ((updating_screen ? updating_screen : selected_screen))) 494 if (! SCREEN_IS_TERMCAP ((updating_screen ? updating_screen : selected_screen)))
493 { 495 {
@@ -1393,6 +1395,7 @@ It may be necessary to do `unsetenv TERMCAP' as well.\n",
1393 1395
1394/* VARARGS 1 */ 1396/* VARARGS 1 */
1395fatal (str, arg1, arg2) 1397fatal (str, arg1, arg2)
1398 char *str, *arg1, *arg2;
1396{ 1399{
1397 fprintf (stderr, "emacs: "); 1400 fprintf (stderr, "emacs: ");
1398 fprintf (stderr, str, arg1, arg2); 1401 fprintf (stderr, str, arg1, arg2);
diff --git a/src/xfns.c b/src/xfns.c
index 4f3a7ff9e2b..d3943a5f779 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1,11 +1,11 @@
1/* Functions for the X window system. 1/* Functions for the X window system.
2 Copyright (C) 1989 Free Software Foundation. 2 Copyright (C) 1989, 1992 Free Software Foundation.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -3950,7 +3950,8 @@ also be depressed for NEWSTRING to appear.")
3950 register Lisp_Object newstring; 3950 register Lisp_Object newstring;
3951{ 3951{
3952 char *rawstring; 3952 char *rawstring;
3953 register KeySym keysym, modifier_list[16]; 3953 register KeySym keysym;
3954 KeySym modifier_list[16];
3954 3955
3955 CHECK_STRING (x_keysym, 1); 3956 CHECK_STRING (x_keysym, 1);
3956 CHECK_STRING (newstring, 3); 3957 CHECK_STRING (newstring, 3);
diff --git a/src/xterm.c b/src/xterm.c
index 05ad3bc588d..1df1c7d36ba 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,11 +1,11 @@
1/* X Communication module for terminals which understand the X protocol. 1/* X Communication module for terminals which understand the X protocol.
2 Copyright (C) 1989 Free Software Foundation, Inc. 2 Copyright (C) 1989, 1992 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -258,8 +258,8 @@ static void dumpqueue ();
258#endif 258#endif
259 259
260void dumpborder (); 260void dumpborder ();
261static XTcursor_to (); 261static int XTcursor_to ();
262static XTclear_end_of_line (); 262static int XTclear_end_of_line ();
263 263
264/* These hooks are called by update_screen at the beginning and end 264/* These hooks are called by update_screen at the beginning and end
265 of a screen update. We record in `updating_screen' the identity 265 of a screen update. We record in `updating_screen' the identity
@@ -361,7 +361,7 @@ XTreset_terminal_modes ()
361 where display update commands will take effect. 361 where display update commands will take effect.
362 This does not affect the place where the cursor-box is displayed. */ 362 This does not affect the place where the cursor-box is displayed. */
363 363
364static 364static int
365XTcursor_to (row, col) 365XTcursor_to (row, col)
366 register int row, col; 366 register int row, col;
367{ 367{
@@ -582,7 +582,7 @@ XTwrite_glyphs (start, len)
582 to column FIRST_UNUSED (exclusive). The idea is that everything 582 to column FIRST_UNUSED (exclusive). The idea is that everything
583 from FIRST_UNUSED onward is already erased. */ 583 from FIRST_UNUSED onward is already erased. */
584 584
585static 585static int
586XTclear_end_of_line (first_unused) 586XTclear_end_of_line (first_unused)
587 register int first_unused; 587 register int first_unused;
588{ 588{
@@ -2775,6 +2775,19 @@ x_text_icon (s, icon_name)
2775 return 0; 2775 return 0;
2776} 2776}
2777 2777
2778/* Handling X errors. */
2779
2780/* A handler for SIGPIPE, when it occurs on the X server's connection.
2781 This basically does an orderly shutdown of Emacs. */
2782static SIGTYPE
2783x_death_handler ()
2784{
2785 if (_Xdebug)
2786 abort ();
2787 else
2788 Fkill_emacs (make_number (70));
2789}
2790
2778static char *x_proto_requests[] = 2791static char *x_proto_requests[] =
2779{ 2792{
2780 "CreateWindow", 2793 "CreateWindow",
@@ -2961,14 +2974,9 @@ x_error_handler (disp, event)
2961 } 2974 }
2962 UNBLOCK_INPUT; 2975 UNBLOCK_INPUT;
2963 2976
2964 if (_Xdebug) 2977 x_death_handler ();
2965 abort ();
2966 else
2967 Fkill_emacs (make_number (70));
2968} 2978}
2969 2979
2970/* Initialize communication with the X window server. */
2971
2972#if 0 2980#if 0
2973static unsigned int x_wire_count; 2981static unsigned int x_wire_count;
2974x_trace_wire () 2982x_trace_wire ()
@@ -3740,7 +3748,7 @@ x_term_init (display_name)
3740 signal (SIGWINCH, SIG_DFL); 3748 signal (SIGWINCH, SIG_DFL);
3741#endif /* SIGWINCH */ 3749#endif /* SIGWINCH */
3742 3750
3743 signal (SIGPIPE, x_error_handler); 3751 signal (SIGPIPE, x_death_handler);
3744} 3752}
3745 3753
3746void 3754void