diff options
| author | Gerd Moellmann | 1999-09-09 14:54:28 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-09-09 14:54:28 +0000 |
| commit | 38b5e49776850087a33c682d64e822ccf201436d (patch) | |
| tree | 4c34d5fddf733759c221c90ef56eb089ea84cf41 /src/fns.c | |
| parent | b0d22e20c3238db04b99015b72ec0db3817adc89 (diff) | |
| download | emacs-38b5e49776850087a33c682d64e822ccf201436d.tar.gz emacs-38b5e49776850087a33c682d64e822ccf201436d.zip | |
(Fmakehash): Accept just one optional argument TEST.
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 54 |
1 files changed, 8 insertions, 46 deletions
| @@ -4309,56 +4309,18 @@ DEFUN ("copy-hash-table", Fcopy_hash_table, Scopy_hash_table, 1, 1, 0, | |||
| 4309 | } | 4309 | } |
| 4310 | 4310 | ||
| 4311 | 4311 | ||
| 4312 | DEFUN ("makehash", Fmakehash, Smakehash, 0, MANY, 0, | 4312 | DEFUN ("makehash", Fmakehash, Smakehash, 0, 1, 0, |
| 4313 | "Create a new hash table.\n\ | 4313 | "Create a new hash table.\n\ |
| 4314 | Optional first argument TEST specifies how to compare keys in\n\ | 4314 | Optional first argument TEST specifies how to compare keys in\n\ |
| 4315 | the table. Predefined tests are `eq', `eql', and `equal'. Default\n\ | 4315 | the table. Predefined tests are `eq', `eql', and `equal'. Default\n\ |
| 4316 | is `eql'. New tests can be defined with `define-hash-table-test'.\n\ | 4316 | is `eql'. New tests can be defined with `define-hash-table-test'.") |
| 4317 | \n\ | 4317 | (test) |
| 4318 | The rest of the optional arguments are keyword/value pairs. The\n\ | 4318 | Lisp_Object test; |
| 4319 | following are recognized:\n\ | ||
| 4320 | \n\ | ||
| 4321 | :SIZE SIZE -- A hint as to how many elements will be put in the table. | ||
| 4322 | Default is 65.\n\ | ||
| 4323 | \n\ | ||
| 4324 | :REHASH-SIZE REHASH-SIZE - Indicates how to expand the table when\n\ | ||
| 4325 | it fills up. If REHASH-SIZE is an integer, add that many space.\n\ | ||
| 4326 | If it is a float, it must be > 1.0, and the new size is computed by\n\ | ||
| 4327 | multiplying the old size with that factor. Default is 1.5.\n\ | ||
| 4328 | \n\ | ||
| 4329 | :REHASH-THRESHOLD THRESHOLD -- THRESHOLD must a float > 0, and <= 1.0.\n\ | ||
| 4330 | Resize the hash table when ratio of the number of entries in the table.\n\ | ||
| 4331 | Default is 0.8.\n\ | ||
| 4332 | \n\ | ||
| 4333 | :WEAKNESS WEAK -- WEAK must be one of nil, t, `key', or `value'.\n\ | ||
| 4334 | If WEAK is not nil, the table returned is a weak table. Key/value\n\ | ||
| 4335 | pairs are removed from a weak hash table when their key, value or both\n\ | ||
| 4336 | (WEAK t) are otherwise unreferenced. Default is nil.") | ||
| 4337 | (nargs, args) | ||
| 4338 | int nargs; | ||
| 4339 | Lisp_Object *args; | ||
| 4340 | { | 4319 | { |
| 4341 | Lisp_Object args2[nargs + 6]; | 4320 | Lisp_Object args[2]; |
| 4342 | int i, j; | 4321 | args[0] = QCtest; |
| 4343 | 4322 | args[1] = test; | |
| 4344 | i = j = 0; | 4323 | return Fmake_hash_table (2, args); |
| 4345 | |||
| 4346 | /* Recognize TEST argument. */ | ||
| 4347 | if (SYMBOLP (args[i]) | ||
| 4348 | && !EQ (args[i], QCrehash_size) | ||
| 4349 | && !EQ (args[i], QCrehash_threshold) | ||
| 4350 | && !EQ (args[i], QCweakness) | ||
| 4351 | && !EQ (args[i], QCsize)) | ||
| 4352 | { | ||
| 4353 | args2[j++] = QCtest; | ||
| 4354 | args2[j++] = args[i++]; | ||
| 4355 | } | ||
| 4356 | |||
| 4357 | /* Copy remaining arguments. */ | ||
| 4358 | while (i < nargs) | ||
| 4359 | args2[j++] = args[i++]; | ||
| 4360 | |||
| 4361 | return Fmake_hash_table (j, args2); | ||
| 4362 | } | 4324 | } |
| 4363 | 4325 | ||
| 4364 | 4326 | ||