Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - Русский

Change language to:
English - Français - 日本語 - Português -

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

Справка Scilab >> Функции > tree2code

tree2code

формирует ASCII-определение Scilab-функции

Синтаксис

txt = tree2code(tree, prettyprint)

Аргументы

tree

дерево функции (полученное с помощью macr2tree).

prettyprint

необязательное логическое значение:

%T : генерирует код, который имеет отступы и красивый вид
%F : генерируемый код не приукрашен (по умолчанию)
txt

вектор-столбец строк, текст, предоставляющий Scilab-инструкции.

Описание

Задавая "дерево" загруженной в Scilab функции (полученное с помощью функции macr2tree), tree2code позволяет восстановить код.

Примеры

tree = macr2tree(log2);   // заметьте, что на входе указано log2 (дескриптор функции), а не "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

Смотрите также

  • macr2tree — Обеспечивает внутренний код скомпилированного функции Scilab
  • macrovar — переменные в функции
  • string — преобразование в строку
Report an issue
<< перегрузка Функции 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:
Tue Feb 14 15:13:37 CET 2017