Scilab 6.0.1
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
tree2code
generates the text definition of a Scilab function from its internal code
Syntax
txt = tree2code(tree, prettyprint)
Arguments
- tree
a macro internal tree (coming from
macr2tree
).- prettyprint
an optional boolean value:
%T : The generated code is indented and beautified %F : The generated code is not beautified (default) - txt
column of texts: Scilab instructions defining the function
Description
Given a loaded Scilab function "tree" (returned by macr2tree
),
tree2code
allows to re-generate the code defining the function.
Examples
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
See also
Report an issue | ||
<< overloading | Advanced functions | varargin >> |