diff options
| author | Dmitry Antipov | 2014-05-19 11:49:09 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-05-19 11:49:09 +0400 |
| commit | 2bcf0551dff645b8c691290adf58dc890b79e745 (patch) | |
| tree | 3962d715c1f4d8e83e6d874cb7936b01e573a3b9 /doc | |
| parent | 60fc70a8e0bf25d7388fb4c2e31d912c203f561d (diff) | |
| download | emacs-2bcf0551dff645b8c691290adf58dc890b79e745.tar.gz emacs-2bcf0551dff645b8c691290adf58dc890b79e745.zip | |
* src/lisp.h (CHECK_BOOLEAN): New function.
* src/alloc.c (Fbool_vector): New function.
(syms_of_alloc): Defsubr it.
* src/data.c (Qbooleanp): New symbol.
(syms_of_data): DEFSYM it.
* src/dbusbind.c (xd_signature): Use CHECK_BOOLEAN.
* doc/lispref/sequences.texi (Bool-vectors): Mention bool-vector.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/sequences.texi | 33 |
2 files changed, 33 insertions, 4 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index d892e1307a0..9614b89f66e 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-05-19 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * sequences.texi (Bool-vectors): Mention bool-vector. | ||
| 4 | |||
| 1 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | Assume C99 or later (Bug#17487). | 7 | Assume C99 or later (Bug#17487). |
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index da53990b449..1f7cd435cf6 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi | |||
| @@ -811,7 +811,7 @@ value into an element of the bool-vector, the effect is to store | |||
| 811 | and the length cannot be changed once the bool-vector is created. | 811 | and the length cannot be changed once the bool-vector is created. |
| 812 | Bool-vectors are constants when evaluated. | 812 | Bool-vectors are constants when evaluated. |
| 813 | 813 | ||
| 814 | There are two special functions for working with bool-vectors; aside | 814 | There are three special functions for working with bool-vectors; aside |
| 815 | from that, you manipulate them with same functions used for other kinds | 815 | from that, you manipulate them with same functions used for other kinds |
| 816 | of arrays. | 816 | of arrays. |
| 817 | 817 | ||
| @@ -820,6 +820,32 @@ Return a new bool-vector of @var{length} elements, | |||
| 820 | each one initialized to @var{initial}. | 820 | each one initialized to @var{initial}. |
| 821 | @end defun | 821 | @end defun |
| 822 | 822 | ||
| 823 | @defun bool-vector &rest objects | ||
| 824 | This function creates and returns a bool-vector whose elements are the | ||
| 825 | arguments, @var{objects}, each of them should be either @code{t} or @code{nil}. | ||
| 826 | Note that the printed form represents up to 8 boolean values as a single | ||
| 827 | character: | ||
| 828 | |||
| 829 | @example | ||
| 830 | @group | ||
| 831 | (bool-vector t nil t nil) | ||
| 832 | @result{} #&4"^E" | ||
| 833 | (bool-vector) | ||
| 834 | @result{} #&0"" | ||
| 835 | @end group | ||
| 836 | @end example | ||
| 837 | |||
| 838 | If you want to print a bool-vector in a way similar to other vectors, | ||
| 839 | you can use @code{vconcat} function: | ||
| 840 | |||
| 841 | @example | ||
| 842 | @group | ||
| 843 | (vconcat (bool-vector nil t nil t)) | ||
| 844 | @result{} [nil t nil t] | ||
| 845 | @end group | ||
| 846 | @end example | ||
| 847 | @end defun | ||
| 848 | |||
| 823 | @defun bool-vector-p object | 849 | @defun bool-vector-p object |
| 824 | This returns @code{t} if @var{object} is a bool-vector, | 850 | This returns @code{t} if @var{object} is a bool-vector, |
| 825 | and @code{nil} otherwise. | 851 | and @code{nil} otherwise. |
| @@ -873,9 +899,8 @@ or @code{nil}, and @var{i} is an index into @code{a}. | |||
| 873 | Return the number of elements that are @code{t} in bool vector @var{a}. | 899 | Return the number of elements that are @code{t} in bool vector @var{a}. |
| 874 | @end defun | 900 | @end defun |
| 875 | 901 | ||
| 876 | Here is an example of creating, examining, and updating a | 902 | Here is another example of creating, examining, and updating a |
| 877 | bool-vector. Note that the printed form represents up to 8 boolean | 903 | bool-vector: |
| 878 | values as a single character. | ||
| 879 | 904 | ||
| 880 | @example | 905 | @example |
| 881 | (setq bv (make-bool-vector 5 t)) | 906 | (setq bv (make-bool-vector 5 t)) |