[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/lexspaces 67e28d9 02/17: Adding binding pseudovector
From: |
Andrea Corallo |
Subject: |
scratch/lexspaces 67e28d9 02/17: Adding binding pseudovector |
Date: |
Fri, 8 May 2020 16:43:06 -0400 (EDT) |
branch: scratch/lexspaces
commit 67e28d9f1060fd41c2e187e017b26a2d474b6075
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>
Adding binding pseudovector
---
src/lexspaces.c | 2 ++
src/lisp.h | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/src/lexspaces.c b/src/lexspaces.c
index ed15a50..feb0adf 100644
--- a/src/lexspaces.c
+++ b/src/lexspaces.c
@@ -31,6 +31,8 @@ DEFUN ("in-lexspace", Fin_lexspace, Sin_lexspace, 1, 1, 0,
void
syms_of_lexspaces (void)
{
+ DEFSYM (Qbinding, "binding");
+
DEFSYM (Qel, "el");
DEFVAR_LISP ("current-lexspace-name", Vcurrent_lexspace_name,
doc: /* Internal use. */);
diff --git a/src/lisp.h b/src/lisp.h
index 58ea559..15b1f8d 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -786,6 +786,7 @@ INLINE void
Lisp_Intfwd, etc.). The pointer is packaged inside a struct to
help static checking. */
typedef struct { void const *fwdptr; } lispfwd;
+
/* Interned state of a symbol. */
@@ -1103,6 +1104,7 @@ enum pvec_type
PVEC_MUTEX,
PVEC_CONDVAR,
PVEC_MODULE_FUNCTION,
+ PVEC_BINDING,
/* These should be last, for internal_equal and sxhash_obj. */
PVEC_COMPILED,
@@ -2936,6 +2938,12 @@ RECORDP (Lisp_Object a)
return PSEUDOVECTORP (a, PVEC_RECORD);
}
+INLINE bool
+BINDINGP (Lisp_Object a)
+{
+ return PSEUDOVECTORP (a, PVEC_BINDING);
+}
+
INLINE void
CHECK_RECORD (Lisp_Object x)
{
@@ -5035,6 +5043,41 @@ maybe_gc (void)
maybe_garbage_collect ();
}
+
+/* Lexspaces and binding. */
+
+#define MAX_LEXSPACES 256
+
+struct Lisp_Binding
+{
+ union vectorlike_header header;
+ Lisp_Object b[MAX_LEXSPACES];
+};
+
+INLINE void
+CHECK_BINDING (Lisp_Object b)
+{
+ CHECK_TYPE (BINDINGP (b), Qbinding, b);
+}
+
+INLINE struct Lisp_Binding *
+XBINDING (Lisp_Object b)
+{
+ eassert (BINDINGP (b));
+ return XUNTAG (b, Lisp_Vectorlike, struct Lisp_Binding);
+}
+
+INLINE Lisp_Object
+make_binding (void)
+{
+ struct Lisp_Binding *binding =
+ ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Binding,
+ b[MAX_LEXSPACES], PVEC_BINDING);
+ for (EMACS_INT i = 0; i < MAX_LEXSPACES; i++)
+ binding->b[i] = Qunbound;
+ return make_lisp_ptr (binding, Lisp_Vectorlike);
+}
+
INLINE_HEADER_END
#endif /* EMACS_LISP_H */
- branch scratch/lexspaces created (now e2f183c), Andrea Corallo, 2020/05/08
- scratch/lexspaces 67e28d9 02/17: Adding binding pseudovector,
Andrea Corallo <=
- scratch/lexspaces 2d1e916 01/17: Add lexspaces.c, Andrea Corallo, 2020/05/08
- scratch/lexspaces 64e442b 04/17: Add SYMBOL_FUNCTION accessor function, Andrea Corallo, 2020/05/08
- scratch/lexspaces 02d8ef2 05/17: Move symbol value into separate binding, Andrea Corallo, 2020/05/08
- scratch/lexspaces 3a57250 06/17: Add lexspace-make-from, Andrea Corallo, 2020/05/08
- scratch/lexspaces 7fecbf5 08/17: Add lexspace redirection, Andrea Corallo, 2020/05/08
- scratch/lexspaces 09821e3 03/17: Store symbol value into the binding, Andrea Corallo, 2020/05/08
- scratch/lexspaces 04ac507 14/17: Remove unnecessary assertion, Andrea Corallo, 2020/05/08
- scratch/lexspaces 00108a5 15/17: Fix sweep_symbols, Andrea Corallo, 2020/05/08
- scratch/lexspaces 295ac3d 07/17: Make in-lexspace do something, Andrea Corallo, 2020/05/08
- scratch/lexspaces 610552d 10/17: Add SYMBOL_FUNC_LEXSPACE, Andrea Corallo, 2020/05/08