XEmacs 21.4.17 "Jumbo Shrimp".
[chise/xemacs-chise.git.1] / src / lisp.h
index 8b2b8cc..9c9caa6 100644 (file)
@@ -71,7 +71,7 @@ void Dynarr_free (void *d);
 #define Dynarr_at(d, pos) ((d)->base[pos])
 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
 #define Dynarr_begin(d) Dynarr_atp (d, 0)
-#define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d))
+#define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d) - 1)
 #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize)
 #define Dynarr_length(d) ((d)->cur)
 #define Dynarr_largest(d) ((d)->largest)
@@ -136,7 +136,7 @@ char *xstrdup (const char *);
    least NEEDED_SIZE objects.  The reallocing is done by doubling,
    which ensures constant amortized time per element. */
 #define DO_REALLOC(basevar, sizevar, needed_size, type)        do {    \
-  size_t do_realloc_needed_size = (needed_size);               \
+  EMACS_INT do_realloc_needed_size = (needed_size);            \
   if ((sizevar) < do_realloc_needed_size)                      \
     {                                                          \
       if ((sizevar) < 32)                                      \
@@ -243,15 +243,16 @@ template<typename T> struct alignment_trick { char c; T member; };
    time the assert checks take is measurable so let's not include them
    in production binaries. */
 
-#ifdef USE_ASSERTIONS
 /* Highly dubious kludge */
 /*   (thanks, Jamie, I feel better now -- ben) */
+# define ABORT() (assert_failed (__FILE__, __LINE__, "ABORT()"))
 void assert_failed (const char *, int, const char *);
-# define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
+
+#ifdef USE_ASSERTIONS
 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
 #else
 # ifdef DEBUG_XEMACS
-#  define assert(x) ((x) ? (void) 0 : (void) abort ())
+#  define assert(x) ((x) ? (void) 0 : (void) ABORT ())
 # else
 #  define assert(x)
 # endif
@@ -585,7 +586,7 @@ enum Lisp_Type
 
 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS)
 #define VALBITS (BITS_PER_EMACS_INT - GCBITS)
-#define EMACS_INT_MAX ((EMACS_INT) ((1UL << INT_VALBITS) -1UL))
+#define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL))
 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1)
 
 #ifdef USE_UNION_TYPE
@@ -879,7 +880,7 @@ do {                                                                        \
 
 /* For a list that's known to be in valid list format, where we may
    be deleting the current element out of the list --
-   will abort() if the list is not in valid format */
+   will ABORT() if the list is not in valid format */
 #define LIST_LOOP_DELETING(consvar, nextconsvar, list)         \
   for (consvar = list;                                         \
        !NILP (consvar) ? (nextconsvar = XCDR (consvar), 1) :0; \
@@ -1277,7 +1278,7 @@ struct Lisp_Bit_Vector
 {
   struct lrecord_header lheader;
   Lisp_Object next;
-  size_t size;
+  EMACS_INT size;
   unsigned long bits[1];
 };
 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
@@ -1410,7 +1411,7 @@ DECLARE_LRECORD (marker, Lisp_Marker);
 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker)
 
 /* The second check was looking for GCed markers still in use */
-/* if (INTP (XMARKER (x)->lheader.next.v)) abort (); */
+/* if (INTP (XMARKER (x)->lheader.next.v)) ABORT (); */
 
 #define marker_next(m) ((m)->next)
 #define marker_prev(m) ((m)->prev)
@@ -1587,7 +1588,7 @@ XCHAR_OR_INT (Lisp_Object obj)
 #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
 #define LISP_READONLY(obj) (LISP_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
 
-/*----------------------------- structrures ----------------------------*/
+/*----------------------------- structures -----------------------------*/
 
 typedef struct structure_keyword_entry structure_keyword_entry;
 struct structure_keyword_entry
@@ -2151,6 +2152,8 @@ void debug_ungcpro(char *, int, struct gcpro *);
 
 extern Lisp_Object_ptr_dynarr *staticpros;
 
+void register_post_gc_action (void (*fun) (void *), void *arg);
+
 /* Call staticpro (&var) to protect static variable `var'. */
 void staticpro (Lisp_Object *);
 
@@ -2262,6 +2265,9 @@ struct overhead_stats
 
 #ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
+#elif defined(INTPTR_T_IN_CYGWIN_TYPES_H)
+/* Recent Cygwin defines these types in <cygwin/types.h>
+   We can hope that if they ever get inttypes.h, they won't define twice */
 #elif SIZEOF_VOID_P == SIZEOF_INT
 typedef int intptr_t;
 typedef unsigned int uintptr_t;
@@ -2393,6 +2399,9 @@ enum arith_comparison {
   arith_grtr_or_equal };
 Lisp_Object arithcompare (Lisp_Object, Lisp_Object, enum arith_comparison);
 
+/* Do NOT use word_to_lisp or wasteful_word_to_lisp to decode time_t's
+   unless you KNOW arg is non-negative.  They cannot return negative
+   values!  Use make_time.  */
 Lisp_Object word_to_lisp (unsigned int);
 unsigned int lisp_to_word (Lisp_Object);
 
@@ -2431,6 +2440,7 @@ Bytind bytind_clip_to_bounds (Bytind, Bytind, Bytind);
 void buffer_insert1 (struct buffer *, Lisp_Object);
 Lisp_Object make_string_from_buffer (struct buffer *, Bufpos, Charcount);
 Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Bufpos, Charcount);
+Lisp_Object make_time (time_t);
 Lisp_Object save_excursion_save (void);
 Lisp_Object save_restriction_save (void);
 Lisp_Object save_excursion_restore (Lisp_Object);
@@ -2453,10 +2463,13 @@ Lisp_Object decode_path (const char *);
 /* Nonzero means don't do interactive redisplay and don't change tty modes */
 extern int noninteractive, noninteractive1;
 extern int fatal_error_in_progress;
+extern int inhibit_non_essential_printing_operations;
 extern int preparing_for_armageddon;
 extern Fixnum emacs_priority;
 extern int running_asynch_code;
 extern int suppress_early_error_handler_backtrace;
+void debug_break (void);
+int debug_can_access_memory (void *ptr, Bytecount len);
 
 /* Defined in eval.c */
 DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, Lisp_Object));