]> code.delx.au - gnu-emacs/blobdiff - src/lisp.h
*** empty log message ***
[gnu-emacs] / src / lisp.h
index 6188ef11e56496b5ad756ffa0b7cb846035f195d..3d9be2759312b222cc1c211b45517496aeb055c0 100644 (file)
@@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 /* Declare the prototype for a general external function.  */
-#if defined (__STDC__) || defined (WINDOWSNT)
+#if defined (PROTOTYPES) || defined (WINDOWSNT)
 #define P_(proto) proto
 #else
 #define P_(proto) ()
@@ -46,6 +46,35 @@ Boston, MA 02111-1307, USA.  */
 #endif
 #endif
 
+/* Extra internal type checking?  */
+extern int suppress_checking;
+extern void die P_((const char *, const char *, int));
+
+#ifdef ENABLE_CHECKING
+
+#define CHECK(check,msg) ((check || suppress_checking          \
+                          ? 0                                  \
+                          : die (msg, __FILE__, __LINE__)),    \
+                         0)
+
+/* Let's get some compile-time checking too.  */
+#undef NO_UNION_TYPE
+
+#else
+
+/* Produce same side effects and result, but don't complain.  */
+#define CHECK(check,msg) ((check),0)
+
+#endif
+
+/* Define an Emacs version of "assert", since some system ones are
+   flaky.  */
+#if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__)
+#define eassert(cond) CHECK(cond,"assertion failed: " #cond)
+#else
+#define eassert(cond) CHECK(cond,"assertion failed")
+#endif
+
 /* Define the fundamental Lisp data structures.  */
 
 /* This is the set of Lisp data types.  */
@@ -395,9 +424,14 @@ extern int pure_size;
 #define XPNTR(a) ((a).u.val)
 
 #define XSET(var, vartype, ptr) \
-   (((var).s.type = ((char) (vartype))), ((var).s.val = ((int) (ptr))))
+   (((var).s.val = ((int) (ptr))), ((var).s.type = ((char) (vartype))))
 
+#if __GNUC__ >= 2 && defined (__OPTIMIZE__)
+#define make_number(N) \
+  (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; }))
+#else
 extern Lisp_Object make_number ();
+#endif
 
 /* During garbage collection, XGCTYPE must be used for extracting types
  so that the mark bit is ignored.  XMARKBIT access the markbit.
@@ -415,11 +449,11 @@ extern Lisp_Object make_number ();
 
 /* Extract a value or address from a Lisp_Object.  */
 
-#define XCONS(a) ((struct Lisp_Cons *) XPNTR(a))
+#define XCONS(a) (eassert (GC_CONSP(a)),(struct Lisp_Cons *) XPNTR(a))
 #define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a))
-#define XSTRING(a) ((struct Lisp_String *) XPNTR(a))
-#define XSYMBOL(a) ((struct Lisp_Symbol *) XPNTR(a))
-#define XFLOAT(a) ((struct Lisp_Float *) XPNTR(a))
+#define XSTRING(a) (eassert (GC_STRINGP(a)),(struct Lisp_String *) XPNTR(a))
+#define XSYMBOL(a) (eassert (GC_SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
+#define XFLOAT(a) (eassert (GC_FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
 
 /* Misc types.  */
 #define XMISC(a)   ((union Lisp_Misc *) XPNTR(a))
@@ -434,10 +468,10 @@ extern Lisp_Object make_number ();
 #define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd))
 
 /* Pseudovector types.  */
-#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a))
-#define XWINDOW(a) ((struct window *) XPNTR(a))
-#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a))
-#define XBUFFER(a) ((struct buffer *) XPNTR(a))
+#define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a))
+#define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) 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))
 #define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a))
 
@@ -494,17 +528,22 @@ struct interval
      You'd think we could store this information in the parent object
      somewhere (after all, that should be visited once and then
      ignored too, right?), but strings are GC'd strangely.  */
-  struct interval *parent;
+  union
+  {
+    struct interval *interval;
+    Lisp_Object obj;
+  } up;
+  unsigned int up_obj : 1;
 
   /* The remaining components are `properties' of the interval.
      The first four are duplicates for things which can be on the list,
      for purposes of speed.  */
 
-  unsigned char write_protect;     /* Non-zero means can't modify.  */
-  unsigned char visible;           /* Zero means don't display.  */
-  unsigned char front_sticky;      /* Non-zero means text inserted just
+  unsigned int write_protect : 1;    /* Non-zero means can't modify.  */
+  unsigned int visible : 1;        /* Zero means don't display.  */
+  unsigned int front_sticky : 1;    /* Non-zero means text inserted just
                                       before this interval goes into it.  */
-  unsigned char rear_sticky;       /* Likewise for just after it.  */
+  unsigned int rear_sticky : 1;            /* Likewise for just after it.  */
 
   /* Properties of this interval.
      The mark bit on this field says whether this particular interval
@@ -562,16 +601,6 @@ struct Lisp_Cons
   : NILP ((c)) ? Qnil                          \
   : wrong_type_argument (Qlistp, (c)))
 
-/* Like a cons, but records info on where the text lives that it was read from */
-/* This is not really in use now */
-
-struct Lisp_Buffer_Cons
-  {
-    Lisp_Object car, cdr;
-    struct buffer *buffer;
-    int bufpos;
-  };
-
 /* Nonzero if STR is a multibyte string.  */
 #define STRING_MULTIBYTE(STR)  \
   (XSTRING (STR)->size_byte >= 0)
