Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - 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 > macr2tree

macr2tree

fornece o código interno de uma função Scilab compilada

Seqüência de Chamamento

p = macr2tree(macro)

Parâmetros

macro

handle of a Scilab macro (NOT its name as a string)

p

List of type program with the fields p.name, p.nblines, p.inputs, p.outputs, and p.statements. The 3 last ones are nested lists describing the internal code of the macro.

Descrição

Esta primitiva converte uma função Scilab compilada function-name em uma árvore (tlistas imbricadas) que codifica a representação interna da função. Deve ser usada com tree2code().

Exemplos

prog = macr2tree(log2);   // Note that the input is log2, not "log2"
typeof(prog)
fieldnames(prog)'
prog.name
deftxt = tree2code(prog, %T);
printf("%s\n", deftxt);
--> typeof(prog)
 ans  =
 program

--> fieldnames(prog)'
 ans  =
!name  outputs  inputs  statements  nblines  !

--> prog.name
 ans  =
 log2

--> deftxt = tree2code(prog, %T);

--> printf("%s\n", deftxt);
function [f,e] = log2(x)
  [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

  • tree2code — gera a definição ASCII de uma função Scilab
  • macrovar — variáveis de uma função
  • functions — procedimentos Scilab e objetos Scilab
Report an issue
<< head_comments Funções macro >>

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:
Tue Feb 14 15:09:57 CET 2017