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;
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];
}
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)
/* 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;
#define MAXPATHLEN 1024
#endif /* not MAXPATHLEN */
-#ifdef NULL
-#undef NULL
-#endif
#include "config.h"
#include "lisp.h"
#include "window.h"
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;
register struct buffer *b;
buf = Fget_buffer (name);
- if (!NULL (buf))
+ if (!NILP (buf))
return buf;
b = (struct buffer *) malloc (sizeof (struct buffer));
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,
CHECK_STRING (name, 0);
tem = Fget_buffer (name);
- if (NULL (tem))
+ if (NILP (tem))
return name;
count = 1;
sprintf (number, "<%d>", ++count);
gentemp = concat2 (name, build_string (number));
tem = Fget_buffer (gentemp);
- if (NULL (tem))
+ if (NILP (tem))
return gentemp;
}
}
(buffer)
register Lisp_Object buffer;
{
- if (NULL (buffer))
+ if (NILP (buffer))
return current_buffer->name;
CHECK_BUFFER (buffer, 0);
return XBUFFER (buffer)->name;
(buffer)
register Lisp_Object buffer;
{
- if (NULL (buffer))
+ if (NILP (buffer))
return current_buffer->filename;
CHECK_BUFFER (buffer, 0);
return XBUFFER (buffer)->filename;
register struct buffer *buf;
register Lisp_Object val;
- if (NULL (buffer))
+ if (NILP (buffer))
buf = current_buffer;
else
{
register Lisp_Object buffer;
{
register struct buffer *buf;
- if (NULL (buffer))
+ if (NILP (buffer))
buf = current_buffer;
else
{
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;
}
register Lisp_Object buffer;
{
register struct buffer *buf;
- if (NULL (buffer))
+ if (NILP (buffer))
buf = current_buffer;
else
{
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);
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;
}
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))
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*"));
}
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);
}
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;
}
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.
{
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);
}
/* 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;
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)
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);
/* 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
/* 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
{
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;
"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;
}
{
register Lisp_Object aelt, link;
- if (NULL (buf))
+ if (NILP (buf))
{
XSET (buf, Lisp_Buffer, current_buffer);
Fswitch_to_buffer (Fother_buffer (buf), Qnil);
Lisp_Object buf1;
buf1 = Fget_buffer (buf);
- if (NULL (buf1))
+ if (NILP (buf1))
nsberror (buf);
buf = buf1;
}
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;
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);
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)
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);
Fprinc (b->mode_name, Qnil);
Findent_to (col3, minspace);
- if (!NULL (b->filename))
+ if (!NILP (b->filename))
Fprinc (b->filename, Qnil);
else
{
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);
/* 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;
/* 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);
Lisp_Object fieldlist;
Lisp_Object collector;
- if (NULL (buffer))
+ if (NILP (buffer))
fieldlist = current_buffer->fieldlist;
else
{
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);
for this buffer. It is incremented for
each such event, and never otherwise
changed. */
-
};
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.
case Bgotoifnil:
op = FETCH2;
- if (NULL (POP))
+ if (NILP (POP))
{
QUIT;
pc = XSTRING (string_saved)->data + op;
case Bgotoifnonnil:
op = FETCH2;
- if (!NULL (POP))
+ if (!NILP (POP))
{
QUIT;
pc = XSTRING (string_saved)->data + op;
case Bgotoifnilelsepop:
op = FETCH2;
- if (NULL (TOP))
+ if (NILP (TOP))
{
QUIT;
pc = XSTRING (string_saved)->data + op;
case Bgotoifnonnilelsepop:
op = FETCH2;
- if (!NULL (TOP))
+ if (!NILP (TOP))
{
QUIT;
pc = XSTRING (string_saved)->data + op;
break;
case BRgotoifnil:
- if (NULL (POP))
+ if (NILP (POP))
{
QUIT;
pc += *pc - 128;
break;
case BRgotoifnonnil:
- if (!NULL (POP))
+ if (!NILP (POP))
{
QUIT;
pc += *pc - 128;
case BRgotoifnilelsepop:
op = *pc++;
- if (NULL (TOP))
+ if (NILP (TOP))
{
QUIT;
pc += op - 128;
case BRgotoifnonnilelsepop:
op = *pc++;
- if (!NULL (TOP))
+ if (!NILP (TOP))
{
QUIT;
pc += op - 128;
{
if (CONSP (v1))
v1 = XCONS (v1)->cdr;
- else if (!NULL (v1))
+ else if (!NILP (v1))
{
immediate_quit = 0;
v1 = wrong_type_argument (Qlistp, v1);
break;
case Blistp:
- TOP = CONSP (TOP) || NULL (TOP) ? Qt : Qnil;
+ TOP = CONSP (TOP) || NILP (TOP) ? Qt : Qnil;
break;
case Beq:
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;
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;
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");
}
else if (EQ (funcar, Qlambda))
{
specs = Fassq (Qinteractive, Fcdr (Fcdr (fun)));
- if (NULL (specs))
+ if (NILP (specs))
goto lose;
specs = Fcar (Fcdr (specs));
}
{
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);
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;
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
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
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');
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++)
may use XSETINT. */
XFASTINT (val) = 0;
- if (NULL (raw))
+ if (NILP (raw))
XFASTINT (val) = 1;
else if (XTYPE (raw) == Lisp_Symbol)
XSETINT (val, -1);
(n)
Lisp_Object n;
{
- if (NULL (n))
+ if (NILP (n))
XFASTINT (n) = 1;
else
CHECK_NUMBER (n, 0);
(n)
Lisp_Object n;
{
- if (NULL (n))
+ if (NILP (n))
XFASTINT (n) = 1;
else
CHECK_NUMBER (n, 0);
int pos;
int count, shortage, negp;
- if (NULL (n))
+ if (NILP (n))
count = 1;
else
{
(n)
Lisp_Object n;
{
- if (NULL (n))
+ if (NILP (n))
XFASTINT (n) = 1;
else
CHECK_NUMBER (n, 0);
register int pos;
register int stop;
- if (NULL (n))
+ if (NILP (n))
XFASTINT (n) = 1;
else
CHECK_NUMBER (n, 0);
{
CHECK_NUMBER (n, 0);
- if (NULL (killflag))
+ if (NILP (killflag))
{
if (XINT (n) < 0)
{
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
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 */
}
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'
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')
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;
/* 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. */
#endif
-#undef NULL
-
#include "lisp.h"
#include "buffer.h"
#include "commands.h"
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 */
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;
}
}
closedir (d);
- if (!NULL (nosort))
+ if (!NILP (nosort))
return list;
return Fsort (Fnreverse (list), Qstring_lessp);
}
** 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));
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
matchcount++;
- if (all_flag || NULL (bestmatch))
+ if (all_flag || NILP (bestmatch))
{
/* This is a possible completion */
if (directoryp)
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;
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;
#define O_RDONLY 0
#endif
-#undef NULL
#include "lisp.h"
#include "buffer.h"
int length;
struct gcpro gcpro1;
- if (NULL (str))
+ if (NILP (str))
return Qnil;
CHECK_STRING (str, 0);
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;
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);
}
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 \"");
Lisp_Object args_left;
struct gcpro gcpro1;
- if (NULL(args))
+ if (NILP(args))
return Qnil;
args_left = args;
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;
Lisp_Object args_left;
struct gcpro gcpro1;
- if (NULL(args))
+ if (NILP(args))
return Qt;
args_left = args;
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;
cond = Feval (Fcar (args));
UNGCPRO;
- if (!NULL (cond))
+ if (!NILP (cond))
return Feval (Fcar (Fcdr (args)));
return Fprogn (Fcdr (Fcdr (args)));
}
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);
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;
val = Feval (Fcar (args_left));
args_left = Fcdr (args_left);
}
- while (!NULL(args_left));
+ while (!NILP(args_left));
UNGCPRO;
return val;
struct gcpro gcpro1, gcpro2;
register int argnum = 0;
- if (NULL(args))
+ if (NILP(args))
return Qnil;
args_left = args;
Feval (Fcar (args_left));
args_left = Fcdr (args_left);
}
- while (!NULL(args_left));
+ while (!NILP(args_left));
UNGCPRO;
return val;
val = Qnil;
- if (NULL(args))
+ if (NILP(args))
return Qnil;
args_left = args;
Feval (Fcar (args_left));
args_left = Fcdr (args_left);
}
- while (!NULL(args_left));
+ while (!NILP(args_left));
UNGCPRO;
return val;
register Lisp_Object val, sym;
struct gcpro gcpro1;
- if (NULL(args))
+ if (NILP(args))
return Qnil;
args_left = args;
Fset (sym, val);
args_left = Fcdr (Fcdr (args_left));
}
- while (!NULL(args_left));
+ while (!NILP(args_left));
UNGCPRO;
return val;
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;
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;
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);
}
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);
}
GCPRO3 (args, elt, varlist);
varlist = Fcar (args);
- while (!NULL (varlist))
+ while (!NILP (varlist))
{
QUIT;
elt = Fcar (varlist);
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);
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++];
test = Fcar (args);
body = Fcdr (args);
- while (tem = Feval (test), !NULL (tem))
+ while (tem = Feval (test), !NILP (tem))
{
QUIT;
Fprogn (body);
{
QUIT;
tem = Fassq (sym, env);
- if (NULL (tem))
+ if (NILP (tem))
{
def = XSYMBOL (sym)->function;
if (XTYPE (def) == Lisp_Symbol && !EQ (def, Qunbound))
}
/* 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. */
{
/* 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);
else
{
expander = XCONS (tem)->cdr;
- if (NULL (expander))
+ if (NILP (expander))
break;
}
explicit:
while (1)
{
- if (!NULL (tag))
+ if (!NILP (tag))
for (c = catchlist; c; c = c->next)
{
if (EQ (c->tag, tag))
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);
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);
}
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. */
if (!CONSP (tem1))
continue;
tem = Fmemq (Fcar (tem1), conditions);
- if (!NULL (tem))
+ if (!NILP (tem))
return tem1;
}
return Qnil;
{
if (++i > 10) return Qnil;
tem = Ffboundp (fun);
- if (NULL (tem)) return Qnil;
+ if (NILP (tem)) return Qnil;
fun = Fsymbol_function (fun);
}
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;
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);
done:
if (!EQ (Vmocklisp_arguments, Qt))
{
- if (NULL (val))
+ if (NILP (val))
XFASTINT (val) = 0;
else if (EQ (val, Qt))
XFASTINT (val) = 1;
/* 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;
struct gcpro gcpro1;
GCPRO1 (fn);
- if (NULL (arg))
+ if (NILP (arg))
RETURN_UNGCPRO (Ffuncall (1, &fn));
gcpro1.nvars = 2;
#ifdef NO_ARG_ARRAY
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);
int count;
Lisp_Object value;
{
- int quitf = !NULL (Vquit_flag);
+ int quitf = !NILP (Vquit_flag);
struct gcpro gcpro1;
GCPRO1 (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;
}
if (backlist)
- backlist->debug_on_exit = !NULL (flag);
+ backlist->debug_on_exit = !NILP (flag);
return flag;
}
if (backlist->nargs == MANY)
{
for (tail = *backlist->args, i = 0;
- !NULL (tail);
+ !NILP (tail);
tail = Fcdr (tail), i++)
{
if (i) write_string (" ", -1);
#include <sys/time.h>
#endif
-#ifdef NULL
-#undef NULL
-#endif
#include "config.h"
#include "lisp.h"
#include "buffer.h"
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));
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
#endif /* not VMS */
&& !newdir)
{
- if (NULL (defalt))
+ if (NILP (defalt))
defalt = current_buffer->directory;
CHECK_STRING (defalt, 1);
newdir = XSTRING (defalt)->data;
#endif /* not VMS */
&& !newdir)
{
- if (NULL (defalt))
+ if (NILP (defalt))
defalt = current_buffer->directory;
CHECK_STRING (defalt, 1);
newdir = XSTRING (defalt)->data;
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)));
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);
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
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);
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);
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);
Lisp_Object string;
{
CHECK_STRING (varname, 0);
- if (NULL (string))
+ if (NILP (string))
delete_logical_name (XSTRING (varname)->data);
else
{
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);
}
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);
#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;
error ("maximum buffer size exceeded");
}
- if (NULL (visit))
+ if (NILP (visit))
prepare_to_modify_buffer (point, point);
move_gap (point);
notfound:
- if (!NULL (visit))
+ if (!NILP (visit))
{
current_buffer->undo_list = Qnil;
#ifdef APOLLO
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 */
#endif /* VMS */
/* Special kludge to simplify auto-saving */
- if (NULL (start))
+ if (NILP (start))
{
XFASTINT (start) = BEG;
XFASTINT (end) = Z;
#endif /* CLASH_DETECTION */
desc = -1;
- if (!NULL (append))
+ if (!NILP (append))
desc = open (fn, O_WRONLY);
if (desc < 0)
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$$")));
record_unwind_protect (close_file_unwind, make_number (desc));
- if (!NULL (append))
+ if (!NILP (append))
if (lseek (desc, 0, 2) < 0)
{
#ifdef CLASH_DETECTION
XFASTINT (current_buffer->save_length) = Z - BEG;
current_buffer->filename = filename;
}
- else if (!NULL (visit))
+ else if (!NILP (visit))
return Qnil;
if (!auto_saving)
/* 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;
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++;
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;
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
{
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 ~. */
if (insert_default_directory)
{
insdef = dir;
- if (!NULL (initial))
+ if (!NILP (initial))
{
Lisp_Object args[2];
#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);
}
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 ~. */
XSTRING (dir)->data[0] = '~';
}
- if (!NULL (initial))
+ if (!NILP (initial))
insdef = initial;
else if (insert_default_directory)
insdef = dir;
#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);
}
#include <fcntl.h>
#endif /* USG */
-#undef NULL
#include "lisp.h"
#include "paths.h"
#include "buffer.h"
/* 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);
}
/* 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);
(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;
}
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. */
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. */
return num;
}
\f
-#ifdef BSD
static
float_error (signo)
int 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);
#undef vector
#define vector *****
-#ifdef NULL
-#undef NULL
-#endif
#include "lisp.h"
#include "commands.h"
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);
XFASTINT (val) = i;
return val;
}
- else if (NULL(obj))
+ else if (NILP(obj))
{
XFASTINT (val) = 0;
return val;
(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);
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))
{
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
}
}
}
- if (!NULL (prev))
+ if (!NILP (prev))
XCONS (prev)->cdr = last_tail;
return val;
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)
{
CHECK_STRING (string, 0);
CHECK_NUMBER (from, 1);
- if (NULL (to))
+ if (NILP (to))
to = Flength (string);
else
CHECK_NUMBER (to, 2);
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);
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)
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;
}
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);
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);
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;
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);
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));
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));
{
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);
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);
l2 = Fcdr (l2);
org_l2 = l2;
}
- if (NULL (tail))
+ if (NILP (tail))
value = tem;
else
Fsetcdr (tail, tem);
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);
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);
prev = tail;
}
newcell = Fcons (prop, Fcons (val, Qnil));
- if (NULL (prev))
+ if (NILP (prev))
Fsetplist (sym, newcell);
else
Fsetcdr (Fcdr (prev), newcell);
{
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;
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;
}
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;
tem = args[argnum + 1];
Fsetcdr (tail, tem);
- if (NULL (tem))
+ if (NILP (tem))
args[argnum + 1] = tail;
}
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,
{
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;
}
register Lisp_Object tem;
CHECK_SYMBOL (feature, 0);
tem = Fmemq (feature, Vfeatures);
- if (NULL (tem))
+ if (NILP (tem))
{
int count = specpdl_ptr - specpdl;
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 );
{
XWINDOW (mini_window)->buffer = Qt;
Fset_window_buffer (mini_window,
- (NULL (Vminibuffer_list)
+ (NILP (Vminibuffer_list)
? get_minibuffer (0)
: Fcar (Vminibuffer_list)));
}
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.");
/* 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;
/* 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;
#ifdef HAVE_X_WINDOWS
#ifdef MULTI_SCREEN
if (XSCREEN (screen)->output_method == output_x_window
- && NULL (no_enter))
+ && NILP (no_enter))
{
Ffocus_screen (screen);
}
(screen)
Lisp_Object screen;
{
- if (NULL (screen))
+ if (NILP (screen))
XSET (screen, Lisp_Screen, selected_screen);
else
CHECK_LIVE_SCREEN (screen, 0);
(screen)
Lisp_Object screen;
{
- if (NULL (screen))
+ if (NILP (screen))
XSET (screen, Lisp_Screen, selected_screen);
else
CHECK_LIVE_SCREEN (screen, 0);
/* 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))
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;
{
Lisp_Object tail;
- if (NULL (screen))
+ if (NILP (screen))
XSET (screen, Lisp_Screen, selected_screen);
else
CHECK_LIVE_SCREEN (screen, 0);
{
CHECK_LIVE_SCREEN (screen, 0);
- if (NULL (focus_screen))
+ if (NILP (focus_screen))
focus_screen = screen;
else
CHECK_LIVE_SCREEN (focus_screen, 1);
register struct screen *s;
CHECK_NUMBER (rows, 0);
- if (NULL (screen))
+ if (NILP (screen))
s = selected_screen;
else
{
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;
}
{
register struct screen *s;
CHECK_NUMBER (cols, 0);
- if (NULL (screen))
+ if (NILP (screen))
s = selected_screen;
else
{
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;
}
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;
/* 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;
#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
#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
#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;
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;
#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
#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
-/* IBM has disclaimed copyright on this module. */
-
-/***************************************************************/
-/* */
-/* Function: hftctl */
-/* */
-/* Syntax: */
-/* #include <sys/ioctl.h> */
-/* #include <sys/hft.h> */
-/* */
-/* int hftctl(fildes, request, arg ) */
-/* int fildes, request ; */
-/* char *arg ; */
-/* */
-/* Description: */
-/* */
-/* Does the following: */
-/* 1. determines if fildes is pty */
-/* does normal ioctl it is not */
-/* 2. places fildes into raw mode */
-/* 3. converts ioctl arguments to datastream */
-/* 4. waits for 2 secs for acknowledgement before */
-/* timimg out. */
-/* 5. places response in callers buffer ( just like */
-/* ioctl. */
-/* 6. returns fildes to its original mode */
-/* */
-/* User of this program should review steps 1,4, and 3. */
-/* hftctl makes no check on the request type. It must be */
-/* a HFT ioctl that is supported remotely. */
-/* This program will use the SIGALRM and alarm(2). Any */
-/* Previous alarms are lost. */
-/* */
-/* Users of this program are free to modify it any way */
-/* they want. */
-/* */
-/* Return Value: */
-/* */
-/* If ioctl fails, a value of -1 is returned and errno */
-/* is set to indicate the error. */
-/* */
-/***************************************************************/
-
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <setjmp.h>
-#include <sys/ioctl.h>
-#include <sys/signal.h>
-#include <sys/devinfo.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" ;
-
-/*************** LOCAL DEFINES **********************************/
-
-typedef int (*FUNC)() ; /* pointer to a function */
-
-#define QDEV ((HFQPDEVCH<<8)|HFQPDEVCL)
-#define QLOC ((HFQLOCCH<<8)|HFQLOCCL)
-#define QPS ((HFQPRESCH<<8)|HFQPRESCL)
-
-/*************** EXTERNAL / GLOBAL DATA AREA ********************/
-
- int hfqry() ;
- int hfskbd() ;
- char *malloc() ;
-
-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() ; */
-
-/*************** 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] )
-
- /* 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 ; }
-
-/*************** HFTCTL FUNCTION *******************************/
-
-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 */
-}
-
-/*************** HFSKBD FUNCTION ******************************/
-static 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) ) ;
-}
-
-/*************** HFQUERY FUNCTION ******************************/
-static 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 ) ) ;
-}
-
-
-/*************** GT_ACK FUNCTION ******************************/
-static 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 */
-}
-
-/*************** HFT_ALRM FUNCTION ******************************/
-static hft_alrm(sig) /* Function hft_alrm - handle */
- int sig ; /* alarm signal */
-{
-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 ) ;
-
-}
-
-/*********************************************************************/
-/*** ***/
-/*** NOTE: Both the HFCTLREQ and the arg structure should be ***/
-/*** sent in one io write operation. If terminal ***/
-/*** emulators are in NODELAY mode then multiple writes ***/
-/*** may cause bogus information to be read by the emulator ***/
-/*** depending on the timing. ***/
-/*** ***/
-/*********************************************************************/
-
-static 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) ;
-
-}
+/* IBM has disclaimed copyright on this module. */
+
+/***************************************************************/
+/* */
+/* Function: hftctl */
+/* */
+/* Syntax: */
+/* #include <sys/ioctl.h> */
+/* #include <sys/hft.h> */
+/* */
+/* int hftctl(fildes, request, arg ) */
+/* int fildes, request; */
+/* char *arg; */
+/* */
+/* Description: */
+/* */
+/* Does the following: */
+/* 1. determines if fildes is pty */
+/* does normal ioctl it is not */
+/* 2. places fildes into raw mode */
+/* 3. converts ioctl arguments to datastream */
+/* 4. waits for 2 secs for acknowledgement before */
+/* timimg out. */
+/* 5. places response in callers buffer ( just like */
+/* ioctl. */
+/* 6. returns fildes to its original mode */
+/* */
+/* User of this program should review steps 1,4, and 3. */
+/* hftctl makes no check on the request type. It must be */
+/* a HFT ioctl that is supported remotely. */
+/* This program will use the SIGALRM and alarm(2). Any */
+/* Previous alarms are lost. */
+/* */
+/* Users of this program are free to modify it any way */
+/* they want. */
+/* */
+/* Return Value: */
+/* */
+/* If ioctl fails, a value of -1 is returned and errno */
+/* is set to indicate the error. */
+/* */
+/***************************************************************/
+
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <setjmp.h>
+#include <sys/ioctl.h>
+#include <sys/signal.h>
+#include <sys/devinfo.h>
+#include <termios.h>
+#include <termio.h>
+#include <sys/hft.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";
+
+/*************** LOCAL DEFINES **********************************/
+
+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();
+
+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(); */
+
+/*************** 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])
+
+ /* 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; }
+
+/*************** 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;
+{
+
+ 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 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));
+}
+
+/*************** HFQUERY FUNCTION ******************************/
+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));
+}
+
+
+/*************** GT_ACK FUNCTION ******************************/
+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;
+
+ 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 int
+hft_alrm (sig) /* Function hft_alrm - handle */
+ int sig; /* alarm signal */
+{
+ 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);
+
+}
+
+/*********************************************************************/
+/*** ***/
+/*** NOTE: Both the HFCTLREQ and the arg structure should be ***/
+/*** sent in one io write operation. If terminal ***/
+/*** emulators are in NODELAY mode then multiple writes ***/
+/*** may cause bogus information to be read by the emulator ***/
+/*** depending on the timing. ***/
+/*** ***/
+/*********************************************************************/
+
+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);
+
+}
(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
/* 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. */
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),
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. */
/* 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;
/* 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);
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;
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;
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);
return cmd;
tem = Fkeymapp (cmd);
- if (NULL (tem))
+ if (NILP (tem))
return make_number (idx);
keymap = get_keymap (cmd);
\f
/* 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.
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;
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;
}
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;
{
register Lisp_Object map;
map = current_buffer->keymap;
- if (NULL (map))
+ if (NILP (map))
return Qnil;
return Flookup_key (map, keys);
}
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);
{
register Lisp_Object map;
map = current_buffer->keymap;
- if (NULL (map))
+ if (NILP (map))
{
map = Fmake_sparse_keymap ();
current_buffer->keymap = map;
(keys)
Lisp_Object keys;
{
- if (!NULL (current_buffer->keymap))
+ if (!NILP (current_buffer->keymap))
Flocal_set_key (keys, Qnil);
return Qnil;
}
Lisp_Object map;
map = Fmake_sparse_keymap ();
Ffset (name, map);
- if (!NULL (mapvar))
+ if (!NILP (mapvar))
Fset (mapvar, map);
else
Fset (name, map);
(keymap)
Lisp_Object keymap;
{
- if (!NULL (keymap))
+ if (!NILP (keymap))
keymap = get_keymap (keymap);
current_buffer->keymap = 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));
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
/* 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;
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
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 */
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
{
Lisp_Object tem;
tem = Fequal (binding, definition);
- if (NULL (tem))
+ if (NILP (tem))
continue;
}
else
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
/* It is a true unshadowed match. Record it. */
- if (!NULL (firstonly))
+ if (!NILP (firstonly))
return sequence;
found = Fcons (sequence, found);
}
}
start1 = XBUFFER (descbuf)->keymap;
- if (!NULL (start1))
+ if (!NILP (start1))
{
insert_string ("Local Bindings:\n");
insert_string (heading);
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,
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);
}
else
{
tem1 = Fkeymapp (definition);
- if (!NULL (tem1))
+ if (!NILP (tem1))
insert_string ("Prefix Command\n");
else
insert_string ("??\n");
{
register Lisp_Object keysdesc;
- if (!NULL (keys) && Flength (keys) > 0)
+ if (!NILP (keys) && Flength (keys) > 0)
keysdesc = concat2 (Fkey_description (keys),
build_string (" "));
else
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)
first = 0;
}
- if (!NULL (elt_prefix))
+ if (!NILP (elt_prefix))
insert1 (elt_prefix);
/* THIS gets the string to describe the character TEM1. */
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)
}
/* 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. */
if (i != XINT (dummy))
{
insert (" .. ", 4);
- if (!NULL (elt_prefix))
+ if (!NILP (elt_prefix))
insert1 (elt_prefix);
XFASTINT (dummy) = i;
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);
}
tem = call0 (readcharfun);
- if (NULL (tem))
+ if (NILP (tem))
return -1;
return XINT (tem);
}
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)));
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);
/* 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;
}
if (complete_filename_p (str))
absolute = 1;
- for (; !NULL (path); path = Fcdr (path))
+ for (; !NILP (path); path = Fcdr (path))
{
char *nsuffix;
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);
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);
}
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);
}
{
extern Lisp_Object Fread_minibuffer ();
- if (NULL (readcharfun))
+ if (NILP (readcharfun))
readcharfun = Vstandard_input;
if (EQ (readcharfun, Qt))
readcharfun = Qread_char;
CHECK_STRING (string,0);
- if (NULL (end))
+ if (NILP (end))
endval = XSTRING (string)->size;
else
{ CHECK_NUMBER (end,2);
args_out_of_range (string, end);
}
- if (NULL (start))
+ if (NILP (start))
startval = 0;
else
{ CHECK_NUMBER (start,1);
switch (c)
{
case 'a':
- return '\a';
+ return '\007';
case 'b':
return '\b';
case 'e':
/* 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)
if (XINT (elt) == '.')
{
GCPRO2 (val, tail);
- if (!NULL (tail))
+ if (!NILP (tail))
XCONS (tail)->cdr = read0 (readcharfun);
else
val = read0 (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;
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);
{
register Lisp_Object tem, sym, *ptr;
- if (NULL (obarray)) obarray = Vobarray;
+ if (NILP (obarray)) obarray = Vobarray;
obarray = check_obarray (obarray);
CHECK_STRING (str, 0);
if (XTYPE (tem) != Lisp_Int)
return tem;
- if (!NULL (Vpurify_flag))
+ if (!NILP (Vpurify_flag))
str = Fpurecopy (str);
sym = Fmake_symbol (str);
{
register Lisp_Object tem;
- if (NULL (obarray)) obarray = Vobarray;
+ if (NILP (obarray)) obarray = Vobarray;
obarray = check_obarray (obarray);
CHECK_STRING (str, 0);
{
Lisp_Object tem;
- if (NULL (obarray)) obarray = Vobarray;
+ if (NILP (obarray)) obarray = Vobarray;
obarray = check_obarray (obarray);
map_obarray (obarray, mapatoms_1, function);
}
/* 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)
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
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;
if (!defining_kbd_macro)
error ("Not defining kbd macro.");
- if (NULL (arg))
+ if (NILP (arg))
XFASTINT (arg) = 1;
else
CHECK_NUMBER (arg, 0);
{
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);
int repeat = 1;
struct gcpro gcpro1;
- if (!NULL (prefixarg))
+ if (!NILP (prefixarg))
prefixarg = Fprefix_numeric_value (prefixarg),
repeat = XINT (prefixarg);
}
if (EXCEEDS_ELISP_PTR (address))
- (*warnfunction) ("Warning: memory in use exceeds lisp pointer size");
+ memory_full ();
}
\f
/* Obtain SIZE bytes of space. If enough space is not presently available
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)
/*
* If the icon is null, we just restore the DefaultCursor
*/
- if (NULL(Icon))
+ if (NILP(Icon))
CurrentCursor = DefaultCursor;
else {
/*
{
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;
}
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;
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);
immediate_quit = 1;
QUIT;
- if (NULL (oldstate))
+ if (NILP (oldstate))
{
depth = 0;
state.instring = -1;
else
{
tem = Fcar (oldstate);
- if (!NULL (tem))
+ if (!NILP (tem))
depth = XINT (tem);
else
depth = 0;
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;
struct lisp_parse_state state;
int target;
- if (!NULL (targetdepth))
+ if (!NILP (targetdepth))
{
CHECK_NUMBER (targetdepth, 3);
target = XINT (targetdepth);
validate_region (&from, &to);
state = *scan_sexps_forward (XINT (from), XINT (to),
- target, !NULL (stopbefore), oldstate);
+ target, !NILP (stopbefore), oldstate);
SET_PT (state.location);
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
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
.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.
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;
}
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;
}
/* 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;
/* 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
Lisp_Object next, car, cdr;
next = Fcar (list);
list = Fcdr (list);
- if (NULL (next))
+ if (NILP (next))
break;
car = Fcar (next);
cdr = Fcdr (next);
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
* 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
#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
*/
#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>
#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
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;
/* 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);
}
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 ();
#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);
register struct buffer *buf;
struct position posval;
- if (NULL (pos))
+ if (NILP (pos))
posint = point;
else
{
posint = XINT (pos);
}
- if (NULL (window))
+ if (NILP (window))
window = selected_window;
else
CHECK_WINDOW (window, 1);
decode_window (window)
register Lisp_Object window;
{
- if (NULL (window))
+ if (NILP (window))
return XWINDOW (selected_window);
CHECK_WINDOW (window, 0);
{
int part;
- if (NULL (screen))
+ if (NILP (screen))
XSET (screen, Lisp_Screen, selected_screen);
else
CHECK_LIVE_SCREEN (screen, 0);
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;
{
register struct window *w = decode_window (window);
- if (NULL (arg))
+ if (NILP (arg))
w->dedicated = Qnil;
else
{
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;
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);
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);
}
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))
/* 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.
}
/* 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);
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;
}
register Lisp_Object tem;
Lisp_Object start_window;
- if (NULL (window))
+ if (NILP (window))
window = selected_window;
else
CHECK_WINDOW (window, 0);
/* 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
{
/* 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
{
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));
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;
}
register Lisp_Object tem;
Lisp_Object start_window;
- if (NULL (window))
+ if (NILP (window))
window = selected_window;
else
CHECK_WINDOW (window, 0);
/* 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
{
/* 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
{
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));
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;
}
}
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;
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. */
#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;
{
/* 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);
#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)))
{
/* 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);
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);
struct buffer *obuf = current_buffer;
int top;
- if (NULL (window))
+ if (NILP (window))
window = selected_window;
else
CHECK_WINDOW (window, 0);
(buffer)
Lisp_Object buffer;
{
- if (!NULL (buffer))
+ if (!NILP (buffer))
{
buffer = Fget_buffer (buffer);
CHECK_BUFFER (buffer, 0);
(buffer)
Lisp_Object buffer;
{
- if (!NULL (buffer))
+ if (!NILP (buffer))
{
buffer = Fget_buffer (buffer);
CHECK_BUFFER (buffer, 0);
Lisp_Object child;
if (!nodelete
- && ! NULL (w->parent)
+ && ! NILP (w->parent)
&& height < window_min_height)
{
Fdelete_window (window);
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);
}
/* 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);
}
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);
}
/* 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);
}
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);
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;
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
window = Fget_largest_window (screens);
- if (!NULL (window)
+ if (!NILP (window)
&& window_height (window) >= split_height_threshold
&&
(XFASTINT (XWINDOW (window)->width)
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;
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;
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;
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;
/* Apportion the available screen space among the two new windows */
- if (!NULL (horflag))
+ if (!NILP (horflag))
{
p->height = o->height;
p->top = o->top;
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;
}
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;
}
{
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;
}
sizep = &CURSIZE (p);
if (*sizep + delta < MINSIZE (p)
- && !NULL (XWINDOW (window)->parent))
+ && !NILP (XWINDOW (window)->parent))
{
Fdelete_window (window);
return;
{
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));
return;
}
- if (!NULL (p->next) &&
+ if (!NILP (p->next) &&
(*sizefun) (p->next) - delta >= MINSIZE (p->next))
{
(*setsizefun) (p->next, (*sizefun) (p->next) - delta, 0);
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);
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;
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;
- 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);
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
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);
register Lisp_Object arg;
{
- if (NULL (arg))
+ if (NILP (arg))
XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2;
else
arg = Fprefix_numeric_value (arg);
(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);
register int ht = window_internal_height (w);
register int opoint = point;
- if (NULL (n))
+ if (NILP (n))
{
extern int screen_garbaged;
register int height = window_internal_height (w);
register int start;
- if (NULL (arg))
+ if (NILP (arg))
XFASTINT (arg) = height / 2;
else
{
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".
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
else
{
w->prev = Qnil;
- if (!NULL (w->parent))
+ if (!NILP (w->parent))
{
if (EQ (p->width, XWINDOW (w->parent)->width))
{
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;
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));
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);
{
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));
}
\f
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;
}
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);
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
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);
}
register int i;
SCREEN_PTR s;
- if (NULL (screen))
+ if (NILP (screen))
s = selected_screen;
else
{
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);
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
if (pause)
{
this_line_bufpos = 0;
- if (!NULL (last_arrow_position))
+ if (!NILP (last_arrow_position))
{
last_arrow_position = Qt;
last_arrow_string = Qt;
{
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
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);
}
redisplay_windows (window)
Lisp_Object window;
{
- for (; !NULL (window); window = XWINDOW (window)->next)
+ for (; !NILP (window); window = XWINDOW (window)->next)
redisplay_window (window, 0);
}
/* 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);
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);
}
}
/* 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;
}
/* 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'))
{
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);
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;
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);
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
}
{
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:
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;
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)
{
break;
case '*':
- if (!NULL (current_buffer->read_only))
+ if (!NILP (current_buffer->read_only))
return "%";
if (MODIFF > current_buffer->save_modified)
return "*";
/* 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;
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
return;
BLOCK_INPUT;
- if (NULL (arg))
+ if (NILP (arg))
result = x_text_icon (s, 0);
else
result = x_bitmap_icon (s, 0);
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);
enum resource_types type;
{
register Lisp_Object tem;
- int i;
tem = Fassq (param, alist);
if (EQ (tem, Qnil))
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;
}
}
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)
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);
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;
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");
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. */
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",
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",
(XTYPE (tem) == Lisp_String
? (char *) XSTRING (tem)->data : ""),
XSTRING (s->name)->data,
- !NULL (hscroll), !NULL (vscroll));
+ !NILP (hscroll), !NILP (vscroll));
}
else
{
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
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. */
(screen)
Lisp_Object screen;
{
- CHECK_SCREEN (screen, 0);
+ CHECK_LIVE_SCREEN (screen, 0);
if (SCREEN_IS_X (XSCREEN (screen)))
{
struct screen *s;
Lisp_Object val, oldval;
{
- if (!NULL (val))
+ if (!NILP (val))
{
if (s->display.x->window_desc != 0)
{
struct screen *s;
Lisp_Object val, oldval;
{
- if (!NULL (val))
+ if (!NILP (val))
{
if (s->display.x->window_desc != 0)
{
(screen)
Lisp_Object screen;
{
- CHECK_SCREEN (screen, 0);
+ CHECK_LIVE_SCREEN (screen, 0);
return make_number (XSCREEN (screen)->display.x->pixel_width);
}
(screen)
Lisp_Object screen;
{
- CHECK_SCREEN (screen, 0);
+ CHECK_LIVE_SCREEN (screen, 0);
return make_number (XSCREEN (screen)->display.x->pixel_height);
}
\f
{
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);
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;
}
#endif
\f
-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);
-}
-\f
#if 0
#ifdef HAVE_X11
}
}
- if (!NULL (arg))
+ if (!NILP (arg))
return Qnil;
/* Wait till we get another mouse event. */
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
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");
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;
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;
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);
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;
*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);
*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);
#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 ();
#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. */
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);
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);
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);
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,
#ifdef HAVE_X_WINDOWS
#include "lisp.h"
-#undef NULL
/* On 4.3 this loses if it comes after xterm.h. */
#include <signal.h>
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;
{
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
#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