home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / packages / bytecomp / eval.c.patch < prev    next >
Encoding:
Text File  |  1991-10-29  |  2.3 KB  |  88 lines

  1. *** old-eval.c    Tue Oct 29 20:36:57 1991
  2. --- eval.c    Tue Oct 29 20:48:59 1991
  3. ***************
  4. *** 715,720 ****
  5. --- 715,722 ----
  6.     return Qnil;
  7.   }
  8.   
  9. + /* better version of this from Hallvard Furuseth.
  10. +  */
  11.   DEFUN ("macroexpand", Fmacroexpand, Smacroexpand, 1, 2, 0,
  12.     "Return result of expanding macros at top level of FORM.\n\
  13.   If FORM is not a macro call, it is returned unchanged.\n\
  14. ***************
  15. *** 734,771 ****
  16.        in case it expands into another macro call.  */
  17.         if (XTYPE (form) != Lisp_Cons)
  18.       break;
  19. !       sym = XCONS (form)->car;
  20. !       /* Detect  ((macro lambda ...) ...)  */
  21. !       if (XTYPE (sym) == Lisp_Cons
  22. !       && EQ (XCONS (sym)->car, Qmacro))
  23. !     {
  24. !       expander = XCONS (sym)->cdr;
  25. !       goto explicit;
  26. !     }
  27. !       if (XTYPE (sym) != Lisp_Symbol)
  28. !     break;
  29.         /* Trace symbols aliases to other symbols
  30.        until we get a symbol that is not an alias.  */
  31. !       while (1)
  32.       {
  33.         QUIT;
  34.         tem = Fassq (sym, env);
  35.         if (NULL (tem))
  36.           {
  37.             def = XSYMBOL (sym)->function;
  38. !           if (XTYPE (def) == Lisp_Symbol && !EQ (def, Qunbound))
  39. !         sym = def;
  40. !           else
  41. !         break;
  42.           }
  43. !       else
  44. !         {
  45. !           if (XTYPE (tem) == Lisp_Cons
  46. !           && XTYPE (XCONS (tem)->cdr) == Lisp_Symbol)
  47. !         sym = XCONS (tem)->cdr;
  48. !           else
  49. !         break;
  50. !         }
  51.       }
  52.         /* Right now TEM is the result from SYM in ENV,
  53.        and if TEM is nil then DEF is SYM's function definition.  */
  54. --- 736,758 ----
  55.        in case it expands into another macro call.  */
  56.         if (XTYPE (form) != Lisp_Cons)
  57.       break;
  58. !       /* Set SYM, give DEF and TEM right values in case SYM is not a symbol. */
  59. !       def = sym = XCONS (form)->car;
  60. !       tem = Qnil;
  61.         /* Trace symbols aliases to other symbols
  62.        until we get a symbol that is not an alias.  */
  63. !       while (XTYPE (def) == Lisp_Symbol)
  64.       {
  65.         QUIT;
  66. +       sym = def;
  67.         tem = Fassq (sym, env);
  68.         if (NULL (tem))
  69.           {
  70.             def = XSYMBOL (sym)->function;
  71. !           if (!EQ (def, Qunbound))
  72. !         continue;
  73.           }
  74. !       break;
  75.       }
  76.         /* Right now TEM is the result from SYM in ENV,
  77.        and if TEM is nil then DEF is SYM's function definition.  */
  78. ***************
  79. *** 797,803 ****
  80.         if (NULL (expander))
  81.           break;
  82.       }
  83. -     explicit:
  84.         form = apply1 (expander, XCONS (form)->cdr);
  85.       }
  86.     return form;
  87. --- 784,789 ----
  88.