X-Git-Url: http://cgit.sxemacs.org/?p=sxemacs;a=blobdiff_plain;f=src%2Flisp.h;h=e60bc149f4b28bbeecca8da25f334b7f542fd592;hp=148c4637c27f98876c4fc08c555c5927b148cfd6;hb=b84e8f01881114d77ad01ed16e50e561494a3c91;hpb=0a2603e5c40f9a6e309d9698b17cb35481bccac0;ds=sidebyside diff --git a/src/lisp.h b/src/lisp.h index 148c463..e60bc14 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -31,6 +31,7 @@ along with this program. If not, see . */ /* the old SXEmacs general includes and utility macros moved here: */ #include "sxe-utils.h" +#include "sxe-memory.h" /* ------------------------ dynamic arrays ------------------- */ @@ -512,7 +513,7 @@ extern Lisp_Object Qnil; { LIST_LOOP_3 (elt, list, tail) { - execute_code_here; + execute_code_here; } } @@ -639,18 +640,18 @@ PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \ #define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \ tortoise, suspicion_length) \ - for (tortoise = hare = list, len = 0; \ + for (tortoise = hare = list, len = 0; \ \ - (CONSP (hare) ? ((void)(elt = XCAR (hare)), 1) : \ - (NILP (hare) ? 0 : \ - ((void)signal_malformed_list_error (list), 0))); \ + (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \ + (NILP (hare) ? 0 : \ + (signal_malformed_list_error (list), 0))); \ \ - hare = XCDR (hare), \ - (void) \ - ((++len > suspicion_length) \ - && \ - ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \ - (EQ (hare, tortoise) && (signal_circular_list_error (list), 0))))) + (hare = XCDR (hare)), \ + (void)((++len > suspicion_length) && \ + ((void)(((len & 1) != 0)&& \ + ((tortoise = XCDR (tortoise)), 0)), \ + (EQ (hare, tortoise) && \ + (signal_circular_list_error (list), 0))))) /* GET_LIST_LENGTH and GET_EXTERNAL_LIST_LENGTH: @@ -672,6 +673,7 @@ do { \ Lisp_Object GELL_elt, GELL_tail; \ EXTERNAL_LIST_LOOP_4_NO_DECLARE (GELL_elt, list, GELL_tail, len) \ ; \ + (void)GELL_elt; \ } while (0) /* For a list that's known to be in valid list format, where we may @@ -719,7 +721,7 @@ do { \ list = XCDR (tail_##elt); \ else \ XCDR (prev_tail_##elt) = XCDR (tail_##elt); \ - /* Keep tortoise from ever passing hare. */ \ + /* Keep tortoise from ever passing hare. */ \ len_##elt = 0; \ } \ else \ @@ -842,7 +844,7 @@ EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \ tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH) #define EXTERNAL_PROPERTY_LIST_LOOP_7(key, value, list, len, hare, \ - tortoise, suspicion_length) \ + tortoise, suspicion_length) \ for (tortoise = hare = list, len = 0; \ \ ((CONSP (hare) && \ @@ -1313,6 +1315,9 @@ extern_inline EMACS_INT XCHAR_OR_INT(Lisp_Object obj) x = wrong_type_argument (Qinteger_char_or_marker_p, x); \ } while (0) +/* basic integer definitions, used quite a lot */ +#include "ent/ent-int.h" + /*--------------------------- readonly objects -------------------------*/ #define CHECK_C_WRITEABLE(obj) \ @@ -2319,18 +2324,18 @@ void debug_gcpro5(char *, int, struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *, Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *); void debug_gcpro6(char *, int, struct gcpro *, struct gcpro *, struct gcpro *, - struct gcpro *, struct gcpro *, struct gcpro *, Lisp_Object *, - Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *, - Lisp_Object *); + struct gcpro *, struct gcpro *, struct gcpro *, Lisp_Object *, + Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *, + Lisp_Object *); void debug_gcpro7(char *, int, struct gcpro *, struct gcpro *, struct gcpro *, - struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *, - Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *, - Lisp_Object *, Lisp_Object *, Lisp_Object *); + struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *, + Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *, + Lisp_Object *, Lisp_Object *, Lisp_Object *); void debug_gcpro8(char *, int, struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *, - struct gcpro *, Lisp_Object *, Lisp_Object *, - Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *, - Lisp_Object *, Lisp_Object *); + struct gcpro *, Lisp_Object *, Lisp_Object *, + Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *, + Lisp_Object *, Lisp_Object *); void debug_ungcpro(char *, int, struct gcpro *); #define GCPRO1(v) \ @@ -2347,13 +2352,13 @@ void debug_ungcpro(char *, int, struct gcpro *); &v1,&v2,&v3,&v4,&v5) #define GCPRO6(v1,v2,v3,v4,v5,v6) \ debug_gcpro6 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,&gcpro6, \ - &v1,&v2,&v3,&v4,&v5,&v6) + &v1,&v2,&v3,&v4,&v5,&v6) #define GCPRO7(v1,v2,v3,v4,v5,v6,v7) \ debug_gcpro7 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,&gcpro6,&gcpro7,\ &v1,&v2,&v3,&v4,&v5,&v6,&v7) #define GCPRO8(v1,v2,v3,v4,v5,v6,v7,v8) \ debug_gcpro8 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,&gcpro6,&gcpro7,&gcpro8, \ - &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8) + &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8) #define UNGCPRO \ debug_ungcpro(__FILE__, __LINE__,&gcpro1) @@ -2371,13 +2376,13 @@ void debug_ungcpro(char *, int, struct gcpro *); &ngcpro5,&v1,&v2,&v3,&v4,&v5) #define NGCPRO6(v1,v2,v3,v4,v5,v6) \ debug_gcpro6 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,&ngcpro5,&ngcpro6, \ - &v1,&v2,&v3,&v4,&v5,&v6) + &v1,&v2,&v3,&v4,&v5,&v6) #define NGCPRO7(v1,v2,v3,v4,v5,v6,v7) \ debug_gcpro7 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,&ngcpro5,&ngcpro6,&ngcpro7,\ &v1,&v2,&v3,&v4,&v5,&v6,&v7) #define NGCPRO8(v1,v2,v3,v4,v5,v6,v7,v8) \ debug_gcpro8 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,&ngcpro5,&ngcpro6,&ngcpro7,&ngcpro8, \ - &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8) + &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8) #define NUNGCPRO \ debug_ungcpro(__FILE__, __LINE__,&ngcpro1) @@ -2395,13 +2400,13 @@ void debug_ungcpro(char *, int, struct gcpro *); &nngcpro5,&v1,&v2,&v3,&v4,&v5) #define NNGCPRO6(v1,v2,v3,v4,v5,v6) \ debug_gcpro6 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,&nngcpro5,&nngcpro6, \ - &v1,&v2,&v3,&v4,&v5,&v6) + &v1,&v2,&v3,&v4,&v5,&v6) #define NNGCPRO7(v1,v2,v3,v4,v5,v6,v7) \ debug_gcpro7 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,&nngcpro5,&nngcpro6,&nngcpro7,\ &v1,&v2,&v3,&v4,&v5,&v6,&v7) #define NNGCPRO8(v1,v2,v3,v4,v5,v6,v7,v8) \ debug_gcpro8 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,&nngcpro5,&nngcpro6,&nngcpro7,&nngcpro8, \ - &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8) + &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8) #define NNUNGCPRO \ debug_ungcpro(__FILE__, __LINE__,&nngcpro1) @@ -2469,8 +2474,29 @@ void staticpro_nodump(Lisp_Object *); /* allocation goodies */ #include "opaque.h" -/* for size computation */ -#include "ent/ent.h" + +static inline EMACS_INT +__attribute__((always_inline)) +__next_2power(EMACS_INT v) +{ +/* compute the next 2-power of in */ + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; +#if SIZEOF_EMACS_INT >= 4 + v |= v >> 16; +#endif /* sizeof(EMACS_INT) >= 4 */ +#if SIZEOF_EMACS_INT >= 8 + v |= v >> 32; +#endif /* sizeof(EMACS_INT) >= 8 */ +#if SIZEOF_EMACS_INT >= 16 + v |= v >> 64; +#endif /* sizeof(EMACS_INT) >= 16 */ + v++; + return v; +} /* also generally useful if you want to avoid arbitrary size limits but don't need a full dynamic array. Assumes that BASEVAR points @@ -2479,16 +2505,14 @@ void staticpro_nodump(Lisp_Object *); macro will realloc BASEVAR as necessary so that it can hold at least NEEDED_SIZE objects. The reallocing is done by doubling, which ensures constant amortized time per element. */ -extern_inline EMACS_INT -__alloc_size(EMACS_INT sz, EMACS_INT needed) - __attribute__((always_inline)); -extern_inline EMACS_INT +static inline EMACS_INT +__attribute__((always_inline)) __alloc_size(EMACS_INT sz, EMACS_INT needed) { if (UNLIKELY(needed <= 32)) { return 32; } - return 1 << (1 + __ase_flsl(needed - 1)); + return __next_2power(needed); } #define DO_REALLOC(basevar, sizevar, needed_size, type) \ @@ -2690,12 +2714,12 @@ typedef unsigned long uintptr_t; #endif /************************************************************************/ -/* Misc definitions */ +/* Misc definitions */ /************************************************************************/ #include "dllist.h" /************************************************************************/ -/* Other numeric types */ +/* Other numeric types */ /************************************************************************/ /* more allocation goodies, C99 wise */ @@ -2864,6 +2888,7 @@ Lisp_Object emacs_doprnt_string_lisp_2(const Bufbyte *, Lisp_Object, void uncache_home_directory(void); Extbyte *get_home_directory(void); char *user_login_name(uid_t *); +char *user_group_name(gid_t *); Bufpos bufpos_clip_to_bounds(Bufpos, Bufpos, Bufpos); Bytind bytind_clip_to_bounds(Bytind, Bytind, Bytind); void buffer_insert1(struct buffer *, Lisp_Object); @@ -3047,8 +3072,8 @@ Lisp_Object call1_trapping_errors(char*, Lisp_Object, Lisp_Object); Lisp_Object call2_trapping_errors(char*, Lisp_Object, Lisp_Object, Lisp_Object); Lisp_Object call3_trapping_errors(char*, - Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object); + Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object); Lisp_Object call_with_suspended_errors(lisp_fn_t, volatile Lisp_Object, Lisp_Object, Error_behavior, int, ...); /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */ @@ -3262,14 +3287,14 @@ void write_string_1(const Bufbyte *, Bytecount, Lisp_Object); void print_cons(Lisp_Object, Lisp_Object, int); void print_vector(Lisp_Object, Lisp_Object, int); void print_string(Lisp_Object, Lisp_Object, int); -char *long_to_string(char *, long); +char *long_to_string(char *, long, int); void print_internal(Lisp_Object, Lisp_Object, int); void print_symbol(Lisp_Object, Lisp_Object, int); /* The number of bytes required to store the decimal printed * representation of an integral type. Add a few bytes for truncation, * optional sign prefix, and null byte terminator. * 2.40824 == log (256) / log (10). - * + * * We don't use floating point since Sun cc (buggily?) cannot use * floating point computations to define a compile-time integral * constant. @@ -3621,6 +3646,7 @@ EXFUN(Fupcase_initials_region, 3); EXFUN(Fupcase_region, 3); EXFUN(Fuser_home_directory, 0); EXFUN(Fuser_login_name, 1); +EXFUN(Fuser_group_name, 1); EXFUN(Fvector, MANY); EXFUN(Fverify_visited_file_modtime, 1); EXFUN(Fvertical_motion, 3); @@ -3699,7 +3725,7 @@ extern Lisp_Object Qrun_hooks, Qsans_modifiers; extern Lisp_Object Qsave_buffers_kill_emacs; extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo; extern Lisp_Object Qsequencep, Qset, Qsetting_constant; -extern Lisp_Object Qseven, Qshift_jis, Qshort; +extern Lisp_Object Qseven, Qshift_jis; extern Lisp_Object Qsingularity_error; extern Lisp_Object Qstandard_input, Qstandard_output; extern Lisp_Object Qstart_open; @@ -3716,7 +3742,6 @@ 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