Mercurial > hg > xemacs-beta
comparison src/lisp.h @ 20:859a2309aef8 r19-15b93
Import from CVS: tag r19-15b93
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:05 +0200 |
parents | 0293115a14e9 |
children | e04119814345 |
comparison
equal
deleted
inserted
replaced
19:ac1f612d5250 | 20:859a2309aef8 |
---|---|
1363 /* DEFUN - Define a built-in Lisp-visible C function or `subr'. | 1363 /* DEFUN - Define a built-in Lisp-visible C function or `subr'. |
1364 `lname' should be the name to give the function in Lisp, | 1364 `lname' should be the name to give the function in Lisp, |
1365 as a null-terminated C string. | 1365 as a null-terminated C string. |
1366 `Fname' should be the C equivalent of `lname', using only characters | 1366 `Fname' should be the C equivalent of `lname', using only characters |
1367 valid in a C identifier, with an "F" prepended. | 1367 valid in a C identifier, with an "F" prepended. |
1368 `sname' should be the name for the C constant structure | 1368 The name of the C constant structure that records information |
1369 that records information on this function for internal use. | 1369 on this function for internal use is "S" concatenated with Fname. |
1370 By convention, it should be the same as `fnname' but with S instead of F. | |
1371 It's too bad that C macros can't compute this from `fnname'. | |
1372 `minargs' should be a number, the minimum number of arguments allowed. | 1370 `minargs' should be a number, the minimum number of arguments allowed. |
1373 `maxargs' should be a number, the maximum number of arguments allowed, | 1371 `maxargs' should be a number, the maximum number of arguments allowed, |
1374 or else MANY or UNEVALLED. | 1372 or else MANY or UNEVALLED. |
1375 MANY means pass a vector of evaluated arguments, | 1373 MANY means pass a vector of evaluated arguments, |
1376 in the form of an integer number-of-arguments | 1374 in the form of an integer number-of-arguments |
1391 #define MANY -2 | 1389 #define MANY -2 |
1392 #define UNEVALLED -1 | 1390 #define UNEVALLED -1 |
1393 | 1391 |
1394 /* Can't be const, because then subr->doc is read-only and | 1392 /* Can't be const, because then subr->doc is read-only and |
1395 Snarf_documentation chokes */ | 1393 Snarf_documentation chokes */ |
1396 #define DEFUN(lname, Fname, sname, minargs, maxargs, prompt) \ | 1394 |
1397 Lisp_Object Fname ( DEFUN__ ## maxargs ) ; /* See below */ \ | 1395 #define DEFUN(lname, Fname, minargs, maxargs, prompt, arglist) \ |
1398 static struct Lisp_Subr sname \ | 1396 Lisp_Object Fname (DEFUN_ ## maxargs arglist) ; /* See below */ \ |
1399 = { { lrecord_subr }, minargs, maxargs, prompt, 0, lname, (lisp_fn_t) Fname }; \ | 1397 static struct Lisp_Subr S##Fname = { {lrecord_subr}, \ |
1400 Lisp_Object Fname | 1398 minargs, maxargs, prompt, 0, lname, (lisp_fn_t) Fname }; \ |
1399 Lisp_Object Fname (DEFUN_##maxargs arglist) | |
1400 | |
1401 | 1401 |
1402 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a | 1402 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a |
1403 prototype that matches maxargs, and add the obligatory | 1403 prototype that matches maxargs, and add the obligatory |
1404 `Lisp_Object' type declaration to the formal C arguments. */ | 1404 `Lisp_Object' type declaration to the formal C arguments. */ |
1405 | 1405 |
1406 #define DEFUN_MANY(named_int, named_Lisp_Object) int named_int, Lisp_Object *named_Lisp_Object | 1406 #define DEFUN_MANY(named_int, named_Lisp_Object) named_int, named_Lisp_Object |
1407 #define DEFUN_UNEVALLED(args) Lisp_Object args | 1407 #define DEFUN_UNEVALLED(args) Lisp_Object args |
1408 #define DEFUN_0() void | 1408 #define DEFUN_0() void |
1409 #define DEFUN_1(a) Lisp_Object a | 1409 #define DEFUN_1(a) Lisp_Object a |
1410 #define DEFUN_2(a,b) DEFUN_1(a), Lisp_Object b | 1410 #define DEFUN_2(a,b) DEFUN_1(a), Lisp_Object b |
1411 #define DEFUN_3(a,b,c) DEFUN_2(a,b), Lisp_Object c | 1411 #define DEFUN_3(a,b,c) DEFUN_2(a,b), Lisp_Object c |
1413 #define DEFUN_5(a,b,c,d,e) DEFUN_4(a,b,c,d), Lisp_Object e | 1413 #define DEFUN_5(a,b,c,d,e) DEFUN_4(a,b,c,d), Lisp_Object e |
1414 #define DEFUN_6(a,b,c,d,e,f) DEFUN_5(a,b,c,d,e), Lisp_Object f | 1414 #define DEFUN_6(a,b,c,d,e,f) DEFUN_5(a,b,c,d,e), Lisp_Object f |
1415 #define DEFUN_7(a,b,c,d,e,f,g) DEFUN_6(a,b,c,d,e,f), Lisp_Object g | 1415 #define DEFUN_7(a,b,c,d,e,f,g) DEFUN_6(a,b,c,d,e,f), Lisp_Object g |
1416 #define DEFUN_8(a,b,c,d,e,f,g,h) DEFUN_7(a,b,c,d,e,f,g), Lisp_Object h | 1416 #define DEFUN_8(a,b,c,d,e,f,g,h) DEFUN_7(a,b,c,d,e,f,g), Lisp_Object h |
1417 | 1417 |
1418 #define DEFUN__MANY DEFUN_MANY(argc,argv) | |
1419 #define DEFUN__UNEVALLED DEFUN_UNEVALLED(args) | |
1420 #define DEFUN__0 DEFUN_0() | |
1421 #define DEFUN__1 DEFUN_1(a) | |
1422 #define DEFUN__2 DEFUN_2(a,b) | |
1423 #define DEFUN__3 DEFUN_3(a,b,c) | |
1424 #define DEFUN__4 DEFUN_4(a,b,c,d) | |
1425 #define DEFUN__5 DEFUN_5(a,b,c,d,e) | |
1426 #define DEFUN__6 DEFUN_6(a,b,c,d,e,f) | |
1427 #define DEFUN__7 DEFUN_7(a,b,c,d,e,f,g) | |
1428 #define DEFUN__8 DEFUN_8(a,b,c,d,e,f,g,h) | |
1429 | |
1430 /* WARNING: If you add defines here for higher values of maxargs, | 1418 /* WARNING: If you add defines here for higher values of maxargs, |
1431 make sure to also fix the clauses in primitive_funcall(), | 1419 make sure to also fix the clauses in primitive_funcall(), |
1432 and change the define of SUBR_MAX_ARGS above. */ | 1420 and change the define of SUBR_MAX_ARGS above. */ |
1433 | 1421 |
1434 #include "symeval.h" | 1422 #include "symeval.h" |
1475 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical)))) | 1463 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical)))) |
1476 | 1464 |
1477 /* Check quit-flag and quit if it is non-nil. Also do any other things | 1465 /* Check quit-flag and quit if it is non-nil. Also do any other things |
1478 that might have gotten queued until it was safe. */ | 1466 that might have gotten queued until it was safe. */ |
1479 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0) | 1467 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0) |
1468 | |
1469 /* | |
1470 #define QUIT \ | |
1471 do {if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \ | |
1472 { Vquit_flag = Qnil; Fsignal (Qquit, Qnil); }} while (0) | |
1473 */ | |
1480 | 1474 |
1481 #define REALLY_QUIT do { if (INTERNAL_REALLY_QUITP) signal_quit (); } while (0) | 1475 #define REALLY_QUIT do { if (INTERNAL_REALLY_QUITP) signal_quit (); } while (0) |
1482 | 1476 |
1483 | 1477 |
1484 /************************************************************************/ | 1478 /************************************************************************/ |