summaryrefslogtreecommitdiff
path: root/2.3-1/macros/ASTManagement/AST_HandleEndWhile.sci
blob: 94649b10d3493e23262af4d4d3cc06e3d136a53a (plain)
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
function SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo)
// function SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo)
// -----------------------------------------------------------------
//#RNU_RES_B
// Handles the EndWhile tag of the AST.
//
//   txt=['While'
//        '  WhileExpression:'
//        '    '+string(W.expression)
//        '  WhileStatements:'
//        '    '+objectlist2string(W.statements)
//        'EndWhile']
//#RNU_RES_E
//
// Input data:
// //NUT: add description here
//
// Output data:
// //NUT: add description here
//
// Status:
// 15-Nov-2007 -- Raffaele Nutricato: Author.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------

// ------------------------------
// --- Check input arguments. ---
// ------------------------------
SCI2CNInArgCheck(argn(2),2,2);

// -----------------------
// --- Initialization. ---
// -----------------------
nxtscifunname    = SharedInfo.NextSCIFunName;
nxtscifunnumber  = SharedInfo.NextSCIFunNumber;

ReportFileName          = FileInfo.Funct(nxtscifunnumber).ReportFileName;
CPass1FileName          = FileInfo.Funct(nxtscifunnumber).CPass1FileName;
CPass1WhileEpilFileName = FileInfo.Funct(nxtscifunnumber).CPass1WhileEpilFileName(SharedInfo.While.Level);

PrintStringInfo(' ',ReportFileName,'file','y');
PrintStringInfo('***Handling EndWhile***',ReportFileName,'file','y');
CCall ='';
// ---------------------------
// --- End Initialization. ---
// ---------------------------

//#RNU_RES_B
// ----------------------------
// --- Generate the C code. ---
// ----------------------------
// --- Copy Epilogue into C code (Pass1) file. ---
//#RNU_RES_E
[CLinesArray,N_Lines] = File2StringArray(CPass1WhileEpilFileName);
CLinesArray = stripblanks(CLinesArray);

for tmpcnt = 1:N_Lines-1
   PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CLinesArray(tmpcnt),CPass1FileName,'file','y');
end
PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent-1)+CLinesArray(N_Lines),CPass1FileName,'file','y');

//#RNU_RES_B
// --------------------------
// --- Update SharedInfo. ---
// --------------------------
//#RNU_RES_E
SharedInfo.NIndent = SharedInfo.NIndent - 1;

// -------------------------------
// --- Delete temporary files. ---
// -------------------------------
SCI2Cmdelete(CPass1WhileEpilFileName);

endfunction