Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - Русский

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

Scilabヘルプ >> Functions > macr2tree

macr2tree

ツリー変換用の関数

呼び出し手順

p = macr2tree(function)

引数

function

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 function.

説明

このプリミティブは, コンパイル済みの Scilab 関数function-name を関数を内部表現にコード化したツリー (鱗状のtlists)に変換します. tree2code()と共に使用します.

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

参照

  • tree2code — Scilab関数のアスキー定義を生成する
  • macrovar — 関数の変数
  • functions — Scilab プロシージャおよび Scilab オブジェクト
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Feb 12 23:12:44 CET 2018