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
|
function [FileInfoDatFile,SharedInfoDatFile] = ...
INIT_SCI2C(UserScilabMainFile, UserSciFilesPaths, SCI2COutputDir, RunMode)
// function [FileInfoDatFile,SharedInfoDatFile] = INIT_SCI2C(SCI2CInputPrmFile)
// -----------------------------------------------------------------
// #RNU_RES_B
// This function initializes the SCI2C tool according
// to the input parameters recorded in the SCI2CParameters.
// All info will be stored into FileInfoDatFile.
//
// Input data:
// SCI2CInputPrmFile: name of the .sce file containing input parameters.
//
// Output data:
// FileInfoDatFile: name of the .dat file containing the FileInfo structure.
// SharedInfoDatFile: it is a buffer containing parameters that are exchanged by the
// functions of the SCI2C tool.
// #RNU_RES_E
// Status:
// 13-Apr-2007 -- Raffaele Nutricato: Author.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------
// #RNU_RES_B
//NUT: questo file e' da rivedere quando il tool funzionera al 50%
// #RNU_RES_E
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
//SCI2CNInArgCheck(argn(2),1,1);
// ------------------------------
// --- Read Input Parameters. ---
// ------------------------------
//exec(SCI2CInputPrmFile);
// #RNU_RES_B
//NUT: queste variabili sono per usi futuri.
//NUT: e saranno introdotti nel parameter file.
// #RNU_RES_E
WorkAreaSizeBytes = 2000*8; // 2000 locations of double
// #RNU_RES_B
// Maximum number of temporary scalar variables that can be used.
// #RNU_RES_E
TotTempScalarVars = 20;
EnableTempVarsReuse = 0; // 0 = Disable; 1 = Enable.
// #RNU_RES_B
//NUT: I prefer to don't show this parameters to the user.
// --- Directory where all the products of the SCI2C tool will be stored. ---
// #RNU_RES_E
//-- [SCI2CResultDir,tmpfile,tmpext] = fileparts(SCI2CInputPrmFile);
SCI2CResultDir = SCI2COutputDir;
WorkingDir = fullfile(SCI2CResultDir,'SCI2CTmpResultsReports');
// #RNU_RES_B
// --- Directory where the generated C code will be stored. ---
// #RNU_RES_E
OutCCCodeDir = SCI2CResultDir;
// ------------------------------
// --- Initialize SharedInfo. ---
// ------------------------------
//SharedInfo = INIT_GenSharedInfo(WorkingDir,OutCCCodeDir,UserSciFilesPaths,...
// RunMode,UserScilabMainFile,TotTempScalarVars,EnableTempVarsReuse,Sci2CLibMainHeaderFName);
//-- FIXME : MainLibHeader and Verbose mode are (?) configurable
SharedInfo = INIT_GenSharedInfo(RunMode,UserScilabMainFile, ...
TotTempScalarVars,EnableTempVarsReuse,"sci2clib.h", %t);
// ----------------------------
// --- Initialize FileInfo. ---
// ----------------------------
FileInfo = INIT_GenFileInfo(WorkingDir,OutCCCodeDir,UserSciFilesPaths);
PrintStepInfo('SCI2C hArtes/POLIBA Tool!!!',FileInfo.GeneralReport,'stdout');
// ----------------------------------------------------
// --- Remove previous versions of SCI2C files/dir. ---
// ----------------------------------------------------
INIT_RemoveDirs(FileInfo,SharedInfo.RunMode);
// ---------------------------
// --- Create Directories. ---
// ---------------------------
INIT_CreateDirs(FileInfo);
PrintStepInfo('SCI2C hArtes/POLIBA Tool!!!',FileInfo.GeneralReport,'file');
// ------------------------------
// --- Initialize GlobalVars. ---
// ------------------------------
GlobalVars = [];
save(FileInfo.GlobalVarFileName, "GlobalVars");
// ----------------------------------
// --- Initialize Main .dat file. ---
// ----------------------------------
//NUT: qui va sistemata.
clear FunInfo
//NUT: qua conviene fare una unica funzione.
FunInfo.SCIFunctionName = SharedInfo.NextSCIFunName;
FunInfo.CFunctionName = SharedInfo.NextCFunName;
FunInfo.FunPrecSpecifier = ''; //NUT: si riferiscono al main verifica se sono corrette
FunInfo.FunTypeAnnot = ''; //NUT: si riferiscono al main verifica se sono corrette
FunInfo.FunSizeAnnot = ''; //NUT: si riferiscono al main verifica se sono corrette
FunInfo.NInArg = 0;//NUT: si riferiscono al main verifica se sono corrette
FunInfo.InArg(1).Name = '';//NUT: si riferiscono al main verifica se sono corrette
FunInfo.InArg(1).Type = '';//NUT: si riferiscono al main verifica se sono corrette
FunInfo.InArg(1).Value = %nan;//NUT: si riferiscono al main verifica se sono corrette
FunInfo.InArg(1).Size(1) = '';//NUT: si riferiscono al main verifica se sono corrette
FunInfo.InArg(1).Dimension = '';//NUT: si riferiscono al main verifica se sono corrette
FunInfo.InArg(2).Size(2) = '';//NUT: si riferiscono al main verifica se sono corrette
FunInfo.NOutArg = 0;//NUT: si riferiscono al main verifica se sono corrette
FunInfo.OutArg(1).Name = '';
FunInfo.OutArg(1).Type = '';
FunInfo.OutArg(1).Size(1) = '';
FunInfo.OutArg(1).Size(2) = '';
FunInfo.OutArg(1).Dimension = '';
FunInfo.PosFirstOutScalar = 0;
FunInfo.LibTypeInfo = 'USER2C';
save(fullfile(FileInfo.FunctionList.FunInfoDatDir,FunInfo.CFunctionName+'.dat'), "FunInfo");
clear FunInfo
// -------------------------------------
// --- Initialize ASTStack.dat file. ---
// -------------------------------------
//NUT: questa struttura deve sostituire le variabili global usate per lo stack
clear ASTStack
ASTStack.SCI2CSTACK = 'EMPTYSTACK';
ASTStack.StackPosition = 1;
ASTStack.STACKDEDUG = 0;
save(FileInfo.ASTStackDataFile, "ASTStack");
clear ASTStack
// ---------------------------------------------
// --- Generate new versions of SCI2C files. ---
// ---------------------------------------------
save(FileInfo.FileInfoDatFile, "FileInfo");
save(FileInfo.SharedInfoDatFile, "SharedInfo");
FileInfoDatFile = FileInfo.FileInfoDatFile;
SharedInfoDatFile = FileInfo.SharedInfoDatFile;
global anscounter; //NUT: just to fix problem with ans variables.
anscounter = 0;
endfunction
// #RNU_RES_B
//NUT: quando genero il c della funzione utente devo anche generare il corrispondente file delle includes.
//NUT: perche' la main non la devo annotare, secondo me occorre annotarla.?
// #RNU_RES_E
|