diff options
| author | Joakim Verona | 2011-08-27 19:45:48 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-08-27 19:45:48 +0200 |
| commit | 9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4 (patch) | |
| tree | e94476d49f15747fcb9409d773702e88201855a4 /src/lisp.h | |
| parent | c7489583c30031c0ecfae9d20b20c149ca1935e9 (diff) | |
| parent | b75258b32810f3690442bddef2e10eef126d2d25 (diff) | |
| download | emacs-9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4.tar.gz emacs-9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4.zip | |
upstream
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/lisp.h b/src/lisp.h index 14bd429a45e..5ca31132668 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1708,6 +1708,11 @@ typedef struct { | |||
| 1708 | #define NUMBERP(x) (INTEGERP (x) || FLOATP (x)) | 1708 | #define NUMBERP(x) (INTEGERP (x) || FLOATP (x)) |
| 1709 | #define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0) | 1709 | #define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0) |
| 1710 | 1710 | ||
| 1711 | #define RANGED_INTEGERP(lo, x, hi) \ | ||
| 1712 | (INTEGERP (x) && (lo) <= XINT (x) && XINT (x) <= (hi)) | ||
| 1713 | #define TYPE_RANGED_INTEGERP(type, x) \ | ||
| 1714 | RANGED_INTEGERP (TYPE_MINIMUM (type), x, TYPE_MAXIMUM (type)) | ||
| 1715 | |||
| 1711 | #define INTEGERP(x) (LISP_INT_TAG_P (XTYPE ((x)))) | 1716 | #define INTEGERP(x) (LISP_INT_TAG_P (XTYPE ((x)))) |
| 1712 | #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) | 1717 | #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) |
| 1713 | #define MISCP(x) (XTYPE ((x)) == Lisp_Misc) | 1718 | #define MISCP(x) (XTYPE ((x)) == Lisp_Misc) |
| @@ -2555,6 +2560,7 @@ extern void syms_of_syntax (void); | |||
| 2555 | 2560 | ||
| 2556 | /* Defined in fns.c */ | 2561 | /* Defined in fns.c */ |
| 2557 | extern Lisp_Object QCrehash_size, QCrehash_threshold; | 2562 | extern Lisp_Object QCrehash_size, QCrehash_threshold; |
| 2563 | enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; | ||
| 2558 | extern EMACS_INT next_almost_prime (EMACS_INT); | 2564 | extern EMACS_INT next_almost_prime (EMACS_INT); |
| 2559 | extern Lisp_Object larger_vector (Lisp_Object, EMACS_INT, Lisp_Object); | 2565 | extern Lisp_Object larger_vector (Lisp_Object, EMACS_INT, Lisp_Object); |
| 2560 | extern void sweep_weak_hash_tables (void); | 2566 | extern void sweep_weak_hash_tables (void); |
| @@ -2566,8 +2572,8 @@ EMACS_UINT sxhash (Lisp_Object, int); | |||
| 2566 | Lisp_Object make_hash_table (Lisp_Object, Lisp_Object, Lisp_Object, | 2572 | Lisp_Object make_hash_table (Lisp_Object, Lisp_Object, Lisp_Object, |
| 2567 | Lisp_Object, Lisp_Object, Lisp_Object, | 2573 | Lisp_Object, Lisp_Object, Lisp_Object, |
| 2568 | Lisp_Object); | 2574 | Lisp_Object); |
| 2569 | EMACS_INT hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); | 2575 | ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); |
| 2570 | EMACS_INT hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, | 2576 | ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, |
| 2571 | EMACS_UINT); | 2577 | EMACS_UINT); |
| 2572 | void init_weak_hash_tables (void); | 2578 | void init_weak_hash_tables (void); |
| 2573 | extern void init_fns (void); | 2579 | extern void init_fns (void); |
| @@ -3573,6 +3579,9 @@ extern int immediate_quit; /* Nonzero means ^G can quit instantly */ | |||
| 3573 | extern POINTER_TYPE *xmalloc (size_t); | 3579 | extern POINTER_TYPE *xmalloc (size_t); |
| 3574 | extern POINTER_TYPE *xrealloc (POINTER_TYPE *, size_t); | 3580 | extern POINTER_TYPE *xrealloc (POINTER_TYPE *, size_t); |
| 3575 | extern void xfree (POINTER_TYPE *); | 3581 | extern void xfree (POINTER_TYPE *); |
| 3582 | extern void *xnmalloc (ptrdiff_t, ptrdiff_t); | ||
| 3583 | extern void *xnrealloc (void *, ptrdiff_t, ptrdiff_t); | ||
| 3584 | extern void *xpalloc (void *, ptrdiff_t *, ptrdiff_t, ptrdiff_t, ptrdiff_t); | ||
| 3576 | 3585 | ||
| 3577 | extern char *xstrdup (const char *); | 3586 | extern char *xstrdup (const char *); |
| 3578 | 3587 | ||
| @@ -3690,6 +3699,23 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3690 | } \ | 3699 | } \ |
| 3691 | } while (0) | 3700 | } while (0) |
| 3692 | 3701 | ||
| 3702 | /* SAFE_NALLOCA sets BUF to a newly allocated array of MULTIPLIER * | ||
| 3703 | NITEMS items, each of the same type as *BUF. MULTIPLIER must | ||
| 3704 | positive. The code is tuned for MULTIPLIER being a constant. */ | ||
| 3705 | |||
| 3706 | #define SAFE_NALLOCA(buf, multiplier, nitems) \ | ||
| 3707 | do { \ | ||
| 3708 | if ((nitems) <= MAX_ALLOCA / sizeof *(buf) / (multiplier)) \ | ||
| 3709 | (buf) = alloca (sizeof *(buf) * (multiplier) * (nitems)); \ | ||
| 3710 | else \ | ||
| 3711 | { \ | ||
| 3712 | (buf) = xnmalloc (nitems, sizeof *(buf) * (multiplier)); \ | ||
| 3713 | sa_must_free = 1; \ | ||
| 3714 | record_unwind_protect (safe_alloca_unwind, \ | ||
| 3715 | make_save_value (buf, 0)); \ | ||
| 3716 | } \ | ||
| 3717 | } while (0) | ||
| 3718 | |||
| 3693 | /* SAFE_FREE frees xmalloced memory and enables GC as needed. */ | 3719 | /* SAFE_FREE frees xmalloced memory and enables GC as needed. */ |
| 3694 | 3720 | ||
| 3695 | #define SAFE_FREE() \ | 3721 | #define SAFE_FREE() \ |