diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-03-16 12:31:07 -0400 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-03-16 12:31:07 -0400 |
| commit | ffbb46849990bf4bf952e01b78c9a1a0ca0d4432 (patch) | |
| tree | ab2d6dbd1f93e8c42a8508342abfb379a4a14d9f | |
| parent | 265a5d9791bf42da0bab7bdbef4352e8d734ef31 (diff) | |
| download | emacs-ffbb46849990bf4bf952e01b78c9a1a0ca0d4432.tar.gz | |
Add obarray-size and fix tests accordingly. Use obarrayp in cedet.
* lisp/obarray.el (obarray-size): New function.
* lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-symbol)
(semantic-lex-spp-save-table, semantic-lex-spp-macros):
* lisp/cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Use obarrayp.
* test/lisp/obarray-tests.el (obarray-make-default-test)
(obarray-make-with-size-test): Use it.
| -rw-r--r-- | lisp/cedet/semantic/bovine/c.el | 2 | ||||
| -rw-r--r-- | lisp/cedet/semantic/lex-spp.el | 14 | ||||
| -rw-r--r-- | lisp/obarray.el | 4 | ||||
| -rw-r--r-- | test/lisp/obarray-tests.el | 6 |
4 files changed, 16 insertions, 10 deletions
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el index bef4b179b23..3200a5c1435 100644 --- a/lisp/cedet/semantic/bovine/c.el +++ b/lisp/cedet/semantic/bovine/c.el @@ -2253,7 +2253,7 @@ actually in their parent which is not accessible.") (princ " Your project symbol map is also derived from the EDE object:\n ") (princ (object-print ede-object))) (princ "\n\n") - (if (arrayp semantic-lex-spp-project-macro-symbol-obarray) + (if (obarrayp semantic-lex-spp-project-macro-symbol-obarray) (let ((macros nil)) (mapatoms #'(lambda (symbol) diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index 8d6467e5ed0..cb33e483a6b 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el @@ -147,13 +147,13 @@ The search priority is: ;; Do the check of the various tables. (or ;; DYNAMIC - (and (arrayp semantic-lex-spp-dynamic-macro-symbol-obarray) + (and (obarrayp semantic-lex-spp-dynamic-macro-symbol-obarray) (intern-soft name semantic-lex-spp-dynamic-macro-symbol-obarray)) ;; PROJECT - (and (arrayp semantic-lex-spp-project-macro-symbol-obarray) + (and (obarrayp semantic-lex-spp-project-macro-symbol-obarray) (intern-soft name semantic-lex-spp-project-macro-symbol-obarray)) ;; SYSTEM - (and (arrayp semantic-lex-spp-macro-symbol-obarray) + (and (obarrayp semantic-lex-spp-macro-symbol-obarray) (intern-soft name semantic-lex-spp-macro-symbol-obarray)) ;; ... ))) @@ -291,7 +291,7 @@ REPLACEMENT a string that would be substituted in for NAME." "Return a list of spp macros and values. The return list is meant to be saved in a semanticdb table." (let (macros) - (when (arrayp semantic-lex-spp-dynamic-macro-symbol-obarray) + (when (obarrayp semantic-lex-spp-dynamic-macro-symbol-obarray) (mapatoms #'(lambda (symbol) (setq macros (cons (cons (symbol-name symbol) @@ -304,17 +304,17 @@ The return list is meant to be saved in a semanticdb table." "Return a list of spp macros as Lisp symbols. The value of each symbol is the replacement stream." (let (macros) - (when (arrayp semantic-lex-spp-macro-symbol-obarray) + (when (obarrayp semantic-lex-spp-macro-symbol-obarray) (mapatoms #'(lambda (symbol) (setq macros (cons symbol macros))) semantic-lex-spp-macro-symbol-obarray)) - (when (arrayp semantic-lex-spp-project-macro-symbol-obarray) + (when (obarrayp semantic-lex-spp-project-macro-symbol-obarray) (mapatoms #'(lambda (symbol) (setq macros (cons symbol macros))) semantic-lex-spp-project-macro-symbol-obarray)) - (when (arrayp semantic-lex-spp-dynamic-macro-symbol-obarray) + (when (obarrayp semantic-lex-spp-dynamic-macro-symbol-obarray) (mapatoms #'(lambda (symbol) (setq macros (cons symbol macros))) diff --git a/lisp/obarray.el b/lisp/obarray.el index aaffe00a072..a4631859925 100644 --- a/lisp/obarray.el +++ b/lisp/obarray.el @@ -37,6 +37,10 @@ (make-vector size 0) (signal 'wrong-type-argument '(size 0))))) +(defun obarray-size (obarray) + "Return the number of slots of OBARRAY." + (length obarray)) + (defun obarrayp (object) "Return t if OBJECT is an obarray." (and (vectorp object) diff --git a/test/lisp/obarray-tests.el b/test/lisp/obarray-tests.el index 9a2d65d8b41..4908b883240 100644 --- a/test/lisp/obarray-tests.el +++ b/test/lisp/obarray-tests.el @@ -43,14 +43,16 @@ (ert-deftest obarray-make-default-test () (let ((table (obarray-make))) (should (obarrayp table)) - (should (equal (make-vector 59 0) table)))) + (should (eq (obarray-size table) obarray-default-size)))) (ert-deftest obarray-make-with-size-test () + ;; FIXME: Actually, `wrong-type-argument' is not the right error to signal, + ;; so we shouldn't enforce this misbehavior in tests! (should-error (obarray-make -1) :type 'wrong-type-argument) (should-error (obarray-make 0) :type 'wrong-type-argument) (let ((table (obarray-make 1))) (should (obarrayp table)) - (should (equal (make-vector 1 0) table)))) + (should (eq (obarray-size table) 1)))) (ert-deftest obarray-get-test () (let ((table (obarray-make 3))) |
