comparison src/eval.c @ 5506:b0d87f92e60b

Complete support for macro-declaration-function, bytecomp{,-runtime}.el lisp/ChangeLog addition: 2011-05-07 Aidan Kehoe <kehoea@parhasard.net> * bytecomp-runtime.el: * bytecomp.el (byte-compile-file-form-defmumble): * bytecomp-runtime.el (macro-declaration-function): New. * subr.el: * subr.el (macro-declaration-function): Removed. Add support for macro-declaration-function, which is a GNU mechanism for indicating indentation and edebug information in macros (and only in macros). src/ChangeLog addition: 2011-05-07 Aidan Kehoe <kehoea@parhasard.net> * eval.c: * eval.c (Fdefmacro): * eval.c (syms_of_eval): Support macro-declaration-function in defmacro, incompletely and without documentation. * lisp.h: Declare Fnth here, necessary for the previous changes.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 08 May 2011 09:19:25 +0100
parents 0af042a0c116
children 56144c8593a8
comparison
equal deleted inserted replaced
5505:3b220aa03f89 5506:b0d87f92e60b
222 222
223 /* A special tag that can be used internally from C code to catch 223 /* A special tag that can be used internally from C code to catch
224 every attempt to throw past this level. */ 224 every attempt to throw past this level. */
225 Lisp_Object Vcatch_everything_tag; 225 Lisp_Object Vcatch_everything_tag;
226 226
227 Lisp_Object Qautoload, Qmacro, Qexit; 227 Lisp_Object Qautoload, Qmacro, Qexit, Qdeclare;
228 Lisp_Object Qinteractive, Qcommandp, Qdefun, Qprogn, Qvalues; 228 Lisp_Object Qinteractive, Qcommandp, Qdefun, Qprogn, Qvalues;
229 Lisp_Object Vquit_flag, Vinhibit_quit; 229 Lisp_Object Vquit_flag, Vinhibit_quit;
230 Lisp_Object Qand_rest, Qand_optional; 230 Lisp_Object Qand_rest, Qand_optional;
231 Lisp_Object Qdebug_on_error, Qstack_trace_on_error; 231 Lisp_Object Qdebug_on_error, Qstack_trace_on_error;
232 Lisp_Object Qdebug_on_signal, Qstack_trace_on_signal; 232 Lisp_Object Qdebug_on_signal, Qstack_trace_on_signal;
270 /* Non-nil means record all fset's and provide's, to be undone 270 /* Non-nil means record all fset's and provide's, to be undone
271 if the file being autoloaded is not fully loaded. 271 if the file being autoloaded is not fully loaded.
272 They are recorded by being consed onto the front of Vautoload_queue: 272 They are recorded by being consed onto the front of Vautoload_queue:
273 (FUN . ODEF) for a defun, (OFEATURES . nil) for a provide. */ 273 (FUN . ODEF) for a defun, (OFEATURES . nil) for a provide. */
274 Lisp_Object Vautoload_queue; 274 Lisp_Object Vautoload_queue;
275
276 Lisp_Object Vmacro_declaration_function;
275 277
276 /* Current number of specbindings allocated in specpdl. */ 278 /* Current number of specbindings allocated in specpdl. */
277 int specpdl_size; 279 int specpdl_size;
278 280
279 /* Pointer to beginning of specpdl. */ 281 /* Pointer to beginning of specpdl. */
1404 arguments: (NAME ARGLIST &optional DOCSTRING &rest BODY) 1406 arguments: (NAME ARGLIST &optional DOCSTRING &rest BODY)
1405 */ 1407 */
1406 (args)) 1408 (args))
1407 { 1409 {
1408 /* This function can GC */ 1410 /* This function can GC */
1411 if (!NILP (Vmacro_declaration_function))
1412 {
1413 Lisp_Object declare = Fnth (make_int (2), args);
1414
1415 /* Sigh. This GNU interface is incompatible with the CL declare macro,
1416 and the latter is much older.
1417
1418 GNU describe this syntax in their docstrings. It's sufficiently
1419 ugly in the XEmacs context (and in general, but ...) that I'm not
1420 rushing to document it.
1421
1422 The GNU interface accepts multiple (declare ...) sexps at the
1423 beginning of a macro. Nothing uses this, and the XEmacs byte
1424 compiler (will) warn(s) if it encounters code that attempts to use
1425 it. */
1426
1427 if (STRINGP (declare))
1428 {
1429 declare = Fnth (make_int (3), args);
1430 }
1431
1432 if (CONSP (declare) && EQ (Qdeclare, XCAR (declare)))
1433 {
1434 call2 (Vmacro_declaration_function, XCAR (args), declare);
1435 }
1436 }
1437
1409 return define_function (XCAR (args), 1438 return define_function (XCAR (args),
1410 Fcons (Qmacro, Fcons (Qlambda, XCDR (args)))); 1439 Fcons (Qmacro, Fcons (Qlambda, XCDR (args))));
1411 } 1440 }
1412 1441
1413 DEFUN ("defvar", Fdefvar, 1, UNEVALLED, 0, /* 1442 DEFUN ("defvar", Fdefvar, 1, UNEVALLED, 0, /*
7313 DEFSYMBOL (Qmacro); 7342 DEFSYMBOL (Qmacro);
7314 defsymbol (&Qand_rest, "&rest"); 7343 defsymbol (&Qand_rest, "&rest");
7315 defsymbol (&Qand_optional, "&optional"); 7344 defsymbol (&Qand_optional, "&optional");
7316 /* Note that the process code also uses Qexit */ 7345 /* Note that the process code also uses Qexit */
7317 DEFSYMBOL (Qexit); 7346 DEFSYMBOL (Qexit);
7347 DEFSYMBOL (Qdeclare);
7318 DEFSYMBOL (Qsetq); 7348 DEFSYMBOL (Qsetq);
7319 DEFSYMBOL (Qinteractive); 7349 DEFSYMBOL (Qinteractive);
7320 DEFSYMBOL (Qcommandp); 7350 DEFSYMBOL (Qcommandp);
7321 DEFSYMBOL (Qdefun); 7351 DEFSYMBOL (Qdefun);
7322 DEFSYMBOL (Qprogn); 7352 DEFSYMBOL (Qprogn);
7570 This applies to `values', `values-list', `multiple-value-bind' and related 7600 This applies to `values', `values-list', `multiple-value-bind' and related
7571 macros and special operators. 7601 macros and special operators.
7572 */); 7602 */);
7573 Vmultiple_values_limit = EMACS_INT_MAX > INT_MAX ? INT_MAX : EMACS_INT_MAX; 7603 Vmultiple_values_limit = EMACS_INT_MAX > INT_MAX ? INT_MAX : EMACS_INT_MAX;
7574 7604
7605 DEFVAR_LISP ("macro-declaration-function", &Vmacro_declaration_function /*
7606 Function to process declarations in a macro definition.
7607 The function will be called with two args MACRO and DECL.
7608 MACRO is the name of the macro being defined.
7609 DECL is a list `(declare ...)' containing the declarations.
7610 The value the function returns is not used.
7611 */);
7612 Vmacro_declaration_function = Qnil;
7613
7575 staticpro (&Vcatch_everything_tag); 7614 staticpro (&Vcatch_everything_tag);
7576 Vcatch_everything_tag = make_opaque (OPAQUE_CLEAR, 0); 7615 Vcatch_everything_tag = make_opaque (OPAQUE_CLEAR, 0);
7577 7616
7578 staticpro (&Vpending_warnings); 7617 staticpro (&Vpending_warnings);
7579 Vpending_warnings = Qnil; 7618 Vpending_warnings = Qnil;