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


Equal

Generates the Scilab internal code representing an instruction "LHS = RHS"

Syntax

eq = Equal(lhslist, RHS)

Arguments

lhslist

list of Left Hand Side parameters (list of "M2SCI tlists")

RHS

a tlist built with "M2SCI" functions, representing the Right Hand Side member of the instruction.

eq

tlist of type "equal"

Description

This function create a tlist representing an instruction when using M2SCI. All input parameters values are verified to be compatible with "M2SCI tlists".

Examples

Let's define the pseudo-code representing the simple statement A = "off":

LHS = Variable("A", Infer(list(1,1),Type(String,Unknown)));
Equal(list(LHS), Cste("off"))

Let's define the pseudo-code representing the statement A(2,:) = "off" :

// A
LHS = Variable("A", Infer(list(Unknown,Unknown),Type(String,Unknown)));
// A(2,:)
LHS = Operation("ins", list(LHS,Cste(2),Colon), list()) // Insertion
// A(2,:) = "off"
Equal(list(LHS), Cste("off"))

Let's define the pseudo-code representing the expression handles(:).axes_reverse(:,2) = "off", where handles is a 1x3 row of graphical (axes) handles:

h = Variable("handles", Infer(list(1,3),Type(Handle,Unknown)));

// Building the Left-Hand-Side part of the assignment (Equal):
// handles(:)
LHS = Operation("ins", list(h,Colon), list());                 // Insertion

// handles(:).axes_reverse :
LHS = Operation("ins", list(LHS,Cste("axes_reverse")), list()) // Insertion

// handles(:).axes_reverse(:,2) :
LHS = Operation("ins", list(LHS,Colon,Cste(2)), list());       // Insertion

// .. and finally the full statement:
s.statement = Equal(list(LHS), Cste("off"))
---> s.statement = Equal(list(LHS), Cste("off"))
 s  =
  statement: [equal] tlist with fields:
      lhs: list:
          (1) : [operation] tlist with fields:
              operator = "ins"
              operands: list:
                  (1) : [operation] tlist with fields:
                      operator = "ins"
                      operands: list:
                          (1) : [operation] tlist with fields:
                              operator = "ins"
                              operands: list with 2 elements.
                              out:  empty list()
                          (2) : [cste] tlist with fields:
                              value = "axes_reverse"
                              infer: [infer] tlist with fields:
                                  [dims, type, contents]
                      out:  empty list()
                  (2) : [variable] tlist with fields:
                      name = ":"
                      infer: [infer] tlist with fields:
                          dims: list:
                              (1) = -1
                              (2) = 1
                          type: [type] tlist with fields:
                              vtype = 1
                              property = 0
                          contents: [contents] tlist with fields:
                              index:  empty list()
                              data:  empty list()
                  (3) : [cste] tlist with fields:
                      value = 2
                      infer: [infer] tlist with fields:
                          dims: list:
                              (1) = 1
                              (2) = 1
                          type: [type] tlist with fields:
                              vtype = 1
                              property = 0
                          contents: [contents] tlist with fields:
                              index:  empty list()
                              data:  empty list()
              out:  empty list()
      expression: [cste] tlist with fields:
          value = "off"
          infer: [infer] tlist with fields:
              dims: list:
                  (1) = 1
                  (2) = 3
              type: [type] tlist with fields:
                  vtype = 10
                  property = 0
              contents: [contents] tlist with fields:
                  index:  empty list()
                  data:  empty list()
      endsymbol = ";"

See also

  • Funcall — Create the converted pseudo-code representing a function call
  • Operation — Generates the Scilab pseudo-code representing an operation
  • Variable — Generates the Scilab internal code representing a variable (without its content)
  • Cste — Create a tree representing a constant
  • Infer — Create a tree containing inference data
  • Contents — Create a tree containing contents inference data
  • Type — Create a tree containing type inference data
Report an issue
<< Cste internals Funcall >>

Copyright (c) 2022-2024 (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 Mar 07 09:29:06 CET 2023