diff options
| author | Michael R. Mauger | 2017-07-03 15:32:41 -0400 |
|---|---|---|
| committer | Michael R. Mauger | 2017-07-03 15:32:41 -0400 |
| commit | 776635c01abd4aa759e7aa9584b513146978568c (patch) | |
| tree | 554f444bc96cb6b05435e8bf195de4df1b00df8f /src/data.c | |
| parent | 77083e2d34ba5559ae2899d3b03cf08c2e6c5ad4 (diff) | |
| parent | 4cd0db3d6e6e4d5bd49283483bdafbbfc0f583f1 (diff) | |
| download | emacs-776635c01abd4aa759e7aa9584b513146978568c.tar.gz emacs-776635c01abd4aa759e7aa9584b513146978568c.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 89 |
1 files changed, 64 insertions, 25 deletions
diff --git a/src/data.c b/src/data.c index ae8dd9721c2..559844b03fd 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -228,8 +228,6 @@ for example, (type-of 1) returns `integer'. */) | |||
| 228 | return Qmarker; | 228 | return Qmarker; |
| 229 | case Lisp_Misc_Overlay: | 229 | case Lisp_Misc_Overlay: |
| 230 | return Qoverlay; | 230 | return Qoverlay; |
| 231 | case Lisp_Misc_Float: | ||
| 232 | return Qfloat; | ||
| 233 | case Lisp_Misc_Finalizer: | 231 | case Lisp_Misc_Finalizer: |
| 234 | return Qfinalizer; | 232 | return Qfinalizer; |
| 235 | #ifdef HAVE_MODULES | 233 | #ifdef HAVE_MODULES |
| @@ -267,6 +265,17 @@ for example, (type-of 1) returns `integer'. */) | |||
| 267 | case PVEC_MUTEX: return Qmutex; | 265 | case PVEC_MUTEX: return Qmutex; |
| 268 | case PVEC_CONDVAR: return Qcondition_variable; | 266 | case PVEC_CONDVAR: return Qcondition_variable; |
| 269 | case PVEC_TERMINAL: return Qterminal; | 267 | case PVEC_TERMINAL: return Qterminal; |
| 268 | case PVEC_RECORD: | ||
| 269 | { | ||
| 270 | Lisp_Object t = AREF (object, 0); | ||
| 271 | if (RECORDP (t) && 1 < PVSIZE (t)) | ||
| 272 | /* Return the type name field of the class! */ | ||
| 273 | return AREF (t, 1); | ||
| 274 | else | ||
| 275 | return t; | ||
| 276 | } | ||
| 277 | case PVEC_MODULE_FUNCTION: | ||
| 278 | return Qmodule_function; | ||
| 270 | /* "Impossible" cases. */ | 279 | /* "Impossible" cases. */ |
| 271 | case PVEC_XWIDGET: | 280 | case PVEC_XWIDGET: |
| 272 | case PVEC_OTHER: | 281 | case PVEC_OTHER: |
| @@ -359,6 +368,15 @@ DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0, | |||
| 359 | return Qnil; | 368 | return Qnil; |
| 360 | } | 369 | } |
| 361 | 370 | ||
| 371 | DEFUN ("recordp", Frecordp, Srecordp, 1, 1, 0, | ||
| 372 | doc: /* Return t if OBJECT is a record. */) | ||
| 373 | (Lisp_Object object) | ||
| 374 | { | ||
| 375 | if (RECORDP (object)) | ||
| 376 | return Qt; | ||
| 377 | return Qnil; | ||
| 378 | } | ||
| 379 | |||
| 362 | DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0, | 380 | DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0, |
| 363 | doc: /* Return t if OBJECT is a string. */ | 381 | doc: /* Return t if OBJECT is a string. */ |
| 364 | attributes: const) | 382 | attributes: const) |
| @@ -474,6 +492,14 @@ DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p, | |||
| 474 | return Qnil; | 492 | return Qnil; |
| 475 | } | 493 | } |
| 476 | 494 | ||
| 495 | DEFUN ("module-function-p", Fmodule_function_p, Smodule_function_p, 1, 1, NULL, | ||
| 496 | doc: /* Return t if OBJECT is a function loaded from a dynamic module. */ | ||
| 497 | attributes: const) | ||
| 498 | (Lisp_Object object) | ||
| 499 | { | ||
| 500 | return MODULE_FUNCTIONP (object) ? Qt : Qnil; | ||
| 501 | } | ||
| 502 | |||
| 477 | DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0, | 503 | DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0, |
| 478 | doc: /* Return t if OBJECT is a character or a string. */ | 504 | doc: /* Return t if OBJECT is a character or a string. */ |
| 479 | attributes: const) | 505 | attributes: const) |
| @@ -672,12 +698,10 @@ global value outside of any lexical scope. */) | |||
| 672 | return (EQ (valcontents, Qunbound) ? Qnil : Qt); | 698 | return (EQ (valcontents, Qunbound) ? Qnil : Qt); |
| 673 | } | 699 | } |
| 674 | 700 | ||
| 675 | /* FIXME: It has been previously suggested to make this function an | 701 | /* It has been previously suggested to make this function an alias for |
| 676 | alias for symbol-function, but upon discussion at Bug#23957, | 702 | symbol-function, but upon discussion at Bug#23957, there is a risk |
| 677 | there is a risk breaking backward compatibility, as some users of | 703 | breaking backward compatibility, as some users of fboundp may |
| 678 | fboundp may expect `t' in particular, rather than any true | 704 | expect `t' in particular, rather than any true value. */ |
| 679 | value. An alias is still welcome so long as the compatibility | ||
| 680 | issues are addressed. */ | ||
| 681 | DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, | 705 | DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, |
| 682 | doc: /* Return t if SYMBOL's function definition is not void. */) | 706 | doc: /* Return t if SYMBOL's function definition is not void. */) |
| 683 | (register Lisp_Object symbol) | 707 | (register Lisp_Object symbol) |
| @@ -884,7 +908,7 @@ Value, if non-nil, is a list (interactive SPEC). */) | |||
| 884 | } | 908 | } |
| 885 | else if (COMPILEDP (fun)) | 909 | else if (COMPILEDP (fun)) |
| 886 | { | 910 | { |
| 887 | if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) | 911 | if (PVSIZE (fun) > COMPILED_INTERACTIVE) |
| 888 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); | 912 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); |
| 889 | } | 913 | } |
| 890 | else if (AUTOLOADP (fun)) | 914 | else if (AUTOLOADP (fun)) |
| @@ -2133,7 +2157,7 @@ If the current binding is global (the default), the value is nil. */) | |||
| 2133 | else if (!BUFFER_OBJFWDP (valcontents)) | 2157 | else if (!BUFFER_OBJFWDP (valcontents)) |
| 2134 | return Qnil; | 2158 | return Qnil; |
| 2135 | } | 2159 | } |
| 2136 | /* FALLTHROUGH */ | 2160 | FALLTHROUGH; |
| 2137 | case SYMBOL_LOCALIZED: | 2161 | case SYMBOL_LOCALIZED: |
| 2138 | /* For a local variable, record both the symbol and which | 2162 | /* For a local variable, record both the symbol and which |
| 2139 | buffer's or frame's value we are saving. */ | 2163 | buffer's or frame's value we are saving. */ |
| @@ -2248,8 +2272,8 @@ function chain of symbols. */) | |||
| 2248 | /* Extract and set vector and string elements. */ | 2272 | /* Extract and set vector and string elements. */ |
| 2249 | 2273 | ||
| 2250 | DEFUN ("aref", Faref, Saref, 2, 2, 0, | 2274 | DEFUN ("aref", Faref, Saref, 2, 2, 0, |
| 2251 | doc: /* Return the element of ARRAY at index IDX. | 2275 | doc: /* Return the element of ARG at index IDX. |
| 2252 | ARRAY may be a vector, a string, a char-table, a bool-vector, | 2276 | ARG may be a vector, a string, a char-table, a bool-vector, a record, |
| 2253 | or a byte-code object. IDX starts at 0. */) | 2277 | or a byte-code object. IDX starts at 0. */) |
| 2254 | (register Lisp_Object array, Lisp_Object idx) | 2278 | (register Lisp_Object array, Lisp_Object idx) |
| 2255 | { | 2279 | { |
| @@ -2287,8 +2311,8 @@ or a byte-code object. IDX starts at 0. */) | |||
| 2287 | ptrdiff_t size = 0; | 2311 | ptrdiff_t size = 0; |
| 2288 | if (VECTORP (array)) | 2312 | if (VECTORP (array)) |
| 2289 | size = ASIZE (array); | 2313 | size = ASIZE (array); |
| 2290 | else if (COMPILEDP (array)) | 2314 | else if (COMPILEDP (array) || RECORDP (array)) |
| 2291 | size = ASIZE (array) & PSEUDOVECTOR_SIZE_MASK; | 2315 | size = PVSIZE (array); |
| 2292 | else | 2316 | else |
| 2293 | wrong_type_argument (Qarrayp, array); | 2317 | wrong_type_argument (Qarrayp, array); |
| 2294 | 2318 | ||
| @@ -2308,7 +2332,8 @@ bool-vector. IDX starts at 0. */) | |||
| 2308 | 2332 | ||
| 2309 | CHECK_NUMBER (idx); | 2333 | CHECK_NUMBER (idx); |
| 2310 | idxval = XINT (idx); | 2334 | idxval = XINT (idx); |
| 2311 | CHECK_ARRAY (array, Qarrayp); | 2335 | if (! RECORDP (array)) |
| 2336 | CHECK_ARRAY (array, Qarrayp); | ||
| 2312 | 2337 | ||
| 2313 | if (VECTORP (array)) | 2338 | if (VECTORP (array)) |
| 2314 | { | 2339 | { |
| @@ -2328,7 +2353,13 @@ bool-vector. IDX starts at 0. */) | |||
| 2328 | CHECK_CHARACTER (idx); | 2353 | CHECK_CHARACTER (idx); |
| 2329 | CHAR_TABLE_SET (array, idxval, newelt); | 2354 | CHAR_TABLE_SET (array, idxval, newelt); |
| 2330 | } | 2355 | } |
| 2331 | else | 2356 | else if (RECORDP (array)) |
| 2357 | { | ||
| 2358 | if (idxval < 0 || idxval >= PVSIZE (array)) | ||
| 2359 | args_out_of_range (array, idx); | ||
| 2360 | ASET (array, idxval, newelt); | ||
| 2361 | } | ||
| 2362 | else /* STRINGP */ | ||
| 2332 | { | 2363 | { |
| 2333 | int c; | 2364 | int c; |
| 2334 | 2365 | ||
| @@ -3039,9 +3070,12 @@ usage: (logxor &rest INTS-OR-MARKERS) */) | |||
| 3039 | } | 3070 | } |
| 3040 | 3071 | ||
| 3041 | static Lisp_Object | 3072 | static Lisp_Object |
| 3042 | ash_lsh_impl (register Lisp_Object value, Lisp_Object count, bool lsh) | 3073 | ash_lsh_impl (Lisp_Object value, Lisp_Object count, bool lsh) |
| 3043 | { | 3074 | { |
| 3044 | register Lisp_Object val; | 3075 | /* This code assumes that signed right shifts are arithmetic. */ |
| 3076 | verify ((EMACS_INT) -1 >> 1 == -1); | ||
| 3077 | |||
| 3078 | Lisp_Object val; | ||
| 3045 | 3079 | ||
| 3046 | CHECK_NUMBER (value); | 3080 | CHECK_NUMBER (value); |
| 3047 | CHECK_NUMBER (count); | 3081 | CHECK_NUMBER (count); |
| @@ -3049,12 +3083,12 @@ ash_lsh_impl (register Lisp_Object value, Lisp_Object count, bool lsh) | |||
| 3049 | if (XINT (count) >= EMACS_INT_WIDTH) | 3083 | if (XINT (count) >= EMACS_INT_WIDTH) |
| 3050 | XSETINT (val, 0); | 3084 | XSETINT (val, 0); |
| 3051 | else if (XINT (count) > 0) | 3085 | else if (XINT (count) > 0) |
| 3052 | XSETINT (val, XUINT (value) << XFASTINT (count)); | 3086 | XSETINT (val, XUINT (value) << XINT (count)); |
| 3053 | else if (XINT (count) <= -EMACS_INT_WIDTH) | 3087 | else if (XINT (count) <= -EMACS_INT_WIDTH) |
| 3054 | XSETINT (val, lsh ? 0 : XINT (value) < 0 ? -1 : 0); | 3088 | XSETINT (val, lsh ? 0 : XINT (value) < 0 ? -1 : 0); |
| 3055 | else | 3089 | else |
| 3056 | XSETINT (val, lsh ? XUINT (value) >> -XINT (count) : \ | 3090 | XSETINT (val, (lsh ? XUINT (value) >> -XINT (count) |
| 3057 | XINT (value) >> -XINT (count)); | 3091 | : XINT (value) >> -XINT (count))); |
| 3058 | return val; | 3092 | return val; |
| 3059 | } | 3093 | } |
| 3060 | 3094 | ||
| @@ -3563,7 +3597,6 @@ syms_of_data (void) | |||
| 3563 | 3597 | ||
| 3564 | DEFSYM (Qquote, "quote"); | 3598 | DEFSYM (Qquote, "quote"); |
| 3565 | DEFSYM (Qlambda, "lambda"); | 3599 | DEFSYM (Qlambda, "lambda"); |
| 3566 | DEFSYM (Qsubr, "subr"); | ||
| 3567 | DEFSYM (Qerror_conditions, "error-conditions"); | 3600 | DEFSYM (Qerror_conditions, "error-conditions"); |
| 3568 | DEFSYM (Qerror_message, "error-message"); | 3601 | DEFSYM (Qerror_message, "error-message"); |
| 3569 | DEFSYM (Qtop_level, "top-level"); | 3602 | DEFSYM (Qtop_level, "top-level"); |
| @@ -3604,6 +3637,7 @@ syms_of_data (void) | |||
| 3604 | DEFSYM (Qsequencep, "sequencep"); | 3637 | DEFSYM (Qsequencep, "sequencep"); |
| 3605 | DEFSYM (Qbufferp, "bufferp"); | 3638 | DEFSYM (Qbufferp, "bufferp"); |
| 3606 | DEFSYM (Qvectorp, "vectorp"); | 3639 | DEFSYM (Qvectorp, "vectorp"); |
| 3640 | DEFSYM (Qrecordp, "recordp"); | ||
| 3607 | DEFSYM (Qbool_vector_p, "bool-vector-p"); | 3641 | DEFSYM (Qbool_vector_p, "bool-vector-p"); |
| 3608 | DEFSYM (Qchar_or_string_p, "char-or-string-p"); | 3642 | DEFSYM (Qchar_or_string_p, "char-or-string-p"); |
| 3609 | DEFSYM (Qmarkerp, "markerp"); | 3643 | DEFSYM (Qmarkerp, "markerp"); |
| @@ -3704,28 +3738,31 @@ syms_of_data (void) | |||
| 3704 | DEFSYM (Qoverlay, "overlay"); | 3738 | DEFSYM (Qoverlay, "overlay"); |
| 3705 | DEFSYM (Qfinalizer, "finalizer"); | 3739 | DEFSYM (Qfinalizer, "finalizer"); |
| 3706 | #ifdef HAVE_MODULES | 3740 | #ifdef HAVE_MODULES |
| 3741 | DEFSYM (Qmodule_function, "module-function"); | ||
| 3707 | DEFSYM (Quser_ptr, "user-ptr"); | 3742 | DEFSYM (Quser_ptr, "user-ptr"); |
| 3708 | #endif | 3743 | #endif |
| 3709 | DEFSYM (Qfloat, "float"); | 3744 | DEFSYM (Qfloat, "float"); |
| 3710 | DEFSYM (Qwindow_configuration, "window-configuration"); | 3745 | DEFSYM (Qwindow_configuration, "window-configuration"); |
| 3711 | DEFSYM (Qprocess, "process"); | 3746 | DEFSYM (Qprocess, "process"); |
| 3712 | DEFSYM (Qwindow, "window"); | 3747 | DEFSYM (Qwindow, "window"); |
| 3748 | DEFSYM (Qsubr, "subr"); | ||
| 3713 | DEFSYM (Qcompiled_function, "compiled-function"); | 3749 | DEFSYM (Qcompiled_function, "compiled-function"); |
| 3714 | DEFSYM (Qbuffer, "buffer"); | 3750 | DEFSYM (Qbuffer, "buffer"); |
| 3715 | DEFSYM (Qframe, "frame"); | 3751 | DEFSYM (Qframe, "frame"); |
| 3716 | DEFSYM (Qvector, "vector"); | 3752 | DEFSYM (Qvector, "vector"); |
| 3753 | DEFSYM (Qrecord, "record"); | ||
| 3717 | DEFSYM (Qchar_table, "char-table"); | 3754 | DEFSYM (Qchar_table, "char-table"); |
| 3718 | DEFSYM (Qbool_vector, "bool-vector"); | 3755 | DEFSYM (Qbool_vector, "bool-vector"); |
| 3719 | DEFSYM (Qhash_table, "hash-table"); | 3756 | DEFSYM (Qhash_table, "hash-table"); |
| 3720 | DEFSYM (Qthread, "thread"); | 3757 | DEFSYM (Qthread, "thread"); |
| 3721 | DEFSYM (Qmutex, "mutex"); | 3758 | DEFSYM (Qmutex, "mutex"); |
| 3722 | DEFSYM (Qcondition_variable, "condition-variable"); | 3759 | DEFSYM (Qcondition_variable, "condition-variable"); |
| 3723 | |||
| 3724 | DEFSYM (Qdefun, "defun"); | ||
| 3725 | |||
| 3726 | DEFSYM (Qfont_spec, "font-spec"); | 3760 | DEFSYM (Qfont_spec, "font-spec"); |
| 3727 | DEFSYM (Qfont_entity, "font-entity"); | 3761 | DEFSYM (Qfont_entity, "font-entity"); |
| 3728 | DEFSYM (Qfont_object, "font-object"); | 3762 | DEFSYM (Qfont_object, "font-object"); |
| 3763 | DEFSYM (Qterminal, "terminal"); | ||
| 3764 | |||
| 3765 | DEFSYM (Qdefun, "defun"); | ||
| 3729 | 3766 | ||
| 3730 | DEFSYM (Qinteractive_form, "interactive-form"); | 3767 | DEFSYM (Qinteractive_form, "interactive-form"); |
| 3731 | DEFSYM (Qdefalias_fset_function, "defalias-fset-function"); | 3768 | DEFSYM (Qdefalias_fset_function, "defalias-fset-function"); |
| @@ -3750,6 +3787,7 @@ syms_of_data (void) | |||
| 3750 | defsubr (&Sstringp); | 3787 | defsubr (&Sstringp); |
| 3751 | defsubr (&Smultibyte_string_p); | 3788 | defsubr (&Smultibyte_string_p); |
| 3752 | defsubr (&Svectorp); | 3789 | defsubr (&Svectorp); |
| 3790 | defsubr (&Srecordp); | ||
| 3753 | defsubr (&Schar_table_p); | 3791 | defsubr (&Schar_table_p); |
| 3754 | defsubr (&Svector_or_char_table_p); | 3792 | defsubr (&Svector_or_char_table_p); |
| 3755 | defsubr (&Sbool_vector_p); | 3793 | defsubr (&Sbool_vector_p); |
| @@ -3759,6 +3797,7 @@ syms_of_data (void) | |||
| 3759 | defsubr (&Smarkerp); | 3797 | defsubr (&Smarkerp); |
| 3760 | defsubr (&Ssubrp); | 3798 | defsubr (&Ssubrp); |
| 3761 | defsubr (&Sbyte_code_function_p); | 3799 | defsubr (&Sbyte_code_function_p); |
| 3800 | defsubr (&Smodule_function_p); | ||
| 3762 | defsubr (&Schar_or_string_p); | 3801 | defsubr (&Schar_or_string_p); |
| 3763 | defsubr (&Sthreadp); | 3802 | defsubr (&Sthreadp); |
| 3764 | defsubr (&Smutexp); | 3803 | defsubr (&Smutexp); |