/* general definitions */
/************************************************************************/
-/* ------------------------ include files ------------------- */
-
-/* We include the following generally useful header files so that you
- don't have to worry about prototypes when using the standard C
- library functions and macros. These files shouldn't be excessively
- large so they shouldn't cause that much of a slowdown. */
-
-#include <stdlib.h>
-#include <string.h> /* primarily for memcpy, etc. */
-#include <stdio.h> /* NULL, etc. */
-#include <ctype.h>
-#include <stdarg.h>
-#include <stddef.h> /* offsetof */
-#include <sys/types.h>
-#include <limits.h>
-#if defined HAVE_STDBOOL_H
-# include <stdbool.h>
-#endif
-
-/* goodies */
-#ifdef UNUSED
-#elif defined(__GNUC__)
-# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
-#elif defined(__LCLINT__)
-# define UNUSED(x) /*@unused@*/ x
-#else
-# define UNUSED(x) x
-#endif
-
-#ifdef WEAK_EXTERN
-#elif defined(__GNUC__)
-# define WEAK_EXTERN extern __attribute__((weak))
-#else
-# error "Grrr, bloody 'ell, can't figure out how to create weak symbols"
-#endif
-
-#ifdef WEAK
-#elif defined(__GNUC__)
-# define WEAK __attribute__((weak))
-#else
-# error "Grrr, bloody 'ell, can't figure out how to create weak symbols"
-#endif
-
-
-#ifdef LIKELY
-#else
-#define LIKELY(_x) __builtin_expect(!!(_x), 1)
-#endif
-#ifdef UNLIKELY
-#else
-#define UNLIKELY(_x) __builtin_expect(!!(_x), 0)
-#endif
-
-#if defined SXE_STATIC_EXTERN_INLINE
-# define extern_inline static inline
-#elif !defined __GNUC_STDC_INLINE__ && !defined SXE_INLINE_NO_EXTERN
-# define extern_inline extern inline
-#else
-# define extern_inline inline
-#endif
-
-#ifdef ALL_DEBUG_FLAGS
-#undef SXE_DEBUG_FLAG
-#define SXE_DEBUG_FLAG
-#endif
-
-#define __SXE_DEBUG__(args...) fprintf(stderr, "SXE " args)
-#ifndef SXE_DEBUG_FLAG
-#define SXE_DEBUG(args...)
-#else
-#define SXE_DEBUG(args...) __SXE_DEBUG__(args)
-#endif
-#define SXE_DEBUG_PT(args...) SXE_DEBUG("[pthread]: " args)
-#define SXE_CRITICAL(args...) __SXE_DEBUG__("CRITICAL: " args)
-
-
-
-/* We define assert iff USE_ASSERTIONS or DEBUG_SXEMACS is defined.
- Otherwise we define it to be empty. Quantify has shown that the
- 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) */
-void assert_failed(const char *, int, const char *);
-# define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
-# define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
-#else
-# ifdef DEBUG_SXEMACS
-# define assert(x) ((x) ? (void) 0 : (void) abort ())
-# else
-# define assert(x)
-# endif
-#endif
-
-/* from c.ac */
-#ifndef BITS_PER_CHAR
-#define BITS_PER_CHAR 8
-#endif
-#define SXE_SHORTBITS (SIZEOF_SHORT * BITS_PER_CHAR)
-#define SXE_INTBITS (SIZEOF_INT * BITS_PER_CHAR)
-#define SXE_LONGBITS (SIZEOF_LONG * BITS_PER_CHAR)
-#define SXE_LONG_LONG_BITS (SIZEOF_LONG_LONG_INT * BITS_PER_CHAR)
-#define SXE_VOID_P_BITS (SIZEOF_VOID_P * BITS_PER_CHAR)
-
+/* the old SXEmacs general includes and utility macros moved here: */
+#include "sxe-utils.h"
+#include "sxe-memory.h"
/* ------------------------ dynamic arrays ------------------- */
size_t Dynarr_memory_usage(void *d, struct overhead_stats *stats);
#endif
-/* Also define min() and max(). (Some compilers put them in strange
- places that won't be referenced by the above include files, such
- as 'macros.h' under Solaris.) */
-
-#ifndef min
-#define min(a,b) (((a) <= (b)) ? (a) : (b))
-#endif
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif
\f
-/************************************************************************/
-/* Memory */
-/************************************************************************/
-
-#ifdef ALL_DEBUG_FLAGS
-#undef GC_DEBUG_FLAG
-#define GC_DEBUG_FLAG
-#endif
-
-#if !defined GC_DEBUG_FLAG
-# define SXE_DEBUG_GC(args...)
-#else
-# define SXE_DEBUG_GC(args...) __SXE_DEBUG__("[gc] " args)
-#endif
-#define SXE_DEBUG_GC_PT(args...) SXE_DEBUG_GC("[pthread]: " args)
-#define SXE_CRITICAL_GC(args...) __SXE_DEBUG__("[gc] CRITICAL: " args)
-
-void malloc_warning(const char *);
-#if defined HAVE_BDWGC && defined EF_USE_BDWGC
-# if defined HAVE_THREADS
-# if !defined GC_PTHREADS
-# define GC_PTHREADS 1
-# endif /* !GC_PTHREADS */
-# if !defined GC_THREADS
-# define GC_THREADS 1
-# endif /* !GC_THREADS */
-# endif /* HAVE_THREADS */
-
-# undef GC_DEBUG
-# if defined GC_DEBUG_FLAG
-# define GC_DEBUG 1
-# endif /* GC_DEBUG_FLAG */
-# if defined HAVE_GC_GC_H
-# include <gc/gc.h>
-# elif defined HAVE_GC_H
-# include <gc.h>
-# else
-# error "Take less of those pills!"
-# endif
-
-# if defined GC_DEBUG_FLAG
-# define zmalloc GC_MALLOC_IGNORE_OFF_PAGE
-# define zcalloc(n, m) GC_MALLOC((n)*(m))
-# define zmalloc_atomic GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE
-# define zmalloc_and_zero GC_MALLOC
-# define zrealloc GC_REALLOC
-# define zstrdup GC_STRDUP
-# undef zfree
-# define zfree(x) GC_FREE(x)
-# else /* !GC_DEBUG_FLAG */
-# define zmalloc GC_malloc_ignore_off_page
-# define zcalloc(n, m) GC_malloc((n)*(m))
-# define zmalloc_atomic GC_malloc_atomic_ignore_off_page
-# define zmalloc_and_zero GC_malloc
-# define zrealloc GC_realloc
-# define zstrdup GC_strdup
-# undef zfree
-# define zfree(x)
-# endif /* GC_DEBUG_FLAG */
-
-#else /* !BDWGC */
-#define zmalloc F&^!
-#define zcalloc F&^!
-#define zmalloc_atomic F&^!
-#define zmalloc_and_zero F&^!
-#define zrealloc F&^!
-#define zstrdrup F&^!
-#endif /* BDWGC */
-
-/* also define libc mem funs */
-#define ymalloc malloc
-#define ycalloc(n, m) calloc(n, m)
-#define ymalloc_atomic(n) ycalloc(1, n)
-#define ymalloc_and_zero(x) ycalloc(1, x)
-#define yrealloc realloc
-#define ystrdup strdup
-#define yfree(x) free(x)
-/* and their convenience companions */
-#define ynew(type) ((type*)ymalloc(sizeof(type)))
-#define ynew_array(type, len) ((type*)ymalloc((len) * sizeof(type)))
-#define ynew_and_zero(type) ((type*)ymalloc_and_zero(sizeof(type)))
-#define ynew_array_and_zero(type, len) \
- ((type*)ymalloc_and_zero((len) * sizeof(type)))
-#define YREALLOC_ARRAY(ptr, type, len) \
- ((void)(ptr = (type *)yrealloc(ptr, (len) * sizeof (type))))
-
-#if defined HAVE_BDWGC && defined EF_USE_BDWGC
-/* and now the x* series */
-# define xmalloc zmalloc
-# define xcalloc zcalloc
-# define xmalloc_atomic zmalloc_atomic
-# define xmalloc_and_zero zmalloc_and_zero
-# define xrealloc zrealloc
-# define xstrdup zstrdup
-# if defined ERROR_CHECK_MALLOC
-# define xfree(args...) zfree(args)
-# else /* !ERROR_CHECK_MALLOC */
-# define xfree(args...)
-# endif /* ERROR_CHECK_MALLOC */
-
-#else /* !BDWGC */
-void *xmalloc(size_t size);
-void *xmalloc_atomic(size_t size);
-void *xmalloc_and_zero(size_t size);
-void *xrealloc(void *, size_t size);
-char *xstrdup(const char *);
-# if defined ERROR_CHECK_MALLOC
-# if SIZEOF_VOID_P == 4
-# define xfree(lvalue) \
- do { \
- void *volatile *xfree_ptr = \
- (void *volatile*) \
- ((volatile void*)&(lvalue)); \
- assert(*xfree_ptr != (void*)0xB00BB4BE); \
- yfree(*xfree_ptr); \
- *xfree_ptr = (void*)0xB00BB4BE; \
- } while (0)
-# elif SIZEOF_VOID_P == 8
-# define xfree(lvalue) \
- do { \
- void *volatile *xfree_ptr = \
- (void *volatile*) \
- ((volatile void*)&(lvalue)); \
- assert(*xfree_ptr != (void*)0xCAFEBABEDEADBEEF); \
- yfree(*xfree_ptr); \
- *xfree_ptr = (void*)0xCAFEBABEDEADBEEF; \
- } while (0)
-# else /* huh? */
-# error "Strange-arse system detected. Watch a movie, it\'s more fun!"
-# endif
-# else /* !ERROR_CHECK_MALLOC */
-# define xfree(args...) yfree(args)
-# endif /* ERROR_CHECK_MALLOC */
-#endif /* BDWGC */
-
-/* generally useful */
-#define countof(x) ((int) (sizeof(x)/sizeof((x)[0])))
-#define xnew(type) ((type *) xmalloc (sizeof (type)))
-#define xnew_atomic(type) ((type *) xmalloc_atomic (sizeof (type)))
-#define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type)))
-#define xnew_atomic_array(type, len) \
- ((type*)xmalloc_atomic((len) * sizeof(type)))
-#define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type)))
-#define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue)))
-#define xnew_array_and_zero(type, len) \
- ((type*)xmalloc_and_zero ((len) * sizeof (type)))
-#define xrealloc_array(ptr, type, len) \
- ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type))))
-#define XREALLOC_ARRAY xrealloc_array
-#define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type)))
-
-#if !defined HAVE_DECL_STRDUP
-extern char *strdup(const char *s);
-#endif /* HAVE_DECL_STRDUP */
-
-#ifndef PRINTF_ARGS
-# if defined (__GNUC__) && (__GNUC__ >= 2)
-# define PRINTF_ARGS(string_index,first_to_check) \
- __attribute__ ((format (printf, string_index, first_to_check)))
-# else
-# define PRINTF_ARGS(string_index,first_to_check)
-# endif /* GNUC */
-#endif
-
-#ifndef DOESNT_RETURN
-# if defined __GNUC__
-# if ((__GNUC__ > 2) || (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
-# define DOESNT_RETURN void
-# define DECLARE_DOESNT_RETURN(decl) \
- extern void decl __attribute__ ((noreturn))
-# define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
- /* Should be able to state multiple independent __attribute__s, but \
- the losing syntax doesn't work that way, and screws losing cpp */ \
- extern void decl \
- __attribute__ ((noreturn, format (printf, str, idx)))
-# else
-# define DOESNT_RETURN void volatile
-# define DECLARE_DOESNT_RETURN(decl) extern void volatile decl
-# define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
- extern void volatile decl PRINTF_ARGS(str,idx)
-# endif /* GNUC 2.5 */
-# else
-# define DOESNT_RETURN void
-# define DECLARE_DOESNT_RETURN(decl) extern void decl
-# define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
- extern void decl PRINTF_ARGS(str,idx)
-# 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)
-/* 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
-/* C++ is annoying, but it has a big bag of tricks.
- The following doesn't have the "inside out" declaration bug C does. */
-template < typename T > struct alignment_trick {
- char c;
- T member;
-};
-# define ALIGNOF(type) offsetof (alignment_trick<type>, member)
-# 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 ((size_t) (ptr), unit))
-
-#ifndef DO_NOTHING
-#define DO_NOTHING do {} while (0)
-#endif
-
-#ifndef DECLARE_NOTHING
-#define DECLARE_NOTHING struct nosuchstruct
-#endif
/*#ifdef DEBUG_SXEMACS*/
#define REGISTER
{
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))); \
+ for (tortoise = hare = list, len = 0; \
\
- hare = XCDR (hare), \
- (void) \
- ((++len > suspicion_length) \
- && \
- ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \
- (EQ (hare, tortoise) && (signal_circular_list_error (list), 0)))))
+ (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \
+ (NILP (hare) ? 0 : \
+ (signal_malformed_list_error (list), 0))); \
+ (hare = XCDR (hare)), SXE_SET_UNUSED(elt), \
+ (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:
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 */
* Note: stream should be defaulted before calling
* (eg Qnil means stdout, not Vstandard_output, etc) */
void write_c_string(const char *, Lisp_Object);
+void write_hex_ptr(void*, Lisp_Object);
+int write_fmt_str(Lisp_Object,const char *,...) PRINTF_ARGS(2, 3);
+int write_fmt_string(Lisp_Object,const char *,...) PRINTF_ARGS(2, 3);
/* Same goes for this function. */
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.
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