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.
This commit is contained in:
parent
265a5d9791
commit
ffbb468499
4 changed files with 16 additions and 10 deletions
|
@ -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)
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)))
|
||||
|
|
Loading…
Add table
Reference in a new issue