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

Please note that the recommended version of Scilab is 6.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Aide de Scilab >> Fonctions avancées > macr2lst

macr2lst

function to list conversion

Calling Sequence

lst = macr2lst(function_name)

Arguments

function_name

a function to be converted.

lst

a list.

Description

This primitive converts a compiled Scilab function function_name into a list which codes the internal representation of the function (reverse Polish notation).

The first entry of the list is the function name, the second and third are respectively the vectors of left hand side variables and right hand side variables names. The following entries are either basic operation records either lists with contains the hierarchical control structures like if, for, ...

Basic operation records are described by a character string vector whose first element represents the opcode.

op codes meaning parameters
"0" ignored opcode none
"1" No more used
"2" variable or function reference variable name, #rhs, #lhs
"3" put a string in the stack the string
"4" put am empty matrix in the stack none
"5" apply an operation operation code, #rhs,#lhs
"6" put a number in the stack the number
"12" pause command none
"13" break command none
"14" abort command none
"15" end of line mark none
"17" quit command none
"18" named variable variable name
"19" create recursive index structure path length, number of final indices
"20" function call function name, #rhs, #lhs
"23" create variable from name variable name
"24" put a variable with type 0 in the stack none
"25" profile record number of call, time spend
"26" put a vector of strings in the stack #rows, #columns, element sequence
"27" put a builtin reference in the stack interface number, position in interface, function name
"28" continue command none
"29" assignment #lhs, display mode, (variable name, #rhs)*
"30" logical expression short circuit type, jump size
"31" comment the comment
"99" return command none
> "100" builtin call (obsolete) 100*fun, #rhs, #lhs, fin

The fun2string function can be used to generate the initial code.

Examples

//DISPLAY
function y=foo(x, flag)
  if flag then
    y=sin(x)
  else
    y=cos(x)
  end
endfunction
L=macr2lst(foo)
fun2string(L)

See Also

  • macrovar — variables d'une fonction
  • fun2string — generates ASCII definition of a Scilab function
  • macr2tree — conversion d'une fonction en arbre
  • tree2code — generates ASCII definition of a Scilab function
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 02 13:54:44 CEST 2014