X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Flisp.h;h=a57ed02ef5081e42fe6fa7bd8f78ccb1bf4bf2a0;hb=a699139716d7a947173ebc9a7130cc0eead5da7f;hp=ab544796516dce08578f7048ac6e014ca7c294c3;hpb=82f6d62ee211b1d36e8f45fed3ee3edde82b6916;p=chise%2Fxemacs-chise.git- diff --git a/src/lisp.h b/src/lisp.h index ab54479..a57ed02e 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -70,6 +70,9 @@ void Dynarr_free (void *d); ((dynarr_type *) Dynarr_newf (sizeof (type))) #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_sizeof(d) ((d)->cur * (d)->elsize) #define Dynarr_length(d) ((d)->cur) #define Dynarr_largest(d) ((d)->largest) #define Dynarr_reset(d) ((d)->cur = 0) @@ -190,20 +193,42 @@ void xfree (void *); # endif /* GNUC */ #endif +/* No type has a greater alignment requirement than max_align_t. + (except perhaps for types we don't use, like long double) */ +typedef union +{ + struct { long l; } l; + struct { void *p; } p; + struct { void (*f)(void); } f; + struct { double d; } d; +} max_align_t; + #ifndef ALIGNOF # if defined (__GNUC__) && (__GNUC__ >= 2) -# define ALIGNOF(x) __alignof__ (x) +/* gcc has an extension that gives us exactly what we want. */ +# define ALIGNOF(type) __alignof__ (type) +# elif ! defined (__cplusplus) +/* The following is mostly portable, except that: + - it doesn't work for inside out declarations like void (*) (void). + (so just call ALIGNOF with a typedef'ed name) + - it doesn't work with C++. The C++ committee has decided, + in its infinite wisdom, that: + "Types must be declared in declarations, not in expressions." */ +# define ALIGNOF(type) offsetof (struct { char c; type member; }, member) # else -# define ALIGNOF(x) sizeof (x) +/* C++ is annoying, but it has a big bag of tricks. + The following doesn't have the "inside out" declaration bug C does. */ +template struct alignment_trick { char c; T member; }; +# define ALIGNOF(type) offsetof (alignment_trick, member) # endif -#endif +#endif /* ALIGNOF */ #define ALIGN_SIZE(len, unit) \ ((((len) + (unit) - 1) / (unit)) * (unit)) /* #### Yuck, this is kind of evil */ #define ALIGN_PTR(ptr, unit) \ - ((void *) ALIGN_SIZE ((long) (ptr), unit)) + ((void *) ALIGN_SIZE ((size_t) (ptr), unit)) #ifndef DO_NOTHING #define DO_NOTHING do {} while (0) @@ -570,6 +595,11 @@ typedef struct Dynarr_declare (Lisp_Object); } Lisp_Object_dynarr; +typedef struct +{ + Dynarr_declare (Lisp_Object *); +} Lisp_Object_ptr_dynarr; + /* Close your eyes now lest you vomit or spontaneously combust ... */ #define HACKEQ_UNSAFE(obj1, obj2) \ @@ -1170,14 +1200,28 @@ void set_string_char (Lisp_String *s, Charcount i, Emchar c); #endif /* not MULE */ -/* Return the true size of a struct with a variable-length array field. */ -#define FLEXIBLE_ARRAY_STRUCT_SIZEOF(flexible_array_structtype, \ - flexible_array_field, \ - flexible_array_length) \ - (offsetof (flexible_array_structtype, flexible_array_field) + \ - (offsetof (flexible_array_structtype, flexible_array_field[1]) - \ - offsetof (flexible_array_structtype, flexible_array_field[0])) * \ - (flexible_array_length)) +/* Return the true aligned size of a struct whose last member is a + variable-length array field. (this is known as the "struct hack") */ +/* Implementation: in practice, structtype and fieldtype usually have + the same alignment, but we can't be sure. We need to use + ALIGN_SIZE to be absolutely sure of getting the correct alignment. + To help the compiler's optimizer, we use a ternary expression that + only a very stupid compiler would fail to correctly simplify. */ +#define FLEXIBLE_ARRAY_STRUCT_SIZEOF(structtype, \ + fieldtype, \ + fieldname, \ + array_length) \ +(ALIGNOF (structtype) == ALIGNOF (fieldtype) \ + ? (offsetof (structtype, fieldname) + \ + (offsetof (structtype, fieldname[1]) - \ + offsetof (structtype, fieldname[0])) * \ + (array_length)) \ + : (ALIGN_SIZE \ + ((offsetof (structtype, fieldname) + \ + (offsetof (structtype, fieldname[1]) - \ + offsetof (structtype, fieldname[0])) * \ + (array_length)), \ + ALIGNOF (structtype)))) /*------------------------------ vector --------------------------------*/ @@ -1859,7 +1903,7 @@ extern EMACS_INT consing_since_gc; /* threshold for doing another gc */ -extern EMACS_INT gc_cons_threshold; +extern Fixnum gc_cons_threshold; /* Structure for recording stack slots that need marking */ @@ -2097,6 +2141,8 @@ void debug_ungcpro(char *, int, struct gcpro *); RETURN_SANS_WARNINGS ret_nunb_val; \ } while (0) +extern Lisp_Object_ptr_dynarr *staticpros; + /* Call staticpro (&var) to protect static variable `var'. */ void staticpro (Lisp_Object *); @@ -2104,19 +2150,55 @@ void staticpro (Lisp_Object *); /* var will not be saved at dump time */ void staticpro_nodump (Lisp_Object *); -/* Call dumpstruct(&var, &desc) to dump the structure pointed to by `var'. */ -void dumpstruct (void *, const struct struct_description *); +/* 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 + +/* 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 dumpopaque(&var, size) to dump the opaque static structure `var'. */ -void dumpopaque (void *, size_t); +/* 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 pdump_wire(&var) to ensure that var is properly updated after pdump. */ -void pdump_wire (Lisp_Object *); +/* Call dump_add_root_object (&var) to ensure that var is properly updated after pdump. */ +#ifdef PDUMP +void dump_add_root_object (Lisp_Object *); +#else +#define dump_add_root_object(varaddr) DO_NOTHING +#endif -/* Call pdump_wire(&var) to ensure that var is properly updated after - pdump. var must point to a linked list of objects out of which +/* Call dump_add_root_object (&var) to ensure that var is properly updated after + pdump. var must point to a linked list of objects out of which some may not be dumped */ -void pdump_wire_list (Lisp_Object *); +#ifdef PDUMP +void dump_add_weak_object_chain (Lisp_Object *); +#else +#define dump_add_weak_object_chain(varaddr) DO_NOTHING +#endif /* Nonzero means Emacs has already been initialized. Used during startup to detect startup of dumped Emacs. */ @@ -2364,7 +2446,7 @@ Lisp_Object decode_path (const char *); extern int noninteractive, noninteractive1; extern int fatal_error_in_progress; 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; @@ -3051,6 +3133,7 @@ EXFUN (Fspecifier_spec_list, 4); 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); @@ -3161,6 +3244,9 @@ extern Lisp_Object Qtext_image_instance_p; 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; @@ -3184,6 +3270,9 @@ extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p; 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;