コミットメタ情報

リビジョン055054c5d91a70dc8d16a1baf16d621141fda16a (tree)
日時2018-11-29 03:42:26
作者Agustina Arzille <avarzille@rise...>
コミッターAgustina Arzille

ログメッセージ

Add the 'macro-fct' interface

変更サマリ

差分

diff -r bcbf24bf3195 -r 055054c5d91a builtins.cpp
--- a/builtins.cpp Wed Nov 28 13:28:54 2018 -0300
+++ b/builtins.cpp Wed Nov 28 15:42:26 2018 -0300
@@ -1497,6 +1497,18 @@
14971497 }
14981498 }
14991499
1500+DEFBUILTIN (macro_fct)
1501+{
1502+ object sym = *argv;
1503+ if (!symbol_p (sym))
1504+ interp->raise2 ("arg-error", "macro-fct: argument must be a symbol");
1505+ else if (!as_symbol(sym)->flagged_p (symbol::ctv_flag))
1506+ qp_return (NIL);
1507+
1508+ sym = symval (sym);
1509+ qp_return (fct_p (sym) ? sym : NIL);
1510+}
1511+
15001512 // Names for the builtins.
15011513 static const char BUILTIN_NAMES[] =
15021514 "%make-exception\0"
@@ -1560,6 +1572,7 @@
15601572 "%gc\0"
15611573 "%iter\0"
15621574 "exit\0"
1575+ "macro-fct\0"
15631576 ;
15641577
15651578 // List of builtins.
@@ -1640,7 +1653,8 @@
16401653 { p_use_fct, 3, 3 },
16411654 { p_gc, 0, -1 },
16421655 { p_iter, 1, 3 },
1643- { exit_fct, 0, 1 }
1656+ { exit_fct, 0, 1 },
1657+ { macro_fct, 1, 1 }
16441658 };
16451659
16461660 static native_function global_builtins[QP_NELEM (BUILTINS)];
旧リポジトリブラウザで表示