1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
<<<<<<< HEAD
function [IfCondArg,NIfCondArg,Op,NOp] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType)
=======
function [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType)
>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// function [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType)
// -----------------------------------------------------------------
//#RNU_RES_B
// Parses the IfExpression structure of the AST.
//
// txt=['If '
// ' Expression:'
// ' '+string(I.expression)
// ' If Statements'
// ' '+objectlist2string(I.then)]
// for e=I.elseifs
// txt=[txt;
// ' Else If Expression'
// ' '+string(e.expression)
// ' Else If Statements'
// ' '+objectlist2string(e.then)]
// end
// txt=[txt;
// ' Else Statements'
// ' '+objectlist2string(I.else)
// 'EndIf']
//
//#RNU_RES_E
//
// Input data:
// //NUT: add description here
//
// Output data:
// //NUT: add description here
//
// Status:
// 11-Apr-2007 -- Raffaele Nutricato: Author.
// 25-June-2017 -- Ukasha Noor: Revised By
// This function is counting the number of logical operators and there operands.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
SCI2CNInArgCheck(argn(2),3,3);
// -----------------------
// --- Initialization. ---
// -----------------------
nxtscifunname = SharedInfo.NextSCIFunName;
nxtscifunnumber = SharedInfo.NextSCIFunNumber;
ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName;
//#RNU_RES_B
PrintStringInfo('***Retrieving '+ASTIfExpType+' expression parameters from AST***',ReportFileName,'file','y');
//#RNU_RES_E
IfCondArg = [];
NIfCondArg = 0;
global SCI2CSTACK
global StackPosition;
global STACKDEDUG
// ---------------------------
// --- End Initialization. ---
// ---------------------------
// ------------------------------------
// --- Read if condition variables. ---
// ------------------------------------
<<<<<<< HEAD
//OutArgOld=[];
//OutArgNew=[];
//for i = 1:3
// OutArgOld(i)=AST_PopASTStack();
//PrintStringInfo(' '+OutArgOld(i),ReportFileName,'file','y');
//end
//x = AST_PopASTStack();
//OutArgNew = SCI2Cflipud(OutArgOld);
flagendpop = 0;
IfExprField = AST_PopASTStack();
PrintStringInfo(' '+IfExprField+' '+ASTIfExpType,ReportFileName,'file','y');
=======
flagendpop = 0;
IfExprField = AST_PopASTStack();
>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
if (ASTIfExpType=='if')
if (IfExprField=='Expression:')
flagendpop = 1;
// Pop Again the If tag from the AST.
IfExprField = AST_PopASTStack();
<<<<<<< HEAD
PrintStringInfo(' '+IfExprField,ReportFileName,'file','y');
=======
>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
end
elseif (ASTIfExpType=='elseif')
if (IfExprField=='Else If Expression')
flagendpop = 1;
end
else
error(9999, 'Unknown ASTIfExpType ""'+ASTIfExpType+'"".');
end
<<<<<<< HEAD
NOp=0;
Op=[];
=======
>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
while (flagendpop == 0)
if (IfExprField~='<EOL>')
if (ASTIfExpType=='if')
if (IfExprField=='Expression:')
flagendpop = 1;
<<<<<<< HEAD
//PrintStringInfo('hello dere '+IfExprField,ReportFileName,'file','y');
// Pop Again the If tag from the AST.
IfExprField = AST_PopASTStack();
elseif (IfExprField=='Operands:')
flagendpop = 0;
g = AST_PopASTStack();
else
if (IfExprField=='&&' | IfExprField=='||')
NOp = NOp + 1;
Op(NOp) = IfExprField;
//PrintStringInfo('operators are '+Op(NOp),ReportFileName,'file','y');
else
NIfCondArg = NIfCondArg + 1;
IfCondArg(NIfCondArg) = IfExprField;
end
//[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField);
=======
// Pop Again the If tag from the AST.
IfExprField = AST_PopASTStack();
else
NIfCondArg = NIfCondArg + 1;
[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField);
>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
end
elseif (ASTIfExpType=='elseif')
if (IfExprField=='Else If Expression')
flagendpop = 1;
<<<<<<< HEAD
//IfExprField = AST_PopASTStack();
else
if (IfExprField=='&&' | IfExprField=='||')
NOp = NOp + 1;
Op(NOp) = IfExprField;
elseif (IfExprField=='Operands:')
flagendpop = 0;
g = AST_PopASTStack();
else
NIfCondArg = NIfCondArg + 1;
IfCondArg(NIfCondArg) = IfExprField;
end
//[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField);
end
end
end
if flagendpop == 0
IfExprField = AST_PopASTStack();
end
PrintStringInfo('operators are '+IfExprField,ReportFileName,'file','y');
end
IfCondArg = SCI2Cflipud(IfCondArg);
=======
else
NIfCondArg = NIfCondArg + 1;
IfCondArg(NIfCondArg) = IfExprField;
[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField);
end
end
end
IfExprField = AST_PopASTStack();
end
>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
//#RNU_RES_B
// -------------------------------------------
// --- Print some info in the report file. ---
// -------------------------------------------
PrintStringInfo('N '+ASTIfExpType+' Condition Arguments: '+string(NIfCondArg),ReportFileName,'file','y');
//#RNU_RES_E
for counterifcondargs = 1:NIfCondArg
//#RNU_RES_B
PrintStringInfo(ASTIfExpType+' Condition Argument Number '+string(counterifcondargs)+': '+IfCondArg(counterifcondargs),...
ReportFileName,'file','y');
//#RNU_RES_E
end
endfunction
|