next up previous
Next: 2.3.6 ユーザ定義関数の評価 Up: 2.3 eval Previous: 2.3.4 組み込み関数の評価

2.3.5 マクロ展開

SUBR,FSUBR,CONSでない式はユーザ定義関数またはマクロであって,その定義 がラムダ式(関数L)でなければマクロフォームであると判断して, macroexpandにより一度展開を行なったあと評価を行なっています.

/* macroexpand - expand a macro call */
int macroexpand(fun,args,pval)
  LVAL fun,args,*pval;
{
    LVAL *argv;
    int argc;
    
    /* make sure it's really a macro call */
    if (!closurep(fun) || gettype(fun) != s_macro)
        return (FALSE);
        
    /* call the expansion function */
    argc = pushargs(fun,args);
    argv = xlfp + 3;
    *pval = evfun(fun,argc,argv);
    xlsp = xlfp;
    xlfp = xlfp - (int)getfixnum(*xlfp);
    return (TRUE);
}


generated through LaTeX2HTML. M.Inaba 平成18年5月6日