diff options
-rw-r--r-- | src/alloc.c | 10 | ||||
-rw-r--r-- | src/buffer.c | 111 | ||||
-rw-r--r-- | src/buffer.h | 3 | ||||
-rw-r--r-- | src/bytecode.c | 26 | ||||
-rw-r--r-- | src/callint.c | 22 | ||||
-rw-r--r-- | src/cmds.c | 30 | ||||
-rw-r--r-- | src/commands.h | 2 | ||||
-rw-r--r-- | src/dired.c | 18 | ||||
-rw-r--r-- | src/dispextern.h | 23 | ||||
-rw-r--r-- | src/doc.c | 11 | ||||
-rw-r--r-- | src/eval.c | 104 | ||||
-rw-r--r-- | src/fileio.c | 83 | ||||
-rw-r--r-- | src/filelock.c | 13 | ||||
-rw-r--r-- | src/floatfns.c | 41 | ||||
-rw-r--r-- | src/fns.c | 89 | ||||
-rw-r--r-- | src/frame.c | 34 | ||||
-rw-r--r-- | src/frame.h | 37 | ||||
-rw-r--r-- | src/hftctl.c | 420 | ||||
-rw-r--r-- | src/keymap.c | 152 | ||||
-rw-r--r-- | src/lread.c | 56 | ||||
-rw-r--r-- | src/macros.c | 8 | ||||
-rw-r--r-- | src/ralloc.c | 2 | ||||
-rw-r--r-- | src/sunfns.c | 4 | ||||
-rw-r--r-- | src/syntax.c | 22 | ||||
-rw-r--r-- | src/termhooks.h | 44 | ||||
-rw-r--r-- | src/undo.c | 12 | ||||
-rw-r--r-- | src/unexaix.c | 4 | ||||
-rw-r--r-- | src/unexec.c | 65 | ||||
-rw-r--r-- | src/window.c | 246 | ||||
-rw-r--r-- | src/xdisp.c | 74 | ||||
-rw-r--r-- | src/xfns.c | 130 | ||||
-rw-r--r-- | src/xmenu.c | 4 | ||||
-rw-r--r-- | src/xrdb.c | 3 | ||||
-rw-r--r-- | src/xselect.c.old | 16 | ||||
-rw-r--r-- | src/xterm.c | 4 | ||||
-rw-r--r-- | src/xterm.h | 3 |
36 files changed, 1013 insertions, 913 deletions
diff --git a/src/alloc.c b/src/alloc.c index 856ac104c9d..24bb67c6dda 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -329,7 +329,7 @@ Any number of arguments, even zero arguments, are allowed.") XFASTINT (len) = nargs; val = Fmake_list (len, Qnil); val_tail = val; - while (!NULL (val_tail)) + while (!NILP (val_tail)) { XCONS (val_tail)->car = *args++; val_tail = XCONS (val_tail)->cdr; @@ -425,14 +425,14 @@ significance.") register struct Lisp_Vector *p; XFASTINT (len) = nargs; - if (!NULL (Vpurify_flag)) + if (!NILP (Vpurify_flag)) val = make_pure_vector (len); else val = Fmake_vector (len, Qnil); p = XVECTOR (val); for (index = 0; index < nargs; index++) { - if (!NULL (Vpurify_flag)) + if (!NILP (Vpurify_flag)) args[index] = Fpurecopy (args[index]); p->contents[index] = args[index]; } @@ -905,7 +905,7 @@ Does not copy symbols.") register Lisp_Object new, tem; register int i; - if (NULL (Vpurify_flag)) + if (NILP (Vpurify_flag)) return obj; if ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) ((char *) pure + PURESIZE) @@ -1041,7 +1041,7 @@ Garbage collection happens automatically if you cons more than\n\ /* Save a copy of the contents of the stack, for debugging. */ #if MAX_SAVE_STACK > 0 - if (NULL (Vpurify_flag)) + if (NILP (Vpurify_flag)) { i = &stack_top_variable - stack_bottom; if (i < 0) i = -i; diff --git a/src/buffer.c b/src/buffer.c index 68575d845f0..55d85f979ba 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -25,9 +25,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define MAXPATHLEN 1024 #endif /* not MAXPATHLEN */ -#ifdef NULL -#undef NULL -#endif #include "config.h" #include "lisp.h" #include "window.h" @@ -163,7 +160,7 @@ If there is no such live buffer, return nil.") if (XTYPE (buf) != Lisp_Buffer) continue; if (XTYPE (XBUFFER (buf)->filename) != Lisp_String) continue; tem = Fstring_equal (XBUFFER (buf)->filename, filename); - if (!NULL (tem)) + if (!NILP (tem)) return buf; } return Qnil; @@ -185,7 +182,7 @@ The value is never nil.") register struct buffer *b; buf = Fget_buffer (name); - if (!NULL (buf)) + if (!NILP (buf)) return buf; b = (struct buffer *) malloc (sizeof (struct buffer)); @@ -227,14 +224,14 @@ The value is never nil.") b->name = name; function = buffer_defaults.major_mode; - if (NULL (function)) + if (NILP (function)) { tem = Fget (current_buffer->major_mode, Qmode_class); if (EQ (tem, Qnil)) function = current_buffer->major_mode; } - if (NULL (function) || EQ (function, Qfundamental_mode)) + if (NILP (function) || EQ (function, Qfundamental_mode)) return buf; /* To select a nonfundamental mode, @@ -327,7 +324,7 @@ until an unused name is found, and then return that name.") CHECK_STRING (name, 0); tem = Fget_buffer (name); - if (NULL (tem)) + if (NILP (tem)) return name; count = 1; @@ -336,7 +333,7 @@ until an unused name is found, and then return that name.") sprintf (number, "<%d>", ++count); gentemp = concat2 (name, build_string (number)); tem = Fget_buffer (gentemp); - if (NULL (tem)) + if (NILP (tem)) return gentemp; } } @@ -348,7 +345,7 @@ With no argument or nil as argument, return the name of the current buffer.") (buffer) register Lisp_Object buffer; { - if (NULL (buffer)) + if (NILP (buffer)) return current_buffer->name; CHECK_BUFFER (buffer, 0); return XBUFFER (buffer)->name; @@ -360,7 +357,7 @@ No argument or nil as argument means use the current buffer.") (buffer) register Lisp_Object buffer; { - if (NULL (buffer)) + if (NILP (buffer)) return current_buffer->filename; CHECK_BUFFER (buffer, 0); return XBUFFER (buffer)->filename; @@ -378,7 +375,7 @@ No argument or nil as argument means use current buffer as BUFFER.") register struct buffer *buf; register Lisp_Object val; - if (NULL (buffer)) + if (NILP (buffer)) buf = current_buffer; else { @@ -433,7 +430,7 @@ No argument or nil as argument means use current buffer as BUFFER.") register Lisp_Object buffer; { register struct buffer *buf; - if (NULL (buffer)) + if (NILP (buffer)) buf = current_buffer; else { @@ -459,17 +456,17 @@ A non-nil FLAG means mark the buffer modified.") If buffer becoming unmodified, unlock the file. */ fn = current_buffer->filename; - if (!NULL (fn)) + if (!NILP (fn)) { already = current_buffer->save_modified < MODIFF; - if (!already && !NULL (flag)) + if (!already && !NILP (flag)) lock_file (fn); - else if (already && NULL (flag)) + else if (already && NILP (flag)) unlock_file (fn); } #endif /* CLASH_DETECTION */ - current_buffer->save_modified = NULL (flag) ? MODIFF : 0; + current_buffer->save_modified = NILP (flag) ? MODIFF : 0; update_mode_lines++; return flag; } @@ -484,7 +481,7 @@ No argument or nil as argument means use current buffer as BUFFER.") register Lisp_Object buffer; { register struct buffer *buf; - if (NULL (buffer)) + if (NILP (buffer)) buf = current_buffer; else { @@ -513,9 +510,9 @@ This does not change the name of the visited file (if any).") tem = Fget_buffer (name); if (XBUFFER (tem) == current_buffer) return current_buffer->name; - if (!NULL (tem)) + if (!NILP (tem)) { - if (!NULL (distinguish)) + if (!NILP (distinguish)) name = Fgenerate_new_buffer_name (name); else error ("Buffer name \"%s\" is in use", XSTRING (name)->data); @@ -524,7 +521,7 @@ This does not change the name of the visited file (if any).") current_buffer->name = name; XSET (buf, Lisp_Buffer, current_buffer); Fsetcar (Frassq (buf, Vbuffer_alist), name); - if (NULL (current_buffer->filename) && !NULL (current_buffer->auto_save_file_name)) + if (NILP (current_buffer->filename) && !NILP (current_buffer->auto_save_file_name)) call0 (intern ("rename-auto-save-file")); return name; } @@ -540,7 +537,7 @@ If BUFFER is omitted or nil, some interesting buffer is returned.") register Lisp_Object tail, buf, notsogood, tem; notsogood = Qnil; - for (tail = Vbuffer_alist; !NULL (tail); tail = Fcdr (tail)) + for (tail = Vbuffer_alist; !NILP (tail); tail = Fcdr (tail)) { buf = Fcdr (Fcar (tail)); if (EQ (buf, buffer)) @@ -548,12 +545,12 @@ If BUFFER is omitted or nil, some interesting buffer is returned.") if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') continue; tem = Fget_buffer_window (buf, Qnil); - if (NULL (tem)) + if (NILP (tem)) return buf; - if (NULL (notsogood)) + if (NILP (notsogood)) notsogood = buf; } - if (!NULL (notsogood)) + if (!NILP (notsogood)) return notsogood; return Fget_buffer_create (build_string ("*scratch*")); } @@ -579,12 +576,12 @@ No argument or nil as argument means do this for the current buffer.") register struct buffer *b; register Lisp_Object buf1; - if (NULL (buf)) + if (NILP (buf)) b = current_buffer; else { buf1 = Fget_buffer (buf); - if (NULL (buf1)) nsberror (buf); + if (NILP (buf1)) nsberror (buf); b = XBUFFER (buf1); } @@ -620,24 +617,24 @@ with `delete-process'.") register struct Lisp_Marker *m; struct gcpro gcpro1, gcpro2; - if (NULL (bufname)) + if (NILP (bufname)) buf = Fcurrent_buffer (); else buf = Fget_buffer (bufname); - if (NULL (buf)) + if (NILP (buf)) nsberror (bufname); b = XBUFFER (buf); /* Query if the buffer is still modified. */ - if (INTERACTIVE && !NULL (b->filename) + if (INTERACTIVE && !NILP (b->filename) && BUF_MODIFF (b) > b->save_modified) { GCPRO2 (buf, bufname); tem = do_yes_or_no_p (format1 ("Buffer %s modified; kill anyway? ", XSTRING (b->name)->data)); UNGCPRO; - if (NULL (tem)) + if (NILP (tem)) return Qnil; } @@ -660,7 +657,7 @@ with `delete-process'.") if (EQ (buf, XWINDOW (minibuf_window)->buffer)) return Qnil; - if (NULL (b->name)) + if (NILP (b->name)) return Qnil; /* Make this buffer not be current. @@ -696,7 +693,7 @@ with `delete-process'.") { Lisp_Object tem; tem = Fsymbol_value (intern ("delete-auto-save-files")); - if (! NULL (tem)) + if (! NILP (tem)) unlink (XSTRING (b->auto_save_file_name)->data); } @@ -739,7 +736,7 @@ record_buffer (buf) /* Effectively do Vbuffer_alist = Fdelq (link, Vbuffer_alist) but cannot use Fdelq here it that allows quitting. */ - if (NULL (prev)) + if (NILP (prev)) Vbuffer_alist = XCONS (Vbuffer_alist)->cdr; else XCONS (prev)->cdr = XCONS (XCONS (prev)->cdr)->cdr; @@ -766,15 +763,15 @@ the window-buffer correspondences.") if (EQ (minibuf_window, selected_window)) error ("Cannot switch buffers in minibuffer window"); tem = Fwindow_dedicated_p (selected_window); - if (!NULL (tem)) + if (!NILP (tem)) error ("Cannot switch buffers in a dedicated window"); - if (NULL (bufname)) + if (NILP (bufname)) buf = Fother_buffer (Fcurrent_buffer ()); else buf = Fget_buffer_create (bufname); Fset_buffer (buf); - if (NULL (norecord)) + if (NILP (norecord)) record_buffer (buf); Fset_window_buffer (EQ (selected_window, minibuf_window) @@ -794,7 +791,7 @@ window even if BUFFER is already visible in the selected window.") Lisp_Object bufname, other; { register Lisp_Object buf; - if (NULL (bufname)) + if (NILP (bufname)) buf = Fother_buffer (Fcurrent_buffer ()); else buf = Fget_buffer_create (bufname); @@ -834,7 +831,7 @@ set_buffer_internal (b) /* Look down buffer's list of local Lisp variables to find and update any that forward into C variables. */ - for (tail = b->local_var_alist; !NULL (tail); tail = XCONS (tail)->cdr) + for (tail = b->local_var_alist; !NILP (tail); tail = XCONS (tail)->cdr) { valcontents = XSYMBOL (XCONS (XCONS (tail)->car)->car)->value; if ((XTYPE (valcontents) == Lisp_Buffer_Local_Value @@ -850,7 +847,7 @@ set_buffer_internal (b) /* Do the same with any others that were local to the previous buffer */ if (old_buf) - for (tail = old_buf->local_var_alist; !NULL (tail); tail = XCONS (tail)->cdr) + for (tail = old_buf->local_var_alist; !NILP (tail); tail = XCONS (tail)->cdr) { valcontents = XSYMBOL (XCONS (XCONS (tail)->car)->car)->value; if ((XTYPE (valcontents) == Lisp_Buffer_Local_Value @@ -876,9 +873,9 @@ Use `switch-to-buffer' or `pop-to-buffer' to switch buffers permanently.") { register Lisp_Object buffer; buffer = Fget_buffer (bufname); - if (NULL (buffer)) + if (NILP (buffer)) nsberror (bufname); - if (NULL (XBUFFER (buffer)->name)) + if (NILP (XBUFFER (buffer)->name)) error ("Selecting deleted buffer"); set_buffer_internal (XBUFFER (buffer)); return buffer; @@ -889,7 +886,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, "Signal a `buffer-read-only' error if the current buffer is read-only.") () { - while (!NULL (current_buffer->read_only)) + while (!NILP (current_buffer->read_only)) Fsignal (Qbuffer_read_only, (Fcons (Fcurrent_buffer (), Qnil))); return Qnil; } @@ -903,7 +900,7 @@ thus, the least likely buffer for \\[switch-to-buffer] to select by default.") { register Lisp_Object aelt, link; - if (NULL (buf)) + if (NILP (buf)) { XSET (buf, Lisp_Buffer, current_buffer); Fswitch_to_buffer (Fother_buffer (buf), Qnil); @@ -913,7 +910,7 @@ thus, the least likely buffer for \\[switch-to-buffer] to select by default.") Lisp_Object buf1; buf1 = Fget_buffer (buf); - if (NULL (buf1)) + if (NILP (buf1)) nsberror (buf); buf = buf1; } @@ -983,7 +980,7 @@ list_buffers_1 (files) tail = intern ("Buffer-menu-mode"); if (!EQ (tail, current_buffer->major_mode) - && (tem = Ffboundp (tail), !NULL (tem))) + && (tem = Ffboundp (tail), !NILP (tem))) call0 (tail); Fbuffer_disable_undo (Vstandard_output); current_buffer->read_only = Qnil; @@ -992,7 +989,7 @@ list_buffers_1 (files) MR Buffer Size Mode File\n\ -- ------ ---- ---- ----\n", -1); - for (tail = Vbuffer_alist; !NULL (tail); tail = Fcdr (tail)) + for (tail = Vbuffer_alist; !NILP (tail); tail = Fcdr (tail)) { buf = Fcdr (Fcar (tail)); b = XBUFFER (buf); @@ -1000,7 +997,7 @@ list_buffers_1 (files) if (XSTRING (b->name)->data[0] == ' ') continue; /* Optionally don't mention buffers that lack files. */ - if (!NULL (files) && NULL (b->filename)) + if (!NILP (files) && NILP (b->filename)) continue; /* Identify the current buffer. */ if (b == old) @@ -1008,7 +1005,7 @@ list_buffers_1 (files) write_string (b == old ? "." : " ", -1); /* Identify modified buffers */ write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1); - write_string (NULL (b->read_only) ? " " : "% ", -1); + write_string (NILP (b->read_only) ? " " : "% ", -1); Fprinc (b->name, Qnil); Findent_to (col1, make_number (2)); XFASTINT (tem) = BUF_Z (b) - BUF_BEG (b); @@ -1017,7 +1014,7 @@ list_buffers_1 (files) Fprinc (b->mode_name, Qnil); Findent_to (col3, minspace); - if (!NULL (b->filename)) + if (!NILP (b->filename)) Fprinc (b->filename, Qnil); else { @@ -1025,7 +1022,7 @@ list_buffers_1 (files) Lisp_Object tem; set_buffer_internal (b); tem = Fboundp (other_file_symbol); - if (!NULL (tem)) + if (!NILP (tem)) { tem = Fsymbol_value (other_file_symbol); Fset_buffer (Vstandard_output); @@ -1085,7 +1082,7 @@ a non-nil `permanent-local' property are not eliminated by this function.") /* Make sure no local variables remain set up with this buffer for their current values. */ - for (alist = oalist; !NULL (alist); alist = XCONS (alist)->cdr) + for (alist = oalist; !NILP (alist); alist = XCONS (alist)->cdr) { sym = XCONS (XCONS (alist)->car)->car; @@ -1115,11 +1112,11 @@ a non-nil `permanent-local' property are not eliminated by this function.") /* Any which are supposed to be permanent, make local again, with the same values they had. */ - for (alist = oalist; !NULL (alist); alist = XCONS (alist)->cdr) + for (alist = oalist; !NILP (alist); alist = XCONS (alist)->cdr) { sym = XCONS (XCONS (alist)->car)->car; tem = Fget (sym, Qpermanent_local); - if (! NULL (tem)) + if (! NILP (tem)) { Fmake_local_variable (sym); Fset (sym, XCONS (XCONS (alist)->car)->cdr); @@ -1146,7 +1143,7 @@ if any protected fields overlap this portion.") Lisp_Object fieldlist; Lisp_Object collector; - if (NULL (buffer)) + if (NILP (buffer)) fieldlist = current_buffer->fieldlist; else { @@ -1174,9 +1171,9 @@ if any protected fields overlap this portion.") if ((start_loc < field_start && end_loc > field_start) || (start_loc >= field_start && start_loc < field_end)) { - if (!NULL (error_check)) + if (!NILP (error_check)) { - if (!NULL (FIELD_PROTECTED_FLAG (field))) + if (!NILP (FIELD_PROTECTED_FLAG (field))) { struct gcpro gcpro1; GCPRO1 (fieldlist); diff --git a/src/buffer.h b/src/buffer.h index f475bbdbafe..a1d838c037d 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -128,7 +128,6 @@ struct buffer_text for this buffer. It is incremented for each such event, and never otherwise changed. */ - }; struct buffer @@ -148,7 +147,7 @@ struct buffer /* Flags saying which DEFVAR_PER_BUFFER variables are local to this buffer. */ int local_var_flags; - /* Value of text.modified as of when visited file was read or written. */ + /* Value of text.modiff as of when visited file was read or written. */ int save_modified; /* Set to the modtime of the visited file when read or written. -1 means visited file was nonexistent. diff --git a/src/bytecode.c b/src/bytecode.c index eb5b117f683..acde450299c 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -450,7 +450,7 @@ If the third argument is incorrect, Emacs may crash.") case Bgotoifnil: op = FETCH2; - if (NULL (POP)) + if (NILP (POP)) { QUIT; pc = XSTRING (string_saved)->data + op; @@ -459,7 +459,7 @@ If the third argument is incorrect, Emacs may crash.") case Bgotoifnonnil: op = FETCH2; - if (!NULL (POP)) + if (!NILP (POP)) { QUIT; pc = XSTRING (string_saved)->data + op; @@ -468,7 +468,7 @@ If the third argument is incorrect, Emacs may crash.") case Bgotoifnilelsepop: op = FETCH2; - if (NULL (TOP)) + if (NILP (TOP)) { QUIT; pc = XSTRING (string_saved)->data + op; @@ -478,7 +478,7 @@ If the third argument is incorrect, Emacs may crash.") case Bgotoifnonnilelsepop: op = FETCH2; - if (!NULL (TOP)) + if (!NILP (TOP)) { QUIT; pc = XSTRING (string_saved)->data + op; @@ -492,7 +492,7 @@ If the third argument is incorrect, Emacs may crash.") break; case BRgotoifnil: - if (NULL (POP)) + if (NILP (POP)) { QUIT; pc += *pc - 128; @@ -501,7 +501,7 @@ If the third argument is incorrect, Emacs may crash.") break; case BRgotoifnonnil: - if (!NULL (POP)) + if (!NILP (POP)) { QUIT; pc += *pc - 128; @@ -511,7 +511,7 @@ If the third argument is incorrect, Emacs may crash.") case BRgotoifnilelsepop: op = *pc++; - if (NULL (TOP)) + if (NILP (TOP)) { QUIT; pc += op - 128; @@ -521,7 +521,7 @@ If the third argument is incorrect, Emacs may crash.") case BRgotoifnonnilelsepop: op = *pc++; - if (!NULL (TOP)) + if (!NILP (TOP)) { QUIT; pc += op - 128; @@ -598,7 +598,7 @@ If the third argument is incorrect, Emacs may crash.") { if (CONSP (v1)) v1 = XCONS (v1)->cdr; - else if (!NULL (v1)) + else if (!NILP (v1)) { immediate_quit = 0; v1 = wrong_type_argument (Qlistp, v1); @@ -622,7 +622,7 @@ If the third argument is incorrect, Emacs may crash.") break; case Blistp: - TOP = CONSP (TOP) || NULL (TOP) ? Qt : Qnil; + TOP = CONSP (TOP) || NILP (TOP) ? Qt : Qnil; break; case Beq: @@ -636,21 +636,21 @@ If the third argument is incorrect, Emacs may crash.") break; case Bnot: - TOP = NULL (TOP) ? Qt : Qnil; + TOP = NILP (TOP) ? Qt : Qnil; break; case Bcar: v1 = TOP; docar: if (CONSP (v1)) TOP = XCONS (v1)->car; - else if (NULL (v1)) TOP = Qnil; + else if (NILP (v1)) TOP = Qnil; else Fcar (wrong_type_argument (Qlistp, v1)); break; case Bcdr: v1 = TOP; if (CONSP (v1)) TOP = XCONS (v1)->cdr; - else if (NULL (v1)) TOP = Qnil; + else if (NILP (v1)) TOP = Qnil; else Fcdr (wrong_type_argument (Qlistp, v1)); break; diff --git a/src/callint.c b/src/callint.c index 723224310f2..a77a0180f5c 100644 --- a/src/callint.c +++ b/src/callint.c @@ -103,7 +103,7 @@ quotify_arg (exp) register Lisp_Object exp; { if (XTYPE (exp) != Lisp_Int && XTYPE (exp) != Lisp_String - && !NULL (exp) && !EQ (exp, Qt)) + && !NILP (exp) && !EQ (exp, Qt)) return Fcons (Qquote, Fcons (exp, Qnil)); return exp; @@ -131,7 +131,7 @@ static void check_mark () { Lisp_Object tem = Fmarker_buffer (current_buffer->mark); - if (NULL (tem) || (XBUFFER (tem) != current_buffer)) + if (NILP (tem) || (XBUFFER (tem) != current_buffer)) error ("The mark is not set now"); } @@ -221,7 +221,7 @@ retry: else if (EQ (funcar, Qlambda)) { specs = Fassq (Qinteractive, Fcdr (Fcdr (fun))); - if (NULL (specs)) + if (NILP (specs)) goto lose; specs = Fcar (Fcdr (specs)); } @@ -236,7 +236,7 @@ retry: { i = num_input_chars; specs = Feval (specs); - if (i != num_input_chars || !NULL (record)) + if (i != num_input_chars || !NILP (record)) Vcommand_history = Fcons (Fcons (function, quotify_args (Fcopy_sequence (specs))), Vcommand_history); @@ -251,13 +251,13 @@ retry: if (*string == '*') { string++; - if (!NULL (current_buffer->read_only)) + if (!NILP (current_buffer->read_only)) Fbarf_if_buffer_read_only (); } else if (*string == '@') { string++; - if (!NULL (Vmouse_window)) + if (!NILP (Vmouse_window)) Fselect_window (Vmouse_window); } else break; @@ -379,7 +379,7 @@ retry: case 'K': /* Mouse click. */ args[i] = last_command_char; - if (NULL (Fmouse_click_p (args[i]))) + if (NILP (Fmouse_click_p (args[i]))) error ("%s must be bound to a mouse click.", (XTYPE (function) == Lisp_Symbol ? (char *) XSYMBOL (function)->name->data @@ -394,7 +394,7 @@ retry: break; case 'N': /* Prefix arg, else number from minibuffer */ - if (!NULL (prefix_arg)) + if (!NILP (prefix_arg)) goto have_prefix_arg; case 'n': /* Read number from minibuffer. */ do @@ -470,7 +470,7 @@ retry: if (varies[i] == 0) arg_from_tty = 1; - if (NULL (visargs[i]) && XTYPE (args[i]) == Lisp_String) + if (NILP (visargs[i]) && XTYPE (args[i]) == Lisp_String) visargs[i] = args[i]; tem = (unsigned char *) index (tem, '\n'); @@ -482,7 +482,7 @@ retry: args[0] = function; - if (arg_from_tty || !NULL (record)) + if (arg_from_tty || !NILP (record)) { visargs[0] = function; for (i = 1; i < count + 1; i++) @@ -519,7 +519,7 @@ Its numeric meaning is what you would get from `(interactive \"p\")'.") may use XSETINT. */ XFASTINT (val) = 0; - if (NULL (raw)) + if (NILP (raw)) XFASTINT (val) = 1; else if (XTYPE (raw) == Lisp_Symbol) XSETINT (val, -1); diff --git a/src/cmds.c b/src/cmds.c index 18821e24b06..2a212ad6223 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -33,7 +33,7 @@ On reaching end of buffer, stop and signal error.") (n) Lisp_Object n; { - if (NULL (n)) + if (NILP (n)) XFASTINT (n) = 1; else CHECK_NUMBER (n, 0); @@ -58,7 +58,7 @@ On attempt to pass beginning or end of buffer, stop and signal error.") (n) Lisp_Object n; { - if (NULL (n)) + if (NILP (n)) XFASTINT (n) = 1; else CHECK_NUMBER (n, 0); @@ -82,7 +82,7 @@ With positive ARG, a non-empty line at the end counts as one line\n\ int pos; int count, shortage, negp; - if (NULL (n)) + if (NILP (n)) count = 1; else { @@ -109,7 +109,7 @@ If scan reaches end of buffer, stop there without error.") (n) Lisp_Object n; { - if (NULL (n)) + if (NILP (n)) XFASTINT (n) = 1; else CHECK_NUMBER (n, 0); @@ -129,7 +129,7 @@ If scan reaches end of buffer, stop there without error.") register int pos; register int stop; - if (NULL (n)) + if (NILP (n)) XFASTINT (n) = 1; else CHECK_NUMBER (n, 0); @@ -155,7 +155,7 @@ ARG was explicitly specified.") { CHECK_NUMBER (n, 0); - if (NULL (killflag)) + if (NILP (killflag)) { if (XINT (n) < 0) { @@ -225,7 +225,7 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long.") arg = Fprefix_numeric_value (arg1); - if (!NULL (current_buffer->read_only)) + if (!NILP (current_buffer->read_only)) Fsignal (Qbuffer_read_only, Qnil); /* Inserting a newline at the end of a line @@ -245,7 +245,7 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long.") if (flag) insert (&c1, 1); else - internal_self_insert ('\n', !NULL (arg1)); + internal_self_insert ('\n', !NILP (arg1)); XFASTINT (arg)--; /* Ok since old and new vals both nonneg */ } @@ -265,10 +265,10 @@ internal_self_insert (c1, noautofill) register enum syntaxcode synt; register int c = c1; - if (!NULL (Vbefore_change_function) || !NULL (Vafter_change_function)) + if (!NILP (Vbefore_change_function) || !NILP (Vafter_change_function)) hairy = 1; - if (!NULL (current_buffer->overwrite_mode) + if (!NILP (current_buffer->overwrite_mode) && point < ZV && c != '\n' && FETCH_CHAR (point) != '\n' && (FETCH_CHAR (point) != '\t' @@ -278,18 +278,18 @@ internal_self_insert (c1, noautofill) del_range (point, point + 1); hairy = 1; } - if (!NULL (current_buffer->abbrev_mode) + if (!NILP (current_buffer->abbrev_mode) && SYNTAX (c) != Sword - && NULL (current_buffer->read_only) + && NILP (current_buffer->read_only) && point > BEGV && SYNTAX (FETCH_CHAR (point - 1)) == Sword) { tem = Fexpand_abbrev (); - if (!NULL (tem)) + if (!NILP (tem)) hairy = 1; } if ((c == ' ' || c == '\n') && !noautofill - && !NULL (current_buffer->auto_fill_function) + && !NILP (current_buffer->auto_fill_function) && current_column () > XFASTINT (current_buffer->fill_column)) { if (c1 != '\n') @@ -303,7 +303,7 @@ internal_self_insert (c1, noautofill) insert (&c1, 1); synt = SYNTAX (c); if ((synt == Sclose || synt == Smath) - && !NULL (Vblink_paren_function) && INTERACTIVE) + && !NILP (Vblink_paren_function) && INTERACTIVE) { call0 (Vblink_paren_function); hairy = 1; diff --git a/src/commands.h b/src/commands.h index de2c7e3c3d3..26141818fe9 100644 --- a/src/commands.h +++ b/src/commands.h @@ -58,7 +58,7 @@ extern Lisp_Object Vexecuting_macro; /* Nonzero if input is coming from the keyboard */ -#define INTERACTIVE (NULL (Vexecuting_macro) && !noninteractive) +#define INTERACTIVE (NILP (Vexecuting_macro) && !noninteractive) /* Set this nonzero to force reconsideration of mode line. */ diff --git a/src/dired.c b/src/dired.c index 0cdc062c699..f04ed255883 100644 --- a/src/dired.c +++ b/src/dired.c @@ -46,8 +46,6 @@ extern struct direct *readdir (); #endif -#undef NULL - #include "lisp.h" #include "buffer.h" #include "commands.h" @@ -81,7 +79,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\ int length; Lisp_Object list, name; - if (!NULL (match)) + if (!NILP (match)) { CHECK_STRING (match, 3); /* Compile it now so we don't get an error after opendir */ @@ -110,10 +108,10 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\ len = NAMLEN (dp); if (dp->d_ino) { - if (NULL (match) + if (NILP (match) || (0 <= re_search (&searchbuf, dp->d_name, len, 0, len, 0))) { - if (!NULL (full)) + if (!NILP (full)) { int index = XSTRING (dirname)->size; int total = len + index; @@ -140,7 +138,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\ } } closedir (d); - if (!NULL (nosort)) + if (!NILP (nosort)) return list; return Fsort (Fnreverse (list), Qstring_lessp); } @@ -233,7 +231,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) ** It would not actually be helpful to the user to ignore any possible completions when making a list of them.** */ - for (passcount = !!all_flag; NULL (bestmatch) && passcount < 2; passcount++) + for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++) { if (!(d = opendir (XSTRING (Fdirectory_file_name (dirname))->data))) report_file_error ("Opening directory", Fcons (dirname, Qnil)); @@ -254,7 +252,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) len = NAMLEN (dp); - if (!NULL (Vquit_flag) && NULL (Vinhibit_quit)) + if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) goto quit; if (!dp->d_ino || len < XSTRING (file)->size @@ -297,7 +295,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) matchcount++; - if (all_flag || NULL (bestmatch)) + if (all_flag || NILP (bestmatch)) { /* This is a possible completion */ if (directoryp) @@ -341,7 +339,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) unbind_to (count, Qnil); - if (all_flag || NULL (bestmatch)) + if (all_flag || NILP (bestmatch)) return bestmatch; if (matchcount == 1 && bestmatchsize == XSTRING (file)->size) return Qt; diff --git a/src/dispextern.h b/src/dispextern.h index 1d7b8710aba..365f229fb53 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -48,22 +48,27 @@ struct screen_glyphs int height; int width; - int *used; /* Vector of widths (in chars) of lines. */ - /* Vector of line contents. - m->glyphs[V][H] is the glyph at position V, H. - Note that ->glyphs[...][screen_width] is always 0 - and so is ->glyphs[...][-1]. */ + /* Contents of the screen. + glyphs[V][H] is the glyph at position V, H. + Note that glyphs[V][-1], + glyphs[V][used[V]], + and glyphs[V][screen_width] are always '\0'. */ GLYPH **glyphs; /* long vector from which the strings in `glyphs' are taken. */ GLYPH *total_contents; + /* When representing a desired screen, + enable[n] == 0 means that line n is same as current screen. + When representing current screen contents, + enable[n] == 0 means that line n is blank. */ + char *enable; + + /* Everything on line n after column used[n] is considered blank. */ + int *used; + /* highlight[n] != 0 iff line n is highlighted. */ char *highlight; - /* When representing a desired screen, enable[n] == 0 implies line - n is same as current screen. When representing current screen - contents, enable[n] == 0 implies line n is blank. */ - char *enable; /* Buffer offset of this line's first char. */ int *bufp; diff --git a/src/doc.c b/src/doc.c index b5bdd6a0f1c..98585f89b2e 100644 --- a/src/doc.c +++ b/src/doc.c @@ -31,7 +31,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define O_RDONLY 0 #endif -#undef NULL #include "lisp.h" #include "buffer.h" @@ -348,7 +347,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int int length; struct gcpro gcpro1; - if (NULL (str)) + if (NILP (str)) return Qnil; CHECK_STRING (str, 0); @@ -388,7 +387,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int tem = Fintern (make_string (start, length), Qnil); tem = Fwhere_is_internal (tem, keymap, Qnil, Qt, Qnil); - if (NULL (tem)) /* but not on any keys */ + if (NILP (tem)) /* but not on any keys */ { new = (unsigned char *) xrealloc (buf, bsize += 4); bufp += new - buf; @@ -429,10 +428,10 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int in case it is a local variable. */ name = Fintern (make_string (start, length), Qnil); tem = Fboundp (name); - if (! NULL (tem)) + if (! NILP (tem)) { tem = Fsymbol_value (name); - if (! NULL (tem)) + if (! NILP (tem)) tem = get_keymap_1 (tem, 0); } @@ -440,7 +439,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int oldbuf = current_buffer; set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); - if (NULL (tem)) + if (NILP (tem)) { name = Fsymbol_name (name); insert_string ("\nUses keymap \""); diff --git a/src/eval.c b/src/eval.c index 6940b8dbada..f549f9d1ffe 100644 --- a/src/eval.c +++ b/src/eval.c @@ -180,7 +180,7 @@ If all args return nil, return nil.") Lisp_Object args_left; struct gcpro gcpro1; - if (NULL(args)) + if (NILP(args)) return Qnil; args_left = args; @@ -189,11 +189,11 @@ If all args return nil, return nil.") do { val = Feval (Fcar (args_left)); - if (!NULL (val)) + if (!NILP (val)) break; args_left = Fcdr (args_left); } - while (!NULL(args_left)); + while (!NILP(args_left)); UNGCPRO; return val; @@ -210,7 +210,7 @@ If no arg yields nil, return the last arg's value.") Lisp_Object args_left; struct gcpro gcpro1; - if (NULL(args)) + if (NILP(args)) return Qt; args_left = args; @@ -219,11 +219,11 @@ If no arg yields nil, return the last arg's value.") do { val = Feval (Fcar (args_left)); - if (NULL (val)) + if (NILP (val)) break; args_left = Fcdr (args_left); } - while (!NULL(args_left)); + while (!NILP(args_left)); UNGCPRO; return val; @@ -244,7 +244,7 @@ If COND yields nil, and there are no ELSE's, the value is nil.") cond = Feval (Fcar (args)); UNGCPRO; - if (!NULL (cond)) + if (!NILP (cond)) return Feval (Fcar (Fcdr (args))); return Fprogn (Fcdr (Fcdr (args))); } @@ -266,11 +266,11 @@ CONDITION's value if non-nil is returned from the cond-form.") val = Qnil; GCPRO1 (args); - while (!NULL (args)) + while (!NILP (args)) { clause = Fcar (args); val = Feval (Fcar (clause)); - if (!NULL (val)) + if (!NILP (val)) { if (!EQ (XCONS (clause)->cdr, Qnil)) val = Fprogn (XCONS (clause)->cdr); @@ -297,14 +297,14 @@ DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, if (!EQ (Vmocklisp_arguments, Qt)) { val = make_number (0); - while (!NULL (args) && (tem = Fcar (args), XTYPE (tem) == Lisp_Symbol)) + while (!NILP (args) && (tem = Fcar (args), XTYPE (tem) == Lisp_Symbol)) { QUIT; specbind (tem, val), args = Fcdr (args); } } - if (NULL(args)) + if (NILP(args)) return Qnil; args_left = args; @@ -315,7 +315,7 @@ DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, val = Feval (Fcar (args_left)); args_left = Fcdr (args_left); } - while (!NULL(args_left)); + while (!NILP(args_left)); UNGCPRO; return val; @@ -333,7 +333,7 @@ whose values are discarded.") struct gcpro gcpro1, gcpro2; register int argnum = 0; - if (NULL(args)) + if (NILP(args)) return Qnil; args_left = args; @@ -348,7 +348,7 @@ whose values are discarded.") Feval (Fcar (args_left)); args_left = Fcdr (args_left); } - while (!NULL(args_left)); + while (!NILP(args_left)); UNGCPRO; return val; @@ -368,7 +368,7 @@ whose values are discarded.") val = Qnil; - if (NULL(args)) + if (NILP(args)) return Qnil; args_left = args; @@ -383,7 +383,7 @@ whose values are discarded.") Feval (Fcar (args_left)); args_left = Fcdr (args_left); } - while (!NULL(args_left)); + while (!NILP(args_left)); UNGCPRO; return val; @@ -400,7 +400,7 @@ Each SYM is set before the next VAL is computed.") register Lisp_Object val, sym; struct gcpro gcpro1; - if (NULL(args)) + if (NILP(args)) return Qnil; args_left = args; @@ -413,7 +413,7 @@ Each SYM is set before the next VAL is computed.") Fset (sym, val); args_left = Fcdr (Fcdr (args_left)); } - while (!NULL(args_left)); + while (!NILP(args_left)); UNGCPRO; return val; @@ -491,7 +491,7 @@ See also the function `interactive'.") fn_name = Fcar (args); defn = Fcons (Qlambda, Fcdr (args)); - if (!NULL (Vpurify_flag)) + if (!NILP (Vpurify_flag)) defn = Fpurecopy (defn); Ffset (fn_name, defn); return fn_name; @@ -512,7 +512,7 @@ and the result should be a form to be evaluated instead of the original.") fn_name = Fcar (args); defn = Fcons (Qmacro, Fcons (Qlambda, Fcdr (args))); - if (!NULL (Vpurify_flag)) + if (!NILP (Vpurify_flag)) defn = Fpurecopy (defn); Ffset (fn_name, defn); return fn_name; @@ -536,16 +536,16 @@ If INITVALUE is missing, SYMBOL's value is not set.") sym = Fcar (args); tem = Fcdr (args); - if (!NULL (tem)) + if (!NILP (tem)) { tem = Fdefault_boundp (sym); - if (NULL (tem)) + if (NILP (tem)) Fset_default (sym, Feval (Fcar (Fcdr (args)))); } tem = Fcar (Fcdr (Fcdr (args))); - if (!NULL (tem)) + if (!NILP (tem)) { - if (!NULL (Vpurify_flag)) + if (!NILP (Vpurify_flag)) tem = Fpurecopy (tem); Fput (sym, Qvariable_documentation, tem); } @@ -573,9 +573,9 @@ it would override the user's choice.") sym = Fcar (args); Fset_default (sym, Feval (Fcar (Fcdr (args)))); tem = Fcar (Fcdr (Fcdr (args))); - if (!NULL (tem)) + if (!NILP (tem)) { - if (!NULL (Vpurify_flag)) + if (!NILP (Vpurify_flag)) tem = Fpurecopy (tem); Fput (sym, Qvariable_documentation, tem); } @@ -617,7 +617,7 @@ Each VALUEFORM can refer to the symbols already bound by this VARLIST.") GCPRO3 (args, elt, varlist); varlist = Fcar (args); - while (!NULL (varlist)) + while (!NILP (varlist)) { QUIT; elt = Fcar (varlist); @@ -661,7 +661,7 @@ All the VALUEFORMs are evalled before any symbols are bound.") GCPRO2 (args, *temps); gcpro2.nvars = 0; - for (argnum = 0; !NULL (varlist); varlist = Fcdr (varlist)) + for (argnum = 0; !NILP (varlist); varlist = Fcdr (varlist)) { QUIT; elt = Fcar (varlist); @@ -674,7 +674,7 @@ All the VALUEFORMs are evalled before any symbols are bound.") UNGCPRO; varlist = Fcar (args); - for (argnum = 0; !NULL (varlist); varlist = Fcdr (varlist)) + for (argnum = 0; !NILP (varlist); varlist = Fcdr (varlist)) { elt = Fcar (varlist); tem = temps[argnum++]; @@ -702,7 +702,7 @@ until TEST returns nil.") test = Fcar (args); body = Fcdr (args); - while (tem = Feval (test), !NULL (tem)) + while (tem = Feval (test), !NILP (tem)) { QUIT; Fprogn (body); @@ -747,7 +747,7 @@ definitions to shadow the loaded ones for use in file byte-compilation.") { QUIT; tem = Fassq (sym, env); - if (NULL (tem)) + if (NILP (tem)) { def = XSYMBOL (sym)->function; if (XTYPE (def) == Lisp_Symbol && !EQ (def, Qunbound)) @@ -770,7 +770,7 @@ definitions to shadow the loaded ones for use in file byte-compilation.") } /* Right now TEM is the result from SYM in ENV, and if TEM is nil then DEF is SYM's function definition. */ - if (NULL (tem)) + if (NILP (tem)) { /* SYM is not mentioned in ENV. Look at its function definition. */ @@ -782,7 +782,7 @@ definitions to shadow the loaded ones for use in file byte-compilation.") { /* Autoloading function: will it be a macro when loaded? */ tem = Fcar (Fnthcdr (make_number (4), def)); - if (NULL (tem)) + if (NILP (tem)) break; /* Yes, load it and try again. */ do_autoload (def, sym); @@ -795,7 +795,7 @@ definitions to shadow the loaded ones for use in file byte-compilation.") else { expander = XCONS (tem)->cdr; - if (NULL (expander)) + if (NILP (expander)) break; } explicit: @@ -897,7 +897,7 @@ Both TAG and VALUE are evalled.") while (1) { - if (!NULL (tag)) + if (!NILP (tag)) for (c = catchlist; c; c = c->next) { if (EQ (c->tag, tag)) @@ -980,7 +980,7 @@ See also the function `signal' for more info.") c.gcpro = gcprolist; if (_setjmp (c.jmp)) { - if (!NULL (h.var)) + if (!NILP (h.var)) specbind (h.var, Fcdr (c.val)); val = Fprogn (Fcdr (Fcar (c.val))); unbind_to (c.pdlcount, Qnil); @@ -991,10 +991,10 @@ See also the function `signal' for more info.") h.var = Fcar (args); h.handler = Fcdr (Fcdr (args)); - for (val = h.handler; ! NULL (val); val = Fcdr (val)) + for (val = h.handler; ! NILP (val); val = Fcdr (val)) { tem = Fcar (val); - if ((!NULL (tem)) && + if ((!NILP (tem)) && (!CONSP (tem) || (XTYPE (XCONS (tem)->car) != Lisp_Symbol))) error ("Invalid condition handler", tem); } @@ -1095,7 +1095,7 @@ See also the function `condition-case'.") error ("Returning a value from an error is no longer supported"); #endif - if (!NULL (clause)) + if (!NILP (clause)) { struct handler *h = handlerlist; /* Restore the polling-suppression count. */ @@ -1155,7 +1155,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) if (!CONSP (tem1)) continue; tem = Fmemq (Fcar (tem1), conditions); - if (!NULL (tem)) + if (!NILP (tem)) return tem1; } return Qnil; @@ -1202,7 +1202,7 @@ Also, a symbol satisfies `commandp' if its function definition does so.") { if (++i > 10) return Qnil; tem = Ffboundp (fun); - if (NULL (tem)) return Qnil; + if (NILP (tem)) return Qnil; fun = Fsymbol_function (fun); } @@ -1353,7 +1353,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, if (EQ (Vmocklisp_arguments, Qt)) return Fsymbol_value (form); val = Fsymbol_value (form); - if (NULL (val)) + if (NILP (val)) XFASTINT (val) = 0; else if (EQ (val, Qt)) XFASTINT (val) = 1; @@ -1438,7 +1438,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, gcpro3.var = vals; gcpro3.nvars = 0; - while (!NULL (args_left)) + while (!NILP (args_left)) { vals[argnum++] = Feval (Fcar (args_left)); args_left = Fcdr (args_left); @@ -1528,7 +1528,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, done: if (!EQ (Vmocklisp_arguments, Qt)) { - if (NULL (val)) + if (NILP (val)) XFASTINT (val) = 0; else if (EQ (val, Qt)) XFASTINT (val) = 1; @@ -1614,7 +1614,7 @@ Thus, (apply '+ 1 2 '(3 4)) returns 10.") /* Spread the last arg we got. Its first element goes in the slot that it used to occupy, hence this value of I. */ i = nargs - 1; - while (!NULL (spread_arg)) + while (!NILP (spread_arg)) { funcall_args [i++] = XCONS (spread_arg)->car; spread_arg = XCONS (spread_arg)->cdr; @@ -1631,7 +1631,7 @@ apply1 (fn, arg) struct gcpro gcpro1; GCPRO1 (fn); - if (NULL (arg)) + if (NILP (arg)) RETURN_UNGCPRO (Ffuncall (1, &fn)); gcpro1.nvars = 2; #ifdef NO_ARG_ARRAY @@ -1942,7 +1942,7 @@ funcall_lambda (fun, nargs, arg_vector) else abort (); i = 0; - for (; !NULL (syms_left); syms_left = Fcdr (syms_left)) + for (; !NILP (syms_left); syms_left = Fcdr (syms_left)) { QUIT; next = Fcar (syms_left); @@ -2042,7 +2042,7 @@ unbind_to (count, value) int count; Lisp_Object value; { - int quitf = !NULL (Vquit_flag); + int quitf = !NILP (Vquit_flag); struct gcpro gcpro1; GCPRO1 (value); @@ -2056,12 +2056,12 @@ unbind_to (count, value) (*specpdl_ptr->func) (specpdl_ptr->old_value); /* Note that a "binding" of nil is really an unwind protect, so in that case the "old value" is a list of forms to evaluate. */ - else if (NULL (specpdl_ptr->symbol)) + else if (NILP (specpdl_ptr->symbol)) Fprogn (specpdl_ptr->old_value); else Fset (specpdl_ptr->symbol, specpdl_ptr->old_value); } - if (NULL (Vquit_flag) && quitf) Vquit_flag = Qt; + if (NILP (Vquit_flag) && quitf) Vquit_flag = Qt; UNGCPRO; @@ -2125,7 +2125,7 @@ The debugger is entered when that frame exits, if the flag is non-nil.") } if (backlist) - backlist->debug_on_exit = !NULL (flag); + backlist->debug_on_exit = !NILP (flag); return flag; } @@ -2164,7 +2164,7 @@ Output stream used is value of `standard-output'.") if (backlist->nargs == MANY) { for (tail = *backlist->args, i = 0; - !NULL (tail); + !NILP (tail); tail = Fcdr (tail), i++) { if (i) write_string (" ", -1); diff --git a/src/fileio.c b/src/fileio.c index ab235fe917f..d1bac1596a5 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -52,9 +52,6 @@ extern int sys_nerr; #include <sys/time.h> #endif -#ifdef NULL -#undef NULL -#endif #include "config.h" #include "lisp.h" #include "buffer.h" @@ -269,7 +266,7 @@ On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc.") char *buf; CHECK_STRING (file, 0); - if (NULL (file)) + if (NILP (file)) return Qnil; buf = (char *) alloca (XSTRING (file)->size + 10); return build_string (file_name_as_directory (buf, XSTRING (file)->data)); @@ -435,7 +432,7 @@ it returns a file name such as \"[X]Y.DIR.1\".") CHECK_STRING (directory, 0); - if (NULL (directory)) + if (NILP (directory)) return Qnil; #ifdef VMS /* 20 extra chars is insufficient for VMS, since we might perform a @@ -658,7 +655,7 @@ See also the function `substitute-in-file-name'.") #endif /* not VMS */ && !newdir) { - if (NULL (defalt)) + if (NILP (defalt)) defalt = current_buffer->directory; CHECK_STRING (defalt, 1); newdir = XSTRING (defalt)->data; @@ -994,7 +991,7 @@ See also the function `substitute-in-file-name'.") #endif /* not VMS */ && !newdir) { - if (NULL (defalt)) + if (NILP (defalt)) defalt = current_buffer->directory; CHECK_STRING (defalt, 1); newdir = XSTRING (defalt)->data; @@ -1354,7 +1351,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive) tem = do_yes_or_no_p (format1 ("File %s already exists; %s anyway? ", XSTRING (absname)->data, querystring)); UNGCPRO; - if (NULL (tem)) + if (NILP (tem)) Fsignal (Qfile_already_exists, Fcons (build_string ("File already exists"), Fcons (absname, Qnil))); @@ -1385,7 +1382,7 @@ A prefix arg makes KEEP-TIME non-nil.") CHECK_STRING (newname, 1); filename = Fexpand_file_name (filename, Qnil); newname = Fexpand_file_name (newname, Qnil); - if (NULL (ok_if_already_exists) + if (NILP (ok_if_already_exists) || XTYPE (ok_if_already_exists) == Lisp_Int) barf_or_query_if_file_exists (newname, "copy to it", XTYPE (ok_if_already_exists) == Lisp_Int); @@ -1417,7 +1414,7 @@ A prefix arg makes KEEP-TIME non-nil.") if (fstat (ifd, &st) >= 0) { #ifdef HAVE_TIMEVAL - if (!NULL (keep_date)) + if (!NILP (keep_date)) { #ifdef USE_UTIME /* AIX has utimes() in compatibility package, but it dies. So use good old @@ -1521,7 +1518,7 @@ This is what happens in interactive use with M-x.") CHECK_STRING (newname, 1); filename = Fexpand_file_name (filename, Qnil); newname = Fexpand_file_name (newname, Qnil); - if (NULL (ok_if_already_exists) + if (NILP (ok_if_already_exists) || XTYPE (ok_if_already_exists) == Lisp_Int) barf_or_query_if_file_exists (newname, "rename to it", XTYPE (ok_if_already_exists) == Lisp_Int); @@ -1572,7 +1569,7 @@ This is what happens in interactive use with M-x.") CHECK_STRING (newname, 1); filename = Fexpand_file_name (filename, Qnil); newname = Fexpand_file_name (newname, Qnil); - if (NULL (ok_if_already_exists) + if (NILP (ok_if_already_exists) || XTYPE (ok_if_already_exists) == Lisp_Int) barf_or_query_if_file_exists (newname, "make it a new name", XTYPE (ok_if_already_exists) == Lisp_Int); @@ -1615,7 +1612,7 @@ This happens for interactive use with M-x.") filename = Fexpand_file_name (filename, Qnil); #endif newname = Fexpand_file_name (newname, Qnil); - if (NULL (ok_if_already_exists) + if (NILP (ok_if_already_exists) || XTYPE (ok_if_already_exists) == Lisp_Int) barf_or_query_if_file_exists (newname, "make it a link", XTYPE (ok_if_already_exists) == Lisp_Int); @@ -1653,7 +1650,7 @@ If STRING is nil or a null string, the logical name NAME is deleted.") Lisp_Object string; { CHECK_STRING (varname, 0); - if (NULL (string)) + if (NILP (string)) delete_logical_name (XSTRING (varname)->data); else { @@ -1809,10 +1806,10 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0, return (access (XSTRING (abspath)->data, 2) >= 0) ? Qt : Qnil; dir = Ffile_name_directory (abspath); #ifdef VMS - if (!NULL (dir)) + if (!NILP (dir)) dir = Fdirectory_file_name (dir); #endif /* VMS */ - return (access (!NULL (dir) ? (char *) XSTRING (dir)->data : "", 2) >= 0 + return (access (!NILP (dir) ? (char *) XSTRING (dir)->data : "", 2) >= 0 ? Qt : Qnil); } @@ -1947,7 +1944,7 @@ before the error is signaled.") struct gcpro gcpro1; GCPRO1 (filename); - if (!NULL (current_buffer->read_only)) + if (!NILP (current_buffer->read_only)) Fbarf_if_buffer_read_only(); CHECK_STRING (filename, 0); @@ -1964,7 +1961,7 @@ before the error is signaled.") #endif /* not APOLLO */ { if (fd >= 0) close (fd); - if (NULL (visit)) + if (NILP (visit)) report_file_error ("Opening input file", Fcons (filename, Qnil)); st.st_mtime = -1; how_much = 0; @@ -1985,7 +1982,7 @@ before the error is signaled.") error ("maximum buffer size exceeded"); } - if (NULL (visit)) + if (NILP (visit)) prepare_to_modify_buffer (point, point); move_gap (point); @@ -2025,7 +2022,7 @@ before the error is signaled.") notfound: - if (!NULL (visit)) + if (!NILP (visit)) { current_buffer->undo_list = Qnil; #ifdef APOLLO @@ -2036,7 +2033,7 @@ before the error is signaled.") current_buffer->auto_save_modified = MODIFF; XFASTINT (current_buffer->save_length) = Z - BEG; #ifdef CLASH_DETECTION - if (!NULL (current_buffer->filename)) + if (!NILP (current_buffer->filename)) unlock_file (current_buffer->filename); unlock_file (filename); #endif /* CLASH_DETECTION */ @@ -2082,7 +2079,7 @@ to the file, instead of any buffer contents, and END is ignored.") #endif /* VMS */ /* Special kludge to simplify auto-saving */ - if (NULL (start)) + if (NILP (start)) { XFASTINT (start) = BEG; XFASTINT (end) = Z; @@ -2099,7 +2096,7 @@ to the file, instead of any buffer contents, and END is ignored.") #endif /* CLASH_DETECTION */ desc = -1; - if (!NULL (append)) + if (!NILP (append)) desc = open (fn, O_WRONLY); if (desc < 0) @@ -2118,7 +2115,7 @@ to the file, instead of any buffer contents, and END is ignored.") Lisp_Object temp_name; temp_name = Ffile_name_directory (filename); - if (!NULL (temp_name)) + if (!NILP (temp_name)) { temp_name = Fmake_temp_name (concat2 (temp_name, build_string ("$$SAVE$$"))); @@ -2164,7 +2161,7 @@ to the file, instead of any buffer contents, and END is ignored.") record_unwind_protect (close_file_unwind, make_number (desc)); - if (!NULL (append)) + if (!NILP (append)) if (lseek (desc, 0, 2) < 0) { #ifdef CLASH_DETECTION @@ -2297,7 +2294,7 @@ to the file, instead of any buffer contents, and END is ignored.") XFASTINT (current_buffer->save_length) = Z - BEG; current_buffer->filename = filename; } - else if (!NULL (visit)) + else if (!NILP (visit)) return Qnil; if (!auto_saving) @@ -2463,7 +2460,7 @@ Non-nil second argumet means save only current buffer.") /* Vrun_hooks is nil before emacs is dumped, and inc-vers.el will eventually call do-auto-save, so don't err here in that case. */ - if (!NULL (Vrun_hooks)) + if (!NILP (Vrun_hooks)) call1 (Vrun_hooks, intern ("auto-save-hook")); for (tail = Vbuffer_alist; XGCTYPE (tail) == Lisp_Cons; @@ -2497,7 +2494,7 @@ Non-nil second argumet means save only current buffer.") continue; } set_buffer_internal (b); - if (!auto_saved && NULL (nomsg)) + if (!auto_saved && NILP (nomsg)) message1 ("Auto-saving..."); internal_condition_case (auto_save_1, Qt, auto_save_error); auto_saved++; @@ -2510,7 +2507,7 @@ Non-nil second argumet means save only current buffer.") if (auto_saved) record_auto_save (); - if (auto_saved && NULL (nomsg)) + if (auto_saved && NILP (nomsg)) message1 (omessage ? omessage : "Auto-saving...done"); auto_saving = 0; @@ -2563,24 +2560,24 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte string = Fsubstitute_in_file_name (string); name = Ffile_name_nondirectory (string); realdir = Ffile_name_directory (string); - if (NULL (realdir)) + if (NILP (realdir)) realdir = dir; else realdir = Fexpand_file_name (realdir, dir); } - if (NULL (action)) + if (NILP (action)) { specdir = Ffile_name_directory (string); val = Ffile_name_completion (name, realdir); if (XTYPE (val) != Lisp_String) { - if (NULL (Fstring_equal (string, orig_string))) + if (NILP (Fstring_equal (string, orig_string))) return string; return (val); } - if (!NULL (specdir)) + if (!NILP (specdir)) val = concat2 (specdir, val); #ifndef VMS { @@ -2641,9 +2638,9 @@ DIR defaults to current buffer's directory default.") register char *homedir; int count; - if (NULL (dir)) + if (NILP (dir)) dir = current_buffer->directory; - if (NULL (defalt)) + if (NILP (defalt)) defalt = current_buffer->filename; /* If dir starts with user's homedir, change that to ~. */ @@ -2661,7 +2658,7 @@ DIR defaults to current buffer's directory default.") if (insert_default_directory) { insdef = dir; - if (!NULL (initial)) + if (!NILP (initial)) { Lisp_Object args[2]; @@ -2694,10 +2691,10 @@ DIR defaults to current buffer's directory default.") #endif UNGCPRO; - if (NULL (val)) + if (NILP (val)) error ("No file name specified"); tem = Fstring_equal (val, insdef); - if (!NULL (tem) && !NULL (defalt)) + if (!NILP (tem) && !NILP (defalt)) return defalt; return Fsubstitute_in_file_name (val); } @@ -2720,9 +2717,9 @@ DIR defaults to current buffer's directory default.") register char *homedir; int count; - if (NULL (dir)) + if (NILP (dir)) dir = current_buffer->directory; - if (NULL (defalt)) + if (NILP (defalt)) defalt = current_buffer->filename; /* If dir starts with user's homedir, change that to ~. */ @@ -2737,7 +2734,7 @@ DIR defaults to current buffer's directory default.") XSTRING (dir)->data[0] = '~'; } - if (!NULL (initial)) + if (!NILP (initial)) insdef = initial; else if (insert_default_directory) insdef = dir; @@ -2759,10 +2756,10 @@ DIR defaults to current buffer's directory default.") #endif UNGCPRO; - if (NULL (val)) + if (NILP (val)) error ("No file name specified"); tem = Fstring_equal (val, insdef); - if (!NULL (tem) && !NULL (defalt)) + if (!NILP (tem) && !NILP (defalt)) return defalt; return Fsubstitute_in_file_name (val); } diff --git a/src/filelock.c b/src/filelock.c index df1794cf6bc..f5557d0decb 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -33,7 +33,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <fcntl.h> #endif /* USG */ -#undef NULL #include "lisp.h" #include "paths.h" #include "buffer.h" @@ -98,9 +97,9 @@ lock_file (fn) /* See if this file is visited and has changed on disk since it was visited. */ { register Lisp_Object subject_buf = Fget_file_buffer (fn); - if (!NULL (subject_buf) - && NULL (Fverify_visited_file_modtime (subject_buf)) - && !NULL (Ffile_exists_p (fn))) + if (!NILP (subject_buf) + && NILP (Fverify_visited_file_modtime (subject_buf)) + && !NILP (Ffile_exists_p (fn))) call1 (intern ("ask-user-about-supersession-threat"), fn); } @@ -112,7 +111,7 @@ lock_file (fn) /* Else consider breaking the lock */ attack = call2 (intern ("ask-user-about-lock"), fn, lock_file_owner_name (lfname)); - if (!NULL (attack)) + if (!NILP (attack)) /* User says take the lock */ { lock_superlock (lfname); @@ -298,12 +297,12 @@ or else nothing is done if current buffer isn't visiting a file.") (fn) Lisp_Object fn; { - if (NULL (fn)) + if (NILP (fn)) fn = current_buffer->filename; else CHECK_STRING (fn, 0); if (current_buffer->save_modified < MODIFF - && !NULL (fn)) + && !NILP (fn)) lock_file (fn); return Qnil; } diff --git a/src/floatfns.c b/src/floatfns.c index 1cf132d5f5c..12f14ffef72 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -26,7 +26,23 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Lisp_Object Qarith_error; #ifdef LISP_FLOAT_TYPE + #include <math.h> +#include <errno.h> + +extern int errno; + +/* Avoid traps on VMS from sinh and cosh. + All the other functions set errno instead. */ + +#ifdef VMS +#undef cosh +#undef sinh +#define cosh(x) ((exp(x)+exp(-x))*0.5) +#define sinh(x) ((exp(x)-exp(-x))*0.5) +#endif /* VMS */ + +static float_error (); /* Nonzero while executing in floating point. This tells float_error what to do. */ @@ -34,13 +50,19 @@ Lisp_Object Qarith_error; static int in_float; /* If an argument is out of range for a mathematical function, - that is detected with a signal. Here is the actual argument - value to use in the error message. */ + here is the actual argument value to use in the error message. */ static Lisp_Object float_error_arg; -#define IN_FLOAT(d, num) \ -(in_float = 1, float_error_arg = num, (d), in_float = 0) +/* Evaluate the floating point expression D, recording NUM + as the original argument for error messages. + D is normally an assignment expression. + Handle errors which may result in signals or may set errno. */ + +#define IN_FLOAT(D, NUM) \ +(in_float = 1, errno = 0, float_error_arg = NUM, (D), \ + (errno == ERANGE || errno == EDOM ? float_error () : 0), \ + in_float = 0) /* Extract a Lisp number as a `double', or signal an error. */ @@ -476,7 +498,6 @@ Rounds the value toward zero.") return num; } -#ifdef BSD static float_error (signo) int signo; @@ -484,22 +505,22 @@ float_error (signo) if (! in_float) fatal_error_signal (signo); +#ifdef BSD #ifdef BSD4_1 sigrelse (SIGILL); #else /* not BSD4_1 */ sigsetmask (0); #endif /* not BSD4_1 */ +#else + /* Must reestablish handler each time it is called. */ + signal (SIGILL, float_error); +#endif /* BSD */ in_float = 0; Fsignal (Qarith_error, Fcons (float_error_arg, Qnil)); } -/* Another idea was to replace the library function `infnan' - where SIGILL is signaled. */ - -#endif /* BSD */ - init_floatfns () { signal (SIGILL, float_error); diff --git a/src/fns.c b/src/fns.c index ca6854b2912..8562f142dce 100644 --- a/src/fns.c +++ b/src/fns.c @@ -60,9 +60,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #undef vector #define vector ***** -#ifdef NULL -#undef NULL -#endif #include "lisp.h" #include "commands.h" @@ -132,7 +129,7 @@ A byte-code function object is also allowed.") return Farray_length (obj); else if (CONSP (obj)) { - for (i = 0, tail = obj; !NULL(tail); i++) + for (i = 0, tail = obj; !NILP(tail); i++) { QUIT; tail = Fcdr (tail); @@ -141,7 +138,7 @@ A byte-code function object is also allowed.") XFASTINT (val) = i; return val; } - else if (NULL(obj)) + else if (NILP(obj)) { XFASTINT (val) = 0; return val; @@ -263,7 +260,7 @@ with the original.") (arg) Lisp_Object arg; { - if (NULL (arg)) return arg; + if (NILP (arg)) return arg; if (!CONSP (arg) && XTYPE (arg) != Lisp_Vector && XTYPE (arg) != Lisp_String) arg = wrong_type_argument (Qsequencep, arg); return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0); @@ -298,7 +295,7 @@ concat (nargs, args, target_type, last_special) for (argnum = 0; argnum < nargs; argnum++) { this = args[argnum]; - if (!(CONSP (this) || NULL (this) + if (!(CONSP (this) || NILP (this) || XTYPE (this) == Lisp_Vector || XTYPE (this) == Lisp_String || XTYPE (this) == Lisp_Compiled)) { @@ -351,7 +348,7 @@ concat (nargs, args, target_type, last_special) register Lisp_Object elt; /* Fetch next element of `this' arg into `elt', or break if `this' is exhausted. */ - if (NULL (this)) break; + if (NILP (this)) break; if (CONSP (this)) elt = Fcar (this), this = Fcdr (this); else @@ -389,7 +386,7 @@ concat (nargs, args, target_type, last_special) } } } - if (!NULL (prev)) + if (!NILP (prev)) XCONS (prev)->cdr = last_tail; return val; @@ -408,7 +405,7 @@ Elements of ALIST that are not conses are also shared.") register Lisp_Object tem; CHECK_LIST (alist, 0); - if (NULL (alist)) + if (NILP (alist)) return alist; alist = concat (1, &alist, Lisp_Cons, 0); for (tem = alist; CONSP (tem); tem = XCONS (tem)->cdr) @@ -432,7 +429,7 @@ If FROM or TO is negative, it counts from the end.") { CHECK_STRING (string, 0); CHECK_NUMBER (from, 1); - if (NULL (to)) + if (NILP (to)) to = Flength (string); else CHECK_NUMBER (to, 2); @@ -458,7 +455,7 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0, register int i, num; CHECK_NUMBER (n, 0); num = XINT (n); - for (i = 0; i < num && !NULL (list); i++) + for (i = 0; i < num && !NILP (list); i++) { QUIT; list = Fcdr (list); @@ -483,7 +480,7 @@ DEFUN ("elt", Felt, Selt, 2, 2, 0, CHECK_NUMBER (n, 0); while (1) { - if (XTYPE (seq) == Lisp_Cons || NULL (seq)) + if (XTYPE (seq) == Lisp_Cons || NILP (seq)) return Fcar (Fnthcdr (n, seq)); else if (XTYPE (seq) == Lisp_String || XTYPE (seq) == Lisp_Vector) @@ -501,11 +498,11 @@ The value is actually the tail of LIST whose car is ELT.") Lisp_Object list; { register Lisp_Object tail; - for (tail = list; !NULL (tail); tail = Fcdr (tail)) + for (tail = list; !NILP (tail); tail = Fcdr (tail)) { register Lisp_Object tem; tem = Fcar (tail); - if (! NULL (Fequal (elt, tem))) + if (! NILP (Fequal (elt, tem))) return tail; QUIT; } @@ -520,7 +517,7 @@ The value is actually the tail of LIST whose car is ELT.") Lisp_Object list; { register Lisp_Object tail; - for (tail = list; !NULL (tail); tail = Fcdr (tail)) + for (tail = list; !NILP (tail); tail = Fcdr (tail)) { register Lisp_Object tem; tem = Fcar (tail); @@ -539,7 +536,7 @@ Elements of LIST that are not conses are ignored.") Lisp_Object list; { register Lisp_Object tail; - for (tail = list; !NULL (tail); tail = Fcdr (tail)) + for (tail = list; !NILP (tail); tail = Fcdr (tail)) { register Lisp_Object elt, tem; elt = Fcar (tail); @@ -579,13 +576,13 @@ The value is actually the element of LIST whose car is ELT.") Lisp_Object list; { register Lisp_Object tail; - for (tail = list; !NULL (tail); tail = Fcdr (tail)) + for (tail = list; !NILP (tail); tail = Fcdr (tail)) { register Lisp_Object elt, tem; elt = Fcar (tail); if (!CONSP (elt)) continue; tem = Fequal (Fcar (elt), key); - if (!NULL (tem)) return elt; + if (!NILP (tem)) return elt; QUIT; } return Qnil; @@ -599,7 +596,7 @@ The value is actually the element of LIST whose cdr is ELT.") Lisp_Object list; { register Lisp_Object tail; - for (tail = list; !NULL (tail); tail = Fcdr (tail)) + for (tail = list; !NILP (tail); tail = Fcdr (tail)) { register Lisp_Object elt, tem; elt = Fcar (tail); @@ -626,12 +623,12 @@ to be sure of changing the value of `foo'.") tail = list; prev = Qnil; - while (!NULL (tail)) + while (!NILP (tail)) { tem = Fcar (tail); if (EQ (elt, tem)) { - if (NULL (prev)) + if (NILP (prev)) list = Fcdr (tail); else Fsetcdr (prev, Fcdr (tail)); @@ -659,12 +656,12 @@ to be sure of changing the value of `foo'.") tail = list; prev = Qnil; - while (!NULL (tail)) + while (!NILP (tail)) { tem = Fcar (tail); if (Fequal (elt, tem)) { - if (NULL (prev)) + if (NILP (prev)) list = Fcdr (tail); else Fsetcdr (prev, Fcdr (tail)); @@ -685,10 +682,10 @@ Returns the beginning of the reversed list.") { register Lisp_Object prev, tail, next; - if (NULL (list)) return list; + if (NILP (list)) return list; prev = Qnil; tail = list; - while (!NULL (tail)) + while (!NILP (tail)) { QUIT; next = Fcdr (tail); @@ -774,24 +771,24 @@ merge (org_l1, org_l2, pred) while (1) { - if (NULL (l1)) + if (NILP (l1)) { UNGCPRO; - if (NULL (tail)) + if (NILP (tail)) return l2; Fsetcdr (tail, l2); return value; } - if (NULL (l2)) + if (NILP (l2)) { UNGCPRO; - if (NULL (tail)) + if (NILP (tail)) return l1; Fsetcdr (tail, l1); return value; } tem = call2 (pred, Fcar (l2), Fcar (l1)); - if (NULL (tem)) + if (NILP (tem)) { tem = l1; l1 = Fcdr (l1); @@ -803,7 +800,7 @@ merge (org_l1, org_l2, pred) l2 = Fcdr (l2); org_l2 = l2; } - if (NULL (tail)) + if (NILP (tail)) value = tem; else Fsetcdr (tail, tem); @@ -819,7 +816,7 @@ This is the last VALUE stored with `(put SYMBOL PROPNAME VALUE)'.") register Lisp_Object prop; { register Lisp_Object tail; - for (tail = Fsymbol_plist (sym); !NULL (tail); tail = Fcdr (Fcdr (tail))) + for (tail = Fsymbol_plist (sym); !NILP (tail); tail = Fcdr (Fcdr (tail))) { register Lisp_Object tem; tem = Fcar (tail); @@ -840,7 +837,7 @@ It can be retrieved with `(get SYMBOL PROPNAME)'.") register Lisp_Object tail, prev; Lisp_Object newcell; prev = Qnil; - for (tail = Fsymbol_plist (sym); !NULL (tail); tail = Fcdr (Fcdr (tail))) + for (tail = Fsymbol_plist (sym); !NILP (tail); tail = Fcdr (Fcdr (tail))) { register Lisp_Object tem; tem = Fcar (tail); @@ -849,7 +846,7 @@ It can be retrieved with `(get SYMBOL PROPNAME)'.") prev = tail; } newcell = Fcons (prop, Fcons (val, Qnil)); - if (NULL (prev)) + if (NILP (prev)) Fsetplist (sym, newcell); else Fsetcdr (Fcdr (prev), newcell); @@ -883,7 +880,7 @@ do_cdr: { Lisp_Object v1; v1 = Fequal (Fcar (o1), Fcar (o2), depth + 1); - if (NULL (v1)) + if (NILP (v1)) return v1; o1 = Fcdr (o1), o2 = Fcdr (o2); goto do_cdr; @@ -905,7 +902,7 @@ do_cdr: v1 = XVECTOR (o1)->contents [index]; v2 = XVECTOR (o2)->contents [index]; v = Fequal (v1, v2, depth + 1); - if (NULL (v)) return v; + if (NILP (v)) return v; } return Qt; } @@ -981,9 +978,9 @@ Only the last argument is not altered, and need not be a list.") for (argnum = 0; argnum < nargs; argnum++) { tem = args[argnum]; - if (NULL (tem)) continue; + if (NILP (tem)) continue; - if (NULL (val)) + if (NILP (val)) val = tem; if (argnum + 1 == nargs) break; @@ -1000,7 +997,7 @@ Only the last argument is not altered, and need not be a list.") tem = args[argnum + 1]; Fsetcdr (tail, tem); - if (NULL (tem)) + if (NILP (tem)) args[argnum + 1] = tail; } @@ -1409,7 +1406,7 @@ This function looks at the value of the variable `features'.") register Lisp_Object tem; CHECK_SYMBOL (feature, 0); tem = Fmemq (feature, Vfeatures); - return (NULL (tem)) ? Qnil : Qt; + return (NILP (tem)) ? Qnil : Qt; } DEFUN ("provide", Fprovide, Sprovide, 1, 1, 0, @@ -1419,10 +1416,10 @@ DEFUN ("provide", Fprovide, Sprovide, 1, 1, 0, { register Lisp_Object tem; CHECK_SYMBOL (feature, 0); - if (!NULL (Vautoload_queue)) + if (!NILP (Vautoload_queue)) Vautoload_queue = Fcons (Fcons (Vfeatures, Qnil), Vautoload_queue); tem = Fmemq (feature, Vfeatures); - if (NULL (tem)) + if (NILP (tem)) Vfeatures = Fcons (feature, Vfeatures); return feature; } @@ -1438,7 +1435,7 @@ If FILENAME is omitted, the printname of FEATURE is used as the file name.") register Lisp_Object tem; CHECK_SYMBOL (feature, 0); tem = Fmemq (feature, Vfeatures); - if (NULL (tem)) + if (NILP (tem)) { int count = specpdl_ptr - specpdl; @@ -1446,11 +1443,11 @@ If FILENAME is omitted, the printname of FEATURE is used as the file name.") record_unwind_protect (un_autoload, Vautoload_queue); Vautoload_queue = Qt; - Fload (NULL (file_name) ? Fsymbol_name (feature) : file_name, + Fload (NILP (file_name) ? Fsymbol_name (feature) : file_name, Qnil, Qt, Qnil); tem = Fmemq (feature, Vfeatures); - if (NULL (tem)) + if (NILP (tem)) error ("Required feature %s was not provided", XSYMBOL (feature)->name->data ); diff --git a/src/frame.c b/src/frame.c index 5eaf5897e01..67c73950505 100644 --- a/src/frame.c +++ b/src/frame.c @@ -163,7 +163,7 @@ make_screen (mini_p) { XWINDOW (mini_window)->buffer = Qt; Fset_window_buffer (mini_window, - (NULL (Vminibuffer_list) + (NILP (Vminibuffer_list) ? get_minibuffer (0) : Fcar (Vminibuffer_list))); } @@ -190,7 +190,7 @@ make_screen_without_minibuffer (mini_window) register struct screen *s; /* Choose the minibuffer window to use. */ - if (NULL (mini_window)) + if (NILP (mini_window)) { if (XTYPE (Vdefault_minibuffer_screen) != Lisp_Screen) error ("default-minibuffer-screen must be set when creating minibufferless screens."); @@ -207,7 +207,7 @@ make_screen_without_minibuffer (mini_window) /* Install the chosen minibuffer window, with proper buffer. */ s->minibuffer_window = mini_window; Fset_window_buffer (mini_window, - (NULL (Vminibuffer_list) + (NILP (Vminibuffer_list) ? get_minibuffer (0) : Fcar (Vminibuffer_list))); return s; @@ -246,7 +246,7 @@ make_minibuffer_screen () /* Put the proper buffer in that window. */ Fset_window_buffer (mini_window, - (NULL (Vminibuffer_list) + (NILP (Vminibuffer_list) ? get_minibuffer (0) : Fcar (Vminibuffer_list))); return s; @@ -289,7 +289,7 @@ focus on that screen.") #ifdef HAVE_X_WINDOWS #ifdef MULTI_SCREEN if (XSCREEN (screen)->output_method == output_x_window - && NULL (no_enter)) + && NILP (no_enter)) { Ffocus_screen (screen); } @@ -323,7 +323,7 @@ DEFUN ("screen-root-window", Fscreen_root_window, Sscreen_root_window, 0, 1, 0, (screen) Lisp_Object screen; { - if (NULL (screen)) + if (NILP (screen)) XSET (screen, Lisp_Screen, selected_screen); else CHECK_LIVE_SCREEN (screen, 0); @@ -337,7 +337,7 @@ DEFUN ("screen-selected-window", Fscreen_selected_window, (screen) Lisp_Object screen; { - if (NULL (screen)) + if (NILP (screen)) XSET (screen, Lisp_Screen, selected_screen); else CHECK_LIVE_SCREEN (screen, 0); @@ -381,7 +381,7 @@ next_screen (screen, minibuf) /* Decide whether this screen is eligible to be returned, according to minibuf. */ - if ((NULL (minibuf) && ! SCREEN_MINIBUF_ONLY_P (XSCREEN (s))) + if ((NILP (minibuf) && ! SCREEN_MINIBUF_ONLY_P (XSCREEN (s))) || XTYPE (minibuf) != Lisp_Window || EQ (SCREEN_MINIBUF_WINDOW (XSCREEN (s)), minibuf) || EQ (s, screen)) @@ -420,18 +420,18 @@ prev_screen (screen, minibuf) if (XTYPE (scr) != Lisp_Screen) abort (); - if (EQ (screen, scr) && !NULL (prev)) + if (EQ (screen, scr) && !NILP (prev)) return prev; /* Decide whether this screen is eligible to be returned, according to minibuf. */ - if ((NULL (minibuf) && ! SCREEN_MINIBUF_ONLY_P (XSCREEN (scr))) + if ((NILP (minibuf) && ! SCREEN_MINIBUF_ONLY_P (XSCREEN (scr))) || XTYPE (minibuf) != Lisp_Window || EQ (SCREEN_MINIBUF_WINDOW (XSCREEN (scr)), minibuf)) prev = scr; } - if (NULL (prev)) + if (NILP (prev)) /* We went through the whole screen list without finding a single acceptable screen. Return the original screen. */ prev = screen; @@ -450,7 +450,7 @@ Lisp_Object screen, miniscreen; { Lisp_Object tail; - if (NULL (screen)) + if (NILP (screen)) XSET (screen, Lisp_Screen, selected_screen); else CHECK_LIVE_SCREEN (screen, 0); @@ -760,7 +760,7 @@ window when a screen doesn't have its own minibuffer.") { CHECK_LIVE_SCREEN (screen, 0); - if (NULL (focus_screen)) + if (NILP (focus_screen)) focus_screen = screen; else CHECK_LIVE_SCREEN (focus_screen, 1); @@ -941,7 +941,7 @@ but that the idea of the actual height of the screen should not be changed.") register struct screen *s; CHECK_NUMBER (rows, 0); - if (NULL (screen)) + if (NILP (screen)) s = selected_screen; else { @@ -955,7 +955,7 @@ but that the idea of the actual height of the screen should not be changed.") x_set_window_size (s, s->width, XINT (rows)); } else - change_screen_size (s, XINT (rows), 0, !NULL (pretend)); + change_screen_size (s, XINT (rows), 0, !NILP (pretend)); return Qnil; } @@ -968,7 +968,7 @@ but that the idea of the actual width of the screen should not be changed.") { register struct screen *s; CHECK_NUMBER (cols, 0); - if (NULL (screen)) + if (NILP (screen)) s = selected_screen; else { @@ -982,7 +982,7 @@ but that the idea of the actual width of the screen should not be changed.") x_set_window_size (s, XINT (cols), s->height); } else - change_screen_size (selected_screen, 0, XINT (cols), !NULL (pretend)); + change_screen_size (selected_screen, 0, XINT (cols), !NILP (pretend)); return Qnil; } diff --git a/src/frame.h b/src/frame.h index c38b0585d00..a9fca616c8c 100644 --- a/src/frame.h +++ b/src/frame.h @@ -55,10 +55,13 @@ struct screen int cursor_x; int cursor_y; - /* Actual cursor position of this screen. + /* Actual cursor position of this screen, and the character under it. (Not used for terminal screens.) */ int phys_cursor_x; int phys_cursor_y; + /* This is handy for undrawing the cursor, because current_glyphs is + not always accurate when in do_scrolling. */ + GLYPH phys_cursor_glyph; /* Size of this screen, in units of characters. */ int height; @@ -120,7 +123,7 @@ struct screen /* Nonzero if this screen should be redrawn. */ char garbaged; - /* True if screen actually has a minibuffer window on it. + /* True if screen actually has a minibuffer window on it. 0 if using a minibuffer window that isn't on this screen. */ char has_minibuffer; @@ -152,9 +155,14 @@ typedef struct screen *SCREEN_PTR; #define WINDOW_SCREEN(w) (w)->screen +#define SCREENP(s) (XTYPE(s) == Lisp_Screen) +#define SCREEN_LIVE_P(s) ((s)->display.nothing != 0) #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1, s->garbaged = 1) #define SCREEN_IS_TERMCAP(s) ((s)->output_method == output_termcap) #define SCREEN_IS_X(s) ((s)->output_method == output_x_window) +#define SCREEN_MINIBUF_ONLY_P(s) \ + EQ (SCREEN_ROOT_WINDOW (s), SCREEN_MINIBUF_WINDOW (s)) +#define SCREEN_HAS_MINIBUF(s) ((s)->has_minibuffer) #define SCREEN_CURRENT_GLYPHS(s) (s)->current_glyphs #define SCREEN_DESIRED_GLYPHS(s) (s)->desired_glyphs #define SCREEN_TEMP_GLYPHS(s) (s)->temp_glyphs @@ -172,7 +180,6 @@ typedef struct screen *SCREEN_PTR; #define SCREEN_MINIBUF_WINDOW(s) (s)->minibuffer_window #define SCREEN_ROOT_WINDOW(s) (s)->root_window #define SCREEN_SELECTED_WINDOW(s) (s)->selected_window -#define SCREENP(s) (XTYPE(s) == Lisp_Screen) #define SET_GLYPHS_SCREEN(glyphs,screen) ((glyphs)->screen = (screen)) #define SCREEN_INSERT_COST(s) (s)->insert_line_cost #define SCREEN_DELETE_COST(s) (s)->delete_line_cost @@ -182,9 +189,20 @@ typedef struct screen *SCREEN_PTR; #define SCREEN_SCROLL_BOTTOM_VPOS(s) (s)->scroll_bottom_vpos #define SCREEN_FOCUS_SCREEN(s) (s)->focus_screen -#define CHECK_SCREEN(x, i) \ - { if (XTYPE ((x)) != Lisp_Screen) x = wrong_type_argument (Qscreenp, (x)); } -extern Lisp_Object Qscreenp; +#define CHECK_SCREEN(x, i) \ + { \ + if (! SCREENP (x)) \ + x = wrong_type_argument (Qscreenp, (x)); \ + } + +#define CHECK_LIVE_SCREEN(x, i) \ + { \ + if (! SCREENP (x) \ + || ! SCREEN_LIVE_P (XSCREEN (x))) \ + x = wrong_type_argument (Qlive_screen_p, (x)); \ + } + +extern Lisp_Object Qscreenp, Qlive_screen_p; extern struct screen *selected_screen; extern struct screen *last_nonminibuf_screen; @@ -195,7 +213,6 @@ extern struct screen *make_minibuffer_screen (); extern struct screen *make_screen_without_minibuffer (); extern Lisp_Object Vscreen_list; -extern Lisp_Object Vglobal_minibuffer_screen; extern Lisp_Object Vdefault_screen_alist; extern Lisp_Object Vterminal_screen; @@ -212,8 +229,13 @@ extern int selected_screen; #define XSCREEN(s) selected_screen #define WINDOW_SCREEN(w) selected_screen +#define SCREENP(s) (XTYPE(s) == Lisp_Screen) +#define SCREEN_LIVE_P(s) 1 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1) #define SCREEN_IS_TERMCAP(s) 1 +#define SCREEN_IS_X(s) 0 +#define SCREEN_IS_MINIBUF_ONLY(s) 0 +#define SCREEN_HAS_MINIBUF(s) 1 #define SCREEN_CURRENT_GLYPHS(s) current_glyphs #define SCREEN_DESIRED_GLYPHS(s) desired_glyphs #define SCREEN_TEMP_GLYPHS(s) temp_glyphs @@ -231,7 +253,6 @@ extern int selected_screen; #define SCREEN_MINIBUF_WINDOW(s) minibuf_window #define SCREEN_ROOT_WINDOW(s) root_window #define SCREEN_SELECTED_WINDOW(s) selected_window -#define SCREENP(s) 0 #define SET_GLYPHS_SCREEN(glyphs,screen) #define SCREEN_INSERT_COST(screen) insert_line_cost #define SCREEN_DELETE_COST(screen) delete_line_cost diff --git a/src/hftctl.c b/src/hftctl.c index 3e3788aa709..1e038725777 100644 --- a/src/hftctl.c +++ b/src/hftctl.c @@ -9,8 +9,8 @@ /* #include <sys/hft.h> */ /* */ /* int hftctl(fildes, request, arg ) */ -/* int fildes, request ; */ -/* char *arg ; */ +/* int fildes, request; */ +/* char *arg; */ /* */ /* Description: */ /* */ @@ -49,222 +49,241 @@ #include <sys/ioctl.h> #include <sys/signal.h> #include <sys/devinfo.h> +#include <termios.h> #include <termio.h> #include <sys/hft.h> -#include <termios.h> #include <sys/tty.h> /* #include <sys/pty.h> */ #define REMOTE 0x01 #undef ioctl -static char SCCSid[] = "com/gnuemacs/src,3.1,9021-90/05/03-5/3/90" ; +static char SCCSid[] = "com/gnuemacs/src,3.1,9021-90/05/03-5/3/90"; /*************** LOCAL DEFINES **********************************/ -typedef int (*FUNC)() ; /* pointer to a function */ +typedef int (*FUNC)(); /* pointer to a function */ #define QDEV ((HFQPDEVCH<<8)|HFQPDEVCL) #define QLOC ((HFQLOCCH<<8)|HFQLOCCL) #define QPS ((HFQPRESCH<<8)|HFQPRESCL) +#ifndef TCGETS +#define TCGETS TCGETA +#endif +#ifndef TCSETS +#define TCSETS TCSETA +#endif + /*************** EXTERNAL / GLOBAL DATA AREA ********************/ - int hfqry() ; - int hfskbd() ; - char *malloc() ; + int hfqry(); + int hfskbd(); + char *malloc(); -extern int errno ; -static jmp_buf hftenv ; -static int is_ack_vtd ; -static FUNC sav_alrm ; +extern int errno; +static jmp_buf hftenv; +static int is_ack_vtd; +static FUNC sav_alrm; static struct hfctlreq req = { 0x1b,'[','x',0,0,0,21,HFCTLREQCH,HFCTLREQCL}; static struct hfctlack ACK = { 0x1b,'[','x',0,0,0,21,HFCTLACKCH,HFCTLACKCL}; - /* FUNC signal() ; */ + /* FUNC signal(); */ /*************** LOCAL MACROS ***********************************/ #define HFTYPE(p) ((p->hf_typehi<<8)|(p->hf_typelo)) -#define BYTE4(p) ( (p)[0]<<24 | (p)[1]<<16 | (p)[2]<<8 | (p)[3] ) +#define BYTE4(p) ((p)[0]<<24 | (p)[1]<<16 | (p)[2]<<8 | (p)[3]) /* read a buffer */ #define RD_BUF(f,p,l) \ - while ( (l) ) \ - if ( ( j = read((f),(p),(l)) ) < 0 ) \ - if ( errno != EINTR ) return (-1) ; \ - else continue ; \ - else { (l)-=j ; (p)+=j ; } + while ((l)) \ + if ((j = read((f),(p),(l))) < 0) \ + if (errno != EINTR) return (-1); \ + else continue; \ + else { (l) -= j; (p) += j; } + +/*************** function prototypes ***************************/ +#ifdef __STDC__ +static GT_ACK (int fd, int req, char *buf); +static WR_REQ (int fd, int request, int cmdlen, char *cmd, int resplen); +static hft_alrm(int sig); +#else +static GT_ACK (); +static WR_REQ (); +static hft_alrm (); +#endif /*************** HFTCTL FUNCTION *******************************/ -hftctl( fd, request, arg ) - int fd ; - int request ; - union { - struct hfintro *intro ; - struct hfquery *query ; - char *c ; - } arg ; +hftctl (fd, request, arg) + int fd; + int request; + union { + struct hfintro *intro; + struct hfquery *query; + char *c; + } arg; { - int i ; - int fd_flag ; /* fcntl flags */ -register union { - struct hfintro *cmd ; /* p.cmd - intro des. */ - struct hfqphdevc *ph ; /* p.ph - physical dev.*/ - char *c ; /* p.c - char ptr */ - } p ; /* general pointer */ - int pty_new ; /* pty modes */ - int pty_old ; - int retcode ; - struct termios term_new ; /* terminal attributes */ - struct termios term_old ; - struct devinfo devInfo ; /* defined in sys/devinfo.h */ - - -if ( ioctl( fd, IOCINFO, &devInfo ) == -1 ) return(-1) ; - -if ( devInfo.devtype != DD_PSEU ) /* is it a pty? */ - return (ioctl(fd, request, arg) ) ; /* no, do IOCTL */ - - /******* START PTY **************/ - /** Pty found, possible HFT */ - /** set new file des as raw */ - /** as you can. */ - /********************************/ - - /* Get current state of file */ - /* descriptor & save */ -if ( ( fd_flag = fcntl( fd, F_GETFL, 0 ) ) == -1 ) return (-1) ; -if ( ioctl( fd, TCGETS, &term_old ) == -1 ) return (-1) ; - /* set terminal attr to raw */ - /* and to delay on read */ -pty_new = pty_old | REMOTE ; -memcpy( &term_new, &term_old, sizeof( term_new ) ) ; -term_new.c_iflag = 0 ; -term_new.c_oflag = 0 ; -term_new.c_lflag = 0 ; -/* term_new.c_line = 0 ; */ -for ( i = 1 ; i <= 5 ; i++ ) -term_new.c_cc[i] = 0 ; -term_new.c_cc[0] = -1 ; -ioctl( fd, TCSETS, &term_new ) ; -if ( fcntl( fd, F_SETFL, fd_flag & ~O_NDELAY ) == -1 ) - return(-1) ; - /* call spacific function */ -if ( request == HFSKBD ) - retcode = hfskbd( fd, request, arg.c) ; -else /* assume HFQUERY */ - retcode = hfqry( fd, request, arg.c) ; - -fcntl( fd, F_SETFL, fd_flag ) ; /* reset terminal to original */ -ioctl( fd, TCSETS, &term_old ) ; - - -return( retcode ) ; /* return error */ + int i; + int fd_flag; /* fcntl flags */ + register union { + struct hfintro *cmd; /* p.cmd - intro des. */ + struct hfqphdevc *ph; /* p.ph - physical dev.*/ + char *c; /* p.c - char ptr */ + } p; /* general pointer */ + int pty_new; /* pty modes */ + int pty_old; + int retcode; + struct termios term_new; /* terminal attributes */ + struct termios term_old; + struct devinfo devInfo; /* defined in sys/devinfo.h */ + + + if (ioctl (fd, IOCINFO, &devInfo) == -1) return(-1); + + if (devInfo.devtype != DD_PSEU) /* is it a pty? */ + return (ioctl(fd, request, arg)); /* no, do IOCTL */ + + /******* START PTY **************/ + /** Pty found, possible HFT */ + /** set new file des as raw */ + /** as you can. */ + /********************************/ + + /* Get current state of file */ + /* descriptor & save */ + if ((fd_flag = fcntl (fd, F_GETFL, 0)) == -1) return (-1); + if (ioctl (fd, TCGETS, &term_old) == -1) return (-1); + /* set terminal attr to raw */ + /* and to delay on read */ + pty_new = pty_old | REMOTE; + memcpy (&term_new, &term_old, sizeof (term_new)); + term_new.c_iflag = 0; + term_new.c_oflag = 0; + term_new.c_lflag = 0; + /* term_new.c_line = 0; */ + for (i = 1; i <= 5; i++) + term_new.c_cc[i] = 0; + term_new.c_cc[0] = -1; + ioctl (fd, TCSETS, &term_new); + if (fcntl (fd, F_SETFL, fd_flag & ~O_NDELAY) == -1) + return(-1); + /* call spacific function */ + if (request == HFSKBD) + retcode = hfskbd (fd, request, arg.c); + else /* assume HFQUERY */ + retcode = hfqry (fd, request, arg.c); + + fcntl (fd, F_SETFL, fd_flag); /* reset terminal to original */ + ioctl (fd, TCSETS, &term_old); + + + return (retcode); /* return error */ } /*************** HFSKBD FUNCTION ******************************/ -static hfskbd(fd, request, arg ) - int fd ; - int request ; - struct hfbuf *arg ; +static int +hfskbd (fd, request, arg) + int fd; + int request; + struct hfbuf *arg; { -WR_REQ(fd, request, arg->hf_buflen, arg->hf_bufp,0) ; -return( GT_ACK(fd, request, arg->hf_bufp) ) ; + WR_REQ(fd, request, arg->hf_buflen, arg->hf_bufp,0); + return (GT_ACK(fd, request, arg->hf_bufp)); } /*************** HFQUERY FUNCTION ******************************/ -static hfqry(fd, request, arg ) - int fd ; - int request ; - struct hfquery *arg ; +static int +hfqry (fd, request, arg) + int fd; + int request; + struct hfquery *arg; { -WR_REQ(fd, request, arg->hf_cmdlen, arg->hf_cmd, arg->hf_resplen ) ; -return( GT_ACK(fd, request, arg->hf_resp ) ) ; + WR_REQ(fd, request, arg->hf_cmdlen, arg->hf_cmd, arg->hf_resplen); + return (GT_ACK(fd, request, arg->hf_resp)); } /*************** GT_ACK FUNCTION ******************************/ -static GT_ACK(fd, req, buf ) - int fd ; - int req ; - char *buf ; +static int +GT_ACK (fd, req, buf) + int fd; + int req; + char *buf; { - - struct hfctlack ack ; - int i = sizeof( ack ) ; - int j = 0 ; - union { - char *c ; - struct hfctlack *ack ; - } p ; - - int hft_alrm() ; - -is_ack_vtd = 0 ; /* flag no ACT VTD yet */ - -if ( setjmp( hftenv ) ) /* set environment in case */ - { /* of time out */ - errno=ENODEV ; /* if time out, set errno */ - return( -1 ) ; /* flag error */ - } - -alarm(3) ; /* time out in 3 secs */ -sav_alrm = signal( SIGALRM, hft_alrm ) ;/* prepare to catch time out */ - -p.ack = &ack ; -while ( ! is_ack_vtd ) /* do until valid ACK VTD */ - { - RD_BUF(fd, p.c, i ) ; /* read until a ACK VTD is fill*/ - - if ( ! memcmp( &ack, &ACK, sizeof( HFINTROSZ ) ) /* the ACK intro & */ - && ( ack.hf_request == req ) ) /* is it the response we want ?*/ - { /* yes, ACK VTD found */ - is_ack_vtd = 1 ; /* quickly, flag it */ - break ; /* get the %$%#@ out of here */ - } - - p.ack = &ack ; /* no, then skip 1st */ - ++p.c ; /* char and start over */ - i = sizeof( ack ) - 1 ; /* one less ESC to cry over */ - - while( ( *p.c != 0x1b ) && i ) /* scan for next ESC */ - { ++p.c ; --i ; } /* if any */ - - ( i ? memcpy( &ack, p.c, i ) : 0 ) ; /* if any left over, then move */ - p.ack = &ack ; /* ESC to front of ack struct */ - p.c += i ; /* skip over whats been read */ - i = sizeof( ack ) - i ; /* set whats left to be read */ - } /***** TRY AGAIN */ - -alarm(0) ; /* ACK VTD received, reset alrm*/ -signal( SIGALRM, sav_alrm ) ; /* reset signal */ - -if ( i = ack.hf_arg_len ) /* any data following ? */ - { /* yes, */ - RD_BUF(fd,buf,i) ; /* read until it is received */ - } - -if ( errno = ack.hf_retcode ) /* set errno based on returned */ - return (-1) ; /* code, if 0, then no error */ -else - return (0) ; /* if set, then error returned */ + struct hfctlack ack; + int i = sizeof (ack); + int j = 0; + union { + char *c; + struct hfctlack *ack; + } p; + + is_ack_vtd = 0; /* flag no ACT VTD yet */ + + if (setjmp (hftenv)) /* set environment in case */ + { /* of time out */ + errno = ENODEV; /* if time out, set errno */ + return (-1); /* flag error */ + } + + alarm(3); /* time out in 3 secs */ + sav_alrm = signal (SIGALRM, hft_alrm); /* prepare to catch time out */ + + p.ack = &ack; + while (! is_ack_vtd) /* do until valid ACK VTD */ + { + RD_BUF(fd, p.c, i); /* read until a ACK VTD is fill*/ + + if (! memcmp (&ack, &ACK, sizeof (HFINTROSZ)) /* the ACK intro & */ + && (ack.hf_request == req)) /* is it the response we want ?*/ + { /* yes, ACK VTD found */ + is_ack_vtd = 1; /* quickly, flag it */ + break; /* get the %$%#@ out of here */ + } + + p.ack = &ack; /* no, then skip 1st */ + ++p.c; /* char and start over */ + i = sizeof (ack) - 1; /* one less ESC to cry over */ + + while ((*p.c != 0x1b) && i) /* scan for next ESC */ + { ++p.c; --i; } /* if any */ + + (i ? memcpy (&ack, p.c, i) : 0); /* if any left over, then move */ + p.ack = &ack; /* ESC to front of ack struct */ + p.c += i; /* skip over whats been read */ + i = sizeof (ack) - i; /* set whats left to be read */ + } /***** TRY AGAIN */ + + alarm(0); /* ACK VTD received, reset alrm*/ + signal (SIGALRM, sav_alrm); /* reset signal */ + + if (i = ack.hf_arg_len) /* any data following ? */ + { /* yes, */ + RD_BUF(fd,buf,i); /* read until it is received */ + } + + if (errno = ack.hf_retcode) /* set errno based on returned */ + return (-1); /* code, if 0, then no error */ + else + return (0); /* if set, then error returned */ } /*************** HFT_ALRM FUNCTION ******************************/ -static hft_alrm(sig) /* Function hft_alrm - handle */ - int sig ; /* alarm signal */ +static int +hft_alrm (sig) /* Function hft_alrm - handle */ + int sig; /* alarm signal */ { -signal( SIGALRM, sav_alrm ) ; /* reset to previous */ + signal (SIGALRM, sav_alrm); /* reset to previous */ -if ( is_ack_vtd ) /* has ack vtd arrived ? */ - return(0) ; /* yes, then continue */ -else /* no, then return with error */ - longjmp( hftenv, -1 ) ; + if (is_ack_vtd) /* has ack vtd arrived ? */ + return(0); /* yes, then continue */ + else /* no, then return with error */ + longjmp (hftenv, -1); } @@ -278,42 +297,43 @@ else /* no, then return with error */ /*** ***/ /*********************************************************************/ -static WR_REQ(fd, request, cmdlen, cmd, resplen ) - int fd ; - int request ; - int cmdlen ; - char *cmd ; - int resplen ; +static int +WR_REQ (fd, request, cmdlen, cmd, resplen) + int fd; + int request; + int cmdlen; + char *cmd; + int resplen; { - struct { - char *c ; - struct hfctlreq *req ; - } p ; - int size ; - - req.hf_request = request ; - req.hf_arg_len = cmdlen ; - req.hf_rsp_len = resplen ; - -if ( cmdlen ) /* if arg structure to pass */ - { - size = sizeof( struct hfctlreq ) + cmdlen ; - if ( ( p.c = malloc(size) ) == NULL ) /* malloc one area */ - return( -1 ) ; - - memcpy( p.c, &req, sizeof( req ) ) ; /* copy CTL REQ struct */ - memcpy( p.c + sizeof( req ), cmd, cmdlen ) ; /* copy arg struct */ - } -else - { - p.req = &req ; /* otherwise use only CTL REQ */ - size = sizeof( req ) ; - } - - /* write request to terminal */ -if ( write(fd,p.c,size) == -1 ) return (-1) ; -if ( p.req != &req ) /* free if allocated */ - free( p.c ) ; -return (0) ; + struct { + char *c; + struct hfctlreq *req; + } p; + int size; + + req.hf_request = request; + req.hf_arg_len = cmdlen; + req.hf_rsp_len = resplen; + + if (cmdlen) /* if arg structure to pass */ + { + size = sizeof (struct hfctlreq) + cmdlen; + if ((p.c = malloc(size)) == NULL) /* malloc one area */ + return (-1); + + memcpy (p.c, &req, sizeof (req)); /* copy CTL REQ struct */ + memcpy (p.c + sizeof (req), cmd, cmdlen); /* copy arg struct */ + } + else + { + p.req = &req; /* otherwise use only CTL REQ */ + size = sizeof (req); + } + + /* write request to terminal */ + if (write(fd,p.c,size) == -1) return (-1); + if (p.req != &req) /* free if allocated */ + free (p.c); + return (0); } diff --git a/src/keymap.c b/src/keymap.c index d55c369356d..ec45512837b 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -155,7 +155,7 @@ VECTOR is a 128-element vector of bindings for ASCII characters.") (object) Lisp_Object object; { - return (NULL (get_keymap_1 (object, 0)) ? Qnil : Qt); + return (NILP (get_keymap_1 (object, 0)) ? Qnil : Qt); } /* Check that OBJECT is a keymap (after dereferencing through any @@ -232,7 +232,7 @@ access_keymap (map, idx) /* A dense keymap indexed by a character? */ if (XTYPE (idx) == Lisp_Int - && ! NULL (table)) + && ! NILP (table)) return XVECTOR (table)->contents[XFASTINT (idx)]; /* This lookup will not involve a vector reference. */ @@ -269,7 +269,7 @@ get_keyelt (object) tem = Fkeymapp (map); /* If the contents are (KEYMAP . ELEMENT), go indirect. */ - if (!NULL (tem)) + if (!NILP (tem)) object = access_keymap (map, Fcdr (object)); /* If the keymap contents looks like (STRING . DEFN), @@ -306,7 +306,7 @@ store_in_keymap (keymap, idx, def) Lisp_Object table = keymap_table (keymap); /* A dense keymap indexed by a character? */ - if (XTYPE (idx) == Lisp_Int && !NULL (table)) + if (XTYPE (idx) == Lisp_Int && !NILP (table)) XVECTOR (table)->contents[XFASTINT (idx)] = def; /* Must be a sparse keymap, or a dense keymap indexed by a symbol. */ @@ -315,7 +315,7 @@ store_in_keymap (keymap, idx, def) /* Point to the pointer to the start of the assoc-list part of the keymap. */ register Lisp_Object *assoc_head - = (NULL (table) + = (NILP (table) ? & XCONS (keymap)->cdr : & XCONS (XCONS (keymap)->cdr)->cdr); register Lisp_Object defining_pair; @@ -328,7 +328,7 @@ store_in_keymap (keymap, idx, def) /* Point to the pair where idx is bound, if any. */ defining_pair = Fassq (idx, *assoc_head); - if (NULL (defining_pair)) + if (NILP (defining_pair)) *assoc_head = Fcons (Fcons (idx, def), *assoc_head); else Fsetcdr (defining_pair, def); @@ -367,7 +367,7 @@ is not copied.") for (i = 0; i < DENSE_TABLE_SIZE; i++) if (XTYPE (XVECTOR (copy)->contents[i]) != Lisp_Symbol) - if (! NULL (Fkeymapp (XVECTOR (table)->contents[i]))) + if (! NILP (Fkeymapp (XVECTOR (table)->contents[i]))) XVECTOR (table)->contents[i] = Fcopy_keymap (XVECTOR (table)->contents[i]); XCONS (tail)->car = table; @@ -384,7 +384,7 @@ is not copied.") elt = XCONS (tail)->car; if (CONSP (elt) && XTYPE (XCONS (elt)->cdr) != Lisp_Symbol - && ! NULL (Fkeymapp (XCONS (elt)->cdr))) + && ! NILP (Fkeymapp (XCONS (elt)->cdr))) XCONS (elt)->cdr = Fcopy_keymap (XCONS (elt)->cdr); tail = XCONS (tail)->cdr; @@ -461,14 +461,14 @@ the front of KEYMAP.") cmd = get_keyelt (access_keymap (keymap, c)); - if (NULL (cmd)) + if (NILP (cmd)) { cmd = Fmake_sparse_keymap (); store_in_keymap (keymap, c, cmd); } tem = Fkeymapp (cmd); - if (NULL (tem)) + if (NILP (tem)) error ("Key sequence %s uses invalid prefix characters", XSTRING (key)->data); @@ -533,7 +533,7 @@ it takes to reach a non-prefix command.") return cmd; tem = Fkeymapp (cmd); - if (NULL (tem)) + if (NILP (tem)) return make_number (idx); keymap = get_keymap (cmd); @@ -568,6 +568,11 @@ append_key (key_sequence, key) /* Global, local, and minor mode keymap stuff. */ +/* We can't put these variables inside current_minor_maps, since under + DGUX they dump as pure. Bleah. */ +static Lisp_Object *cmm_modes, *cmm_maps; +static int cmm_size; + /* Store a pointer to an array of the keymaps of the currently active minor modes in *buf, and return the number of maps it contains. @@ -588,9 +593,6 @@ int current_minor_maps (modeptr, mapptr) Lisp_Object **modeptr, **mapptr; { - static Lisp_Object *modes, *maps; - static int size; - int i = 0; Lisp_Object alist, assoc, var; @@ -599,39 +601,39 @@ current_minor_maps (modeptr, mapptr) alist = XCONS (alist)->cdr) if (CONSP (assoc = XCONS (alist)->car) && XTYPE (var = XCONS (assoc)->car) == Lisp_Symbol - && ! NULL (Fboundp (var)) - && ! NULL (Fsymbol_value (var))) + && ! NILP (Fboundp (var)) + && ! NILP (Fsymbol_value (var))) { - if (i >= size) + if (i >= cmm_size) { Lisp_Object *newmodes, *newmaps; - if (maps) + if (cmm_maps) { - newmodes = (Lisp_Object *) realloc (modes, size *= 2); - newmaps = (Lisp_Object *) realloc (maps, size); + newmodes = (Lisp_Object *) realloc (cmm_modes, cmm_size *= 2); + newmaps = (Lisp_Object *) realloc (cmm_maps, cmm_size); } else { - newmodes = (Lisp_Object *) malloc (size = 30); - newmaps = (Lisp_Object *) malloc (size); + newmodes = (Lisp_Object *) malloc (cmm_size = 30); + newmaps = (Lisp_Object *) malloc (cmm_size); } if (newmaps && newmodes) { - modes = newmodes; - maps = newmaps; + cmm_modes = newmodes; + cmm_maps = newmaps; } else break; } - modes[i] = var; - maps [i] = XCONS (assoc)->cdr; + cmm_modes[i] = var; + cmm_maps [i] = XCONS (assoc)->cdr; i++; } - if (modeptr) *modeptr = modes; - if (mapptr) *mapptr = maps; + if (modeptr) *modeptr = cmm_modes; + if (mapptr) *mapptr = cmm_maps; return i; } @@ -647,22 +649,22 @@ The binding is probably a symbol with a function definition.") nmaps = current_minor_maps (0, &maps); for (i = 0; i < nmaps; i++) - if (! NULL (maps[i])) + if (! NILP (maps[i])) { value = Flookup_key (maps[i], key); - if (! NULL (value) && XTYPE (value) != Lisp_Int) + if (! NILP (value) && XTYPE (value) != Lisp_Int) return value; } - if (! NULL (current_buffer->keymap)) + if (! NILP (current_buffer->keymap)) { value = Flookup_key (current_buffer->keymap, key); - if (! NULL (value) && XTYPE (value) != Lisp_Int) + if (! NILP (value) && XTYPE (value) != Lisp_Int) return value; } value = Flookup_key (current_global_map, key); - if (! NULL (value) && XTYPE (value) != Lisp_Int) + if (! NILP (value) && XTYPE (value) != Lisp_Int) return value; return Qnil; @@ -677,7 +679,7 @@ The binding is probably a symbol with a function definition.") { register Lisp_Object map; map = current_buffer->keymap; - if (NULL (map)) + if (NILP (map)) return Qnil; return Flookup_key (map, keys); } @@ -711,11 +713,11 @@ that come after prefix bindings.") nmaps = current_minor_maps (&modes, &maps); for (i = j = 0; i < nmaps; i++) - if (! NULL (maps[i]) - && ! NULL (binding = Flookup_key (maps[i], key)) + if (! NILP (maps[i]) + && ! NILP (binding = Flookup_key (maps[i], key)) && XTYPE (binding) != Lisp_Int) { - if (! NULL (get_keymap_1 (binding, 0))) + if (! NILP (get_keymap_1 (binding, 0))) maps[j++] = Fcons (modes[i], binding); else if (j == 0) return Fcons (Fcons (modes[i], binding), Qnil); @@ -754,7 +756,7 @@ which is shared with other buffers in the same major mode.") { register Lisp_Object map; map = current_buffer->keymap; - if (NULL (map)) + if (NILP (map)) { map = Fmake_sparse_keymap (); current_buffer->keymap = map; @@ -785,7 +787,7 @@ KEY is a string representing a sequence of keystrokes.") (keys) Lisp_Object keys; { - if (!NULL (current_buffer->keymap)) + if (!NILP (current_buffer->keymap)) Flocal_set_key (keys, Qnil); return Qnil; } @@ -802,7 +804,7 @@ as a function.") Lisp_Object map; map = Fmake_sparse_keymap (); Ffset (name, map); - if (!NULL (mapvar)) + if (!NILP (mapvar)) Fset (mapvar, map); else Fset (name, map); @@ -825,7 +827,7 @@ If KEYMAP is nil, that means no local keymap.") (keymap) Lisp_Object keymap; { - if (!NULL (keymap)) + if (!NILP (keymap)) keymap = get_keymap (keymap); current_buffer->keymap = keymap; @@ -880,7 +882,7 @@ so that the KEYS increase in length. The first element is (\"\" . KEYMAP).") This is a breadth-first traversal, where tail is the queue of nodes, and maps accumulates a list of all nodes visited. */ - while (!NULL (tail)) + while (!NILP (tail)) { register Lisp_Object thisseq = Fcar (Fcar (tail)); register Lisp_Object thismap = Fcdr (Fcar (tail)); @@ -908,14 +910,14 @@ so that the KEYS increase in length. The first element is (\"\" . KEYMAP).") register Lisp_Object cmd; cmd = get_keyelt (XVECTOR (table)->contents[i]); - if (NULL (cmd)) continue; + if (NILP (cmd)) continue; tem = Fkeymapp (cmd); - if (!NULL (tem)) + if (!NILP (tem)) { cmd = get_keymap (cmd); /* Ignore keymaps that are already added to maps. */ tem = Frassq (cmd, maps); - if (NULL (tem)) + if (NILP (tem)) { /* If the last key in thisseq is meta-prefix-char, turn it into a meta-ized keystroke. We know @@ -960,12 +962,12 @@ so that the KEYS increase in length. The first element is (\"\" . KEYMAP).") /* Ignore definitions that aren't keymaps themselves. */ tem = Fkeymapp (cmd); - if (!NULL (tem)) + if (!NILP (tem)) { /* Ignore keymaps that have been seen already. */ cmd = get_keymap (cmd); tem = Frassq (cmd, maps); - if (NULL (tem)) + if (NILP (tem)) { /* let elt be the event defined by this map entry. */ elt = XCONS (elt)->car; @@ -1171,10 +1173,10 @@ indirect definition itself.") register Lisp_Object maps; Lisp_Object found; - if (NULL (global_keymap)) + if (NILP (global_keymap)) global_keymap = current_global_map; - if (!NULL (local_keymap)) + if (!NILP (local_keymap)) maps = nconc2 (Faccessible_keymaps (get_keymap (local_keymap)), Faccessible_keymaps (get_keymap (global_keymap))); else @@ -1182,7 +1184,7 @@ indirect definition itself.") found = Qnil; - for (; !NULL (maps); maps = Fcdr (maps)) + for (; !NILP (maps); maps = Fcdr (maps)) { register this = Fcar (Fcar (maps)); /* Key sequence to reach map */ register map = Fcdr (Fcar (maps)); /* The map that it reaches */ @@ -1245,7 +1247,7 @@ indirect definition itself.") break; /* Search through indirections unless that's not wanted. */ - if (NULL (noindirect)) + if (NILP (noindirect)) binding = get_keyelt (binding); /* End this iteration if this element does not match @@ -1255,7 +1257,7 @@ indirect definition itself.") { Lisp_Object tem; tem = Fequal (binding, definition); - if (NULL (tem)) + if (NILP (tem)) continue; } else @@ -1281,16 +1283,16 @@ indirect definition itself.") Either nil or number as value from Flookup_key means undefined. */ - if (!NULL (local_keymap)) + if (!NILP (local_keymap)) { binding = Flookup_key (local_keymap, sequence); - if (!NULL (binding) && XTYPE (binding) != Lisp_Int) + if (!NILP (binding) && XTYPE (binding) != Lisp_Int) { if (XTYPE (definition) == Lisp_Cons) { Lisp_Object tem; tem = Fequal (binding, definition); - if (NULL (tem)) + if (NILP (tem)) continue; } else @@ -1301,7 +1303,7 @@ indirect definition itself.") /* It is a true unshadowed match. Record it. */ - if (!NULL (firstonly)) + if (!NILP (firstonly)) return sequence; found = Fcons (sequence, found); } @@ -1392,7 +1394,7 @@ describe_buffer_bindings (descbuf) } start1 = XBUFFER (descbuf)->keymap; - if (!NULL (start1)) + if (!NILP (start1)) { insert_string ("Local Bindings:\n"); insert_string (heading); @@ -1428,13 +1430,13 @@ describe_map_tree (startmap, partial, shadow) maps = Faccessible_keymaps (startmap); GCPRO1 (maps); - for (; !NULL (maps); maps = Fcdr (maps)) + for (; !NILP (maps); maps = Fcdr (maps)) { elt = Fcar (maps); sh = Fcar (elt); /* If there is no shadow keymap given, don't shadow. */ - if (NULL (shadow)) + if (NILP (shadow)) sh = Qnil; /* If the sequence by which we reach this keymap is zero-length, @@ -1460,7 +1462,7 @@ describe_map_tree (startmap, partial, shadow) show through), describe the map. Otherwise, sh is a command that completely shadows the current map, and we shouldn't bother. */ - if (NULL (sh) || !NULL (Fkeymapp (sh))) + if (NILP (sh) || !NILP (Fkeymapp (sh))) describe_map (Fcdr (elt), Fcar (elt), partial, sh); } @@ -1484,7 +1486,7 @@ describe_command (definition) else { tem1 = Fkeymapp (definition); - if (!NULL (tem1)) + if (!NILP (tem1)) insert_string ("Prefix Command\n"); else insert_string ("??\n"); @@ -1503,7 +1505,7 @@ describe_map (map, keys, partial, shadow) { register Lisp_Object keysdesc; - if (!NULL (keys) && Flength (keys) > 0) + if (!NILP (keys) && Flength (keys) > 0) keysdesc = concat2 (Fkey_description (keys), build_string (" ")); else @@ -1560,24 +1562,24 @@ describe_alist (alist, elt_prefix, elt_describer, partial, shadow) tem2 = get_keyelt (Fcdr_safe (Fcar (alist))); /* Don't show undefined commands or suppressed commands. */ - if (NULL (tem2)) continue; + if (NILP (tem2)) continue; if (XTYPE (tem2) == Lisp_Symbol && partial) { this = Fget (tem2, suppress); - if (!NULL (this)) + if (!NILP (this)) continue; } /* Don't show a command that isn't really visible because a local definition of the same key shadows it. */ - if (!NULL (shadow)) + if (!NILP (shadow)) { Lisp_Object tem; XVECTOR (kludge)->contents[0] = tem1; tem = Flookup_key (shadow, kludge); - if (!NULL (tem)) continue; + if (!NILP (tem)) continue; } if (first) @@ -1586,7 +1588,7 @@ describe_alist (alist, elt_prefix, elt_describer, partial, shadow) first = 0; } - if (!NULL (elt_prefix)) + if (!NILP (elt_prefix)) insert1 (elt_prefix); /* THIS gets the string to describe the character TEM1. */ @@ -1651,26 +1653,26 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow) QUIT; tem1 = get_keyelt (XVECTOR (vector)->contents[i]); - if (NULL (tem1)) continue; + if (NILP (tem1)) continue; /* Don't mention suppressed commands. */ if (XTYPE (tem1) == Lisp_Symbol && partial) { this = Fget (tem1, suppress); - if (!NULL (this)) + if (!NILP (this)) continue; } /* If this command in this map is shadowed by some other map, ignore it. */ - if (!NULL (shadow)) + if (!NILP (shadow)) { Lisp_Object tem; XVECTOR (kludge)->contents[0] = make_number (i); tem = Flookup_key (shadow, kludge); - if (!NULL (tem)) continue; + if (!NILP (tem)) continue; } if (first) @@ -1680,7 +1682,7 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow) } /* Output the prefix that applies to every entry in this map. */ - if (!NULL (elt_prefix)) + if (!NILP (elt_prefix)) insert1 (elt_prefix); /* Get the string to describe the character I, and print it. */ @@ -1702,7 +1704,7 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow) if (i != XINT (dummy)) { insert (" .. ", 4); - if (!NULL (elt_prefix)) + if (!NILP (elt_prefix)) insert1 (elt_prefix); XFASTINT (dummy) = i; @@ -1729,9 +1731,9 @@ apropos_accum (symbol, string) register Lisp_Object tem; tem = Fstring_match (string, Fsymbol_name (symbol), Qnil); - if (!NULL (tem) && !NULL (apropos_predicate)) + if (!NILP (tem) && !NILP (apropos_predicate)) tem = call1 (apropos_predicate, symbol); - if (!NULL (tem)) + if (!NILP (tem)) apropos_accumulate = Fcons (symbol, apropos_accumulate); } diff --git a/src/lread.c b/src/lread.c index 73d448dd716..2a8c47e9559 100644 --- a/src/lread.c +++ b/src/lread.c @@ -122,7 +122,7 @@ readchar (readcharfun) tem = call0 (readcharfun); - if (NULL (tem)) + if (NILP (tem)) return -1; return XINT (tem); } @@ -250,13 +250,13 @@ Return t if file exists.") since it would try to load a directory as a Lisp file */ if (XSTRING (str)->size > 0) { - fd = openp (Vload_path, str, !NULL (nosuffix) ? "" : ".elc:.el:", + fd = openp (Vload_path, str, !NILP (nosuffix) ? "" : ".elc:.el:", &found, 0); } if (fd < 0) { - if (NULL (noerror)) + if (NILP (noerror)) while (1) Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"), Fcons (str, Qnil))); @@ -286,7 +286,7 @@ Return t if file exists.") error ("Failure to create stdio stream for %s", XSTRING (str)->data); } - if (NULL (nomessage)) + if (NILP (nomessage)) message ("Loading %s...", XSTRING (str)->data); GCPRO1 (str); @@ -303,11 +303,11 @@ Return t if file exists.") /* Run any load-hooks for this file. */ temp = Fassoc (str, Vafter_load_alist); - if (!NULL (temp)) + if (!NILP (temp)) Fprogn (Fcdr (temp)); UNGCPRO; - if (!noninteractive && NULL (nomessage)) + if (!noninteractive && NILP (nomessage)) message ("Loading %s...done", XSTRING (str)->data); return Qt; } @@ -373,7 +373,7 @@ openp (path, str, suffix, storeptr, exec_only) if (complete_filename_p (str)) absolute = 1; - for (; !NULL (path); path = Fcdr (path)) + for (; !NILP (path); path = Fcdr (path)) { char *nsuffix; @@ -472,7 +472,7 @@ readevalloop (readcharfun, stream, evalfun, printflag) if (c < 0) break; if (c == ' ' || c == '\t' || c == '\n' || c == '\f') continue; - if (!NULL (Vpurify_flag) && c == '(') + if (!NILP (Vpurify_flag) && c == '(') { record_unwind_protect (unreadpure, Qnil); val = read_list (-1, readcharfun); @@ -513,14 +513,14 @@ point remains at the end of the last character read from the buffer.") int count = specpdl_ptr - specpdl; Lisp_Object tem; - if (NULL (printflag)) + if (NILP (printflag)) tem = Qsymbolp; else tem = printflag; specbind (Qstandard_output, tem); record_unwind_protect (save_excursion_restore, save_excursion_save ()); SET_PT (BEGV); - readevalloop (Fcurrent_buffer (), 0, Feval, !NULL (printflag)); + readevalloop (Fcurrent_buffer (), 0, Feval, !NILP (printflag)); return unbind_to (count, Qnil); } @@ -540,20 +540,20 @@ point remains at the end of the last character read from the buffer.") int count = specpdl_ptr - specpdl; Lisp_Object tem; - if (NULL (printflag)) + if (NILP (printflag)) tem = Qsymbolp; else tem = printflag; specbind (Qstandard_output, tem); - if (NULL (printflag)) + if (NILP (printflag)) record_unwind_protect (save_excursion_restore, save_excursion_save ()); record_unwind_protect (save_restriction_restore, save_restriction_save ()); /* This both uses b and checks its type. */ Fgoto_char (b); Fnarrow_to_region (make_number (BEGV), e); - readevalloop (Fcurrent_buffer (), 0, Feval, !NULL (printflag)); + readevalloop (Fcurrent_buffer (), 0, Feval, !NILP (printflag)); return unbind_to (count, Qnil); } @@ -575,7 +575,7 @@ STREAM or the value of `standard-input' may be:\n\ { extern Lisp_Object Fread_minibuffer (); - if (NULL (readcharfun)) + if (NILP (readcharfun)) readcharfun = Vstandard_input; if (EQ (readcharfun, Qt)) readcharfun = Qread_char; @@ -604,7 +604,7 @@ START and END optionally delimit a substring of STRING from which to read;\n\ CHECK_STRING (string,0); - if (NULL (end)) + if (NILP (end)) endval = XSTRING (string)->size; else { CHECK_NUMBER (end,2); @@ -613,7 +613,7 @@ START and END optionally delimit a substring of STRING from which to read;\n\ args_out_of_range (string, end); } - if (NULL (start)) + if (NILP (start)) startval = 0; else { CHECK_NUMBER (start,1); @@ -659,7 +659,7 @@ read_escape (readcharfun) switch (c) { case 'a': - return '\a'; + return '\007'; case 'b': return '\b'; case 'e': @@ -859,7 +859,7 @@ read1 (readcharfun) /* If purifying, and string starts with \ newline, return zero instead. This is for doc strings that we are really going to find in share-lib/DOC.nn.nn */ - if (!NULL (Vpurify_flag) && NULL (Vdoc_file_name) && cancel) + if (!NILP (Vpurify_flag) && NILP (Vdoc_file_name) && cancel) return make_number (0); if (read_pure) @@ -1060,7 +1060,7 @@ read_list (flag, readcharfun) if (XINT (elt) == '.') { GCPRO2 (val, tail); - if (!NULL (tail)) + if (!NILP (tail)) XCONS (tail)->cdr = read0 (readcharfun); else val = read0 (readcharfun); @@ -1075,7 +1075,7 @@ read_list (flag, readcharfun) tem = (read_pure && flag <= 0 ? pure_cons (elt, Qnil) : Fcons (elt, Qnil)); - if (!NULL (tail)) + if (!NILP (tail)) XCONS (tail)->cdr = tem; else val = tem; @@ -1120,7 +1120,7 @@ intern (str) tem = oblookup (obarray, str, len); if (XTYPE (tem) == Lisp_Symbol) return tem; - return Fintern ((!NULL (Vpurify_flag) + return Fintern ((!NILP (Vpurify_flag) ? make_pure_string (str, len) : make_string (str, len)), obarray); @@ -1136,7 +1136,7 @@ it defaults to the value of `obarray'.") { register Lisp_Object tem, sym, *ptr; - if (NULL (obarray)) obarray = Vobarray; + if (NILP (obarray)) obarray = Vobarray; obarray = check_obarray (obarray); CHECK_STRING (str, 0); @@ -1145,7 +1145,7 @@ it defaults to the value of `obarray'.") if (XTYPE (tem) != Lisp_Int) return tem; - if (!NULL (Vpurify_flag)) + if (!NILP (Vpurify_flag)) str = Fpurecopy (str); sym = Fmake_symbol (str); @@ -1167,7 +1167,7 @@ it defaults to the value of `obarray'.") { register Lisp_Object tem; - if (NULL (obarray)) obarray = Vobarray; + if (NILP (obarray)) obarray = Vobarray; obarray = check_obarray (obarray); CHECK_STRING (str, 0); @@ -1270,7 +1270,7 @@ OBARRAY defaults to the value of `obarray'.") { Lisp_Object tem; - if (NULL (obarray)) obarray = Vobarray; + if (NILP (obarray)) obarray = Vobarray; obarray = check_obarray (obarray); map_obarray (obarray, mapatoms_1, function); @@ -1452,11 +1452,11 @@ init_lread () } /* Warn if dirs in the *standard* path don't exist. */ - for (; !NULL (normal_path); normal_path = XCONS (normal_path)->cdr) + for (; !NILP (normal_path); normal_path = XCONS (normal_path)->cdr) { Lisp_Object dirfile; dirfile = Fcar (normal_path); - if (!NULL (dirfile)) + if (!NILP (dirfile)) { dirfile = Fdirectory_file_name (dirfile); if (access (XSTRING (dirfile)->data, 0) < 0) @@ -1468,7 +1468,7 @@ init_lread () if (egetenv ("EMACSLOADPATH")) Vload_path = decode_env_path ("EMACSLOADPATH", normal); #ifndef CANNOT_DUMP - if (!NULL (Vpurify_flag)) + if (!NILP (Vpurify_flag)) Vload_path = Fcons (build_string ("../lisp"), Vload_path); #endif diff --git a/src/macros.c b/src/macros.c index 5b19d926d66..f9c158c89eb 100644 --- a/src/macros.c +++ b/src/macros.c @@ -64,7 +64,7 @@ Non-nil arg (prefix arg) means append to last macro defined;\n\ error ("Already defining kbd macro"); update_mode_lines++; - if (NULL (append)) + if (NILP (append)) { kbd_macro_ptr = kbd_macro_buffer; kbd_macro_end = kbd_macro_buffer; @@ -97,7 +97,7 @@ An argument of zero means repeat until error.") if (!defining_kbd_macro) error ("Not defining kbd macro."); - if (NULL (arg)) + if (NILP (arg)) XFASTINT (arg) = 1; else CHECK_NUMBER (arg, 0); @@ -164,7 +164,7 @@ defining others, use \\[name-last-kbd-macro].") { if (defining_kbd_macro) error ("Can't execute anonymous macro while defining one"); - else if (NULL (Vlast_kbd_macro)) + else if (NILP (Vlast_kbd_macro)) error ("No kbd macro has been defined"); else Fexecute_kbd_macro (Vlast_kbd_macro, prefix); @@ -197,7 +197,7 @@ COUNT is a repeat count, or nil for once, or 0 for infinite loop.") int repeat = 1; struct gcpro gcpro1; - if (!NULL (prefixarg)) + if (!NILP (prefixarg)) prefixarg = Fprefix_numeric_value (prefixarg), repeat = XINT (prefixarg); diff --git a/src/ralloc.c b/src/ralloc.c index 1f92b51be88..d2dae3637a0 100644 --- a/src/ralloc.c +++ b/src/ralloc.c @@ -97,7 +97,7 @@ check_memory_limits (address) } if (EXCEEDS_ELISP_PTR (address)) - (*warnfunction) ("Warning: memory in use exceeds lisp pointer size"); + memory_full (); } /* Obtain SIZE bytes of space. If enough space is not presently available diff --git a/src/sunfns.c b/src/sunfns.c index 8fcf8bd507e..7c637e670f0 100644 --- a/src/sunfns.c +++ b/src/sunfns.c @@ -107,7 +107,7 @@ or -1 if can not open it.") char *cp; static int already_initialized = 0; - if ((! already_initialized) || (!NULL(force))) { + if ((! already_initialized) || (!NILP(force))) { cp = getenv("WINDOW_GFX"); if (cp != 0) win_fd = open(cp, 2); if (win_fd > 0) @@ -213,7 +213,7 @@ expressed as a string. If ICON is nil then the original arrow cursor is used") /* * If the icon is null, we just restore the DefaultCursor */ - if (NULL(Icon)) + if (NILP(Icon)) CurrentCursor = DefaultCursor; else { /* diff --git a/src/syntax.c b/src/syntax.c index f90ed5cf8f0..4f203caf8f8 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -46,7 +46,7 @@ check_syntax_table (obj) { register Lisp_Object tem; while (tem = Fsyntax_table_p (obj), - NULL (tem)) + NILP (tem)) obj = wrong_type_argument (Qsyntax_table_p, obj, 0); return obj; } @@ -79,9 +79,9 @@ It is a copy of the TABLE, which defaults to the standard syntax table.") XFASTINT (size) = 0400; XFASTINT (val) = 0; val = Fmake_vector (size, val); - if (!NULL (table)) + if (!NILP (table)) table = check_syntax_table (table); - else if (NULL (Vstandard_syntax_table)) + else if (NILP (Vstandard_syntax_table)) /* Can only be null during initialization */ return val; else table = Vstandard_syntax_table; @@ -195,7 +195,7 @@ DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3, CHECK_NUMBER (c, 0); CHECK_STRING (newentry, 1); - if (NULL (syntax_table)) + if (NILP (syntax_table)) syntax_table = current_buffer->syntax_table; else syntax_table = check_syntax_table (syntax_table); @@ -899,7 +899,7 @@ scan_sexps_forward (from, end, targetdepth, stopbefore, oldstate) immediate_quit = 1; QUIT; - if (NULL (oldstate)) + if (NILP (oldstate)) { depth = 0; state.instring = -1; @@ -908,7 +908,7 @@ scan_sexps_forward (from, end, targetdepth, stopbefore, oldstate) else { tem = Fcar (oldstate); - if (!NULL (tem)) + if (!NILP (tem)) depth = XINT (tem); else depth = 0; @@ -917,15 +917,15 @@ scan_sexps_forward (from, end, targetdepth, stopbefore, oldstate) oldstate = Fcdr (oldstate); oldstate = Fcdr (oldstate); tem = Fcar (oldstate); - state.instring = !NULL (tem) ? XINT (tem) : -1; + state.instring = !NILP (tem) ? XINT (tem) : -1; oldstate = Fcdr (oldstate); tem = Fcar (oldstate); - state.incomment = !NULL (tem); + state.incomment = !NILP (tem); oldstate = Fcdr (oldstate); tem = Fcar (oldstate); - start_quoted = !NULL (tem); + start_quoted = !NILP (tem); } state.quoted = 0; mindepth = depth; @@ -1125,7 +1125,7 @@ DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 5, 0, struct lisp_parse_state state; int target; - if (!NULL (targetdepth)) + if (!NILP (targetdepth)) { CHECK_NUMBER (targetdepth, 3); target = XINT (targetdepth); @@ -1135,7 +1135,7 @@ DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 5, 0, validate_region (&from, &to); state = *scan_sexps_forward (XINT (from), XINT (to), - target, !NULL (stopbefore), oldstate); + target, !NILP (stopbefore), oldstate); SET_PT (state.location); diff --git a/src/termhooks.h b/src/termhooks.h index d414149ca95..ff1df84059d 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -45,37 +45,30 @@ extern int (*set_terminal_window_hook) (); extern int (*read_socket_hook) (); -/* Hook for Emacs to call to tell the window-system-specific code to - enable/disable low-level tracking. The value of ENABLE tells the - window system event handler whether it should notice or ignore - subsequent mouse movement and mouse button releases. - - If this is 0, Emacs should assume that there is no mouse (or at - least no mouse tracking) available. - - If called with ENABLE non-zero, the window system event handler - should call set_pointer_loc with the new mouse co-ordinates - whenever the mouse moves, and enqueue a mouse button event for - button releases as well as button presses. - - If called with ENABLE zero, the window system event handler should - ignore mouse movement events, and not enqueue events for mouse - button releases. */ -extern int (*mouse_tracking_enable_hook) ( /* int ENABLE */ ); +/* Return the current position of the mouse. This should clear + mouse_moved until the next motion event arrives. */ +extern void (*mouse_position_hook) ( /* SCREEN_PTR *s, + Lisp_Object *x, + Lisp_Object *y, + Lisp_Object *time */ ); + +/* The window system handling code should set this if the mouse has + moved since the last call to the mouse_position_hook. Calling that + hook should clear this. */ +extern int mouse_moved; /* When a screen's focus redirection is changed, this hook tells the window system code to re-decide where to put the highlight. Under - X, this means that the system lies about where the focus is. */ + X, this means that Emacs lies about where the focus is. */ extern void (*screen_rehighlight_hook) ( /* void */ ); /* If nonzero, send all terminal output characters to this stream also. */ - extern FILE *termscript; -#ifdef XINT /* Expedient hack: only provide the below definitions to files that are prepared to handle lispy things. XINT is defined iff lisp.h - has been included in the file before this file. */ + has been included before this file. */ +#ifdef XINT /* The keyboard input buffer is an array of these structures. Each one represents some sort of input event - a keystroke, a mouse click, or @@ -93,8 +86,9 @@ struct input_event { was typed. Note that this includes meta-keys, and the modifiers field of the event - is unused. */ - + is unused. + .timestamp gives a timestamp (in + milliseconds) for the keystroke. */ non_ascii_keystroke, /* .code is a number identifying the function key. A code N represents a key whose name is @@ -104,7 +98,9 @@ struct input_event { .modifiers holds the state of the modifier keys. .screen is the screen in which the key - was typed. */ + was typed. + .timestamp gives a timestamp (in + milliseconds) for the keystroke. */ mouse_click, /* The button number is in .code. .modifiers holds the state of the modifier keys. diff --git a/src/undo.c b/src/undo.c index 2993dc77d5e..852771764f1 100644 --- a/src/undo.c +++ b/src/undo.c @@ -127,7 +127,7 @@ but another undo command will undo to the previous boundary.") if (EQ (current_buffer->undo_list, Qt)) return Qnil; tem = Fcar (current_buffer->undo_list); - if (!NULL (tem)) + if (!NILP (tem)) current_buffer->undo_list = Fcons (Qnil, current_buffer->undo_list); return Qnil; } @@ -197,7 +197,7 @@ truncate_undo_list (list, minsize, maxsize) either before or after it. The lower threshold, MINSIZE, tells us to truncate after it. If its size pushes past the higher threshold MAXSIZE as well, we truncate before it. */ - if (NULL (elt)) + if (NILP (elt)) { if (size_so_far > maxsize) break; @@ -222,11 +222,11 @@ truncate_undo_list (list, minsize, maxsize) } /* If we scanned the whole list, it is short enough; don't change it. */ - if (NULL (next)) + if (NILP (next)) return list; /* Truncate at the boundary where we decided to truncate. */ - if (!NULL (last_boundary)) + if (!NILP (last_boundary)) { XCONS (last_boundary)->cdr = Qnil; return list; @@ -249,7 +249,7 @@ Return what remains of the list.") /* If the head of the list is a boundary, it is the boundary preceding this command. Get rid of it and don't count it. */ tem = Fcar (list); - if (NULL (tem)) + if (NILP (tem)) list = Fcdr (list); #endif @@ -260,7 +260,7 @@ Return what remains of the list.") Lisp_Object next, car, cdr; next = Fcar (list); list = Fcdr (list); - if (NULL (next)) + if (NILP (next)) break; car = Fcar (next); cdr = Fcdr (next); diff --git a/src/unexaix.c b/src/unexaix.c index a1adff12ec9..b2b3dd14e45 100644 --- a/src/unexaix.c +++ b/src/unexaix.c @@ -5,8 +5,8 @@ when Emacs was dumped, the dumped data won't work. No one has been able to prevent the address from varying. - The following comments should be in etc/MACHINES if this dumping - is ever made to work: + The following comments should be in share-lib/MACHINES if this + dumping is ever made to work: Note that Emacs can store the pure Lisp data in a shared segment on this machine, but only if you put this command in one of the boot diff --git a/src/unexec.c b/src/unexec.c index ccd67451203..4d4cf20fd55 100644 --- a/src/unexec.c +++ b/src/unexec.c @@ -74,6 +74,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ * COFF Define this if your system uses COFF for executables. + +* COFF_ENCAPSULATE + +Define this if you are using the GNU coff encapsulated a.out format. +This is closer to a.out than COFF. You should *not* define COFF if +you define COFF_ENCAPSULATE + Otherwise we assume you use Berkeley format. * NO_REMAP @@ -165,7 +172,13 @@ pointer looks like an int) but not on all machines. #ifndef CANNOT_UNEXEC /* most of rest of file */ +#ifdef COFF_ENCAPSULATE +int need_coff_header = 1; +#include <coff-encap/a.out.encap.h> /* The location might be a poor assumption */ +#else #include <a.out.h> +#endif + /* Define getpagesize () if the system does not. Note that this may depend on symbols defined in a.out.h */ @@ -173,7 +186,7 @@ pointer looks like an int) but not on all machines. #ifndef makedev /* Try to detect types.h already loaded */ #include <sys/types.h> -#endif +#endif /* makedev */ #include <stdio.h> #include <sys/stat.h> #include <errno.h> @@ -218,7 +231,7 @@ static EXEC_HDR_TYPE hdr, ohdr; #else /* not HPUX */ -#if defined (USG) && !defined (IBMAIX) && !defined (IRIS) +#if defined (USG) && !defined (IBMAIX) && !defined (IRIS) && !defined (COFF_ENCAPSULATE) static struct bhdr hdr, ohdr; #define a_magic fmagic #define a_text tsize @@ -241,6 +254,11 @@ static EXEC_HDR_TYPE hdr, ohdr; static int unexec_text_start; static int unexec_data_start; +#ifdef COFF_ENCAPSULATE +/* coffheader is defined in the GNU a.out.encap.h file. */ +struct coffheader coffheader; +#endif + #endif /* not COFF */ static int pagemask; @@ -624,6 +642,16 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) /* Get symbol table info from header of a.out file if given one. */ if (a_out >= 0) { +#ifdef COFF_ENCAPSULATE + if (read (a_out, &coffheader, sizeof coffheader) != sizeof coffheader) + { + PERROR(a_name); + } + if (coffheader.f_magic != COFF_MAGIC) + { + ERROR1("%s doesn't have legal coff magic number\n", a_name); + } +#endif if (read (a_out, &ohdr, sizeof hdr) != sizeof hdr) { PERROR (a_name); @@ -637,7 +665,14 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) } else { +#ifdef COFF_ENCAPSULATE + /* We probably could without too much trouble. The code is in gld + * but I don't have that much time or incentive. + */ + ERROR0 ("can't build a COFF file from scratch yet"); +#else bzero (hdr, sizeof hdr); +#endif } unexec_text_start = (long) start_of_text (); @@ -666,6 +701,32 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) #endif /* not NO_REMAP */ +#ifdef COFF_ENCAPSULATE + /* We are encapsulating BSD format within COFF format. */ + { + struct coffscn *tp, *dp, *bp; + tp = &coffheader.scns[0]; + dp = &coffheader.scns[1]; + bp = &coffheader.scns[2]; + tp->s_size = hdr.a_text + sizeof(struct exec); + dp->s_paddr = data_start; + dp->s_vaddr = data_start; + dp->s_size = hdr.a_data; + bp->s_paddr = dp->s_vaddr + dp->s_size; + bp->s_vaddr = bp->s_paddr; + bp->s_size = hdr.a_bss; + coffheader.tsize = tp->s_size; + coffheader.dsize = dp->s_size; + coffheader.bsize = bp->s_size; + coffheader.text_start = tp->s_vaddr; + coffheader.data_start = dp->s_vaddr; + } + if (write (new, &coffheader, sizeof coffheader) != sizeof coffheader) + { + PERROR(new_name); + } +#endif /* COFF_ENCAPSULATE */ + if (write (new, &hdr, sizeof hdr) != sizeof hdr) { PERROR (new_name); diff --git a/src/window.c b/src/window.c index a6e1d9c6c31..738227726f2 100644 --- a/src/window.c +++ b/src/window.c @@ -182,7 +182,7 @@ POS defaults to point; WINDOW, to the selected window.") register struct buffer *buf; struct position posval; - if (NULL (pos)) + if (NILP (pos)) posint = point; else { @@ -190,7 +190,7 @@ POS defaults to point; WINDOW, to the selected window.") posint = XINT (pos); } - if (NULL (window)) + if (NILP (window)) window = selected_window; else CHECK_WINDOW (window, 1); @@ -232,7 +232,7 @@ static struct window * decode_window (window) register Lisp_Object window; { - if (NULL (window)) + if (NILP (window)) return XWINDOW (selected_window); CHECK_WINDOW (window, 0); @@ -433,7 +433,7 @@ which are relative to 0,0 at the top left corner of the screen.") { int part; - if (NULL (screen)) + if (NILP (screen)) XSET (screen, Lisp_Screen, selected_screen); else CHECK_LIVE_SCREEN (screen, 0); @@ -519,7 +519,7 @@ from overriding motion of point in order to display at this exact start.") set_marker_restricted (w->start, pos, w->buffer); /* this is not right, but much easier than doing what is right. */ w->start_at_line_beg = Qnil; - if (NULL (noforce)) + if (NILP (noforce)) w->force_start = Qt; w->update_mode_line = Qt; XFASTINT (w->last_modified) = 0; @@ -549,7 +549,7 @@ buffer appears in it currently).") { register struct window *w = decode_window (window); - if (NULL (arg)) + if (NILP (arg)) w->dedicated = Qnil; else { @@ -652,15 +652,15 @@ replace_window (old, replacement) p->height = o->height; p->next = tem = o->next; - if (!NULL (tem)) + if (!NILP (tem)) XWINDOW (tem)->prev = replacement; p->prev = tem = o->prev; - if (!NULL (tem)) + if (!NILP (tem)) XWINDOW (tem)->next = replacement; p->parent = tem = o->parent; - if (!NULL (tem)) + if (!NILP (tem)) { if (EQ (XWINDOW (tem)->vchild, old)) XWINDOW (tem)->vchild = replacement; @@ -682,14 +682,14 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", register struct window *p; register struct window *par; - if (NULL (window)) + if (NILP (window)) window = selected_window; else CHECK_WINDOW (window, 0); p = XWINDOW (window); parent = p->parent; - if (NULL (parent)) + if (NILP (parent)) error ("Attempt to delete minibuffer or sole ordinary window"); par = XWINDOW (parent); @@ -701,7 +701,7 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", tem = p->buffer; /* tem is null for dummy parent windows (which have inferiors but not any contents themselves) */ - if (!NULL (tem)) + if (!NILP (tem)) { unshow_buffer (p); unchain_marker (p->pointm); @@ -710,11 +710,11 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", } tem = p->next; - if (!NULL (tem)) + if (!NILP (tem)) XWINDOW (tem)->prev = p->prev; tem = p->prev; - if (!NULL (tem)) + if (!NILP (tem)) XWINDOW (tem)->next = p->next; if (EQ (window, par->hchild)) @@ -724,7 +724,7 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", /* Find one of our siblings to give our space to. */ sib = p->prev; - if (NULL (sib)) + if (NILP (sib)) { /* If p gives its space to its next sibling, that sibling needs to have its top/left side pulled back to where p's is. @@ -736,11 +736,11 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", } /* Stretch that sibling. */ - if (!NULL (par->vchild)) + if (!NILP (par->vchild)) set_window_height (sib, XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height), 1); - if (!NULL (par->hchild)) + if (!NILP (par->hchild)) set_window_width (sib, XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width), 1); @@ -749,9 +749,9 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", put the child into the parent's place. */ tem = par->hchild; - if (NULL (tem)) + if (NILP (tem)) tem = par->vchild; - if (NULL (XWINDOW (tem)->next)) + if (NILP (XWINDOW (tem)->next)) replace_window (parent, tem); return Qnil; } @@ -783,7 +783,7 @@ above. If neither nil nor t, restrict to WINDOW's screen.") register Lisp_Object tem; Lisp_Object start_window; - if (NULL (window)) + if (NILP (window)) window = selected_window; else CHECK_WINDOW (window, 0); @@ -792,12 +792,12 @@ above. If neither nil nor t, restrict to WINDOW's screen.") /* minibuf == nil may or may not include minibuffers. Decide if it does. */ - if (NULL (minibuf)) + if (NILP (minibuf)) minibuf = (minibuf_level ? Qt : Qlambda); /* all_screens == nil doesn't specify which screens to include. Decide which screens it includes. */ - if (NULL (all_screens)) + if (NILP (all_screens)) all_screens = (EQ (minibuf, Qt) ? (SCREEN_MINIBUF_WINDOW (XSCREEN @@ -813,8 +813,8 @@ above. If neither nil nor t, restrict to WINDOW's screen.") { /* Find a window that actually has a next one. This loop climbs up the tree. */ - while (tem = XWINDOW (window)->next, NULL (tem)) - if (tem = XWINDOW (window)->parent, !NULL (tem)) + while (tem = XWINDOW (window)->next, NILP (tem)) + if (tem = XWINDOW (window)->parent, !NILP (tem)) window = tem; else { @@ -822,7 +822,7 @@ above. If neither nil nor t, restrict to WINDOW's screen.") Which other screens are acceptable? */ tem = WINDOW_SCREEN (XWINDOW (window)); #ifdef MULTI_SCREEN - if (! NULL (all_screens)) + if (! NILP (all_screens)) tem = next_screen (tem, all_screens); #endif tem = SCREEN_ROOT_WINDOW (XSCREEN (tem)); @@ -836,9 +836,9 @@ above. If neither nil nor t, restrict to WINDOW's screen.") recurse on that. Otherwise, we've found the window we want. */ while (1) { - if (!NULL (XWINDOW (window)->hchild)) + if (!NILP (XWINDOW (window)->hchild)) window = XWINDOW (window)->hchild; - else if (!NULL (XWINDOW (window)->vchild)) + else if (!NILP (XWINDOW (window)->vchild)) window = XWINDOW (window)->vchild; else break; } @@ -880,7 +880,7 @@ above. If neither nil nor t, restrict to WINDOW's screen.") register Lisp_Object tem; Lisp_Object start_window; - if (NULL (window)) + if (NILP (window)) window = selected_window; else CHECK_WINDOW (window, 0); @@ -889,12 +889,12 @@ above. If neither nil nor t, restrict to WINDOW's screen.") /* minibuf == nil may or may not include minibuffers. Decide if it does. */ - if (NULL (minibuf)) + if (NILP (minibuf)) minibuf = (minibuf_level ? Qt : Qlambda); /* all_screens == nil doesn't specify which screens to include. Decide which screens it includes. */ - if (NULL (all_screens)) + if (NILP (all_screens)) all_screens = (EQ (minibuf, Qt) ? (SCREEN_MINIBUF_WINDOW (XSCREEN @@ -910,8 +910,8 @@ above. If neither nil nor t, restrict to WINDOW's screen.") { /* Find a window that actually has a previous one. This loop climbs up the tree. */ - while (tem = XWINDOW (window)->prev, NULL (tem)) - if (tem = XWINDOW (window)->parent, !NULL (tem)) + while (tem = XWINDOW (window)->prev, NILP (tem)) + if (tem = XWINDOW (window)->parent, !NILP (tem)) window = tem; else { @@ -919,7 +919,7 @@ above. If neither nil nor t, restrict to WINDOW's screen.") Which screens are acceptable? */ tem = WINDOW_SCREEN (XWINDOW (window)); #ifdef MULTI_SCREEN - if (! NULL (all_screens)) + if (! NILP (all_screens)) tem = next_screen (tem, all_screens); #endif tem = SCREEN_ROOT_WINDOW (XSCREEN (tem)); @@ -932,12 +932,12 @@ above. If neither nil nor t, restrict to WINDOW's screen.") recurse on that. Otherwise, we've found the window we want. */ while (1) { - if (!NULL (XWINDOW (window)->hchild)) + if (!NILP (XWINDOW (window)->hchild)) window = XWINDOW (window)->hchild; - else if (!NULL (XWINDOW (window)->vchild)) + else if (!NILP (XWINDOW (window)->vchild)) window = XWINDOW (window)->vchild; else break; - while (tem = XWINDOW (window)->next, !NULL (tem)) + while (tem = XWINDOW (window)->next, !NILP (tem)) window = tem; } } @@ -1018,7 +1018,7 @@ window_loop (type, obj, mini, screens) on all screens, screen is 0. */ if (SCREENP (screens)) screen = XSCREEN (screens); - else if (NULL (screens)) + else if (NILP (screens)) screen = selected_screen; else screen = 0; @@ -1063,7 +1063,7 @@ window_loop (type, obj, mini, screens) case GET_LRU_WINDOW: /* t as arg means consider only full-width windows */ - if (!NULL (obj) && XFASTINT (XWINDOW (w)->width) != screen->width) + if (!NILP (obj) && XFASTINT (XWINDOW (w)->width) != screen->width) break; #if 0 /* Ignore invisible and iconified screens. */ @@ -1073,9 +1073,9 @@ window_loop (type, obj, mini, screens) #endif /* Ignore dedicated windows and minibuffers. */ if (MINI_WINDOW_P (XWINDOW (w)) - || !NULL (XWINDOW (w)->dedicated)) + || !NILP (XWINDOW (w)->dedicated)) break; - if (NULL (best_window) + if (NILP (best_window) || (XFASTINT (XWINDOW (best_window)->use_time) > XFASTINT (XWINDOW (w)->use_time))) best_window = w; @@ -1091,10 +1091,10 @@ window_loop (type, obj, mini, screens) { /* If we're deleting the buffer displayed in the only window on the screen, find a new buffer to display there. */ - if (NULL (XWINDOW (w)->parent)) + if (NILP (XWINDOW (w)->parent)) { Lisp_Object new_buffer = Fother_buffer (obj); - if (NULL (new_buffer)) + if (NILP (new_buffer)) new_buffer = Fget_buffer_create (build_string ("*scratch*")); Fset_window_buffer (w, new_buffer); @@ -1114,12 +1114,12 @@ window_loop (type, obj, mini, screens) #endif /* Ignore dedicated windows and minibuffers. */ if (MINI_WINDOW_P (XWINDOW (w)) - || !NULL (XWINDOW (w)->dedicated)) + || !NILP (XWINDOW (w)->dedicated)) break; { struct window *best_window_ptr = XWINDOW (best_window); struct window *w_ptr = XWINDOW (w); - if (NULL (best_window) || + if (NILP (best_window) || (XFASTINT (w_ptr->height) * XFASTINT (w_ptr->width)) > (XFASTINT (best_window_ptr->height) * XFASTINT (best_window_ptr->width))) @@ -1132,7 +1132,7 @@ window_loop (type, obj, mini, screens) { /* Find another buffer to show in this window. */ Lisp_Object another_buffer = Fother_buffer (obj); - if (NULL (another_buffer)) + if (NILP (another_buffer)) another_buffer = Fget_buffer_create (build_string ("*scratch*")); Fset_window_buffer (w, another_buffer); @@ -1158,7 +1158,7 @@ screen, search only that screen.\n") register Lisp_Object w; /* First try for a window that is full-width */ w = window_loop (GET_LRU_WINDOW, Qt, 0, screens); - if (!NULL (w) && !EQ (w, selected_window)) + if (!NILP (w) && !EQ (w, selected_window)) return w; /* If none of them, try the rest */ return window_loop (GET_LRU_WINDOW, Qnil, 0, screens); @@ -1201,7 +1201,7 @@ Only the screen WINDOW is on is affected.") struct buffer *obuf = current_buffer; int top; - if (NULL (window)) + if (NILP (window)) window = selected_window; else CHECK_WINDOW (window, 0); @@ -1226,7 +1226,7 @@ DEFUN ("delete-windows-on", Fdelete_windows_on, Sdelete_windows_on, (buffer) Lisp_Object buffer; { - if (!NULL (buffer)) + if (!NILP (buffer)) { buffer = Fget_buffer (buffer); CHECK_BUFFER (buffer, 0); @@ -1242,7 +1242,7 @@ DEFUN ("replace-buffer-in-windows", Freplace_buffer_in_windows, (buffer) Lisp_Object buffer; { - if (!NULL (buffer)) + if (!NILP (buffer)) { buffer = Fget_buffer (buffer); CHECK_BUFFER (buffer, 0); @@ -1268,7 +1268,7 @@ set_window_height (window, height, nodelete) Lisp_Object child; if (!nodelete - && ! NULL (w->parent) + && ! NILP (w->parent) && height < window_min_height) { Fdelete_window (window); @@ -1278,19 +1278,19 @@ set_window_height (window, height, nodelete) XFASTINT (w->last_modified) = 0; windows_or_buffers_changed++; XFASTINT (w->height) = height; - if (!NULL (w->hchild)) + if (!NILP (w->hchild)) { - for (child = w->hchild; !NULL (child); child = XWINDOW (child)->next) + for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next) { XWINDOW (child)->top = w->top; set_window_height (child, height, nodelete); } } - else if (!NULL (w->vchild)) + else if (!NILP (w->vchild)) { lastbot = top = XFASTINT (w->top); lastobot = 0; - for (child = w->vchild; !NULL (child); child = c->next) + for (child = w->vchild; !NILP (child); child = c->next) { c = XWINDOW (child); @@ -1310,7 +1310,7 @@ set_window_height (window, height, nodelete) } /* Now delete any children that became too small. */ if (!nodelete) - for (child = w->vchild; !NULL (child); child = XWINDOW (child)->next) + for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next) { set_window_height (child, XINT (XWINDOW (child)->height), 0); } @@ -1339,19 +1339,19 @@ set_window_width (window, width, nodelete) XFASTINT (w->last_modified) = 0; windows_or_buffers_changed++; XFASTINT (w->width) = width; - if (!NULL (w->vchild)) + if (!NILP (w->vchild)) { - for (child = w->vchild; !NULL (child); child = XWINDOW (child)->next) + for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next) { XWINDOW (child)->left = w->left; set_window_width (child, width, nodelete); } } - else if (!NULL (w->hchild)) + else if (!NILP (w->hchild)) { lastright = left = XFASTINT (w->left); lastoright = 0; - for (child = w->hchild; !NULL (child); child = c->next) + for (child = w->hchild; !NILP (child); child = c->next) { c = XWINDOW (child); @@ -1370,7 +1370,7 @@ set_window_width (window, width, nodelete) } /* Delete children that became too small */ if (!nodelete) - for (child = w->hchild; !NULL (child); child = XWINDOW (child)->next) + for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next) { set_window_width (child, XINT (XWINDOW (child)->width), 0); } @@ -1391,16 +1391,16 @@ BUFFER can be a buffer or buffer name.") buffer = Fget_buffer (buffer); CHECK_BUFFER (buffer, 1); - if (NULL (XBUFFER (buffer)->name)) + if (NILP (XBUFFER (buffer)->name)) error ("Attempt to display deleted buffer"); tem = w->buffer; - if (NULL (tem)) + if (NILP (tem)) error ("Window is deleted"); else if (! EQ (tem, Qt)) /* w->buffer is t when the window is first being set up. */ { - if (!NULL (w->dedicated) && !EQ (tem, buffer)) + if (!NILP (w->dedicated) && !EQ (tem, buffer)) error ("Window is dedicated to %s\n", tem); unshow_buffer (w); @@ -1436,7 +1436,7 @@ before each command.") w = XWINDOW (window); - if (NULL (w->buffer)) + if (NILP (w->buffer)) error ("Trying to select deleted window or non-leaf window"); XFASTINT (w->use_time) = ++window_select_count; @@ -1494,16 +1494,16 @@ Returns the window displaying BUFFER.") buffer = Fget_buffer (buffer); CHECK_BUFFER (buffer, 0); - if (!NULL (Vdisplay_buffer_function)) + if (!NILP (Vdisplay_buffer_function)) return call2 (Vdisplay_buffer_function, buffer, not_this_window); - if (NULL (not_this_window) + if (NILP (not_this_window) && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer)) return selected_window; window = Fget_buffer_window (buffer, Qnil); - if (!NULL (window) - && (NULL (not_this_window) || !EQ (window, selected_window))) + if (!NILP (window) + && (NILP (not_this_window) || !EQ (window, selected_window))) return window; #ifdef MULTI_SCREEN @@ -1539,7 +1539,7 @@ Returns the window displaying BUFFER.") window = Fget_largest_window (screens); - if (!NULL (window) + if (!NILP (window) && window_height (window) >= split_height_threshold && (XFASTINT (XWINDOW (window)->width) @@ -1637,16 +1637,16 @@ and put SIZE columns in the first of the pair.") register struct window *o, *p; register int size; - if (NULL (window)) + if (NILP (window)) window = selected_window; else CHECK_WINDOW (window, 0); o = XWINDOW (window); - if (NULL (chsize)) + if (NILP (chsize)) { - if (!NULL (horflag)) + if (!NILP (horflag)) /* Round odd size up, since this is for the left-hand window, and it will lose a column for the separators. */ size = ((XFASTINT (o->width) + 1) & -2) >> 1; @@ -1670,13 +1670,13 @@ and put SIZE columns in the first of the pair.") if (window_min_height < 2) window_min_height = 2; - if (NULL (horflag)) + if (NILP (horflag)) { if (size < window_min_height || size + window_min_height > XFASTINT (o->height)) args_out_of_range_3 (window, chsize, horflag); - if (NULL (o->parent) - || NULL (XWINDOW (o->parent)->vchild)) + if (NILP (o->parent) + || NILP (XWINDOW (o->parent)->vchild)) { make_dummy_parent (window); new = o->parent; @@ -1688,8 +1688,8 @@ and put SIZE columns in the first of the pair.") if (size < window_min_width || size + window_min_width > XFASTINT (o->width)) args_out_of_range_3 (window, chsize, horflag); - if (NULL (o->parent) - || NULL (XWINDOW (o->parent)->hchild)) + if (NILP (o->parent) + || NILP (XWINDOW (o->parent)->hchild)) { make_dummy_parent (window); new = o->parent; @@ -1707,7 +1707,7 @@ and put SIZE columns in the first of the pair.") p->screen = o->screen; p->next = o->next; - if (!NULL (p->next)) + if (!NILP (p->next)) XWINDOW (p->next)->prev = new; p->prev = window; o->next = new; @@ -1718,7 +1718,7 @@ and put SIZE columns in the first of the pair.") /* Apportion the available screen space among the two new windows */ - if (!NULL (horflag)) + if (!NILP (horflag)) { p->height = o->height; p->top = o->top; @@ -1745,7 +1745,7 @@ From program, optional second arg non-nil means grow sideways ARG columns.") register Lisp_Object n, side; { CHECK_NUMBER (n, 0); - change_window_height (XINT (n), !NULL (side)); + change_window_height (XINT (n), !NILP (side)); return Qnil; } @@ -1756,7 +1756,7 @@ From program, optional second arg non-nil means shrink sideways ARG columns.") register Lisp_Object n, side; { CHECK_NUMBER (n, 0); - change_window_height (-XINT (n), !NULL (side)); + change_window_height (-XINT (n), !NILP (side)); return Qnil; } @@ -1813,14 +1813,14 @@ change_window_height (delta, widthflag) { p = XWINDOW (window); parent = p->parent; - if (NULL (parent)) + if (NILP (parent)) { if (widthflag) error ("No other window to side of this one"); break; } - if (widthflag ? !NULL (XWINDOW (parent)->hchild) - : !NULL (XWINDOW (parent)->vchild)) + if (widthflag ? !NILP (XWINDOW (parent)->hchild) + : !NILP (XWINDOW (parent)->vchild)) break; window = parent; } @@ -1828,7 +1828,7 @@ change_window_height (delta, widthflag) sizep = &CURSIZE (p); if (*sizep + delta < MINSIZE (p) - && !NULL (XWINDOW (window)->parent)) + && !NILP (XWINDOW (window)->parent)) { Fdelete_window (window); return; @@ -1837,9 +1837,9 @@ change_window_height (delta, widthflag) { register int maxdelta; - maxdelta = (!NULL (parent) ? (*sizefun) (parent) - *sizep - : !NULL (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next) - : !NULL (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev) + maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep + : !NILP (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next) + : !NILP (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev) /* This is a screen with only one window, a minibuffer-only or a minibufferless screen. */ : (delta = 0)); @@ -1854,7 +1854,7 @@ change_window_height (delta, widthflag) return; } - if (!NULL (p->next) && + if (!NILP (p->next) && (*sizefun) (p->next) - delta >= MINSIZE (p->next)) { (*setsizefun) (p->next, (*sizefun) (p->next) - delta, 0); @@ -1864,7 +1864,7 @@ change_window_height (delta, widthflag) but it propagates the new top edge to its children */ (*setsizefun) (p->next, (*sizefun) (p->next), 0); } - else if (!NULL (p->prev) && + else if (!NILP (p->prev) && (*sizefun) (p->prev) - delta >= MINSIZE (p->prev)) { (*setsizefun) (p->prev, (*sizefun) (p->prev) - delta, 0); @@ -1919,8 +1919,8 @@ window_internal_height (w) if (MINI_WINDOW_P (w)) return ht; - if (!NULL (w->parent) || !NULL (w->vchild) || !NULL (w->hchild) - || !NULL (w->next) || !NULL (w->prev) + if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild) + || !NILP (w->next) || !NILP (w->prev) || SCREEN_WANTS_MODELINE_P (XSCREEN (WINDOW_SCREEN (w)))) return ht - 1; @@ -1945,7 +1945,7 @@ window_scroll (window, n) XFASTINT (tem) = point; tem = Fpos_visible_in_window_p (tem, window); - if (NULL (tem)) + if (NILP (tem)) { Fvertical_motion (make_number (- ht / 2)); XFASTINT (tem) = point; @@ -2012,7 +2012,7 @@ scroll_command (n, direction) - next_screen_context_lines); defalt = direction * (defalt < 1 ? 1 : defalt); - if (NULL (n)) + if (NILP (n)) window_scroll (selected_window, defalt); else if (EQ (n, Qminus)) window_scroll (selected_window, - defalt); @@ -2066,13 +2066,13 @@ showing that buffer, popping the buffer up if necessary.") register int count = specpdl_ptr - specpdl; if (MINI_WINDOW_P (XWINDOW (selected_window)) - && !NULL (Vminibuf_scroll_window)) + && !NILP (Vminibuf_scroll_window)) window = Vminibuf_scroll_window; /* If buffer is specified, scroll that buffer. */ - else if (!NULL (Vother_window_scroll_buffer)) + else if (!NILP (Vother_window_scroll_buffer)) { window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); - if (NULL (window)) + if (NILP (window)) window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt); } else @@ -2092,7 +2092,7 @@ showing that buffer, popping the buffer up if necessary.") Fset_buffer (w->buffer); SET_PT (marker_position (w->pointm)); - if (NULL (n)) + if (NILP (n)) window_scroll (window, ht - next_screen_context_lines); else if (EQ (n, Qminus)) window_scroll (window, next_screen_context_lines - ht); @@ -2117,7 +2117,7 @@ Default for ARG is window width minus 2.") register Lisp_Object arg; { - if (NULL (arg)) + if (NILP (arg)) XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2; else arg = Fprefix_numeric_value (arg); @@ -2134,7 +2134,7 @@ Default for ARG is window width minus 2.") (arg) register Lisp_Object arg; { - if (NULL (arg)) + if (NILP (arg)) XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2; else arg = Fprefix_numeric_value (arg); @@ -2158,7 +2158,7 @@ redraws with point in the center.") register int ht = window_internal_height (w); register int opoint = point; - if (NULL (n)) + if (NILP (n)) { extern int screen_garbaged; @@ -2203,7 +2203,7 @@ negative means relative to bottom of window.") register int height = window_internal_height (w); register int start; - if (NULL (arg)) + if (NILP (arg)) XFASTINT (arg) = height / 2; else { @@ -2310,7 +2310,7 @@ by `current-window-configuration' (which see).") windows_or_buffers_changed++; new_current_buffer = data->current_buffer; - if (NULL (XBUFFER (new_current_buffer)->name)) + if (NILP (XBUFFER (new_current_buffer)->name)) new_current_buffer = Qnil; /* Mark all windows now on screen as "deleted". @@ -2328,12 +2328,12 @@ by `current-window-configuration' (which see).") w = XWINDOW (p->window); w->next = Qnil; - if (!NULL (p->parent)) + if (!NILP (p->parent)) w->parent = SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window; else w->parent = Qnil; - if (!NULL (p->prev)) + if (!NILP (p->prev)) { w->prev = SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window; #ifdef MULTI_SCREEN @@ -2347,7 +2347,7 @@ by `current-window-configuration' (which see).") else { w->prev = Qnil; - if (!NULL (w->parent)) + if (!NILP (w->parent)) { if (EQ (p->width, XWINDOW (w->parent)->width)) { @@ -2370,11 +2370,11 @@ by `current-window-configuration' (which see).") XFASTINT (w->last_modified) = 0; /* Reinstall the saved buffer and pointers into it. */ - if (NULL (p->buffer)) + if (NILP (p->buffer)) w->buffer = p->buffer; else { - if (!NULL (XBUFFER (p->buffer)->name)) + if (!NILP (XBUFFER (p->buffer)->name)) /* If saved buffer is alive, install it. */ { w->buffer = p->buffer; @@ -2388,7 +2388,7 @@ by `current-window-configuration' (which see).") XBUFFER (p->buffer) == current_buffer) Fgoto_char (w->pointm); } - else if (NULL (XBUFFER (w->buffer)->name)) + else if (NILP (XBUFFER (w->buffer)->name)) /* Else if window's old buffer is dead too, get a live one. */ { w->buffer = Fcdr (Fcar (Vbuffer_alist)); @@ -2423,7 +2423,7 @@ by `current-window-configuration' (which see).") if (s == selected_screen) { Fselect_window (data->current_window); - if (!NULL (new_current_buffer)) + if (!NILP (new_current_buffer)) Fset_buffer (new_current_buffer); else Fset_buffer (XWINDOW (selected_window)->buffer); @@ -2442,11 +2442,11 @@ delete_all_subwindows (w) { register int count = 1; w->buffer = Qnil; - if (!NULL (w->next)) + if (!NILP (w->next)) delete_all_subwindows (XWINDOW (w->next)); - if (!NULL (w->vchild)) + if (!NILP (w->vchild)) delete_all_subwindows (XWINDOW (w->vchild)); - if (!NULL (w->hchild)) + if (!NILP (w->hchild)) delete_all_subwindows (XWINDOW (w->hchild)); } @@ -2455,11 +2455,11 @@ count_windows (window) register struct window *window; { register int count = 1; - if (!NULL (window->next)) + if (!NILP (window->next)) count += count_windows (XWINDOW (window->next)); - if (!NULL (window->vchild)) + if (!NILP (window->vchild)) count += count_windows (XWINDOW (window->vchild)); - if (!NULL (window->hchild)) + if (!NILP (window->hchild)) count += count_windows (XWINDOW (window->hchild)); return count; } @@ -2474,7 +2474,7 @@ save_window_save (window, vector, i) register struct window *w; register Lisp_Object tem; - for (;!NULL (window); window = w->next) + for (;!NILP (window); window = w->next) { p = SAVED_WINDOW_N (vector, i); w = XWINDOW (window); @@ -2488,7 +2488,7 @@ save_window_save (window, vector, i) p->height = w->height; p->hscroll = w->hscroll; p->display_table = w->display_table; - if (!NULL (w->buffer)) + if (!NILP (w->buffer)) { /* Save w's value of point in the window configuration. If w is the selected window, then get the value of point @@ -2516,19 +2516,19 @@ save_window_save (window, vector, i) p->start_at_line_beg = Qnil; } - if (NULL (w->parent)) + if (NILP (w->parent)) p->parent = Qnil; else p->parent = XWINDOW (w->parent)->temslot; - if (NULL (w->prev)) + if (NILP (w->prev)) p->prev = Qnil; else p->prev = XWINDOW (w->prev)->temslot; - if (!NULL (w->vchild)) + if (!NILP (w->vchild)) i = save_window_save (w->vchild, vector, i); - if (!NULL (w->hchild)) + if (!NILP (w->hchild)) i = save_window_save (w->hchild, vector, i); } @@ -2552,7 +2552,7 @@ its value is -not- saved.") register int i; SCREEN_PTR s; - if (NULL (screen)) + if (NILP (screen)) s = selected_screen; else { diff --git a/src/xdisp.c b/src/xdisp.c index 66f213ddf1c..86be201caf7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -221,18 +221,20 @@ message (m, a1, a2, a3) Fmake_screen_visible (WINDOW_SCREEN (XWINDOW (minibuf_window))); #endif + { #ifdef NO_ARG_ARRAY - int a[3]; - a[0] = a1; - a[1] = a2; - a[2] = a3; + int a[3]; + a[0] = a1; + a[1] = a2; + a[2] = a3; - doprnt (SCREEN_MESSAGE_BUF (selected_screen), - SCREEN_WIDTH (selected_screen), m, 0, 3, a); + doprnt (SCREEN_MESSAGE_BUF (selected_screen), + SCREEN_WIDTH (selected_screen), m, 0, 3, a); #else - doprnt (SCREEN_MESSAGE_BUF (selected_screen), - SCREEN_WIDTH (selected_screen), m, 0, 3, &a1); + doprnt (SCREEN_MESSAGE_BUF (selected_screen), + SCREEN_WIDTH (selected_screen), m, 0, 3, &a1); #endif /* NO_ARG_ARRAY */ + } echo_area_glyphs = SCREEN_MESSAGE_BUF (selected_screen); @@ -391,12 +393,12 @@ redisplay () tlbufpos = this_line_bufpos; tlendpos = this_line_endpos; - if (!all_windows && tlbufpos > 0 && NULL (w->update_mode_line) + if (!all_windows && tlbufpos > 0 && NILP (w->update_mode_line) && SCREEN_VISIBLE_P (XSCREEN (w->screen)) /* Make sure recorded data applies to current buffer, etc */ && this_line_buffer == current_buffer && current_buffer == XBUFFER (w->buffer) - && NULL (w->force_start) + && NILP (w->force_start) /* Point must be on the line that we have info recorded about */ && point >= tlbufpos && point <= Z - tlendpos @@ -557,7 +559,7 @@ update: if (pause) { this_line_bufpos = 0; - if (!NULL (last_arrow_position)) + if (!NILP (last_arrow_position)) { last_arrow_position = Qt; last_arrow_string = Qt; @@ -643,11 +645,11 @@ mark_window_display_accurate (window, flag) { register struct window *w; - for (;!NULL (window); window = w->next) + for (;!NILP (window); window = w->next) { w = XWINDOW (window); - if (!NULL (w->buffer)) + if (!NILP (w->buffer)) XFASTINT (w->last_modified) = !flag ? 0 : XBUFFER (w->buffer) == current_buffer @@ -655,9 +657,9 @@ mark_window_display_accurate (window, flag) w->window_end_valid = Qt; w->update_mode_line = Qnil; - if (!NULL (w->vchild)) + if (!NILP (w->vchild)) mark_window_display_accurate (w->vchild, flag); - if (!NULL (w->hchild)) + if (!NILP (w->hchild)) mark_window_display_accurate (w->hchild, flag); } @@ -680,7 +682,7 @@ static void redisplay_windows (window) Lisp_Object window; { - for (; !NULL (window); window = XWINDOW (window)->next) + for (; !NILP (window); window = XWINDOW (window)->next) redisplay_window (window, 0); } @@ -708,17 +710,17 @@ redisplay_window (window, just_this_one) /* If this is a combination window, do its children; that's all. */ - if (!NULL (w->vchild)) + if (!NILP (w->vchild)) { redisplay_windows (w->vchild); return; } - if (!NULL (w->hchild)) + if (!NILP (w->hchild)) { redisplay_windows (w->hchild); return; } - if (NULL (w->buffer)) + if (NILP (w->buffer)) abort (); height = window_internal_height (w); @@ -770,12 +772,12 @@ redisplay_window (window, just_this_one) SET_PT (marker_position (w->pointm)); if (point < BEGV) { - point = BEGV; + SET_PT (BEGV); Fset_marker (w->pointm, make_number (point), Qnil); } else if (point > (ZV - 1)) { - point = ZV; + SET_PT (ZV); Fset_marker (w->pointm, make_number (point), Qnil); } } @@ -788,7 +790,7 @@ redisplay_window (window, just_this_one) /* Handle case where place to start displaying has been specified, unless the specified location is outside the visible range. */ - if (!NULL (w->force_start)) + if (!NILP (w->force_start)) { w->update_mode_line = Qt; w->force_start = Qnil; @@ -862,7 +864,7 @@ redisplay_window (window, just_this_one) } /* If current starting point was originally the beginning of a line but no longer is, find a new starting point. */ - else if (!NULL (w->start_at_line_beg) + else if (!NILP (w->start_at_line_beg) && !(startp == BEGV || FETCH_CHAR (startp - 1) == '\n')) { @@ -943,7 +945,7 @@ recenter: done: /* If window not full width, must redo its mode line if the window to its side is being redone */ - if ((!NULL (w->update_mode_line) + if ((!NILP (w->update_mode_line) || (!just_this_one && width < SCREEN_WIDTH (s) - 1)) && height != XFASTINT (w->height)) display_mode_line (w); @@ -1432,7 +1434,7 @@ display_text_line (w, start, vpos, hpos, taboffset) register GLYPH *p1prev; SCREEN_PTR s = XSCREEN (w->screen); int tab_width = XINT (current_buffer->tab_width); - int ctl_arrow = !NULL (current_buffer->ctl_arrow); + int ctl_arrow = !NILP (current_buffer->ctl_arrow); int width = XFASTINT (w->width) - 1 - (XFASTINT (w->width) + XFASTINT (w->left) != SCREEN_WIDTH (s)); struct position val; @@ -1442,13 +1444,13 @@ display_text_line (w, start, vpos, hpos, taboffset) int truncate = hscroll || (truncate_partial_width_windows && XFASTINT (w->width) < SCREEN_WIDTH (s)) - || !NULL (current_buffer->truncate_lines); + || !NILP (current_buffer->truncate_lines); int selective = XTYPE (current_buffer->selective_display) == Lisp_Int ? XINT (current_buffer->selective_display) - : !NULL (current_buffer->selective_display) ? -1 : 0; + : !NILP (current_buffer->selective_display) ? -1 : 0; #ifndef old - int selective_e = selective && !NULL (current_buffer->selective_display_ellipses); + int selective_e = selective && !NILP (current_buffer->selective_display_ellipses); #endif register struct screen_glyphs *desired_glyphs = SCREEN_DESIRED_GLYPHS (s); register struct Lisp_Vector *dp = window_display_table (w); @@ -1768,7 +1770,7 @@ display_mode_line (w) if (SCREEN_IS_X (s) && ! SCREEN_MINIBUF_ONLY_P (s) && w == XWINDOW (s->selected_window) - && (NULL (Fstring_equal (XBUFFER (w->buffer)->name, s->name)))) + && (NILP (Fstring_equal (XBUFFER (w->buffer)->name, s->name)))) x_set_name (s, XBUFFER (w->buffer)->name, Qnil); #endif } @@ -1875,7 +1877,7 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt) { register Lisp_Object tem; tem = Fboundp (elt); - if (!NULL (tem)) + if (!NILP (tem)) { tem = Fsymbol_value (elt); /* If value is a string, output that string literally: @@ -1911,17 +1913,17 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt) goto invalid; /* elt is now the cdr, and we know it is a cons cell. Use its car if CAR has a non-nil value. */ - if (!NULL (tem)) + if (!NILP (tem)) { tem = Fsymbol_value (car); - if (!NULL (tem)) + if (!NILP (tem)) { elt = XCONS (elt)->car; goto tail_recurse; } } /* Symbol's value is nil (or symbol is unbound) Get the cddr of the original list and if possible find the caddr and use that. */ elt = XCONS (elt)->cdr; - if (NULL (elt)) + if (NILP (elt)) break; else if (XTYPE (elt) != Lisp_Cons) goto invalid; @@ -2015,7 +2017,7 @@ decode_mode_spec (w, c, maxwidth) case 'f': obj = current_buffer->filename; #if 0 - if (NULL (obj)) + if (NILP (obj)) return "[none]"; else if (XTYPE (obj) == Lisp_String && XSTRING (obj)->size > maxwidth) { @@ -2037,7 +2039,7 @@ decode_mode_spec (w, c, maxwidth) break; case '*': - if (!NULL (current_buffer->read_only)) + if (!NILP (current_buffer->read_only)) return "%"; if (MODIFF > current_buffer->save_modified) return "*"; @@ -2047,7 +2049,7 @@ decode_mode_spec (w, c, maxwidth) /* status of process */ #ifdef subprocesses obj = Fget_buffer_process (Fcurrent_buffer ()); - if (NULL (obj)) + if (NILP (obj)) return "no process"; obj = Fsymbol_name (Fprocess_status (obj)); break; diff --git a/src/xfns.c b/src/xfns.c index 4af2c899390..387af54197d 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -479,10 +479,10 @@ x_decode_color (arg, def) return WHITE_PIX_DEFAULT; #ifdef HAVE_X11 - if (XFASTINT (x_screen_planes) <= 2) + if (XFASTINT (x_screen_planes) == 1) return def; #else - if (DISPLAY_CELLS <= 2) + if (DISPLAY_CELLS == 1) return def; #endif @@ -956,7 +956,7 @@ x_set_icon_type (s, arg, oldval) return; BLOCK_INPUT; - if (NULL (arg)) + if (NILP (arg)) result = x_text_icon (s, 0); else result = x_bitmap_icon (s, 0); @@ -1327,14 +1327,14 @@ key of the form INSTANCE.COMPONENT.ATTRIBUTE, with class \"Emacs.CLASS\".") char *class_key; CHECK_STRING (attribute, 0); - if (!NULL (name)) + if (!NILP (name)) CHECK_STRING (name, 1); - if (!NULL (class)) + if (!NILP (class)) CHECK_STRING (class, 2); - if (NULL (name) != NULL (class)) + if (NILP (name) != NILP (class)) error ("x-get-resource: must specify both NAME and CLASS or neither"); - if (NULL (name)) + if (NILP (name)) { name_key = (char *) alloca (XSTRING (invocation_name)->size + 1 + XSTRING (attribute)->size + 1); @@ -1424,7 +1424,6 @@ x_get_arg (alist, param, screen_name, attribute, type) enum resource_types type; { register Lisp_Object tem; - int i; tem = Fassq (param, alist); if (EQ (tem, Qnil)) @@ -1437,13 +1436,27 @@ x_get_arg (alist, param, screen_name, attribute, type) component name. */ if (XTYPE (screen_name) == Lisp_String) { - sterile_name = make_uninit_string (XSTRING (screen_name)->size); + int i; - for (i = 0; i < XSTRING (sterile_name)->size; i++) + sterile_name = make_uninit_string (XSTRING (screen_name)->size); + for (i = 0; i < XSTRING (screen_name)->size; i++) { int c = XSTRING (screen_name)->data[i]; - if (c == ':' || c == '.' || c == '*' || isspace (c)) - c = '_'; + + switch (c) + { + case ':': + case '.': + case '*': + case ' ': + case '\t': + case '\n': + c = '_'; + break; + default: + break; + } + XSTRING (sterile_name)->data[i] = c; } } @@ -1452,9 +1465,9 @@ x_get_arg (alist, param, screen_name, attribute, type) tem = Fx_get_resource (build_string (attribute), sterile_name, - (NULL (sterile_name) ? Qnil : screen_class)); + (NILP (sterile_name) ? Qnil : screen_class)); - if (NULL (tem)) + if (NILP (tem)) return Qnil; switch (type) @@ -1677,7 +1690,7 @@ x_window (s) screen_visual, /* set in Fx_open_connection */ attribute_mask, &attributes); - class_hints.res_name = s->name; + class_hints.res_name = (char *) XSTRING (s->name)->data; class_hints.res_class = EMACS_CLASS; XSetClassHint (x_current_display, s->display.x->window_desc, &class_hints); @@ -1823,13 +1836,13 @@ x_make_gc (s) DEFUN ("x-create-screen", Fx_create_screen, Sx_create_screen, 1, 1, 0, - "Make a new X window, which is considered a \"screen\" in Emacs terms.\n\ + "Make a new X window, which is called a \"screen\" in Emacs terms.\n\ Return an Emacs screen object representing the X window.\n\ ALIST is an alist of screen parameters.\n\ The value of ``x-screen-defaults'' is an additional alist\n\ of default parameters which apply when not overridden by ALIST.\n\ If the parameters specify that the screen should not have a minibuffer,\n\ -then ``global-minibuffer-screen'' must be a screen whose minibuffer can\n\ +then ``default-minibuffer-screen'' must be a screen whose minibuffer can\n\ be shared by the new screen.") (parms) Lisp_Object parms; @@ -1846,7 +1859,7 @@ be shared by the new screen.") error ("X windows are not in use or not initialized"); name = x_get_arg (parms, intern ("name"), Qnil, "Title", string); - if (NULL (name)) + if (NILP (name)) name = build_string (x_id_name); if (XTYPE (name) != Lisp_String) error ("x-create-screen: name parameter must be a string"); @@ -1859,10 +1872,10 @@ be shared by the new screen.") s = make_minibuffer_screen (); minibuffer_only = 1; } - else if (! EQ (tem, Qnil)) - s = make_screen_without_minibuffer (tem); - else + else if (EQ (tem, Qnil) || EQ (tem, Qt)) s = make_screen (1); + else + s = make_screen_without_minibuffer (tem); /* Set the name; the functions to which we pass s expect the name to be set. */ @@ -1873,6 +1886,9 @@ be shared by the new screen.") s->display.x = (struct x_display *) xmalloc (sizeof (struct x_display)); bzero (s->display.x, sizeof (struct x_display)); + /* Note that the screen has no physical cursor right now. */ + s->phys_cursor_x = -1; + /* Extract the window parameters from the supplied values that are needed to determine window geometry. */ x_default_parameter (s, parms, "font", @@ -1882,7 +1898,7 @@ be shared by the new screen.") x_default_parameter (s, parms, "border-width", make_number (2), "BorderWidth", number); x_default_parameter (s, parms, "internal-border-width", - make_number (4), "InternalBorderWidth", number); + make_number (1), "InternalBorderWidth", number); /* Also do the stuff which must be set before the window exists. */ x_default_parameter (s, parms, "foreground-color", @@ -2066,7 +2082,7 @@ be shared by the new screen.") (XTYPE (tem) == Lisp_String ? (char *) XSTRING (tem)->data : ""), XSTRING (s->name)->data, - !NULL (hscroll), !NULL (vscroll)); + !NILP (hscroll), !NILP (vscroll)); } else { @@ -2099,10 +2115,10 @@ be shared by the new screen.") pixelwidth = (width * FONT_WIDTH (s->display.x->font) + 2 * s->display.x->internal_border_width - + (!NULL (vscroll) ? VSCROLL_WIDTH : 0)); + + (!NILP (vscroll) ? VSCROLL_WIDTH : 0)); pixelheight = (height * FONT_HEIGHT (s->display.x->font) + 2 * s->display.x->internal_border_width - + (!NULL (hscroll) ? HSCROLL_HEIGHT : 0)); + + (!NILP (hscroll) ? HSCROLL_HEIGHT : 0)); BLOCK_INPUT; s->display.x->window_desc @@ -2158,9 +2174,9 @@ be shared by the new screen.") Fmodify_screen_parameters (screen, parms); - if (!NULL (vscroll)) + if (!NILP (vscroll)) install_vertical_scrollbar (s, pixelwidth, pixelheight); - if (!NULL (hscroll)) + if (!NILP (hscroll)) install_horizontal_scrollbar (s, pixelwidth, pixelheight); /* Make the window appear on the screen and enable display. */ @@ -2178,7 +2194,7 @@ DEFUN ("focus-screen", Ffocus_screen, Sfocus_screen, 1, 1, 0, (screen) Lisp_Object screen; { - CHECK_SCREEN (screen, 0); + CHECK_LIVE_SCREEN (screen, 0); if (SCREEN_IS_X (XSCREEN (screen))) { @@ -2291,7 +2307,7 @@ x_set_horizontal_scrollbar (s, val, oldval) struct screen *s; Lisp_Object val, oldval; { - if (!NULL (val)) + if (!NILP (val)) { if (s->display.x->window_desc != 0) { @@ -2325,7 +2341,7 @@ x_set_vertical_scrollbar (s, val, oldval) struct screen *s; Lisp_Object val, oldval; { - if (!NULL (val)) + if (!NILP (val)) { if (s->display.x->window_desc != 0) { @@ -2878,7 +2894,7 @@ DEFUN ("x-pixel-width", Fx_pixel_width, Sx_pixel_width, 1, 1, 0, (screen) Lisp_Object screen; { - CHECK_SCREEN (screen, 0); + CHECK_LIVE_SCREEN (screen, 0); return make_number (XSCREEN (screen)->display.x->pixel_width); } @@ -2887,7 +2903,7 @@ DEFUN ("x-pixel-height", Fx_pixel_height, Sx_pixel_height, 1, 1, 0, (screen) Lisp_Object screen; { - CHECK_SCREEN (screen, 0); + CHECK_LIVE_SCREEN (screen, 0); return make_number (XSCREEN (screen)->display.x->pixel_height); } @@ -2929,7 +2945,7 @@ numbers X0, Y0, X1, Y1 in the cursor pixel.") { register int x0, y0, x1, y1, top, left, n_chars, n_lines; - CHECK_SCREEN (screen, 0); + CHECK_LIVE_SCREEN (screen, 0); CHECK_NUMBER (X0, 0); CHECK_NUMBER (Y0, 1); CHECK_NUMBER (X1, 2); @@ -3528,7 +3544,7 @@ DEFUN ("x-track-pointer", Fx_track_pointer, Sx_track_pointer, 1, 1, "e", int len = SCREEN_CURRENT_GLYPHS (s)->used[x_mouse_y]; int p = SCREEN_CURRENT_GLYPHS (s)->bufp[x_mouse_y]; int tab_width = XINT (b->tab_width); - int ctl_arrow_p = !NULL (b->ctl_arrow); + int ctl_arrow_p = !NILP (b->ctl_arrow); unsigned char c; int mode_line_vpos = XFASTINT (w->height) + XFASTINT (w->top) - 1; int in_mode_line = 0; @@ -3692,38 +3708,6 @@ x_draw_pixmap (s, x, y, image_data, width, height) } #endif -x_read_mouse_position (s, x, y) - struct screen *s; - int *x, *y; -{ - Window w; - int ix, iy; - int ibw = s->display.x->internal_border_width; - -#ifdef HAVE_X11 - Window root_window; - int root_x, root_y; - unsigned int keys_and_buttons; - - BLOCK_INPUT; - if (XQueryPointer (x_current_display, s->display.x->window_desc, - &root_window, &w, &root_x, &root_y, &ix, &iy, - &keys_and_buttons) == False) - { - UNBLOCK_INPUT; - error ("Pointer not on same screen as window."); - } - UNBLOCK_INPUT; -#else - BLOCK_INPUT; - XQueryMouse (s->display.x->window_desc, &ix, &iy, &w); - UNBLOCK_INPUT; -#endif /* not HAVE_X11 */ - - x_mouse_x = *x = (ix - ibw) / FONT_WIDTH (s->display.x->font); - x_mouse_y = *y = (iy - ibw) / FONT_HEIGHT (s->display.x->font); -} - #if 0 #ifdef HAVE_X11 @@ -3920,7 +3904,7 @@ the mouse event.") } } - if (!NULL (arg)) + if (!NILP (arg)) return Qnil; /* Wait till we get another mouse event. */ @@ -3990,7 +3974,7 @@ also be depressed for NEWSTRING to appear.") if (keysym == NoSymbol) error ("Keysym does not exist"); - if (NULL (modifiers)) + if (NILP (modifiers)) XRebindKeysym (x_current_display, keysym, modifier_list, 0, XSTRING (newstring)->data, XSTRING (newstring)->size); else @@ -3998,7 +3982,7 @@ also be depressed for NEWSTRING to appear.") register Lisp_Object rest, mod; register int i = 0; - for (rest = modifiers; !NULL (rest); rest = Fcdr (rest)) + for (rest = modifiers; !NILP (rest); rest = Fcdr (rest)) { if (i == 16) error ("Can't have more than 16 modifiers"); @@ -4040,7 +4024,7 @@ See the documentation of `x-rebind-key' for more information.") for (i = 0; i <= 15; strings = Fcdr (strings), i++) { item = Fcar (strings); - if (!NULL (item)) + if (!NILP (item)) { CHECK_STRING (item, 2); strsize = XSTRING (item)->size; @@ -4080,7 +4064,7 @@ This problem will be fixed in X version 11.") int i, strsize; CHECK_NUMBER (keycode, 1); - if (!NULL (shift_mask)) + if (!NILP (shift_mask)) CHECK_NUMBER (shift_mask, 2); CHECK_STRING (newstring, 3); strsize = XSTRING (newstring)->size; @@ -4089,7 +4073,7 @@ This problem will be fixed in X version 11.") keysym = ((unsigned) (XINT (keycode))) & 255; - if (NULL (shift_mask)) + if (NILP (shift_mask)) { for (i = 0; i <= 15; i++) XRebindCode (keysym, i<<11, rawstring, strsize); @@ -4123,7 +4107,7 @@ See the documentation of `x-rebind-key' for more information.") for (i = 0; i <= 15; strings = Fcdr (strings), i++) { item = Fcar (strings); - if (!NULL (item)) + if (!NILP (item)) { CHECK_STRING (item, 2); strsize = XSTRING (item)->size; diff --git a/src/xmenu.c b/src/xmenu.c index 553e5b35a7a..120af6bf94c 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -320,7 +320,7 @@ list_of_panes (vector, panes, names, items, menu) *items = (int *) xmalloc (i * sizeof (int)); *names = (char ***) xmalloc (i * sizeof (char **)); - for (i=0, tail = menu; !NULL (tail); tail = Fcdr (tail), i++) + for (i=0, tail = menu; !NILP (tail); tail = Fcdr (tail), i++) { item = Fcdr (Fcar (tail)); if (XTYPE (item) != Lisp_Cons) (void) wrong_type_argument (Qlistp, item); @@ -358,7 +358,7 @@ list_of_items (vector, names, pane) /* get list from emacs and put to vector */ *vector = (Lisp_Object *) xmalloc (i * sizeof (Lisp_Object)); *names = (char **) xmalloc (i * sizeof (char *)); - for (i=0, tail = pane; !NULL (tail); tail = Fcdr (tail), i++) + for (i=0, tail = pane; !NILP (tail); tail = Fcdr (tail), i++) { item = Fcar (tail); if (XTYPE (item) != Lisp_Cons) (void) wrong_type_argument (Qlistp, item); diff --git a/src/xrdb.c b/src/xrdb.c index 930b4d54d43..23f6b942469 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -26,13 +26,14 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <sys/param.h> #include <pwd.h> #include <sys/stat.h> +#include <sys/types.h> #ifdef emacs #include "config.h" #endif extern char *getenv (); -extern int getuid (); +extern uid_t getuid (); extern struct passwd *getpwuid (); extern struct passwd *getpwnam (); diff --git a/src/xselect.c.old b/src/xselect.c.old index 8d3e3d12fc4..81f069e341e 100644 --- a/src/xselect.c.old +++ b/src/xselect.c.old @@ -28,11 +28,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define MAX_SELECTION(dpy) (((dpy)->max_request_size << 3) - 100) #define SELECTION_LENGTH(len,format) ((len) * ((format) >> 3)) -/* The last 23 bits of the timestamp of the last mouse button event. */ -extern Time mouse_timestamp; +/* From keyboard.c. This is almost always the right timestamp for + ownership arbitration, since the last event was either the + keystroke bound to the command now running, or something else read + by that command. */ +extern unsigned long last_event_timestamp; /* t if a mouse button is depressed. */ - extern Lisp_Object Vmouse_grabbed; /* When emacs became the PRIMARY selection owner. */ @@ -113,7 +115,7 @@ This is done with the X11 selection mechanism.") if (EQ (Qnil, Vx_selection_value)) /* We are not the owner. */ { - event_time = mouse_timestamp; + event_time = last_event_timestamp; XSetSelectionOwner (x_current_display, XA_PRIMARY, selecting_window, event_time); owner_window = XGetSelectionOwner (x_current_display, XA_PRIMARY); @@ -150,7 +152,7 @@ DEFUN ("x-own-clipboard", Fx_own_clipboard, Sx_own_clipboard, if (EQ (Qnil, Vx_clipboard_value)) { - event_time = mouse_timestamp; + event_time = last_event_timestamp; XSetSelectionOwner (x_current_display, Xatom_clipboard, selecting_window, event_time); owner_window = XGetSelectionOwner (x_current_display, Xatom_clipboard); @@ -489,7 +491,7 @@ This is done with the X11 selection mechanism.") return Vx_selection_value; BLOCK_INPUT; - requestor_time = mouse_timestamp; + requestor_time = last_event_timestamp; requestor_window = selected_screen->display.x->window_desc; XConvertSelection (x_current_display, XA_PRIMARY, XA_STRING, Xatom_emacs_selection, requestor_window, requestor_time); @@ -520,7 +522,7 @@ This is done with the X11 selection mechanism.") return Vx_selection_value; BLOCK_INPUT; - requestor_time = mouse_timestamp; + requestor_time = last_event_timestamp; requestor_window = selected_screen->display.x->window_desc; XConvertSelection (x_current_display, Xatom_clipboard, XA_STRING, Xatom_clipboard_selection, diff --git a/src/xterm.c b/src/xterm.c index 079f162505c..dd07185ca23 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -30,7 +30,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef HAVE_X_WINDOWS #include "lisp.h" -#undef NULL /* On 4.3 this loses if it comes after xterm.h. */ #include <signal.h> @@ -368,6 +367,7 @@ XTreset_terminal_modes () where display update commands will take effect. This does not affect the place where the cursor-box is displayed. */ +static XTcursor_to (row, col) register int row, col; { @@ -401,8 +401,6 @@ dumpglyphs (s, left, top, gp, n, hl, font) int hl; FONT_TYPE *font; { - char buf[s->width]; - register char *cp = buf; register int len; Window window = s->display.x->window_desc; GC drawing_gc = (hl == 2 ? s->display.x->cursor_gc diff --git a/src/xterm.h b/src/xterm.h index c11f8ca713a..934a2917f34 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -158,7 +158,8 @@ extern int x_pending_input; #define BLOCK_INPUT (x_input_blocked++) /* End critical section. */ -#define UNBLOCK_INPUT (x_input_blocked--, (x_input_blocked < 0 ? abort () : 0)) +#define UNBLOCK_INPUT \ + (x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0)) #define TOTALLY_UNBLOCK_INPUT (x_input_blocked = 0) #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT |