#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)
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) \
# else
/* C++ is annoying, but it has a big bag of tricks.
The following doesn't have the "inside out" declaration bug C does. */
-template<class T> struct alignment_trick { char c; T member; };
+template<typename T> struct alignment_trick { char c; T member; };
# define ALIGNOF(type) offsetof (alignment_trick<type>, member)
# endif
#endif /* ALIGNOF */
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
/* EMACS_INT is the underlying integral type into which a Lisp_Object must fit.
In particular, it must be large enough to contain a pointer.
- config.h can override this, e.g. to use `long long' for bigger lisp ints. */
+ config.h can override this, e.g. to use `long long' for bigger lisp ints.
+
+ #### In point of fact, it would NOT be a good idea for config.h to mess
+ with EMACS_INT. A lot of code makes the basic assumption that EMACS_INT
+ is the size of a pointer. */
#ifndef SIZEOF_EMACS_INT
# define SIZEOF_EMACS_INT SIZEOF_VOID_P
typedef int Emchar;
/* Different ways of referring to a position in a buffer. We use
- the typedefs in preference to 'int' to make it clearer what
+ the typedefs in preference to 'EMACS_INT' to make it clearer what
sort of position is being used. See extents.c for a description
of the different positions. We put them here instead of in
buffer.h (where they rightfully belong) to avoid syntax errors
/* structure/other typedefs */
/* ------------------------------- */
+/* Counts of bytes or array elements */
+typedef EMACS_INT Memory_count;
+typedef EMACS_INT Element_count;
+
typedef struct lstream Lstream;
typedef unsigned int face_index;
#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
/* 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; \
{
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;
#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)
#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
/* threshold for doing another gc */
-extern EMACS_INT gc_cons_threshold;
+extern Fixnum gc_cons_threshold;
/* Structure for recording stack slots that need marking */
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 *);
/* var will not be saved at dump time */
void staticpro_nodump (Lisp_Object *);
-/* Call dump_add_root_struct_ptr (&var, &desc) to dump the structure pointed to by `var'. */
+/* dump_add_root_struct_ptr (&var, &desc) dumps the structure pointed to by `var'. */
#ifdef PDUMP
void dump_add_root_struct_ptr (void *, const struct struct_description *);
#else
#define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING
#endif
-/* Call dump_add_opaque (&var, size) to dump the opaque static structure `var'. */
+/* dump_add_opaque (&var, size) dumps the opaque static structure `var'. */
#ifdef PDUMP
void dump_add_opaque (void *, size_t);
#else
#define dump_add_opaque(varaddr,size) DO_NOTHING
#endif
+/* Call dump_add_opaque_int (&int_var) to dump `int_var', of type `int'. */
+#ifdef PDUMP
+#define dump_add_opaque_int(int_varaddr) do { \
+ int *dao_ = (int_varaddr); /* type check */ \
+ dump_add_opaque (dao_, sizeof (*dao_)); \
+} while (0)
+#else
+#define dump_add_opaque_int(int_varaddr) DO_NOTHING
+#endif
+
+/* Call dump_add_opaque_fixnum (&fixnum_var) to dump `fixnum_var', of type `Fixnum'. */
+#ifdef PDUMP
+#define dump_add_opaque_fixnum(fixnum_varaddr) do { \
+ Fixnum *dao_ = (fixnum_varaddr); /* type check */ \
+ dump_add_opaque (dao_, sizeof (*dao_)); \
+} while (0)
+#else
+#define dump_add_opaque_fixnum(fixnum_varaddr) DO_NOTHING
+#endif
+
/* Call dump_add_root_object (&var) to ensure that var is properly updated after pdump. */
#ifdef PDUMP
void dump_add_root_object (Lisp_Object *);
#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;
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);
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);
/* 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 int emacs_priority;
+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));
int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int);
EXFUN (Flocate_file_clear_hashing, 1);
int isfloat_string (const char *);
+Lisp_Object read_from_c_string (const unsigned char* str, size_t size);
/* Well, I've decided to enable this. -- ben */
/* And I've decided to make it work right. -- sb */
EXFUN (Fcar_safe, 1);
EXFUN (Fcdr, 1);
EXFUN (Fchar_after, 2);
+EXFUN (Fchar_ref_p, 1);
EXFUN (Fchar_to_string, 1);
EXFUN (Fcheck_valid_plist, 1);
EXFUN (Fvalid_plist_p, 1);
EXFUN (Fstring_equal, 2);
EXFUN (Fstring_lessp, 2);
EXFUN (Fstring_match, 4);
+EXFUN (Fstring_to_number, 2);
EXFUN (Fsub1, 1);
EXFUN (Fsubr_max_args, 1);
EXFUN (Fsubr_min_args, 1);
extern Lisp_Object Qtop_level;
extern Lisp_Object Qtrue_list_p;
extern Lisp_Object Qunbound, Qunderflow_error;
+#ifdef UTF2000
+extern Lisp_Object Qunloaded;
+#endif
extern Lisp_Object Qunderline, Quser_files_and_directories;
extern Lisp_Object Qvalues;
extern Lisp_Object Qvariable_documentation, Qvariable_domain;
extern Lisp_Object Qvoid_function, Qvoid_variable;
extern Lisp_Object Qwindow_live_p, Qwrong_number_of_arguments;
extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p;
+extern Lisp_Object Qgtk;
#define SYMBOL(fou) extern Lisp_Object fou
#define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
extern Lisp_Object Vactivate_menubar_hook;
extern Lisp_Object Vautoload_queue, Vblank_menubar;
extern Lisp_Object Vcharset_ascii, Vcharset_composite, Vcharset_control_1;
+extern Lisp_Object Vcharset_latin_iso8859_1, Vcharset_greek_iso8859_7;
+extern Lisp_Object Vcharset_cyrillic_iso8859_5, Vcharset_hebrew_iso8859_8;
+extern Lisp_Object Vcharset_thai_tis620, Vcharset_katakana_jisx0201;
extern Lisp_Object Vcoding_system_for_read, Vcoding_system_for_write;
extern Lisp_Object Vcoding_system_hash_table, Vcommand_history;
extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;