tree2code
Scilab関数のアスキー定義を生成する
呼び出し手順
txt = tree2code(tree, prettyprint)
引数
- tree
マクロツリー (
macr2treeの出力)- prettyprint
オプションの論理値
%T : 生成されるコードはインデント,整形されます. The indentation length is the Scinotes one. It can be tuned through Scinotes preferences. %F : 生成されるコードは整形されません (デフォルト) - txt
文字列の列ベクトルで, Scilab命令を指定するテキスト
説明
読み込まれたScilab関数 "ツリー" (macr2treeの出力)を
指定することで, tree2code
によりコードを再生成することができます.
例
tree = macr2tree(log2); // note that the input is log2 (the function handle), not "log2" txt = tree2code(tree, %T); printf("%s\n", txt);
--> printf("%s\n",c)
function [f,e] = log2(x)
// x may be positive, negative, or complex
[lhs,rhs] = argn(0)
if rhs<>1 then
msg = gettext("%s: Wrong number of input argument(s): %d expected.\n")
error(msprintf(msg, "log2", 1))
end;
if argn(1)==1 then
f = log(x)/log(2)
else
[f,e] = frexp(x)
end
endfunction
| Report an issue | ||
| << overloading | Functions | varargin >> |