/* the old SXEmacs general includes and utility macros moved here: */
#include "sxe-utils.h"
+#include "sxe-memory.h"
/* ------------------------ dynamic arrays ------------------- */
{
LIST_LOOP_3 (elt, list, tail)
{
- execute_code_here;
+ execute_code_here;
}
}
#define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \
tortoise, suspicion_length) \
for (tortoise = hare = list, len = 0; \
- \
+ \
(CONSP (hare) ? ((elt = XCAR (hare)), 1) : \
(NILP (hare) ? 0 : \
(signal_malformed_list_error (list), 0))); \
- \
- (hare = XCDR (hare)), \
+ (hare = XCDR (hare)), SXE_SET_UNUSED(elt), \
(void)((++len > suspicion_length) && \
((void)(((len & 1) != 0)&& \
((tortoise = XCDR (tortoise)), 0)), \
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
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 \
#define PRIVATE_EXTERNAL_ALIST_LOOP_8(elt, elt_car, elt_cdr, list, len, \
hare, tortoise, suspicion_length) \
+SXE_SET_UNUSED(elt_car),SXE_SET_UNUSED(elt_cdr); \
PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, hare, tortoise, \
suspicion_length) \
if (CONSP (elt) ? (elt_car = XCAR (elt), elt_cdr = XCDR (elt), 0) :1) \
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) && \
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) \
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) \
&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)
&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)
&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)
/* 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
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) \
#endif
\f
/************************************************************************/
-/* Misc definitions */
+/* Misc definitions */
/************************************************************************/
#include "dllist.h"
\f
/************************************************************************/
-/* Other numeric types */
+/* Other numeric types */
/************************************************************************/
/* more allocation goodies, C99 wise */
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);
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 */
* 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.
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);
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;
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