Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> Funções > tree2code

tree2code

gera a definição ASCII de uma função Scilab

Seqüência de Chamamento

txt = tree2code(tree, prettyprint)

Parâmetros

tree

uma árvore macro (vinda de macr2tree)

prettyprint

valor opcional booleano :

%T : o código gerado é identado e embelezado. The indentation length is the Scinotes one. It can be tuned through Scinotes preferences.
%F : o código gerado não é embelezado (padrão)
txt

coluna de strings, o texto fornecendo as instruções Scilab

Descrição

Dada uma função Scilab carregada "tree" (retornada por macr2tree), tree2code permite gerar novamente o código.

Exemplos

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

Ver Também

  • macr2tree — fornece o código interno de uma função Scilab compilada
  • macrovar — variáveis de uma função
  • string — conversão para string (cadeia de caracteres)
Report an issue
<< overloading Funções varargin >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:35:42 CET 2022