Mercurial > hg > xemacs-beta
comparison src/data.c @ 20:859a2309aef8 r19-15b93
Import from CVS: tag r19-15b93
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:05 +0200 |
parents | 0293115a14e9 |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
19:ac1f612d5250 | 20:859a2309aef8 |
---|---|
103 dead_wrong_type_argument (Lisp_Object predicate, Lisp_Object value) | 103 dead_wrong_type_argument (Lisp_Object predicate, Lisp_Object value) |
104 { | 104 { |
105 signal_error (Qwrong_type_argument, list2 (predicate, value)); | 105 signal_error (Qwrong_type_argument, list2 (predicate, value)); |
106 } | 106 } |
107 | 107 |
108 DEFUN ("wrong-type-argument", Fwrong_type_argument, Swrong_type_argument, | 108 DEFUN ("wrong-type-argument", Fwrong_type_argument, 2, 2, 0, /* |
109 2, 2, 0 /* | |
110 Signal an error until the correct type value is given by the user. | 109 Signal an error until the correct type value is given by the user. |
111 This function loops, signalling a continuable `wrong-type-argument' error | 110 This function loops, signalling a continuable `wrong-type-argument' error |
112 with PREDICATE and VALUE as the data associated with the error and then | 111 with PREDICATE and VALUE as the data associated with the error and then |
113 calling PREDICATE on the returned value, until the value gotten satisfies | 112 calling PREDICATE on the returned value, until the value gotten satisfies |
114 PREDICATE. At that point, the gotten value is returned. | 113 PREDICATE. At that point, the gotten value is returned. |
115 */ ) | 114 */ |
116 (predicate, value) | 115 (predicate, value)) |
117 Lisp_Object predicate, value; | |
118 { | 116 { |
119 return wrong_type_argument (predicate, value); | 117 return wrong_type_argument (predicate, value); |
120 } | 118 } |
121 | 119 |
122 DOESNT_RETURN | 120 DOESNT_RETURN |
183 return val; | 181 return val; |
184 } | 182 } |
185 | 183 |
186 /* Data type predicates */ | 184 /* Data type predicates */ |
187 | 185 |
188 DEFUN ("eq", Feq, Seq, 2, 2, 0 /* | 186 DEFUN ("eq", Feq, 2, 2, 0, /* |
189 T if the two args are the same Lisp object. | 187 T if the two args are the same Lisp object. |
190 */ ) | 188 */ |
191 (obj1, obj2) | 189 (obj1, obj2)) |
192 Lisp_Object obj1, obj2; | |
193 { | 190 { |
194 return EQ (obj1, obj2) ? Qt : Qnil; | 191 return EQ (obj1, obj2) ? Qt : Qnil; |
195 } | 192 } |
196 | 193 |
197 DEFUN ("null", Fnull, Snull, 1, 1, 0 /* | 194 DEFUN ("null", Fnull, 1, 1, 0, /* |
198 T if OBJECT is nil. | 195 T if OBJECT is nil. |
199 */ ) | 196 */ |
200 (object) | 197 (object)) |
201 Lisp_Object object; | |
202 { | 198 { |
203 return NILP (object) ? Qt : Qnil; | 199 return NILP (object) ? Qt : Qnil; |
204 } | 200 } |
205 | 201 |
206 DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0 /* | 202 DEFUN ("consp", Fconsp, 1, 1, 0, /* |
207 T if OBJECT is a cons cell. | 203 T if OBJECT is a cons cell. |
208 */ ) | 204 */ |
209 (object) | 205 (object)) |
210 Lisp_Object object; | |
211 { | 206 { |
212 return CONSP (object) ? Qt : Qnil; | 207 return CONSP (object) ? Qt : Qnil; |
213 } | 208 } |
214 | 209 |
215 DEFUN ("atom", Fatom, Satom, 1, 1, 0 /* | 210 DEFUN ("atom", Fatom, 1, 1, 0, /* |
216 T if OBJECT is not a cons cell. This includes nil. | 211 T if OBJECT is not a cons cell. This includes nil. |
217 */ ) | 212 */ |
218 (object) | 213 (object)) |
219 Lisp_Object object; | |
220 { | 214 { |
221 return CONSP (object) ? Qnil : Qt; | 215 return CONSP (object) ? Qnil : Qt; |
222 } | 216 } |
223 | 217 |
224 DEFUN ("listp", Flistp, Slistp, 1, 1, 0 /* | 218 DEFUN ("listp", Flistp, 1, 1, 0, /* |
225 T if OBJECT is a list. This includes nil. | 219 T if OBJECT is a list. This includes nil. |
226 */ ) | 220 */ |
227 (object) | 221 (object)) |
228 Lisp_Object object; | |
229 { | 222 { |
230 return (CONSP (object) || NILP (object)) ? Qt : Qnil; | 223 return (CONSP (object) || NILP (object)) ? Qt : Qnil; |
231 } | 224 } |
232 | 225 |
233 DEFUN ("nlistp", Fnlistp, Snlistp, 1, 1, 0 /* | 226 DEFUN ("nlistp", Fnlistp, 1, 1, 0, /* |
234 T if OBJECT is not a list. Lists include nil. | 227 T if OBJECT is not a list. Lists include nil. |
235 */ ) | 228 */ |
236 (object) | 229 (object)) |
237 Lisp_Object object; | |
238 { | 230 { |
239 return (CONSP (object) || NILP (object)) ? Qnil : Qt; | 231 return (CONSP (object) || NILP (object)) ? Qnil : Qt; |
240 } | 232 } |
241 | 233 |
242 DEFUN ("symbolp", Fsymbolp, Ssymbolp, 1, 1, 0 /* | 234 DEFUN ("symbolp", Fsymbolp, 1, 1, 0, /* |
243 T if OBJECT is a symbol. | 235 T if OBJECT is a symbol. |
244 */ ) | 236 */ |
245 (object) | 237 (object)) |
246 Lisp_Object object; | |
247 { | 238 { |
248 return SYMBOLP (object) ? Qt : Qnil; | 239 return SYMBOLP (object) ? Qt : Qnil; |
249 } | 240 } |
250 | 241 |
251 DEFUN ("keywordp", Fkeywordp, Skeywordp, 1, 1, 0 /* | 242 DEFUN ("keywordp", Fkeywordp, 1, 1, 0, /* |
252 T if OBJECT is a keyword. | 243 T if OBJECT is a keyword. |
253 */ ) | 244 */ |
254 (object) | 245 (object)) |
255 Lisp_Object object; | |
256 { | 246 { |
257 return KEYWORDP (object) ? Qt : Qnil; | 247 return KEYWORDP (object) ? Qt : Qnil; |
258 } | 248 } |
259 | 249 |
260 DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0 /* | 250 DEFUN ("vectorp", Fvectorp, 1, 1, 0, /* |
261 T if OBJECT is a vector. | 251 T if OBJECT is a vector. |
262 */ ) | 252 */ |
263 (object) | 253 (object)) |
264 Lisp_Object object; | |
265 { | 254 { |
266 return VECTORP (object) ? Qt : Qnil; | 255 return VECTORP (object) ? Qt : Qnil; |
267 } | 256 } |
268 | 257 |
269 DEFUN ("bit-vector-p", Fbit_vector_p, Sbit_vector_p, 1, 1, 0 /* | 258 DEFUN ("bit-vector-p", Fbit_vector_p, 1, 1, 0, /* |
270 T if OBJECT is a bit vector. | 259 T if OBJECT is a bit vector. |
271 */ ) | 260 */ |
272 (object) | 261 (object)) |
273 Lisp_Object object; | |
274 { | 262 { |
275 return BIT_VECTORP (object) ? Qt : Qnil; | 263 return BIT_VECTORP (object) ? Qt : Qnil; |
276 } | 264 } |
277 | 265 |
278 DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0 /* | 266 DEFUN ("stringp", Fstringp, 1, 1, 0, /* |
279 T if OBJECT is a string. | 267 T if OBJECT is a string. |
280 */ ) | 268 */ |
281 (object) | 269 (object)) |
282 Lisp_Object object; | |
283 { | 270 { |
284 return STRINGP (object) ? Qt : Qnil; | 271 return STRINGP (object) ? Qt : Qnil; |
285 } | 272 } |
286 | 273 |
287 DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0 /* | 274 DEFUN ("arrayp", Farrayp, 1, 1, 0, /* |
288 T if OBJECT is an array (string, vector, or bit vector). | 275 T if OBJECT is an array (string, vector, or bit vector). |
289 */ ) | 276 */ |
290 (object) | 277 (object)) |
291 Lisp_Object object; | |
292 { | 278 { |
293 return (VECTORP (object) || | 279 return (VECTORP (object) || |
294 STRINGP (object) || | 280 STRINGP (object) || |
295 BIT_VECTORP (object)) | 281 BIT_VECTORP (object)) |
296 ? Qt : Qnil; | 282 ? Qt : Qnil; |
297 } | 283 } |
298 | 284 |
299 DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0 /* | 285 DEFUN ("sequencep", Fsequencep, 1, 1, 0, /* |
300 T if OBJECT is a sequence (list or array). | 286 T if OBJECT is a sequence (list or array). |
301 */ ) | 287 */ |
302 (object) | 288 (object)) |
303 Lisp_Object object; | |
304 { | 289 { |
305 return (CONSP (object) || | 290 return (CONSP (object) || |
306 NILP (object) || | 291 NILP (object) || |
307 VECTORP (object) || | 292 VECTORP (object) || |
308 STRINGP (object) || | 293 STRINGP (object) || |
309 BIT_VECTORP (object)) | 294 BIT_VECTORP (object)) |
310 ? Qt : Qnil; | 295 ? Qt : Qnil; |
311 } | 296 } |
312 | 297 |
313 DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0 /* | 298 DEFUN ("markerp", Fmarkerp, 1, 1, 0, /* |
314 T if OBJECT is a marker (editor pointer). | 299 T if OBJECT is a marker (editor pointer). |
315 */ ) | 300 */ |
316 (object) | 301 (object)) |
317 Lisp_Object object; | |
318 { | 302 { |
319 return MARKERP (object) ? Qt : Qnil; | 303 return MARKERP (object) ? Qt : Qnil; |
320 } | 304 } |
321 | 305 |
322 DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0 /* | 306 DEFUN ("subrp", Fsubrp, 1, 1, 0, /* |
323 T if OBJECT is a built-in function. | 307 T if OBJECT is a built-in function. |
324 */ ) | 308 */ |
325 (object) | 309 (object)) |
326 Lisp_Object object; | |
327 { | 310 { |
328 return SUBRP (object) ? Qt : Qnil; | 311 return SUBRP (object) ? Qt : Qnil; |
329 } | 312 } |
330 | 313 |
331 DEFUN ("subr-min-args", Fsubr_min_args, Ssubr_min_args, 1, 1, 0 /* | 314 DEFUN ("subr-min-args", Fsubr_min_args, 1, 1, 0, /* |
332 Return minimum number of args built-in function SUBR may be called with. | 315 Return minimum number of args built-in function SUBR may be called with. |
333 */ ) | 316 */ |
334 (subr) | 317 (subr)) |
335 Lisp_Object subr; | |
336 { | 318 { |
337 CHECK_SUBR (subr); | 319 CHECK_SUBR (subr); |
338 return make_int (XSUBR (subr)->min_args); | 320 return make_int (XSUBR (subr)->min_args); |
339 } | 321 } |
340 | 322 |
341 DEFUN ("subr-max-args", Fsubr_max_args, Ssubr_max_args, 1, 1, 0 /* | 323 DEFUN ("subr-max-args", Fsubr_max_args, 1, 1, 0, /* |
342 Return maximum number of args built-in function SUBR may be called with, | 324 Return maximum number of args built-in function SUBR may be called with, |
343 or nil if it takes an arbitrary number of arguments or is a special form. | 325 or nil if it takes an arbitrary number of arguments or is a special form. |
344 */ ) | 326 */ |
345 (subr) | 327 (subr)) |
346 Lisp_Object subr; | |
347 { | 328 { |
348 int nargs; | 329 int nargs; |
349 CHECK_SUBR (subr); | 330 CHECK_SUBR (subr); |
350 nargs = XSUBR (subr)->max_args; | 331 nargs = XSUBR (subr)->max_args; |
351 if (nargs == MANY || nargs == UNEVALLED) | 332 if (nargs == MANY || nargs == UNEVALLED) |
352 return Qnil; | 333 return Qnil; |
353 else | 334 else |
354 return make_int (nargs); | 335 return make_int (nargs); |
355 } | 336 } |
356 | 337 |
357 DEFUN ("compiled-function-p", Fcompiled_function_p, Scompiled_function_p, 1, 1, 0 /* | 338 DEFUN ("compiled-function-p", Fcompiled_function_p, 1, 1, 0, /* |
358 t if OBJECT is a byte-compiled function object. | 339 t if OBJECT is a byte-compiled function object. |
359 */ ) | 340 */ |
360 (object) | 341 (object)) |
361 Lisp_Object object; | |
362 { | 342 { |
363 return COMPILED_FUNCTIONP (object) ? Qt : Qnil; | 343 return COMPILED_FUNCTIONP (object) ? Qt : Qnil; |
364 } | 344 } |
365 | 345 |
366 | 346 |
367 DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 1, 0 /* | 347 DEFUN ("characterp", Fcharacterp, 1, 1, 0, /* |
368 t if OBJECT is a character. | 348 t if OBJECT is a character. |
369 A character is an integer that can be inserted into a buffer with | 349 A character is an integer that can be inserted into a buffer with |
370 `insert-char'. All integers are considered valid characters and are | 350 `insert-char'. All integers are considered valid characters and are |
371 modded with 256 to get the actual character to use. | 351 modded with 256 to get the actual character to use. |
372 */ ) | 352 */ |
373 (object) | 353 (object)) |
374 Lisp_Object object; | |
375 { | 354 { |
376 return CHARP (object) ? Qt : Qnil; | 355 return CHARP (object) ? Qt : Qnil; |
377 } | 356 } |
378 | 357 |
379 DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0 /* | 358 DEFUN ("char-or-string-p", Fchar_or_string_p, 1, 1, 0, /* |
380 t if OBJECT is a character or a string. | 359 t if OBJECT is a character or a string. |
381 */ ) | 360 */ |
382 (object) | 361 (object)) |
383 Lisp_Object object; | |
384 { | 362 { |
385 return CHAR_OR_CHAR_INTP (object) || STRINGP (object) ? Qt : Qnil; | 363 return CHAR_OR_CHAR_INTP (object) || STRINGP (object) ? Qt : Qnil; |
386 } | 364 } |
387 | 365 |
388 DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0 /* | 366 DEFUN ("integerp", Fintegerp, 1, 1, 0, /* |
389 t if OBJECT is an integer. | 367 t if OBJECT is an integer. |
390 */ ) | 368 */ |
391 (object) | 369 (object)) |
392 Lisp_Object object; | |
393 { | 370 { |
394 return INTP (object) ? Qt : Qnil; | 371 return INTP (object) ? Qt : Qnil; |
395 } | 372 } |
396 | 373 |
397 DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, | 374 DEFUN ("integer-or-marker-p", Finteger_or_marker_p, 1, 1, 0, /* |
398 1, 1, 0 /* | |
399 t if OBJECT is an integer or a marker (editor pointer). | 375 t if OBJECT is an integer or a marker (editor pointer). |
400 */ ) | 376 */ |
401 (object) | 377 (object)) |
402 Lisp_Object object; | |
403 { | 378 { |
404 return INTP (object) || MARKERP (object) ? Qt : Qnil; | 379 return INTP (object) || MARKERP (object) ? Qt : Qnil; |
405 } | 380 } |
406 | 381 |
407 DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0 /* | 382 DEFUN ("natnump", Fnatnump, 1, 1, 0, /* |
408 t if OBJECT is a nonnegative integer. | 383 t if OBJECT is a nonnegative integer. |
409 */ ) | 384 */ |
410 (object) | 385 (object)) |
411 Lisp_Object object; | |
412 { | 386 { |
413 return NATNUMP (object) ? Qt : Qnil; | 387 return NATNUMP (object) ? Qt : Qnil; |
414 } | 388 } |
415 | 389 |
416 DEFUN ("bitp", Fbitp, Sbitp, 1, 1, 0 /* | 390 DEFUN ("bitp", Fbitp, 1, 1, 0, /* |
417 t if OBJECT is a bit (0 or 1). | 391 t if OBJECT is a bit (0 or 1). |
418 */ ) | 392 */ |
419 (object) | 393 (object)) |
420 Lisp_Object object; | |
421 { | 394 { |
422 return BITP (object) ? Qt : Qnil; | 395 return BITP (object) ? Qt : Qnil; |
423 } | 396 } |
424 | 397 |
425 DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0 /* | 398 DEFUN ("numberp", Fnumberp, 1, 1, 0, /* |
426 t if OBJECT is a number (floating point or integer). | 399 t if OBJECT is a number (floating point or integer). |
427 */ ) | 400 */ |
428 (object) | 401 (object)) |
429 Lisp_Object object; | |
430 { | 402 { |
431 return INT_OR_FLOATP (object) ? Qt : Qnil; | 403 return INT_OR_FLOATP (object) ? Qt : Qnil; |
432 } | 404 } |
433 | 405 |
434 DEFUN ("number-or-marker-p", Fnumber_or_marker_p, Snumber_or_marker_p, 1, 1, 0 /* | 406 DEFUN ("number-or-marker-p", Fnumber_or_marker_p, 1, 1, 0, /* |
435 t if OBJECT is a number or a marker. | 407 t if OBJECT is a number or a marker. |
436 */ ) | 408 */ |
437 (object) | 409 (object)) |
438 Lisp_Object object; | |
439 { | 410 { |
440 return INT_OR_FLOATP (object) || MARKERP (object) ? Qt : Qnil; | 411 return INT_OR_FLOATP (object) || MARKERP (object) ? Qt : Qnil; |
441 } | 412 } |
442 | 413 |
443 #ifdef LISP_FLOAT_TYPE | 414 #ifdef LISP_FLOAT_TYPE |
444 DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0 /* | 415 DEFUN ("floatp", Ffloatp, 1, 1, 0, /* |
445 t if OBJECT is a floating point number. | 416 t if OBJECT is a floating point number. |
446 */ ) | 417 */ |
447 (object) | 418 (object)) |
448 Lisp_Object object; | |
449 { | 419 { |
450 return FLOATP (object) ? Qt : Qnil; | 420 return FLOATP (object) ? Qt : Qnil; |
451 } | 421 } |
452 #endif /* LISP_FLOAT_TYPE */ | 422 #endif /* LISP_FLOAT_TYPE */ |
453 | 423 |
454 DEFUN ("type-of", Ftype_of, Stype_of, 1, 1, 0 /* | 424 DEFUN ("type-of", Ftype_of, 1, 1, 0, /* |
455 Return a symbol representing the type of OBJECT. | 425 Return a symbol representing the type of OBJECT. |
456 */ ) | 426 */ |
457 (object) | 427 (object)) |
458 Lisp_Object object; | |
459 { | 428 { |
460 if (CONSP (object)) return Qcons; | 429 if (CONSP (object)) return Qcons; |
461 if (SYMBOLP (object)) return Qsymbol; | 430 if (SYMBOLP (object)) return Qsymbol; |
462 if (KEYWORDP (object)) return Qkeyword; | 431 if (KEYWORDP (object)) return Qkeyword; |
463 if (INTP (object)) return Qinteger; | 432 if (INTP (object)) return Qinteger; |
469 } | 438 } |
470 | 439 |
471 | 440 |
472 /* Extract and set components of lists */ | 441 /* Extract and set components of lists */ |
473 | 442 |
474 DEFUN ("car", Fcar, Scar, 1, 1, 0 /* | 443 DEFUN ("car", Fcar, 1, 1, 0, /* |
475 Return the car of LIST. If arg is nil, return nil. | 444 Return the car of LIST. If arg is nil, return nil. |
476 Error if arg is not nil and not a cons cell. See also `car-safe'. | 445 Error if arg is not nil and not a cons cell. See also `car-safe'. |
477 */ ) | 446 */ |
478 (list) | 447 (list)) |
479 Lisp_Object list; | |
480 { | 448 { |
481 while (1) | 449 while (1) |
482 { | 450 { |
483 if (CONSP (list)) | 451 if (CONSP (list)) |
484 return XCAR (list); | 452 return XCAR (list); |
487 else | 455 else |
488 list = wrong_type_argument (Qconsp, list); | 456 list = wrong_type_argument (Qconsp, list); |
489 } | 457 } |
490 } | 458 } |
491 | 459 |
492 DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0 /* | 460 DEFUN ("car-safe", Fcar_safe, 1, 1, 0, /* |
493 Return the car of OBJECT if it is a cons cell, or else nil. | 461 Return the car of OBJECT if it is a cons cell, or else nil. |
494 */ ) | 462 */ |
495 (object) | 463 (object)) |
496 Lisp_Object object; | |
497 { | 464 { |
498 return CONSP (object) ? XCAR (object) : Qnil; | 465 return CONSP (object) ? XCAR (object) : Qnil; |
499 } | 466 } |
500 | 467 |
501 DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0 /* | 468 DEFUN ("cdr", Fcdr, 1, 1, 0, /* |
502 Return the cdr of LIST. If arg is nil, return nil. | 469 Return the cdr of LIST. If arg is nil, return nil. |
503 Error if arg is not nil and not a cons cell. See also `cdr-safe'. | 470 Error if arg is not nil and not a cons cell. See also `cdr-safe'. |
504 */ ) | 471 */ |
505 (list) | 472 (list)) |
506 Lisp_Object list; | |
507 { | 473 { |
508 while (1) | 474 while (1) |
509 { | 475 { |
510 if (CONSP (list)) | 476 if (CONSP (list)) |
511 return XCDR (list); | 477 return XCDR (list); |
514 else | 480 else |
515 list = wrong_type_argument (Qconsp, list); | 481 list = wrong_type_argument (Qconsp, list); |
516 } | 482 } |
517 } | 483 } |
518 | 484 |
519 DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0 /* | 485 DEFUN ("cdr-safe", Fcdr_safe, 1, 1, 0, /* |
520 Return the cdr of OBJECT if it is a cons cell, or else nil. | 486 Return the cdr of OBJECT if it is a cons cell, or else nil. |
521 */ ) | 487 */ |
522 (object) | 488 (object)) |
523 Lisp_Object object; | |
524 { | 489 { |
525 return CONSP (object) ? XCDR (object) : Qnil; | 490 return CONSP (object) ? XCDR (object) : Qnil; |
526 } | 491 } |
527 | 492 |
528 DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0 /* | 493 DEFUN ("setcar", Fsetcar, 2, 2, 0, /* |
529 Set the car of CONSCELL to be NEWCAR. Returns NEWCAR. | 494 Set the car of CONSCELL to be NEWCAR. Returns NEWCAR. |
530 */ ) | 495 */ |
531 (conscell, newcar) | 496 (conscell, newcar)) |
532 Lisp_Object conscell, newcar; | |
533 { | 497 { |
534 if (!CONSP (conscell)) | 498 if (!CONSP (conscell)) |
535 conscell = wrong_type_argument (Qconsp, conscell); | 499 conscell = wrong_type_argument (Qconsp, conscell); |
536 | 500 |
537 CHECK_IMPURE (conscell); | 501 CHECK_IMPURE (conscell); |
538 XCAR (conscell) = newcar; | 502 XCAR (conscell) = newcar; |
539 return newcar; | 503 return newcar; |
540 } | 504 } |
541 | 505 |
542 DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0 /* | 506 DEFUN ("setcdr", Fsetcdr, 2, 2, 0, /* |
543 Set the cdr of CONSCELL to be NEWCDR. Returns NEWCDR. | 507 Set the cdr of CONSCELL to be NEWCDR. Returns NEWCDR. |
544 */ ) | 508 */ |
545 (conscell, newcdr) | 509 (conscell, newcdr)) |
546 Lisp_Object conscell, newcdr; | |
547 { | 510 { |
548 if (!CONSP (conscell)) | 511 if (!CONSP (conscell)) |
549 conscell = wrong_type_argument (Qconsp, conscell); | 512 conscell = wrong_type_argument (Qconsp, conscell); |
550 | 513 |
551 CHECK_IMPURE (conscell); | 514 CHECK_IMPURE (conscell); |
586 if (UNBOUNDP (hare) && errorp) | 549 if (UNBOUNDP (hare) && errorp) |
587 return Fsignal (Qvoid_function, list1 (object)); | 550 return Fsignal (Qvoid_function, list1 (object)); |
588 return hare; | 551 return hare; |
589 } | 552 } |
590 | 553 |
591 DEFUN ("indirect-function", Findirect_function, Sindirect_function, 1, 1, 0 /* | 554 DEFUN ("indirect-function", Findirect_function, 1, 1, 0, /* |
592 Return the function at the end of OBJECT's function chain. | 555 Return the function at the end of OBJECT's function chain. |
593 If OBJECT is a symbol, follow all function indirections and return | 556 If OBJECT is a symbol, follow all function indirections and return |
594 the final function binding. | 557 the final function binding. |
595 If OBJECT is not a symbol, just return it. | 558 If OBJECT is not a symbol, just return it. |
596 Signal a void-function error if the final symbol is unbound. | 559 Signal a void-function error if the final symbol is unbound. |
597 Signal a cyclic-function-indirection error if there is a loop in the | 560 Signal a cyclic-function-indirection error if there is a loop in the |
598 function chain of symbols. | 561 function chain of symbols. |
599 */ ) | 562 */ |
600 (object) | 563 (object)) |
601 Lisp_Object object; | |
602 { | 564 { |
603 return indirect_function (object, 1); | 565 return indirect_function (object, 1); |
604 } | 566 } |
605 | 567 |
606 /* Extract and set vector and string elements */ | 568 /* Extract and set vector and string elements */ |
607 | 569 |
608 DEFUN ("aref", Faref, Saref, 2, 2, 0 /* | 570 DEFUN ("aref", Faref, 2, 2, 0, /* |
609 Return the element of ARRAY at index INDEX. | 571 Return the element of ARRAY at index INDEX. |
610 ARRAY may be a vector, bit vector, string, or byte-code object. | 572 ARRAY may be a vector, bit vector, string, or byte-code object. |
611 IDX starts at 0. | 573 IDX starts at 0. |
612 */ ) | 574 */ |
613 (array, idx) | 575 (array, idx)) |
614 Lisp_Object array; | |
615 Lisp_Object idx; | |
616 { | 576 { |
617 int idxval; | 577 int idxval; |
618 | 578 |
619 retry: | 579 retry: |
620 CHECK_INT_COERCE_CHAR (idx); /* yuck! */ | 580 CHECK_INT_COERCE_CHAR (idx); /* yuck! */ |
652 array = wrong_type_argument (Qarrayp, array); | 612 array = wrong_type_argument (Qarrayp, array); |
653 goto retry; | 613 goto retry; |
654 } | 614 } |
655 } | 615 } |
656 | 616 |
657 DEFUN ("aset", Faset, Saset, 3, 3, 0 /* | 617 DEFUN ("aset", Faset, 3, 3, 0, /* |
658 Store into the element of ARRAY at index IDX the value NEWVAL. | 618 Store into the element of ARRAY at index IDX the value NEWVAL. |
659 ARRAY may be a vector, bit vector, or string. IDX starts at 0. | 619 ARRAY may be a vector, bit vector, or string. IDX starts at 0. |
660 */ ) | 620 */ |
661 (array, idx, newval) | 621 (array, idx, newval)) |
662 Lisp_Object array; | |
663 Lisp_Object idx, newval; | |
664 { | 622 { |
665 int idxval; | 623 int idxval; |
666 | 624 |
667 CHECK_INT_COERCE_CHAR (idx); /* yuck! */ | 625 CHECK_INT_COERCE_CHAR (idx); /* yuck! */ |
668 if (!VECTORP (array) && !BIT_VECTORP (array) && !STRINGP (array)) | 626 if (!VECTORP (array) && !BIT_VECTORP (array) && !STRINGP (array)) |
790 XCAR (b->doc_and_interactive) = new; | 748 XCAR (b->doc_and_interactive) = new; |
791 else | 749 else |
792 b->doc_and_interactive = new; | 750 b->doc_and_interactive = new; |
793 } | 751 } |
794 | 752 |
795 DEFUN ("compiled-function-instructions", Fcompiled_function_instructions, | 753 DEFUN ("compiled-function-instructions", Fcompiled_function_instructions, 1, 1, 0, /* |
796 Scompiled_function_instructions, 1, 1, 0 /* | |
797 Return the byte-opcode string of the compiled-function object. | 754 Return the byte-opcode string of the compiled-function object. |
798 */ ) | 755 */ |
799 (function) | 756 (function)) |
800 Lisp_Object function; | |
801 { | 757 { |
802 CHECK_COMPILED_FUNCTION (function); | 758 CHECK_COMPILED_FUNCTION (function); |
803 return (XCOMPILED_FUNCTION (function)->bytecodes); | 759 return (XCOMPILED_FUNCTION (function)->bytecodes); |
804 } | 760 } |
805 | 761 |
806 DEFUN ("compiled-function-constants", Fcompiled_function_constants, | 762 DEFUN ("compiled-function-constants", Fcompiled_function_constants, 1, 1, 0, /* |
807 Scompiled_function_constants, 1, 1, 0 /* | |
808 Return the constants vector of the compiled-function object. | 763 Return the constants vector of the compiled-function object. |
809 */ ) | 764 */ |
810 (function) | 765 (function)) |
811 Lisp_Object function; | |
812 { | 766 { |
813 CHECK_COMPILED_FUNCTION (function); | 767 CHECK_COMPILED_FUNCTION (function); |
814 return (XCOMPILED_FUNCTION (function)->constants); | 768 return (XCOMPILED_FUNCTION (function)->constants); |
815 } | 769 } |
816 | 770 |
817 DEFUN ("compiled-function-stack-depth", Fcompiled_function_stack_depth, | 771 DEFUN ("compiled-function-stack-depth", Fcompiled_function_stack_depth, 1, 1, 0, /* |
818 Scompiled_function_stack_depth, 1, 1, 0 /* | |
819 Return the max stack depth of the compiled-function object. | 772 Return the max stack depth of the compiled-function object. |
820 */ ) | 773 */ |
821 (function) | 774 (function)) |
822 Lisp_Object function; | |
823 { | 775 { |
824 CHECK_COMPILED_FUNCTION (function); | 776 CHECK_COMPILED_FUNCTION (function); |
825 return (make_int (XCOMPILED_FUNCTION (function)->maxdepth)); | 777 return (make_int (XCOMPILED_FUNCTION (function)->maxdepth)); |
826 } | 778 } |
827 | 779 |
828 DEFUN ("compiled-function-arglist", Fcompiled_function_arglist, | 780 DEFUN ("compiled-function-arglist", Fcompiled_function_arglist, 1, 1, 0, /* |
829 Scompiled_function_arglist, 1, 1, 0 /* | |
830 Return the argument list of the compiled-function object. | 781 Return the argument list of the compiled-function object. |
831 */ ) | 782 */ |
832 (function) | 783 (function)) |
833 Lisp_Object function; | |
834 { | 784 { |
835 CHECK_COMPILED_FUNCTION (function); | 785 CHECK_COMPILED_FUNCTION (function); |
836 return (XCOMPILED_FUNCTION (function)->arglist); | 786 return (XCOMPILED_FUNCTION (function)->arglist); |
837 } | 787 } |
838 | 788 |
839 DEFUN ("compiled-function-interactive", Fcompiled_function_interactive, | 789 DEFUN ("compiled-function-interactive", Fcompiled_function_interactive, 1, 1, 0, /* |
840 Scompiled_function_interactive, 1, 1, 0 /* | |
841 Return the interactive spec of the compiled-function object, or nil. | 790 Return the interactive spec of the compiled-function object, or nil. |
842 If non-nil, the return value will be a list whose first element is | 791 If non-nil, the return value will be a list whose first element is |
843 `interactive' and whose second element is the interactive spec. | 792 `interactive' and whose second element is the interactive spec. |
844 */ ) | 793 */ |
845 (function) | 794 (function)) |
846 Lisp_Object function; | |
847 { | 795 { |
848 CHECK_COMPILED_FUNCTION (function); | 796 CHECK_COMPILED_FUNCTION (function); |
849 if (!XCOMPILED_FUNCTION (function)->flags.interactivep) | 797 if (!XCOMPILED_FUNCTION (function)->flags.interactivep) |
850 return Qnil; | 798 return Qnil; |
851 return (list2 (Qinteractive, | 799 return (list2 (Qinteractive, |
852 compiled_function_interactive | 800 compiled_function_interactive |
853 (XCOMPILED_FUNCTION (function)))); | 801 (XCOMPILED_FUNCTION (function)))); |
854 } | 802 } |
855 | 803 |
856 DEFUN ("compiled-function-doc-string", Fcompiled_function_doc_string, | 804 DEFUN ("compiled-function-doc-string", Fcompiled_function_doc_string, 1, 1, 0, /* |
857 Scompiled_function_doc_string, 1, 1, 0 /* | |
858 Return the doc string of the compiled-function object, if available. | 805 Return the doc string of the compiled-function object, if available. |
859 */ ) | 806 */ |
860 (function) | 807 (function)) |
861 Lisp_Object function; | |
862 { | 808 { |
863 CHECK_COMPILED_FUNCTION (function); | 809 CHECK_COMPILED_FUNCTION (function); |
864 if (!XCOMPILED_FUNCTION (function)->flags.interactivep) | 810 if (!XCOMPILED_FUNCTION (function)->flags.interactivep) |
865 return Qnil; | 811 return Qnil; |
866 return (list2 (Qinteractive, | 812 return (list2 (Qinteractive, |
868 (XCOMPILED_FUNCTION (function)))); | 814 (XCOMPILED_FUNCTION (function)))); |
869 } | 815 } |
870 | 816 |
871 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK | 817 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK |
872 | 818 |
873 DEFUN ("compiled-function-annotation", Fcompiled_function_annotation, | 819 DEFUN ("compiled-function-annotation", Fcompiled_function_annotation, 1, 1, 0, /* |
874 Scompiled_function_annotation, 1, 1, 0 /* | |
875 Return the annotation of the compiled-function object, or nil. | 820 Return the annotation of the compiled-function object, or nil. |
876 The annotation is a piece of information indicating where this | 821 The annotation is a piece of information indicating where this |
877 compiled-function object came from. Generally this will be | 822 compiled-function object came from. Generally this will be |
878 a symbol naming a function; or a string naming a file, if the | 823 a symbol naming a function; or a string naming a file, if the |
879 compiled-function object was not defined in a function; or nil, | 824 compiled-function object was not defined in a function; or nil, |
880 if the compiled-function object was not created as a result of | 825 if the compiled-function object was not created as a result of |
881 a `load'. | 826 a `load'. |
882 */ ) | 827 */ |
883 (function) | 828 (function)) |
884 Lisp_Object function; | |
885 { | 829 { |
886 CHECK_COMPILED_FUNCTION (function); | 830 CHECK_COMPILED_FUNCTION (function); |
887 return (compiled_function_annotation (XCOMPILED_FUNCTION (function))); | 831 return (compiled_function_annotation (XCOMPILED_FUNCTION (function))); |
888 } | 832 } |
889 | 833 |
890 #endif /* COMPILED_FUNCTION_ANNOTATION_HACK */ | 834 #endif /* COMPILED_FUNCTION_ANNOTATION_HACK */ |
891 | 835 |
892 DEFUN ("compiled-function-domain", Fcompiled_function_domain, | 836 DEFUN ("compiled-function-domain", Fcompiled_function_domain, 1, 1, 0, /* |
893 Scompiled_function_domain, 1, 1, 0 /* | |
894 Return the domain of the compiled-function object, or nil. | 837 Return the domain of the compiled-function object, or nil. |
895 This is only meaningful if I18N3 was enabled when emacs was compiled. | 838 This is only meaningful if I18N3 was enabled when emacs was compiled. |
896 */ ) | 839 */ |
897 (function) | 840 (function)) |
898 Lisp_Object function; | |
899 { | 841 { |
900 CHECK_COMPILED_FUNCTION (function); | 842 CHECK_COMPILED_FUNCTION (function); |
901 if (!XCOMPILED_FUNCTION (function)->flags.domainp) | 843 if (!XCOMPILED_FUNCTION (function)->flags.domainp) |
902 return Qnil; | 844 return Qnil; |
903 return (compiled_function_domain (XCOMPILED_FUNCTION (function))); | 845 return (compiled_function_domain (XCOMPILED_FUNCTION (function))); |
946 | 888 |
947 abort (); | 889 abort (); |
948 return Qnil; /* suppress compiler warning */ | 890 return Qnil; /* suppress compiler warning */ |
949 } | 891 } |
950 | 892 |
951 DEFUN ("=", Feqlsign, Seqlsign, 2, 2, 0 /* | 893 DEFUN ("=", Feqlsign, 2, 2, 0, /* |
952 T if two args, both numbers or markers, are equal. | 894 T if two args, both numbers or markers, are equal. |
953 */ ) | 895 */ |
954 (num1, num2) | 896 (num1, num2)) |
955 Lisp_Object num1, num2; | |
956 { | 897 { |
957 return arithcompare (num1, num2, equal); | 898 return arithcompare (num1, num2, equal); |
958 } | 899 } |
959 | 900 |
960 DEFUN ("<", Flss, Slss, 2, 2, 0 /* | 901 DEFUN ("<", Flss, 2, 2, 0, /* |
961 T if first arg is less than second arg. | 902 T if first arg is less than second arg. |
962 Both must be numbers or markers. | 903 Both must be numbers or markers. |
963 */ ) | 904 */ |
964 (num1, num2) | 905 (num1, num2)) |
965 Lisp_Object num1, num2; | |
966 { | 906 { |
967 return arithcompare (num1, num2, less); | 907 return arithcompare (num1, num2, less); |
968 } | 908 } |
969 | 909 |
970 DEFUN (">", Fgtr, Sgtr, 2, 2, 0 /* | 910 DEFUN (">", Fgtr, 2, 2, 0, /* |
971 T if first arg is greater than second arg. | 911 T if first arg is greater than second arg. |
972 Both must be numbers or markers. | 912 Both must be numbers or markers. |
973 */ ) | 913 */ |
974 (num1, num2) | 914 (num1, num2)) |
975 Lisp_Object num1, num2; | |
976 { | 915 { |
977 return arithcompare (num1, num2, grtr); | 916 return arithcompare (num1, num2, grtr); |
978 } | 917 } |
979 | 918 |
980 DEFUN ("<=", Fleq, Sleq, 2, 2, 0 /* | 919 DEFUN ("<=", Fleq, 2, 2, 0, /* |
981 T if first arg is less than or equal to second arg. | 920 T if first arg is less than or equal to second arg. |
982 Both must be numbers or markers. | 921 Both must be numbers or markers. |
983 */ ) | 922 */ |
984 (num1, num2) | 923 (num1, num2)) |
985 Lisp_Object num1, num2; | |
986 { | 924 { |
987 return arithcompare (num1, num2, less_or_equal); | 925 return arithcompare (num1, num2, less_or_equal); |
988 } | 926 } |
989 | 927 |
990 DEFUN (">=", Fgeq, Sgeq, 2, 2, 0 /* | 928 DEFUN (">=", Fgeq, 2, 2, 0, /* |
991 T if first arg is greater than or equal to second arg. | 929 T if first arg is greater than or equal to second arg. |
992 Both must be numbers or markers. | 930 Both must be numbers or markers. |
993 */ ) | 931 */ |
994 (num1, num2) | 932 (num1, num2)) |
995 Lisp_Object num1, num2; | |
996 { | 933 { |
997 return arithcompare (num1, num2, grtr_or_equal); | 934 return arithcompare (num1, num2, grtr_or_equal); |
998 } | 935 } |
999 | 936 |
1000 DEFUN ("/=", Fneq, Sneq, 2, 2, 0 /* | 937 DEFUN ("/=", Fneq, 2, 2, 0, /* |
1001 T if first arg is not equal to second arg. | 938 T if first arg is not equal to second arg. |
1002 Both must be numbers or markers. | 939 Both must be numbers or markers. |
1003 */ ) | 940 */ |
1004 (num1, num2) | 941 (num1, num2)) |
1005 Lisp_Object num1, num2; | |
1006 { | 942 { |
1007 return arithcompare (num1, num2, notequal); | 943 return arithcompare (num1, num2, notequal); |
1008 } | 944 } |
1009 | 945 |
1010 DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0 /* | 946 DEFUN ("zerop", Fzerop, 1, 1, 0, /* |
1011 T if NUMBER is zero. | 947 T if NUMBER is zero. |
1012 */ ) | 948 */ |
1013 (number) | 949 (number)) |
1014 Lisp_Object number; | |
1015 { | 950 { |
1016 CHECK_INT_OR_FLOAT (number); | 951 CHECK_INT_OR_FLOAT (number); |
1017 | 952 |
1018 #ifdef LISP_FLOAT_TYPE | 953 #ifdef LISP_FLOAT_TYPE |
1019 if (FLOATP (number)) | 954 if (FLOATP (number)) |
1050 return (XINT (top) << 16) | (XINT (bot) & 0xffff); | 985 return (XINT (top) << 16) | (XINT (bot) & 0xffff); |
1051 } | 986 } |
1052 } | 987 } |
1053 | 988 |
1054 | 989 |
1055 DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0 /* | 990 DEFUN ("number-to-string", Fnumber_to_string, 1, 1, 0, /* |
1056 Convert NUM to a string by printing it in decimal. | 991 Convert NUM to a string by printing it in decimal. |
1057 Uses a minus sign if negative. | 992 Uses a minus sign if negative. |
1058 NUM may be an integer or a floating point number. | 993 NUM may be an integer or a floating point number. |
1059 */ ) | 994 */ |
1060 (num) | 995 (num)) |
1061 Lisp_Object num; | |
1062 { | 996 { |
1063 char buffer[VALBITS]; | 997 char buffer[VALBITS]; |
1064 | 998 |
1065 CHECK_INT_OR_FLOAT (num); | 999 CHECK_INT_OR_FLOAT (num); |
1066 | 1000 |
1081 else | 1015 else |
1082 abort (); | 1016 abort (); |
1083 return build_string (buffer); | 1017 return build_string (buffer); |
1084 } | 1018 } |
1085 | 1019 |
1086 DEFUN ("string-to-number", Fstring_to_number, Sstring_to_number, 1, 1, 0 /* | 1020 DEFUN ("string-to-number", Fstring_to_number, 1, 1, 0, /* |
1087 Convert STRING to a number by parsing it as a decimal number. | 1021 Convert STRING to a number by parsing it as a decimal number. |
1088 This parses both integers and floating point numbers. | 1022 This parses both integers and floating point numbers. |
1089 It ignores leading spaces and tabs. | 1023 It ignores leading spaces and tabs. |
1090 */ ) | 1024 */ |
1091 (string) | 1025 (string)) |
1092 Lisp_Object string; | |
1093 { | 1026 { |
1094 Lisp_Object value; | 1027 Lisp_Object value; |
1095 char *p; | 1028 char *p; |
1096 CHECK_STRING (string); | 1029 CHECK_STRING (string); |
1097 | 1030 |
1251 | 1184 |
1252 XSETINT (val, accum); | 1185 XSETINT (val, accum); |
1253 return val; | 1186 return val; |
1254 } | 1187 } |
1255 | 1188 |
1256 DEFUN ("+", Fplus, Splus, 0, MANY, 0 /* | 1189 DEFUN ("+", Fplus, 0, MANY, 0, /* |
1257 Return sum of any number of arguments. | 1190 Return sum of any number of arguments. |
1258 The arguments should all be numbers or markers. | 1191 The arguments should all be numbers or markers. |
1259 */ ) | 1192 */ |
1260 (nargs, args) | 1193 (int nargs, Lisp_Object *args)) |
1261 int nargs; | |
1262 Lisp_Object *args; | |
1263 { | 1194 { |
1264 return arith_driver (Aadd, nargs, args); | 1195 return arith_driver (Aadd, nargs, args); |
1265 } | 1196 } |
1266 | 1197 |
1267 DEFUN ("-", Fminus, Sminus, 0, MANY, 0 /* | 1198 DEFUN ("-", Fminus, 0, MANY, 0, /* |
1268 Negate number or subtract numbers or markers. | 1199 Negate number or subtract numbers or markers. |
1269 With one arg, negates it. With more than one arg, | 1200 With one arg, negates it. With more than one arg, |
1270 subtracts all but the first from the first. | 1201 subtracts all but the first from the first. |
1271 */ ) | 1202 */ |
1272 (nargs, args) | 1203 (int nargs, Lisp_Object *args)) |
1273 int nargs; | |
1274 Lisp_Object *args; | |
1275 { | 1204 { |
1276 return arith_driver (Asub, nargs, args); | 1205 return arith_driver (Asub, nargs, args); |
1277 } | 1206 } |
1278 | 1207 |
1279 DEFUN ("*", Ftimes, Stimes, 0, MANY, 0 /* | 1208 DEFUN ("*", Ftimes, 0, MANY, 0, /* |
1280 Return product of any number of arguments. | 1209 Return product of any number of arguments. |
1281 The arguments should all be numbers or markers. | 1210 The arguments should all be numbers or markers. |
1282 */ ) | 1211 */ |
1283 (nargs, args) | 1212 (int nargs, Lisp_Object *args)) |
1284 int nargs; | |
1285 Lisp_Object *args; | |
1286 { | 1213 { |
1287 return arith_driver (Amult, nargs, args); | 1214 return arith_driver (Amult, nargs, args); |
1288 } | 1215 } |
1289 | 1216 |
1290 DEFUN ("/", Fquo, Squo, 2, MANY, 0 /* | 1217 DEFUN ("/", Fquo, 2, MANY, 0, /* |
1291 Return first argument divided by all the remaining arguments. | 1218 Return first argument divided by all the remaining arguments. |
1292 The arguments must be numbers or markers. | 1219 The arguments must be numbers or markers. |
1293 */ ) | 1220 */ |
1294 (nargs, args) | 1221 (int nargs, Lisp_Object *args)) |
1295 int nargs; | |
1296 Lisp_Object *args; | |
1297 { | 1222 { |
1298 return arith_driver (Adiv, nargs, args); | 1223 return arith_driver (Adiv, nargs, args); |
1299 } | 1224 } |
1300 | 1225 |
1301 DEFUN ("%", Frem, Srem, 2, 2, 0 /* | 1226 DEFUN ("%", Frem, 2, 2, 0, /* |
1302 Return remainder of first arg divided by second. | 1227 Return remainder of first arg divided by second. |
1303 Both must be integers or markers. | 1228 Both must be integers or markers. |
1304 */ ) | 1229 */ |
1305 (num1, num2) | 1230 (num1, num2)) |
1306 Lisp_Object num1, num2; | |
1307 { | 1231 { |
1308 CHECK_INT_COERCE_CHAR_OR_MARKER (num1); | 1232 CHECK_INT_COERCE_CHAR_OR_MARKER (num1); |
1309 CHECK_INT_COERCE_CHAR_OR_MARKER (num2); | 1233 CHECK_INT_COERCE_CHAR_OR_MARKER (num2); |
1310 | 1234 |
1311 if (ZEROP (num2)) | 1235 if (ZEROP (num2)) |
1327 return (f1 - f2 * floor (f1/f2)); | 1251 return (f1 - f2 * floor (f1/f2)); |
1328 } | 1252 } |
1329 #endif /* ! HAVE_FMOD */ | 1253 #endif /* ! HAVE_FMOD */ |
1330 | 1254 |
1331 | 1255 |
1332 DEFUN ("mod", Fmod, Smod, 2, 2, 0 /* | 1256 DEFUN ("mod", Fmod, 2, 2, 0, /* |
1333 Return X modulo Y. | 1257 Return X modulo Y. |
1334 The result falls between zero (inclusive) and Y (exclusive). | 1258 The result falls between zero (inclusive) and Y (exclusive). |
1335 Both X and Y must be numbers or markers. | 1259 Both X and Y must be numbers or markers. |
1336 If either argument is a float, a float will be returned. | 1260 If either argument is a float, a float will be returned. |
1337 */ ) | 1261 */ |
1338 (x, y) | 1262 (x, y)) |
1339 Lisp_Object x, y; | |
1340 { | 1263 { |
1341 EMACS_INT i1, i2; | 1264 EMACS_INT i1, i2; |
1342 | 1265 |
1343 #ifdef LISP_FLOAT_TYPE | 1266 #ifdef LISP_FLOAT_TYPE |
1344 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (x); | 1267 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (x); |
1379 | 1302 |
1380 return (make_int (i1)); | 1303 return (make_int (i1)); |
1381 } | 1304 } |
1382 | 1305 |
1383 | 1306 |
1384 DEFUN ("max", Fmax, Smax, 1, MANY, 0 /* | 1307 DEFUN ("max", Fmax, 1, MANY, 0, /* |
1385 Return largest of all the arguments. | 1308 Return largest of all the arguments. |
1386 All arguments must be numbers or markers. | 1309 All arguments must be numbers or markers. |
1387 The value is always a number; markers are converted to numbers. | 1310 The value is always a number; markers are converted to numbers. |
1388 */ ) | 1311 */ |
1389 (nargs, args) | 1312 (int nargs, Lisp_Object *args)) |
1390 int nargs; | |
1391 Lisp_Object *args; | |
1392 { | 1313 { |
1393 return arith_driver (Amax, nargs, args); | 1314 return arith_driver (Amax, nargs, args); |
1394 } | 1315 } |
1395 | 1316 |
1396 DEFUN ("min", Fmin, Smin, 1, MANY, 0 /* | 1317 DEFUN ("min", Fmin, 1, MANY, 0, /* |
1397 Return smallest of all the arguments. | 1318 Return smallest of all the arguments. |
1398 All arguments must be numbers or markers. | 1319 All arguments must be numbers or markers. |
1399 The value is always a number; markers are converted to numbers. | 1320 The value is always a number; markers are converted to numbers. |
1400 */ ) | 1321 */ |
1401 (nargs, args) | 1322 (int nargs, Lisp_Object *args)) |
1402 int nargs; | |
1403 Lisp_Object *args; | |
1404 { | 1323 { |
1405 return arith_driver (Amin, nargs, args); | 1324 return arith_driver (Amin, nargs, args); |
1406 } | 1325 } |
1407 | 1326 |
1408 DEFUN ("logand", Flogand, Slogand, 0, MANY, 0 /* | 1327 DEFUN ("logand", Flogand, 0, MANY, 0, /* |
1409 Return bitwise-and of all the arguments. | 1328 Return bitwise-and of all the arguments. |
1410 Arguments may be integers, or markers converted to integers. | 1329 Arguments may be integers, or markers converted to integers. |
1411 */ ) | 1330 */ |
1412 (nargs, args) | 1331 (int nargs, Lisp_Object *args)) |
1413 int nargs; | |
1414 Lisp_Object *args; | |
1415 { | 1332 { |
1416 return arith_driver (Alogand, nargs, args); | 1333 return arith_driver (Alogand, nargs, args); |
1417 } | 1334 } |
1418 | 1335 |
1419 DEFUN ("logior", Flogior, Slogior, 0, MANY, 0 /* | 1336 DEFUN ("logior", Flogior, 0, MANY, 0, /* |
1420 Return bitwise-or of all the arguments. | 1337 Return bitwise-or of all the arguments. |
1421 Arguments may be integers, or markers converted to integers. | 1338 Arguments may be integers, or markers converted to integers. |
1422 */ ) | 1339 */ |
1423 (nargs, args) | 1340 (int nargs, Lisp_Object *args)) |
1424 int nargs; | |
1425 Lisp_Object *args; | |
1426 { | 1341 { |
1427 return arith_driver (Alogior, nargs, args); | 1342 return arith_driver (Alogior, nargs, args); |
1428 } | 1343 } |
1429 | 1344 |
1430 DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0 /* | 1345 DEFUN ("logxor", Flogxor, 0, MANY, 0, /* |
1431 Return bitwise-exclusive-or of all the arguments. | 1346 Return bitwise-exclusive-or of all the arguments. |
1432 Arguments may be integers, or markers converted to integers. | 1347 Arguments may be integers, or markers converted to integers. |
1433 */ ) | 1348 */ |
1434 (nargs, args) | 1349 (int nargs, Lisp_Object *args)) |
1435 int nargs; | |
1436 Lisp_Object *args; | |
1437 { | 1350 { |
1438 return arith_driver (Alogxor, nargs, args); | 1351 return arith_driver (Alogxor, nargs, args); |
1439 } | 1352 } |
1440 | 1353 |
1441 DEFUN ("ash", Fash, Sash, 2, 2, 0 /* | 1354 DEFUN ("ash", Fash, 2, 2, 0, /* |
1442 Return VALUE with its bits shifted left by COUNT. | 1355 Return VALUE with its bits shifted left by COUNT. |
1443 If COUNT is negative, shifting is actually to the right. | 1356 If COUNT is negative, shifting is actually to the right. |
1444 In this case, the sign bit is duplicated. | 1357 In this case, the sign bit is duplicated. |
1445 */ ) | 1358 */ |
1446 (value, count) | 1359 (value, count)) |
1447 Lisp_Object value, count; | |
1448 { | 1360 { |
1449 CHECK_INT_COERCE_CHAR (value); | 1361 CHECK_INT_COERCE_CHAR (value); |
1450 CHECK_INT (count); | 1362 CHECK_INT (count); |
1451 | 1363 |
1452 return make_int (XINT (count) > 0 ? | 1364 return make_int (XINT (count) > 0 ? |
1453 XINT (value) << XINT (count) : | 1365 XINT (value) << XINT (count) : |
1454 XINT (value) >> -XINT (count)); | 1366 XINT (value) >> -XINT (count)); |
1455 } | 1367 } |
1456 | 1368 |
1457 DEFUN ("lsh", Flsh, Slsh, 2, 2, 0 /* | 1369 DEFUN ("lsh", Flsh, 2, 2, 0, /* |
1458 Return VALUE with its bits shifted left by COUNT. | 1370 Return VALUE with its bits shifted left by COUNT. |
1459 If COUNT is negative, shifting is actually to the right. | 1371 If COUNT is negative, shifting is actually to the right. |
1460 In this case, zeros are shifted in on the left. | 1372 In this case, zeros are shifted in on the left. |
1461 */ ) | 1373 */ |
1462 (value, count) | 1374 (value, count)) |
1463 Lisp_Object value, count; | |
1464 { | 1375 { |
1465 Lisp_Object val; | 1376 Lisp_Object val; |
1466 | 1377 |
1467 CHECK_INT_COERCE_CHAR (value); | 1378 CHECK_INT_COERCE_CHAR (value); |
1468 CHECK_INT (count); | 1379 CHECK_INT (count); |
1472 else | 1383 else |
1473 XSETINT (val, (EMACS_UINT) XUINT (value) >> -XINT (count)); | 1384 XSETINT (val, (EMACS_UINT) XUINT (value) >> -XINT (count)); |
1474 return val; | 1385 return val; |
1475 } | 1386 } |
1476 | 1387 |
1477 DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0 /* | 1388 DEFUN ("1+", Fadd1, 1, 1, 0, /* |
1478 Return NUMBER plus one. NUMBER may be a number or a marker. | 1389 Return NUMBER plus one. NUMBER may be a number or a marker. |
1479 Markers are converted to integers. | 1390 Markers are converted to integers. |
1480 */ ) | 1391 */ |
1481 (number) | 1392 (number)) |
1482 Lisp_Object number; | |
1483 { | 1393 { |
1484 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (number); | 1394 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (number); |
1485 | 1395 |
1486 #ifdef LISP_FLOAT_TYPE | 1396 #ifdef LISP_FLOAT_TYPE |
1487 if (FLOATP (number)) | 1397 if (FLOATP (number)) |
1489 #endif /* LISP_FLOAT_TYPE */ | 1399 #endif /* LISP_FLOAT_TYPE */ |
1490 | 1400 |
1491 return (make_int (XINT (number) + 1)); | 1401 return (make_int (XINT (number) + 1)); |
1492 } | 1402 } |
1493 | 1403 |
1494 DEFUN ("1-", Fsub1, Ssub1, 1, 1, 0 /* | 1404 DEFUN ("1-", Fsub1, 1, 1, 0, /* |
1495 Return NUMBER minus one. NUMBER may be a number or a marker. | 1405 Return NUMBER minus one. NUMBER may be a number or a marker. |
1496 Markers are converted to integers. | 1406 Markers are converted to integers. |
1497 */ ) | 1407 */ |
1498 (number) | 1408 (number)) |
1499 Lisp_Object number; | |
1500 { | 1409 { |
1501 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (number); | 1410 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (number); |
1502 | 1411 |
1503 #ifdef LISP_FLOAT_TYPE | 1412 #ifdef LISP_FLOAT_TYPE |
1504 if (FLOATP (number)) | 1413 if (FLOATP (number)) |
1506 #endif /* LISP_FLOAT_TYPE */ | 1415 #endif /* LISP_FLOAT_TYPE */ |
1507 | 1416 |
1508 return (make_int (XINT (number) - 1)); | 1417 return (make_int (XINT (number) - 1)); |
1509 } | 1418 } |
1510 | 1419 |
1511 DEFUN ("lognot", Flognot, Slognot, 1, 1, 0 /* | 1420 DEFUN ("lognot", Flognot, 1, 1, 0, /* |
1512 Return the bitwise complement of NUMBER. NUMBER must be an integer. | 1421 Return the bitwise complement of NUMBER. NUMBER must be an integer. |
1513 */ ) | 1422 */ |
1514 (number) | 1423 (number)) |
1515 Lisp_Object number; | |
1516 { | 1424 { |
1517 CHECK_INT (number); | 1425 CHECK_INT (number); |
1518 return (make_int (~XINT (number))); | 1426 return (make_int (~XINT (number))); |
1519 } | 1427 } |
1520 | 1428 |
1870 } | 1778 } |
1871 | 1779 |
1872 return Qnil; /* not reached */ | 1780 return Qnil; /* not reached */ |
1873 } | 1781 } |
1874 | 1782 |
1875 DEFUN ("weak-list-p", Fweak_list_p, Sweak_list_p, 1, 1, 0 /* | 1783 DEFUN ("weak-list-p", Fweak_list_p, 1, 1, 0, /* |
1876 Return non-nil if OBJECT is a weak list. | 1784 Return non-nil if OBJECT is a weak list. |
1877 */ ) | 1785 */ |
1878 (object) | 1786 (object)) |
1879 Lisp_Object object; | |
1880 { | 1787 { |
1881 return WEAK_LISTP (object) ? Qt : Qnil; | 1788 return WEAK_LISTP (object) ? Qt : Qnil; |
1882 } | 1789 } |
1883 | 1790 |
1884 DEFUN ("make-weak-list", Fmake_weak_list, Smake_weak_list, 0, 1, 0 /* | 1791 DEFUN ("make-weak-list", Fmake_weak_list, 0, 1, 0, /* |
1885 Create a new weak list. | 1792 Create a new weak list. |
1886 A weak list object is an object that contains a list. This list behaves | 1793 A weak list object is an object that contains a list. This list behaves |
1887 like any other list except that its elements do not count towards | 1794 like any other list except that its elements do not count towards |
1888 garbage collection -- if the only pointer to an object in inside a weak | 1795 garbage collection -- if the only pointer to an object in inside a weak |
1889 list (other than pointers in similar objects such as weak hash tables), | 1796 list (other than pointers in similar objects such as weak hash tables), |
1902 pointed to. | 1809 pointed to. |
1903 `key-assoc' Objects in the list disappear if they are conses | 1810 `key-assoc' Objects in the list disappear if they are conses |
1904 and the car is not pointed to. | 1811 and the car is not pointed to. |
1905 `value-assoc' Objects in the list disappear if they are conses | 1812 `value-assoc' Objects in the list disappear if they are conses |
1906 and the cdr is not pointed to. | 1813 and the cdr is not pointed to. |
1907 */ ) | 1814 */ |
1908 (type) | 1815 (type)) |
1909 Lisp_Object type; | |
1910 { | 1816 { |
1911 if (NILP (type)) | 1817 if (NILP (type)) |
1912 type = Qsimple; | 1818 type = Qsimple; |
1913 | 1819 |
1914 return make_weak_list (decode_weak_list_type (type)); | 1820 return make_weak_list (decode_weak_list_type (type)); |
1915 } | 1821 } |
1916 | 1822 |
1917 DEFUN ("weak-list-type", Fweak_list_type, Sweak_list_type, 1, 1, 0 /* | 1823 DEFUN ("weak-list-type", Fweak_list_type, 1, 1, 0, /* |
1918 Return the type of the given weak-list object. | 1824 Return the type of the given weak-list object. |
1919 */ ) | 1825 */ |
1920 (weak) | 1826 (weak)) |
1921 Lisp_Object weak; | |
1922 { | 1827 { |
1923 CHECK_WEAK_LIST (weak); | 1828 CHECK_WEAK_LIST (weak); |
1924 return encode_weak_list_type (XWEAK_LIST (weak)->type); | 1829 return encode_weak_list_type (XWEAK_LIST (weak)->type); |
1925 } | 1830 } |
1926 | 1831 |
1927 DEFUN ("weak-list-list", Fweak_list_list, Sweak_list_list, 1, 1, 0 /* | 1832 DEFUN ("weak-list-list", Fweak_list_list, 1, 1, 0, /* |
1928 Return the list contained in a weak-list object. | 1833 Return the list contained in a weak-list object. |
1929 */ ) | 1834 */ |
1930 (weak) | 1835 (weak)) |
1931 Lisp_Object weak; | |
1932 { | 1836 { |
1933 CHECK_WEAK_LIST (weak); | 1837 CHECK_WEAK_LIST (weak); |
1934 return XWEAK_LIST_LIST (weak); | 1838 return XWEAK_LIST_LIST (weak); |
1935 } | 1839 } |
1936 | 1840 |
1937 DEFUN ("set-weak-list-list", Fset_weak_list_list, Sset_weak_list_list, | 1841 DEFUN ("set-weak-list-list", Fset_weak_list_list, 2, 2, 0, /* |
1938 2, 2, 0 /* | |
1939 Change the list contained in a weak-list object. | 1842 Change the list contained in a weak-list object. |
1940 */ ) | 1843 */ |
1941 (weak, new_list) | 1844 (weak, new_list)) |
1942 Lisp_Object weak, new_list; | |
1943 { | 1845 { |
1944 CHECK_WEAK_LIST (weak); | 1846 CHECK_WEAK_LIST (weak); |
1945 XWEAK_LIST_LIST (weak) = new_list; | 1847 XWEAK_LIST_LIST (weak) = new_list; |
1946 return new_list; | 1848 return new_list; |
1947 } | 1849 } |
2088 | 1990 |
2089 defsymbol (&Qcdr, "cdr"); | 1991 defsymbol (&Qcdr, "cdr"); |
2090 | 1992 |
2091 defsymbol (&Qweak_listp, "weak-list-p"); | 1993 defsymbol (&Qweak_listp, "weak-list-p"); |
2092 | 1994 |
2093 defsubr (&Swrong_type_argument); | 1995 DEFSUBR (Fwrong_type_argument); |
2094 | 1996 |
2095 defsubr (&Seq); | 1997 DEFSUBR (Feq); |
2096 defsubr (&Snull); | 1998 DEFSUBR (Fnull); |
2097 defsubr (&Slistp); | 1999 DEFSUBR (Flistp); |
2098 defsubr (&Snlistp); | 2000 DEFSUBR (Fnlistp); |
2099 defsubr (&Sconsp); | 2001 DEFSUBR (Fconsp); |
2100 defsubr (&Satom); | 2002 DEFSUBR (Fatom); |
2101 defsubr (&Schar_or_string_p); | 2003 DEFSUBR (Fchar_or_string_p); |
2102 defsubr (&Scharacterp); | 2004 DEFSUBR (Fcharacterp); |
2103 defsubr (&Sintegerp); | 2005 DEFSUBR (Fintegerp); |
2104 defsubr (&Sinteger_or_marker_p); | 2006 DEFSUBR (Finteger_or_marker_p); |
2105 defsubr (&Snumberp); | 2007 DEFSUBR (Fnumberp); |
2106 defsubr (&Snumber_or_marker_p); | 2008 DEFSUBR (Fnumber_or_marker_p); |
2107 #ifdef LISP_FLOAT_TYPE | 2009 #ifdef LISP_FLOAT_TYPE |
2108 defsubr (&Sfloatp); | 2010 DEFSUBR (Ffloatp); |
2109 #endif /* LISP_FLOAT_TYPE */ | 2011 #endif /* LISP_FLOAT_TYPE */ |
2110 defsubr (&Snatnump); | 2012 DEFSUBR (Fnatnump); |
2111 defsubr (&Ssymbolp); | 2013 DEFSUBR (Fsymbolp); |
2112 defsubr (&Skeywordp); | 2014 DEFSUBR (Fkeywordp); |
2113 defsubr (&Sstringp); | 2015 DEFSUBR (Fstringp); |
2114 defsubr (&Svectorp); | 2016 DEFSUBR (Fvectorp); |
2115 defsubr (&Sbitp); | 2017 DEFSUBR (Fbitp); |
2116 defsubr (&Sbit_vector_p); | 2018 DEFSUBR (Fbit_vector_p); |
2117 defsubr (&Sarrayp); | 2019 DEFSUBR (Farrayp); |
2118 defsubr (&Ssequencep); | 2020 DEFSUBR (Fsequencep); |
2119 defsubr (&Smarkerp); | 2021 DEFSUBR (Fmarkerp); |
2120 defsubr (&Ssubrp); | 2022 DEFSUBR (Fsubrp); |
2121 defsubr (&Ssubr_min_args); | 2023 DEFSUBR (Fsubr_min_args); |
2122 defsubr (&Ssubr_max_args); | 2024 DEFSUBR (Fsubr_max_args); |
2123 defsubr (&Scompiled_function_p); | 2025 DEFSUBR (Fcompiled_function_p); |
2124 defsubr (&Stype_of); | 2026 DEFSUBR (Ftype_of); |
2125 defsubr (&Scar); | 2027 DEFSUBR (Fcar); |
2126 defsubr (&Scdr); | 2028 DEFSUBR (Fcdr); |
2127 defsubr (&Scar_safe); | 2029 DEFSUBR (Fcar_safe); |
2128 defsubr (&Scdr_safe); | 2030 DEFSUBR (Fcdr_safe); |
2129 defsubr (&Ssetcar); | 2031 DEFSUBR (Fsetcar); |
2130 defsubr (&Ssetcdr); | 2032 DEFSUBR (Fsetcdr); |
2131 defsubr (&Sindirect_function); | 2033 DEFSUBR (Findirect_function); |
2132 defsubr (&Saref); | 2034 DEFSUBR (Faref); |
2133 defsubr (&Saset); | 2035 DEFSUBR (Faset); |
2134 | 2036 |
2135 defsubr (&Scompiled_function_instructions); | 2037 DEFSUBR (Fcompiled_function_instructions); |
2136 defsubr (&Scompiled_function_constants); | 2038 DEFSUBR (Fcompiled_function_constants); |
2137 defsubr (&Scompiled_function_stack_depth); | 2039 DEFSUBR (Fcompiled_function_stack_depth); |
2138 defsubr (&Scompiled_function_arglist); | 2040 DEFSUBR (Fcompiled_function_arglist); |
2139 defsubr (&Scompiled_function_interactive); | 2041 DEFSUBR (Fcompiled_function_interactive); |
2140 defsubr (&Scompiled_function_doc_string); | 2042 DEFSUBR (Fcompiled_function_doc_string); |
2141 defsubr (&Scompiled_function_domain); | 2043 DEFSUBR (Fcompiled_function_domain); |
2142 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK | 2044 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK |
2143 defsubr (&Scompiled_function_annotation); | 2045 DEFSUBR (Fcompiled_function_annotation); |
2144 #endif | 2046 #endif |
2145 | 2047 |
2146 defsubr (&Snumber_to_string); | 2048 DEFSUBR (Fnumber_to_string); |
2147 defsubr (&Sstring_to_number); | 2049 DEFSUBR (Fstring_to_number); |
2148 defsubr (&Seqlsign); | 2050 DEFSUBR (Feqlsign); |
2149 defsubr (&Slss); | 2051 DEFSUBR (Flss); |
2150 defsubr (&Sgtr); | 2052 DEFSUBR (Fgtr); |
2151 defsubr (&Sleq); | 2053 DEFSUBR (Fleq); |
2152 defsubr (&Sgeq); | 2054 DEFSUBR (Fgeq); |
2153 defsubr (&Sneq); | 2055 DEFSUBR (Fneq); |
2154 defsubr (&Szerop); | 2056 DEFSUBR (Fzerop); |
2155 defsubr (&Splus); | 2057 DEFSUBR (Fplus); |
2156 defsubr (&Sminus); | 2058 DEFSUBR (Fminus); |
2157 defsubr (&Stimes); | 2059 DEFSUBR (Ftimes); |
2158 defsubr (&Squo); | 2060 DEFSUBR (Fquo); |
2159 defsubr (&Srem); | 2061 DEFSUBR (Frem); |
2160 defsubr (&Smod); | 2062 DEFSUBR (Fmod); |
2161 defsubr (&Smax); | 2063 DEFSUBR (Fmax); |
2162 defsubr (&Smin); | 2064 DEFSUBR (Fmin); |
2163 defsubr (&Slogand); | 2065 DEFSUBR (Flogand); |
2164 defsubr (&Slogior); | 2066 DEFSUBR (Flogior); |
2165 defsubr (&Slogxor); | 2067 DEFSUBR (Flogxor); |
2166 defsubr (&Slsh); | 2068 DEFSUBR (Flsh); |
2167 defsubr (&Sash); | 2069 DEFSUBR (Fash); |
2168 defsubr (&Sadd1); | 2070 DEFSUBR (Fadd1); |
2169 defsubr (&Ssub1); | 2071 DEFSUBR (Fsub1); |
2170 defsubr (&Slognot); | 2072 DEFSUBR (Flognot); |
2171 | 2073 |
2172 defsubr (&Sweak_list_p); | 2074 DEFSUBR (Fweak_list_p); |
2173 defsubr (&Smake_weak_list); | 2075 DEFSUBR (Fmake_weak_list); |
2174 defsubr (&Sweak_list_type); | 2076 DEFSUBR (Fweak_list_type); |
2175 defsubr (&Sweak_list_list); | 2077 DEFSUBR (Fweak_list_list); |
2176 defsubr (&Sset_weak_list_list); | 2078 DEFSUBR (Fset_weak_list_list); |
2177 } | 2079 } |
2178 | 2080 |
2179 void | 2081 void |
2180 vars_of_data (void) | 2082 vars_of_data (void) |
2181 { | 2083 { |