@@ -1882,6 +1911,7 @@ extern int nonascii_insert_offset;
 extern Lisp_Object Vnonascii_translation_table;
 EXFUN (Fchar_bytes, 1);
 EXFUN (Fchar_width, 1);
+EXFUN (Fstring, MANY);
 extern int chars_in_text P_ ((unsigned char *, int));
 extern int multibyte_chars_in_text P_ ((unsigned char *, int));
 extern int unibyte_char_to_multibyte P_ ((int));
@@ -1901,6 +1931,7 @@ extern void init_syntax_once P_ ((void));
 extern void syms_of_syntax P_ ((void));
 
 /* Defined in fns.c */
+extern Lisp_Object larger_vector P_ ((Lisp_Object, int, Lisp_Object));
 extern void sweep_weak_hash_tables P_ ((void));
 extern Lisp_Object Qstring_lessp;
 extern Lisp_Object Vfeatures;
@@ -1976,7 +2007,7 @@ extern Lisp_Object concat2 P_ ((Lisp_Object, Lisp_Object));
 extern Lisp_Object concat3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
 extern Lisp_Object nconc2 P_ ((Lisp_Object, Lisp_Object));
 extern Lisp_Object assq_no_quit P_ ((Lisp_Object, Lisp_Object));
-extern void clear_string_char_byte_cache P_ (());
+extern void clear_string_char_byte_cache P_ ((void));
 extern int string_char_to_byte P_ ((Lisp_Object, int));
 extern int string_byte_to_char P_ ((Lisp_Object, int));
 extern Lisp_Object string_make_multibyte P_ ((Lisp_Object));
@@ -2086,12 +2117,8 @@ extern void syms_of_xdisp P_ ((void));
 extern void init_xdisp P_ ((void));
 
 /* Defined in vm-limit.c.  */
-#ifdef __STDC__
-extern void memory_warnings P_ ((void *, void (*warnfun) ()));
-#else
-extern void memory_warnings P_ ((char *, void (*warnfun) ()));
-#endif
-                               
+extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
+
 /* Defined in alloc.c */
 extern void allocate_string_data P_ ((struct Lisp_String *, int, int));
 extern void uninterrupt_malloc P_ ((void));
@@ -2143,6 +2170,7 @@ extern void free_cons P_ ((struct Lisp_Cons *));
 extern void init_alloc_once P_ ((void));
 extern void init_alloc P_ ((void));
 extern void syms_of_alloc P_ ((void));
+extern struct buffer * allocate_buffer P_ ((void));
 
 /* Defined in print.c */
 extern Lisp_Object Vprin1_to_string_buffer;
@@ -2318,6 +2346,11 @@ extern void init_editfns P_ ((void));
 extern void syms_of_editfns P_ ((void));
 EXFUN (Fcurrent_message, 0);
 extern Lisp_Object Vinhibit_field_text_motion;
+EXFUN (Fconstrain_to_field, 4);
+EXFUN (Ffield_string, 1);
+EXFUN (Fdelete_field, 1);
+EXFUN (Ffield_beginning, 2);
+EXFUN (Ffield_string_no_properties, 1);
 
 /* defined in buffer.c */
 extern void nsberror P_ ((Lisp_Object));
@@ -2486,7 +2519,7 @@ EXFUN (Finput_pending_p, 0);
 extern Lisp_Object menu_bar_items P_ ((Lisp_Object));
 extern Lisp_Object tool_bar_items P_ ((Lisp_Object, int *));
 extern Lisp_Object Qvertical_scroll_bar;
-extern void discard_mouse_events ();
+extern void discard_mouse_events P_ ((void));
 EXFUN (Fevent_convert_list, 1);
 EXFUN (Fread_key_sequence, 5);
 EXFUN (Fset_input_mode, 4);
@@ -2804,9 +2837,13 @@ extern int getloadavg P_ ((double *, int));
 /* Defined in xfns.c */
 extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
 extern void syms_of_xfns P_ ((void));
-EXFUN (Fx_hide_busy_cursor, 1);
 extern void init_xfns P_ ((void));
+EXFUN (Fxw_display_color_p, 1);
+#ifdef HAVE_X_I18N
+extern void free_frame_xic P_ ((struct frame *));
 #endif
+/* Fixme: x_defined_color needs declaring, but needs FRAME_PTR and XColor. */
+#endif /* HAVE_X_WINDOWS */
 
 /* Defined in xselect.c */
 extern void syms_of_xselect P_ ((void));
@@ -2816,7 +2853,9 @@ extern void syms_of_xterm P_ ((void));
 
 /* Defined in getloadavg.c */
 extern int getloadavg P_ ((double [], int));
-\f
+
+/* Defined in composite.c */
+extern void compose_text P_ ((int, int, Lisp_Object, Lisp_Object, Lisp_Object));\f
 /* Nonzero means Emacs has already been initialized.
    Used during startup to detect startup of dumped Emacs.  */
 extern int initialized;
@@ -2826,6 +2865,7 @@ extern int immediate_quit;            /* Nonzero means ^G can quit instantly */
 extern char *getenv (), *ctime (), *getwd ();
 extern long *xmalloc (), *xrealloc ();
 extern void xfree ();
+extern char *xstrdup P_ ((char *));
 
 extern char *egetenv P_ ((char *));