]> code.delx.au - gnu-emacs/blobdiff - src/lisp.h
(regi-interpret): Use `mapc' rather than `mapcar'.
[gnu-emacs] / src / lisp.h
index 012d66e4d5ae7e95b63f0ad56cab4ab5ae88ec66..65ea46fae1f603c4c3f89f740378ebf2bbc77675 100644 (file)
@@ -6,7 +6,7 @@ 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,
@@ -56,7 +56,7 @@ Boston, MA 02110-1301, USA.  */
 #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.  */
@@ -274,7 +274,8 @@ typedef EMACS_INT Lisp_Object;
 
 /* 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,
@@ -288,7 +289,8 @@ enum pvec_type
   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
@@ -538,6 +540,7 @@ extern size_t pure_size;
 
 #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))
@@ -565,6 +568,7 @@ extern size_t pure_size;
   (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))
@@ -701,7 +705,10 @@ extern int string_bytes P_ ((struct Lisp_String *));
 #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)
@@ -735,9 +742,9 @@ struct Lisp_Vector
 
 /* 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
@@ -888,7 +895,7 @@ struct Lisp_Subr
     Lisp_Object (*function) ();
     short min_args, max_args;
     char *symbol_name;
-    char *prompt;
+    char *intspec;
     char *doc;
   };
 
@@ -1038,16 +1045,16 @@ struct Lisp_Hash_Table
      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));
@@ -1441,7 +1448,7 @@ typedef unsigned char UCHAR;
 #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.  */
@@ -1514,6 +1521,8 @@ typedef unsigned char UCHAR;
 #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)
@@ -1588,7 +1597,7 @@ typedef unsigned char UCHAR;
    "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) \
@@ -1666,30 +1675,33 @@ typedef unsigned char UCHAR;
         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
@@ -2425,7 +2437,7 @@ EXFUN (Fstring_lessp, 2);
 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));
 
@@ -2594,6 +2606,7 @@ extern struct Lisp_Hash_Table *allocate_hash_table 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));
@@ -2649,6 +2662,7 @@ EXFUN (Fread_char, 3);
 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));
@@ -2988,6 +3002,10 @@ extern Lisp_Object Qvertical_scroll_bar;
 extern void discard_mouse_events P_ ((void));
 EXFUN (Fevent_convert_list, 1);
 EXFUN (Fread_key_sequence, 5);
+EXFUN (Fset_input_interrupt_mode, 1);
+EXFUN (Fset_output_flow_control, 2);
+EXFUN (Fset_input_meta_mode, 2);
+EXFUN (Fset_quit_char, 1);
 EXFUN (Fset_input_mode, 4);
 extern int detect_input_pending P_ ((void));
 extern int detect_input_pending_ignore_squeezables P_ ((void));
@@ -3001,6 +3019,7 @@ extern void init_keyboard P_ ((void));
 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 */
@@ -3043,6 +3062,7 @@ EXFUN (Fvisible_frame_list, 0);
 EXFUN (Fframe_parameter, 2);
 EXFUN (Fframe_parameters, 1);
 EXFUN (Fmodify_frame_parameters, 2);
+EXFUN (Fframe_with_environment, 1);
 EXFUN (Fset_frame_height, 3);
 EXFUN (Fset_frame_width, 3);
 EXFUN (Fset_frame_size, 3);
@@ -3059,7 +3079,8 @@ extern void syms_of_frame P_ ((void));
 /* 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));
@@ -3095,6 +3116,8 @@ extern int wait_reading_process_output P_ ((int, int, int, int,
                                            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));
@@ -3108,7 +3131,7 @@ EXFUN (Fcall_process, MANY);
 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_process_environment P_ ((void));
+extern void set_initial_environment P_ ((void));
 extern void syms_of_callproc P_ ((void));
 
 /* defined in doc.c */
@@ -3170,28 +3193,31 @@ EXFUN (Fx_popup_menu, 2);
 EXFUN (Fx_popup_dialog, 3);
 extern void syms_of_xmenu P_ ((void));
 
+/* defined in termchar.h */
+struct tty_display_info;
+
+/* defined in termhooks.h */
+struct terminal;
+
 /* defined in sysdep.c */
 #ifndef HAVE_GET_CURRENT_DIR_NAME
 extern char *get_current_dir_name P_ ((void));
 #endif
 extern void stuff_char P_ ((char c));
 extern void init_sigio P_ ((int));
-extern void request_sigio P_ ((void));
-extern void unrequest_sigio P_ ((void));
-extern void reset_sys_modes P_ ((void));
 extern void sys_subshell P_ ((void));
 extern void sys_suspend P_ ((void));
 extern void discard_tty_input P_ ((void));
-extern void init_sys_modes P_ ((void));
-extern void get_frame_size P_ ((int *, int *));
+extern void init_sys_modes P_ ((struct tty_display_info *));
+extern void reset_sys_modes P_ ((struct tty_display_info *));
+extern void init_all_sys_modes P_ ((void));
+extern void reset_all_sys_modes P_ ((void));
 extern void wait_for_termination P_ ((int));
 extern void flush_pending_output P_ ((int));
 extern void child_setup_tty P_ ((int));
 extern void setup_pty P_ ((int));
 extern int set_window_size P_ ((int, int, int));
 extern void create_process P_ ((Lisp_Object, char **, Lisp_Object));
-extern int tabs_safe_p P_ ((void));
-extern void init_baud_rate P_ ((void));
 extern int emacs_open P_ ((const char *, int, int));
 extern int emacs_close P_ ((int));
 extern int emacs_read P_ ((int, char *, unsigned int));
@@ -3226,6 +3252,9 @@ extern void syms_of_dired P_ ((void));
 extern void syms_of_term P_ ((void));
 extern void fatal () NO_RETURN;
 
+/* Defined in terminal.c */
+extern void syms_of_terminal P_ ((void));
+
 #ifdef HAVE_WINDOW_SYSTEM
 /* Defined in fontset.c */
 extern void syms_of_fontset P_ ((void));
@@ -3237,6 +3266,7 @@ EXFUN (Fx_file_dialog, 5);
 #endif
 
 /* Defined in xfaces.c */
+EXFUN (Fclear_face_cache, 1);
 extern void syms_of_xfaces P_ ((void));
 
 #ifndef HAVE_GETLOADAVG
@@ -3252,6 +3282,7 @@ extern void syms_of_xfns P_ ((void));
 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 */
@@ -3368,6 +3399,11 @@ extern Lisp_Object Vdirectory_sep_char;
 #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.  */