Function: srecode-dictionary-add-entries
srecode-dictionary-add-entries is a byte-compiled function defined in
dictionary.el.gz.
Signature
(srecode-dictionary-add-entries ARG &rest ARGS)
Implementations
(srecode-dictionary-add-entries (DICT srecode-dictionary) ENTRIES &optional STATE) in `srecode/dictionary.el'.
Add ENTRIES to DICT.
ENTRIES is a list of even length of dictionary entries to add. ENTRIES looks like this:
(NAME_1 VALUE_1 NAME_2 VALUE_2 ...)
The following rules apply: * NAME_N is a string and for values * If VALUE_N is t, the section NAME_N is shown. * If VALUE_N is a string, an ordinary value is inserted. * If VALUE_N is a dictionary, it is inserted as entry NAME_N. * Otherwise, a compound variable is created for VALUE_N.
The optional argument STATE has to non-nil when compound values are inserted. An error is signaled if ENTRIES contains compound values but STATE is nil.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/srecode/dictionary.el.gz
(cl-defmethod srecode-dictionary-add-entries ((dict srecode-dictionary)
entries &optional state)
"Add ENTRIES to DICT.
ENTRIES is a list of even length of dictionary entries to add.
ENTRIES looks like this:
(NAME_1 VALUE_1 NAME_2 VALUE_2 ...)
The following rules apply:
* NAME_N is a string
and for values
* If VALUE_N is t, the section NAME_N is shown.
* If VALUE_N is a string, an ordinary value is inserted.
* If VALUE_N is a dictionary, it is inserted as entry NAME_N.
* Otherwise, a compound variable is created for VALUE_N.
The optional argument STATE has to non-nil when compound values
are inserted. An error is signaled if ENTRIES contains compound
values but STATE is nil."
(while entries
(let ((name (nth 0 entries))
(value (nth 1 entries)))
(cond
;; Value is t; show a section.
((eq value t)
(srecode-dictionary-show-section dict name))
;; Value is a simple string; create an ordinary dictionary
;; entry
((stringp value)
(srecode-dictionary-set-value dict name value))
;; Value is a dictionary; insert as child dictionary.
((cl-typep value 'srecode-dictionary)
(srecode-dictionary-merge
(srecode-dictionary-add-section-dictionary dict name)
value t))
;; Value is some other object; create a compound value.
(t
(unless state
(error "Cannot insert compound values without state"))
(srecode-dictionary-set-value
dict name
(srecode-dictionary-compound-variable
:value value :state state)))))
(setq entries (nthcdr 2 entries)))
dict)