comparison src/eval.c @ 4693:80cd90837ac5

Add argument information to remaining MANY or UNEVALLED C subrs. src/ChangeLog addition: 2009-09-20 Aidan Kehoe <kehoea@parhasard.net> * alloc.c (Flist): (Fvector): (Fbit_vector): (Fmake_byte_code): (Fstring): * data.c (Feqlsign): (Flss): (Fgtr): (Fleq): (Fgeq): (Fneq): (Fgtr): (Fplus): (Fminus): (Ftimes): (Fdiv): (Fquo): (Fmax): (Fmin): (Flogand): (Flogior): (Flogxor): * editfns.c (Fsave_excursion): (Fsave_current_buffer): (Fencode_time): (Finsert): (Finsert_before_markers): (Fsave_restriction): (Fformat): * elhash.c (Fmake_hash_table): * eval.c (Fdefun): (Fdefmacro): (Fcatch): (Funwind_protect): (Fcall_with_condition_handler): (Ffuncall): (Fapply): (Frun_hooks): * fns.c (Fappend): (Fconcat): (Fvconcat): (Fbvconcat): (Fnconc): * print.c (Fwith_output_to_temp_buffer): * process.c (Fstart_process_internal): * window.c (Fsave_window_excursion): * widget.c (Fwidget_apply): Add argument information, in a form understood by #'function-arglist, to all these MANY or UNEVALLED (that is to say, special-operator) built-in functions.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 20 Sep 2009 21:29:00 +0100
parents cdabd56ce1b5
children 17f7e9191c0b
comparison
equal deleted inserted replaced
4692:dc3c2f298857 4693:80cd90837ac5
1286 LOADHIST_ATTACH (Fcons (Qdefun, name)); 1286 LOADHIST_ATTACH (Fcons (Qdefun, name));
1287 return name; 1287 return name;
1288 } 1288 }
1289 1289
1290 DEFUN ("defun", Fdefun, 2, UNEVALLED, 0, /* 1290 DEFUN ("defun", Fdefun, 2, UNEVALLED, 0, /*
1291 \(defun NAME ARGLIST [DOCSTRING] BODY...): define NAME as a function. 1291 Define NAME as a function.
1292 The definition is (lambda ARGLIST [DOCSTRING] BODY...). 1292 The definition is (lambda ARGLIST [DOCSTRING] BODY...).
1293 See also the function `interactive'. 1293 See also the function `interactive'.
1294
1295 arguments: (NAME ARGLIST &optional DOCSTRING &rest BODY)
1294 */ 1296 */
1295 (args)) 1297 (args))
1296 { 1298 {
1297 /* This function can GC */ 1299 /* This function can GC */
1298 return define_function (XCAR (args), 1300 return define_function (XCAR (args),
1299 Fcons (Qlambda, XCDR (args))); 1301 Fcons (Qlambda, XCDR (args)));
1300 } 1302 }
1301 1303
1302 DEFUN ("defmacro", Fdefmacro, 2, UNEVALLED, 0, /* 1304 DEFUN ("defmacro", Fdefmacro, 2, UNEVALLED, 0, /*
1303 \(defmacro NAME ARGLIST [DOCSTRING] BODY...): define NAME as a macro. 1305 Define NAME as a macro.
1304 The definition is (macro lambda ARGLIST [DOCSTRING] BODY...). 1306 The definition is (macro lambda ARGLIST [DOCSTRING] BODY...).
1305 When the macro is called, as in (NAME ARGS...), 1307 When the macro is called, as in (NAME ARGS...),
1306 the function (lambda ARGLIST BODY...) is applied to 1308 the function (lambda ARGLIST BODY...) is applied to
1307 the list ARGS... as it appears in the expression, 1309 the list ARGS... as it appears in the expression,
1308 and the result should be a form to be evaluated instead of the original. 1310 and the result should be a form to be evaluated instead of the original.
1311
1312 arguments: (NAME ARGLIST &optional DOCSTRING &rest BODY)
1309 */ 1313 */
1310 (args)) 1314 (args))
1311 { 1315 {
1312 /* This function can GC */ 1316 /* This function can GC */
1313 return define_function (XCAR (args), 1317 return define_function (XCAR (args),
1534 } 1538 }
1535 1539
1536 #endif /* ERROR_CHECK_TRAPPING_PROBLEMS */ 1540 #endif /* ERROR_CHECK_TRAPPING_PROBLEMS */
1537 1541
1538 DEFUN ("catch", Fcatch, 1, UNEVALLED, 0, /* 1542 DEFUN ("catch", Fcatch, 1, UNEVALLED, 0, /*
1539 \(catch TAG BODY...): eval BODY allowing nonlocal exits using `throw'. 1543 Eval BODY allowing nonlocal exits using `throw'.
1540 TAG is evalled to get the tag to use. Then the BODY is executed. 1544 TAG is evalled to get the tag to use. Then the BODY is executed.
1541 Within BODY, (throw TAG VAL) with same (`eq') tag exits BODY and this `catch'. 1545 Within BODY, (throw TAG VAL) with same (`eq') tag exits BODY and this `catch'.
1542 If no throw happens, `catch' returns the value of the last BODY form. 1546 If no throw happens, `catch' returns the value of the last BODY form.
1543 If a throw happens, it specifies the value to return from `catch'. 1547 If a throw happens, it specifies the value to return from `catch'.
1548
1549 arguments: (TAG &rest BODY)
1544 */ 1550 */
1545 (args)) 1551 (args))
1546 { 1552 {
1547 /* This function can GC */ 1553 /* This function can GC */
1548 Lisp_Object tag = Feval (XCAR (args)); 1554 Lisp_Object tag = Feval (XCAR (args));
1805 RETURN_NOT_REACHED (Qnil); 1811 RETURN_NOT_REACHED (Qnil);
1806 } 1812 }
1807 1813
1808 DEFUN ("unwind-protect", Funwind_protect, 1, UNEVALLED, 0, /* 1814 DEFUN ("unwind-protect", Funwind_protect, 1, UNEVALLED, 0, /*
1809 Do BODYFORM, protecting with UNWINDFORMS. 1815 Do BODYFORM, protecting with UNWINDFORMS.
1810 Usage looks like (unwind-protect BODYFORM UNWINDFORMS...).
1811 If BODYFORM completes normally, its value is returned 1816 If BODYFORM completes normally, its value is returned
1812 after executing the UNWINDFORMS. 1817 after executing the UNWINDFORMS.
1813 If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway. 1818 If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway.
1819
1820 arguments: (BODYFORM &rest UNWINDFORMS)
1814 */ 1821 */
1815 (args)) 1822 (args))
1816 { 1823 {
1817 /* This function can GC */ 1824 /* This function can GC */
1818 int speccount = specpdl_depth(); 1825 int speccount = specpdl_depth();
2147 Lisp_Object handlers = XCDR (XCDR (args)); 2154 Lisp_Object handlers = XCDR (XCDR (args));
2148 return condition_case_3 (bodyform, var, handlers); 2155 return condition_case_3 (bodyform, var, handlers);
2149 } 2156 }
2150 2157
2151 DEFUN ("call-with-condition-handler", Fcall_with_condition_handler, 2, MANY, 0, /* 2158 DEFUN ("call-with-condition-handler", Fcall_with_condition_handler, 2, MANY, 0, /*
2152 Regain control when an error is signalled, without popping the stack. 2159 Call FUNCTION with arguments ARGS, regaining control on error.
2153 Usage looks like (call-with-condition-handler HANDLER FUNCTION &rest ARGS). 2160
2154 This function is similar to `condition-case', but the handler is invoked 2161 This function is similar to `condition-case', but HANDLER is invoked
2155 with the same environment (Lisp stack, bindings, catches, condition-cases) 2162 with the same environment (Lisp stack, bindings, catches, condition-cases)
2156 that was current when `signal' was called, rather than when the handler 2163 that was current when `signal' was called, rather than when the handler
2157 was established. 2164 was established.
2158 2165
2159 HANDLER should be a function of one argument, which is a cons of the args 2166 HANDLER should be a function of one argument, which is a cons of the args
2161 `signal' is called (this differs from `condition-case', which allows 2168 `signal' is called (this differs from `condition-case', which allows
2162 you to specify which errors are trapped). If the handler function 2169 you to specify which errors are trapped). If the handler function
2163 returns, `signal' continues as if the handler were never invoked. 2170 returns, `signal' continues as if the handler were never invoked.
2164 \(It continues to look for handlers established earlier than this one, 2171 \(It continues to look for handlers established earlier than this one,
2165 and invokes the standard error-handler if none is found.) 2172 and invokes the standard error-handler if none is found.)
2173
2174 arguments: (HANDLER FUNCTION &rest ARGS)
2166 */ 2175 */
2167 (int nargs, Lisp_Object *args)) /* Note! Args side-effected! */ 2176 (int nargs, Lisp_Object *args)) /* Note! Args side-effected! */
2168 { 2177 {
2169 /* This function can GC */ 2178 /* This function can GC */
2170 int speccount = specpdl_depth(); 2179 int speccount = specpdl_depth();
3893 (Qgarbage_collecting, 2, args, RUN_HOOKS_TO_COMPLETION, 3902 (Qgarbage_collecting, 2, args, RUN_HOOKS_TO_COMPLETION,
3894 INHIBIT_QUIT | NO_INHIBIT_ERRORS); 3903 INHIBIT_QUIT | NO_INHIBIT_ERRORS);
3895 } 3904 }
3896 3905
3897 DEFUN ("funcall", Ffuncall, 1, MANY, 0, /* 3906 DEFUN ("funcall", Ffuncall, 1, MANY, 0, /*
3898 Call first argument as a function, passing the remaining arguments to it. 3907 Call FUNCTION as a function, passing the remaining arguments to it.
3899 Thus, (funcall 'cons 'x 'y) returns (x . y). 3908 Thus, (funcall 'cons 'x 'y) returns (x . y).
3909
3910 arguments: (FUNCTION &rest ARGS)
3900 */ 3911 */
3901 (int nargs, Lisp_Object *args)) 3912 (int nargs, Lisp_Object *args))
3902 { 3913 {
3903 /* This function can GC */ 3914 /* This function can GC */
3904 Lisp_Object fun; 3915 Lisp_Object fun;
4220 4231
4221 4232
4222 DEFUN ("apply", Fapply, 2, MANY, 0, /* 4233 DEFUN ("apply", Fapply, 2, MANY, 0, /*
4223 Call FUNCTION with the remaining args, using the last arg as a list of args. 4234 Call FUNCTION with the remaining args, using the last arg as a list of args.
4224 Thus, (apply '+ 1 2 '(3 4)) returns 10. 4235 Thus, (apply '+ 1 2 '(3 4)) returns 10.
4236
4237 arguments: (FUNCTION &rest ARGS)
4225 */ 4238 */
4226 (int nargs, Lisp_Object *args)) 4239 (int nargs, Lisp_Object *args))
4227 { 4240 {
4228 /* This function can GC */ 4241 /* This function can GC */
4229 Lisp_Object fun = args[0]; 4242 Lisp_Object fun = args[0];
4963 If it is a list, the elements are called, in order, with no arguments. 4976 If it is a list, the elements are called, in order, with no arguments.
4964 4977
4965 To make a hook variable buffer-local, use `make-local-hook', 4978 To make a hook variable buffer-local, use `make-local-hook',
4966 not `make-local-variable'. 4979 not `make-local-variable'.
4967 4980
4968 arguments: (&rest HOOKS) 4981 arguments: (FIRST &rest REST)
4969 */ 4982 */
4970 (int nargs, Lisp_Object *args)) 4983 (int nargs, Lisp_Object *args))
4971 { 4984 {
4972 REGISTER int i; 4985 REGISTER int i;
4973 4986