aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorMiles Bader <[email protected]>2004-04-26 00:21:41 +0000
committerMiles Bader <[email protected]>2004-04-26 00:21:41 +0000
commite32d987200ff81685dbc52d7ada1692169763fe1 (patch)
treef4ebdcea0a57c2f2344bcbdbffa921a144204dbf /src/lisp.h
parente198ba8711821da8fec10d1ab5d836f058fcf646 (diff)
Revision: [email protected]/emacs--cvs-trunk--0--patch-248
src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lisp.h b/src/lisp.h
index aa1e0cb8e4..ce5a5c5917 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3185,6 +3185,32 @@ extern Lisp_Object Vdirectory_sep_char;
? make_float (val) \
: make_number ((EMACS_INT)(val)))
+
+/* Checks the `cycle check' variable CHECK to see if it indicates that
+ EL is part of a cycle; CHECK must be either Qnil or a value returned
+ by an earlier use of CYCLE_CHECK. SUSPICIOUS is the number of
+ elements after which a cycle might be suspected; after that many
+ elements, this macro begins consing in order to keep more precise
+ track of elements.
+
+ Returns nil if a cycle was detected, otherwise a new value for CHECK
+ that includes EL.
+
+ CHECK is evaluated multiple times, EL and SUSPICIOUS 0 or 1 times, so
+ the caller should make sure that's ok. */
+
+#define CYCLE_CHECK(check, el, suspicious) \
+ (NILP (check) \
+ ? make_number (0) \
+ : (INTEGERP (check) \
+ ? (XFASTINT (check) < (suspicious) \
+ ? make_number (XFASTINT (check) + 1) \
+ : Fcons (el, Qnil)) \
+ : (!NILP (Fmemq ((el), (check))) \
+ ? Qnil \
+ : Fcons ((el), (check)))))
+
+
#endif /* EMACS_LISP_H */
/* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e