diff options
| author | Richard M. Stallman | 1995-10-07 21:53:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-10-07 21:53:27 +0000 |
| commit | 7b07587bc2e10335602b15be57af29a211192588 (patch) | |
| tree | a2b8ec4de234f555df13941673e266671dc50bb5 /src/alloc.c | |
| parent | e03f79336240cf8f1a4f59aeb4347ef54e419c28 (diff) | |
| download | emacs-7b07587bc2e10335602b15be57af29a211192588.tar.gz emacs-7b07587bc2e10335602b15be57af29a211192588.zip | |
(Fmake_chartable, Fmake_boolvector): New functions.
(syms_of_alloc): defsubr them.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 791d5168a7a..a428ac2c2f1 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -756,6 +756,25 @@ See also the function `vector'.") | |||
| 756 | return vector; | 756 | return vector; |
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | DEFUN ("make-char-table", Fmake_char_table, Smake_char_table, 0, 2, 0, | ||
| 760 | "Return a newly created char-table, with N \"extra\" slots.\n\ | ||
| 761 | Each element is initialized to INIT, which defaults to nil.\n\ | ||
| 762 | N may not be more than ten.\n\ | ||
| 763 | See `char-table-extra-slot' and `set-char-table-extra-slot'.") | ||
| 764 | (n, init) | ||
| 765 | register Lisp_Object n, init; | ||
| 766 | { | ||
| 767 | Lisp_Object vector; | ||
| 768 | CHECK_NUMBER (n, 1); | ||
| 769 | if (XINT (n) < 0 || XINT (n) > 10) | ||
| 770 | args_out_of_range (n, Qnil); | ||
| 771 | /* Add 2 to the size for the defalt and parent slots. */ | ||
| 772 | vector = Fmake_vector (make_number (CHAR_TABLE_STANDARD_SLOTS + XINT (n)), | ||
| 773 | init); | ||
| 774 | XSETCHAR_TABLE (vector, XCHAR_TABLE (vector)); | ||
| 775 | return vector; | ||
| 776 | } | ||
| 777 | |||
| 759 | DEFUN ("vector", Fvector, Svector, 0, MANY, 0, | 778 | DEFUN ("vector", Fvector, Svector, 0, MANY, 0, |
| 760 | "Return a newly created vector with specified arguments as elements.\n\ | 779 | "Return a newly created vector with specified arguments as elements.\n\ |
| 761 | Any number of arguments, even zero arguments, are allowed.") | 780 | Any number of arguments, even zero arguments, are allowed.") |
| @@ -1053,6 +1072,38 @@ Both LENGTH and INIT must be numbers.") | |||
| 1053 | return val; | 1072 | return val; |
| 1054 | } | 1073 | } |
| 1055 | 1074 | ||
| 1075 | DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, | ||
| 1076 | "Return a newly created bitstring of length LENGTH, with INIT as each element.\n\ | ||
| 1077 | Both LENGTH and INIT must be numbers. INIT matters only in whether it is t or nil.") | ||
| 1078 | (length, init) | ||
| 1079 | Lisp_Object length, init; | ||
| 1080 | { | ||
| 1081 | register Lisp_Object val; | ||
| 1082 | struct Lisp_Bool_Vector *p; | ||
| 1083 | int real_init, i; | ||
| 1084 | int length_in_chars, length_in_elts, bits_per_value; | ||
| 1085 | |||
| 1086 | CHECK_NATNUM (length, 0); | ||
| 1087 | |||
| 1088 | bits_per_value = sizeof (EMACS_INT) * INTBITS / sizeof (int); | ||
| 1089 | |||
| 1090 | length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; | ||
| 1091 | length_in_chars = length_in_elts * sizeof (EMACS_INT); | ||
| 1092 | |||
| 1093 | val = Fmake_vector (make_number (length_in_elts), Qnil); | ||
| 1094 | p = XBOOL_VECTOR (val); | ||
| 1095 | /* Get rid of any bits that would cause confusion. */ | ||
| 1096 | p->vector_size = 0; | ||
| 1097 | XSETBOOL_VECTOR (val, p); | ||
| 1098 | p->size = XFASTINT (length); | ||
| 1099 | |||
| 1100 | real_init = (NILP (init) ? 0 : -1); | ||
| 1101 | for (i = 0; i < length_in_chars ; i++) | ||
| 1102 | p->data[i] = real_init; | ||
| 1103 | |||
| 1104 | return val; | ||
| 1105 | } | ||
| 1106 | |||
| 1056 | Lisp_Object | 1107 | Lisp_Object |
| 1057 | make_string (contents, length) | 1108 | make_string (contents, length) |
| 1058 | char *contents; | 1109 | char *contents; |
| @@ -1751,6 +1802,8 @@ mark_object (objptr) | |||
| 1751 | mark_object (&ptr->buffer_predicate); | 1802 | mark_object (&ptr->buffer_predicate); |
| 1752 | } | 1803 | } |
| 1753 | #endif /* MULTI_FRAME */ | 1804 | #endif /* MULTI_FRAME */ |
| 1805 | else if (GC_BOOL_VECTOR_P (obj)) | ||
| 1806 | ; | ||
| 1754 | else | 1807 | else |
| 1755 | { | 1808 | { |
| 1756 | register struct Lisp_Vector *ptr = XVECTOR (obj); | 1809 | register struct Lisp_Vector *ptr = XVECTOR (obj); |
| @@ -2560,7 +2613,9 @@ which includes both saved text and other data."); | |||
| 2560 | defsubr (&Smake_byte_code); | 2613 | defsubr (&Smake_byte_code); |
| 2561 | defsubr (&Smake_list); | 2614 | defsubr (&Smake_list); |
| 2562 | defsubr (&Smake_vector); | 2615 | defsubr (&Smake_vector); |
| 2616 | defsubr (&Smake_char_table); | ||
| 2563 | defsubr (&Smake_string); | 2617 | defsubr (&Smake_string); |
| 2618 | defsubr (&Smake_bool_vector); | ||
| 2564 | defsubr (&Smake_symbol); | 2619 | defsubr (&Smake_symbol); |
| 2565 | defsubr (&Smake_marker); | 2620 | defsubr (&Smake_marker); |
| 2566 | defsubr (&Spurecopy); | 2621 | defsubr (&Spurecopy); |