blob: e96edd4c9d102676084b00a49ff5150c9b7b073f (
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
77
78
79
80
81
82
83
84
|
function FileInfo = AST_HandleFor(FileInfo,SharedInfo)
// function FileInfo = AST_HandleFor(FileInfo,SharedInfo)
// -----------------------------------------------------------------
//#RNU_RES_B
// Handles the For tag of the AST.
//
// overloading function for "for" type tlist string function
// this is a node of the AST
// fields:
// expression : "expression" type tlist (the loop expression)
// statements : list of "equal" type tlist and list('EOL') (the
// for instructions list)
// txt=['For'
// ' Expression:'
// ' '+string(F.expression)
// ' Statements:'
// ' '+objectlist2string(F.statements)
// 'EndFor']
//
//#RNU_RES_E
// Input data:
// //NUT: add description here
//
// Output data:
// //NUT: add description here
//
// Status:
// 10-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;
PfxP1ForProlFileName = FileInfo.Funct(nxtscifunnumber).PfxP1ForProlFileName;
PfxP1ForEpilFileName = FileInfo.Funct(nxtscifunnumber).PfxP1ForEpilFileName;
PrintStepInfo('Handling For',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
// ---------------------------
// --- End Initialization. ---
// ---------------------------
//#RNU_RES_B
// --- Signal the entrance in a for expression. ---
//#RNU_RES_E
SharedInfo.ForExpr.OnExec = SharedInfo.ForExpr.OnExec + 1;
//#RNU_RES_B
// --- Generate the file names for the prologue and epilogue files. ---
//#RNU_RES_E
FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level) = ...
PfxP1ForProlFileName+string(SharedInfo.For.Level)+'.c';
FileInfo.Funct(nxtscifunnumber).CPass1ForEpilFileName(SharedInfo.For.Level) = ...
PfxP1ForEpilFileName+string(SharedInfo.For.Level)+'.c';
//#RNU_RES_B
// ---------------------------------------------------------
// --- Create a copy of the For Prologue/Epilogue Files. ---
// ---------------------------------------------------------
//#RNU_RES_E
PrintStringInfo(' ',FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level),'file');
PrintStringInfo(' ',FileInfo.Funct(nxtscifunnumber).CPass1ForEpilFileName(SharedInfo.For.Level),'file');
//#RNU_RES_B
// ------------------------------------------------------
// --- Replace the CPass1V1 file with a temp ForFile. ---
// ------------------------------------------------------
// From now up to Expression: all the C code will be written in a for temporary file.
//#RNU_RES_E
tmpfilename = FileInfo.Funct(nxtscifunnumber).CPass1FileName;
FileInfo.Funct(nxtscifunnumber).CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level);
FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level) = tmpfilename;
PrintStringInfo('Redirecting C code to: '+FileInfo.Funct(nxtscifunnumber).CPass1FileName,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
endfunction
|