/* Fundamental definitions for GNU Emacs Lisp interpreter.
Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
#ifdef GC_CHECK_CONS_LIST
#define CHECK_CONS_LIST() check_cons_list()
#else
-#define CHECK_CONS_LIST() 0
+#define CHECK_CONS_LIST() ((void)0)
#endif
/* These are default choices for the types to use. */
#ifdef ENABLE_CHECKING
-#define CHECK(check,msg) ((void)((check) || suppress_checking \
- ? (void) 0 \
- : die ((msg), __FILE__, __LINE__)), \
+#define CHECK(check,msg) (((check) || suppress_checking \
+ ? (void) 0 \
+ : die ((msg), __FILE__, __LINE__)), \
0)
#else
/* Produce same side effects and result, but don't complain. */
-#define CHECK(check,msg) ((void)(check),0)
+#define CHECK(check,msg) ((check),0)
#endif
/* In a pseudovector, the size field actually contains a word with one
PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
- indicate the actual type. */
+ indicate the actual type.
+ FIXME: Why a bitset if only one of the bits can ever be set at a time? */
enum pvec_type
{
PVEC_NORMAL_VECTOR = 0,
PVEC_BOOL_VECTOR = 0x10000,
PVEC_BUFFER = 0x20000,
PVEC_HASH_TABLE = 0x40000,
- PVEC_TYPE_MASK = 0x7fe00
+ PVEC_TERMINAL = 0x80000,
+ PVEC_TYPE_MASK = 0xffe00
#if 0 /* This is used to make the value of PSEUDOVECTOR_FLAG available to
GDB. It doesn't work on OS Alpha. Moved to a variable in
#define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a))
#define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) XPNTR(a))
+#define XTERMINAL(a) (eassert (GC_TERMINALP(a)),(struct terminal *) XPNTR(a))
#define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a))
#define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a))
#define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a))
(XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
+#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL))
#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
#endif /* not GC_CHECK_STRING_BYTES */
/* Mark STR as a unibyte string. */
-#define STRING_SET_UNIBYTE(STR) (XSTRING (STR)->size_byte = -1)
+#define STRING_SET_UNIBYTE(STR) \
+ do { if (EQ (STR, empty_multibyte_string)) \
+ (STR) = empty_unibyte_string; \
+ else XSTRING (STR)->size_byte = -1; } while (0)
/* Get text properties. */
#define STRING_INTERVALS(STR) (XSTRING (STR)->intervals + 0)
/* If a struct is made to look like a vector, this macro returns the length
of the shortest vector that would hold that struct. */
-#define VECSIZE(type) ((sizeof (type) - (sizeof (struct Lisp_Vector) \
- - sizeof (Lisp_Object)) \
- + sizeof(Lisp_Object) - 1) /* round up */ \
+#define VECSIZE(type) ((sizeof (type) \
+ - OFFSETOF (struct Lisp_Vector, contents[0]) \
+ + sizeof(Lisp_Object) - 1) /* round up */ \
/ sizeof (Lisp_Object))
/* Like VECSIZE, but used when the pseudo-vector has non-Lisp_Object fields
Lisp_Object (*function) ();
short min_args, max_args;
char *symbol_name;
- char *prompt;
+ char *intspec;
char *doc;
};
hash table size to reduce collisions. */
Lisp_Object index;
- /* Next weak hash table if this is a weak hash table. The head
- of the list is in Vweak_hash_tables. */
- Lisp_Object next_weak;
-
/* User-supplied hash function, or nil. */
Lisp_Object user_hash_function;
/* User-supplied key comparison function, or nil. */
Lisp_Object user_cmp_function;
+ /* Next weak hash table if this is a weak hash table. The head
+ of the list is in weak_hash_tables. */
+ struct Lisp_Hash_Table *next_weak;
+
/* C function to compare two keys. */
int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object,
unsigned, Lisp_Object, unsigned));
#define GLYPH_CHAR(f, g) (FAST_GLYPH_CHAR (g))
#define GLYPH_FACE(f, g) (FAST_GLYPH_FACE (g))
-/* Return 1 iff GLYPH contains valid character code. */
+/* Return 1 if GLYPH contains valid character code. */
#define GLYPH_CHAR_VALID_P(glyph) CHAR_VALID_P (FAST_GLYPH_CHAR (glyph), 1)
/* The ID of the mode line highlighting face. */
#define GC_PROCESSP(x) GC_PSEUDOVECTORP (x, PVEC_PROCESS)
#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
#define GC_WINDOWP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW)
+#define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL)
+#define GC_TERMINALP(x) GC_PSEUDOVECTORP (x, PVEC_TERMINAL)
#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
#define GC_SUBRP(x) GC_PSEUDOVECTORP (x, PVEC_SUBR)
#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
"dead", which is what we want; this is an argument-checking macro, and
the user should never get access to interior windows.
- A window of any sort, leaf or interior, is dead iff the buffer,
+ A window of any sort, leaf or interior, is dead if the buffer,
vchild, and hchild members are all nil. */
#define CHECK_LIVE_WINDOW(x) \
followed by the address of a vector of Lisp_Objects
which contains the argument values.
UNEVALLED means pass the list of unevaluated arguments
- `prompt' says how to read arguments for an interactive call.
- See the doc string for `interactive'.
+ `intspec' says how interactive arguments are to be fetched.
+ If the string starts with a `(', `intspec' is evaluated and the resulting
+ list is the list of arguments.
+ If it's a string that doesn't start with `(', the value should follow
+ the one of the doc string for `interactive'.
A null string means call interactively with no arguments.
`doc' is documentation for the user. */
#if (!defined (__STDC__) && !defined (PROTOTYPES)) \
|| defined (USE_NONANSI_DEFUN)
-#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
+#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
Lisp_Object fnname (); \
DECL_ALIGN (struct Lisp_Subr, sname) = \
{ PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
- fnname, minargs, maxargs, lname, prompt, 0}; \
+ fnname, minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
#else
/* This version of DEFUN declares a function prototype with the right
arguments, so we can catch errors with maxargs at compile-time. */
-#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
+#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
DECL_ALIGN (struct Lisp_Subr, sname) = \
{ PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
- fnname, minargs, maxargs, lname, prompt, 0}; \
+ fnname, minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
/* Note that the weird token-substitution semantics of ANSI C makes
extern int char_table_translate P_ ((Lisp_Object, int));
extern void map_char_table P_ ((void (*) (Lisp_Object, Lisp_Object, Lisp_Object),
Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, int,
- Lisp_Object *));
+ int *));
extern Lisp_Object char_table_ref_and_index P_ ((Lisp_Object, int, int *));
extern void syms_of_fns P_ ((void));
extern struct window *allocate_window P_ ((void));
extern struct frame *allocate_frame P_ ((void));
extern struct Lisp_Process *allocate_process P_ ((void));
+extern struct terminal *allocate_terminal P_ ((void));
extern int gc_in_progress;
extern int abort_on_gc;
extern Lisp_Object make_float P_ ((double));
EXFUN (Fread_event, 3);
extern Lisp_Object read_filtered_event P_ ((int, int, int, int, Lisp_Object));
EXFUN (Feval_region, 4);
+extern Lisp_Object check_obarray P_ ((Lisp_Object));
extern Lisp_Object intern P_ ((const char *));
extern Lisp_Object make_symbol P_ ((char *));
extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
extern void syms_of_keyboard P_ ((void));
extern void keys_of_keyboard P_ ((void));
extern char *push_key_description P_ ((unsigned int, char *, int));
+extern void add_user_signal P_ ((int sig, const char *name));
/* defined in indent.c */
/* defined in emacs.c */
extern Lisp_Object decode_env_path P_ ((char *, char *));
extern Lisp_Object Vinvocation_name, Vinvocation_directory;
-extern Lisp_Object Vinstallation_directory, empty_string;
+extern Lisp_Object Vinstallation_directory;
+extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
EXFUN (Fkill_emacs, 1);
#if HAVE_SETLOCALE
void fixup_locale P_ ((void));
int));
extern void add_keyboard_wait_descriptor P_ ((int));
extern void delete_keyboard_wait_descriptor P_ ((int));
+extern void add_gpm_wait_descriptor P_ ((int));
+extern void delete_gpm_wait_descriptor P_ ((int));
extern void close_process_descs P_ ((void));
extern void init_process P_ ((void));
extern void syms_of_process P_ ((void));
extern int child_setup P_ ((int, int, int, char **, int, Lisp_Object));
extern void init_callproc_1 P_ ((void));
extern void init_callproc P_ ((void));
-extern void set_global_environment P_ ((void));
+extern void set_initial_environment P_ ((void));
extern void syms_of_callproc P_ ((void));
/* defined in doc.c */
#endif
/* Defined in xfaces.c */
+EXFUN (Fclear_face_cache, 1);
extern void syms_of_xfaces P_ ((void));
#ifndef HAVE_GETLOADAVG
extern void syms_of_xsmfns P_ ((void));
/* Defined in xselect.c */
+EXFUN (Fx_send_client_event, 6);
extern void syms_of_xselect P_ ((void));
/* Defined in xterm.c */
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
+/* Make sure we have abs defined */
+#if !defined(abs)
+#define abs(x) ((x) < 0 ? -(x) : (x))
+#endif
+
/* Return a fixnum or float, depending on whether VAL fits in a Lisp
fixnum. */