diff options
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 53 |
1 files changed, 51 insertions, 2 deletions
| @@ -91,6 +91,12 @@ enum { QUIT_COUNT_HEURISTIC = 1 << 16 }; | |||
| 91 | 91 | ||
| 92 | /* Random data-structure functions. */ | 92 | /* Random data-structure functions. */ |
| 93 | 93 | ||
| 94 | static void | ||
| 95 | CHECK_LIST_END (Lisp_Object x, Lisp_Object y) | ||
| 96 | { | ||
| 97 | CHECK_TYPE (NILP (x), Qlistp, y); | ||
| 98 | } | ||
| 99 | |||
| 94 | DEFUN ("length", Flength, Slength, 1, 1, 0, | 100 | DEFUN ("length", Flength, Slength, 1, 1, 0, |
| 95 | doc: /* Return the length of vector, list or string SEQUENCE. | 101 | doc: /* Return the length of vector, list or string SEQUENCE. |
| 96 | A byte-code function object is also allowed. | 102 | A byte-code function object is also allowed. |
| @@ -445,7 +451,7 @@ with the original. */) | |||
| 445 | if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg)) | 451 | if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg)) |
| 446 | wrong_type_argument (Qsequencep, arg); | 452 | wrong_type_argument (Qsequencep, arg); |
| 447 | 453 | ||
| 448 | return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0); | 454 | return concat (1, &arg, XTYPE (arg), 0); |
| 449 | } | 455 | } |
| 450 | 456 | ||
| 451 | /* This structure holds information of an argument of `concat' that is | 457 | /* This structure holds information of an argument of `concat' that is |
| @@ -3337,7 +3343,8 @@ static struct Lisp_Hash_Table *weak_hash_tables; | |||
| 3337 | 3343 | ||
| 3338 | /* Various symbols. */ | 3344 | /* Various symbols. */ |
| 3339 | 3345 | ||
| 3340 | static Lisp_Object Qhash_table_p, Qkey, Qvalue, Qeql; | 3346 | static Lisp_Object Qhash_table_p; |
| 3347 | static Lisp_Object Qkey, Qvalue, Qeql; | ||
| 3341 | Lisp_Object Qeq, Qequal; | 3348 | Lisp_Object Qeq, Qequal; |
| 3342 | Lisp_Object QCtest, QCsize, QCrehash_size, QCrehash_threshold, QCweakness; | 3349 | Lisp_Object QCtest, QCsize, QCrehash_size, QCrehash_threshold, QCweakness; |
| 3343 | static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; | 3350 | static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; |
| @@ -3347,6 +3354,48 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; | |||
| 3347 | Utilities | 3354 | Utilities |
| 3348 | ***********************************************************************/ | 3355 | ***********************************************************************/ |
| 3349 | 3356 | ||
| 3357 | static void | ||
| 3358 | CHECK_HASH_TABLE (Lisp_Object x) | ||
| 3359 | { | ||
| 3360 | CHECK_TYPE (HASH_TABLE_P (x), Qhash_table_p, x); | ||
| 3361 | } | ||
| 3362 | |||
| 3363 | static void | ||
| 3364 | set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value) | ||
| 3365 | { | ||
| 3366 | h->key_and_value = key_and_value; | ||
| 3367 | } | ||
| 3368 | static void | ||
| 3369 | set_hash_next (struct Lisp_Hash_Table *h, Lisp_Object next) | ||
| 3370 | { | ||
| 3371 | h->next = next; | ||
| 3372 | } | ||
| 3373 | static void | ||
| 3374 | set_hash_next_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | ||
| 3375 | { | ||
| 3376 | gc_aset (h->next, idx, val); | ||
| 3377 | } | ||
| 3378 | static void | ||
| 3379 | set_hash_hash (struct Lisp_Hash_Table *h, Lisp_Object hash) | ||
| 3380 | { | ||
| 3381 | h->hash = hash; | ||
| 3382 | } | ||
| 3383 | static void | ||
| 3384 | set_hash_hash_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | ||
| 3385 | { | ||
| 3386 | gc_aset (h->hash, idx, val); | ||
| 3387 | } | ||
| 3388 | static void | ||
| 3389 | set_hash_index (struct Lisp_Hash_Table *h, Lisp_Object index) | ||
| 3390 | { | ||
| 3391 | h->index = index; | ||
| 3392 | } | ||
| 3393 | static void | ||
| 3394 | set_hash_index_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | ||
| 3395 | { | ||
| 3396 | gc_aset (h->index, idx, val); | ||
| 3397 | } | ||
| 3398 | |||
| 3350 | /* If OBJ is a Lisp hash table, return a pointer to its struct | 3399 | /* If OBJ is a Lisp hash table, return a pointer to its struct |
| 3351 | Lisp_Hash_Table. Otherwise, signal an error. */ | 3400 | Lisp_Hash_Table. Otherwise, signal an error. */ |
| 3352 | 3401 | ||