Equal
Génère le code interne Scilab représentant une instruction "LHS = RHS"
Séquence d'appel
eq = Equal(lhslist, RHS)
Arguments
- lhslist
liste des arguments de sortie (Left Hand Side : coté gauche de l'assignation) (liste d'une liste typée de M2SCI)
- RHS
partie droite de l'instruction (Righ Hand Side)(une tlist de M2SCI)
- eq
une tlist de type "equal".
Description
Cette fonction créé une tlist représentant une instruction "LHS = RHS",
utilisable par le convertisseur M2SCI.
Les arguments d'entrée sont vérifiés, en regard des formats attendus par le convertisseur.
Examples
Générons le code interne représentant l'instruction simple A = "off":
Générons le code interne représentant l'instruction 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"))
Générons le code interne représentant l'expression
handles(:).axes_reverse(:,2) = "off", où handles
est un vecteur ligne 1x3 d'identifiants (de repères) graphiques:
h = Variable("handles", Infer(list(1,3),Type(Handle,Unknown))); // Construction du code interne du récipient (partie gauche): // 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 // .. et finalement l'expression complète : 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 = ";"
Voir aussi
- Funcall — Crée le pseudo-code converti représentant l'appel à une fonction
- Operation — Génère le code interne Scilab représentant une opération
- Variable — Génère le code interne Scilab représentant une variable (sans sa valeur)
- Cste — Créé un arbre représentant une constante
- Infer — Créé un arbre contenant les données d'inférence
- Contents — Créé un arbre contenant les données d'inférence du contenu d'une variable
- Type — Crée un arbre contenant les données d'inférence de type
| Report an issue | ||
| << Cste | internals | Funcall >> |