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
|
function runsci2c(UserScilabMainFile, UserSciFilesPaths, SCI2COutputPath, Runmode)
// function runsci2c(SCI2CInputPrmFile)
// -----------------------------------------------------------------
// === hArtes/PoliBa/GAP SCI2C tool ===
// === Authors: ===
// === Raffaele Nutricato ===
// === raffaele.nutricato@tiscali.it ===
// === Alberto Morea ===
//
// This is the main function of SCI2C.
//
// Input data:
// SCI2CInputPrmFile: path+filename of the input parameters file.
//
// Output data:
// ---
//
// Status:
// 11-Apr-2007 -- Raffaele Nutricato: Author.
// 11-Apr-2007 -- Alberto Morea: Tests.
//
// Copyright 2007 Raffaele Nutricato & Alberto Morea.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------
// -------------------
// --- Soft reset. ---
// -------------------
//mode(-1);
//clc;
// -----------------------
// --- End Soft reset. ---
// -----------------------
// -------------------------
// --- Input Parameters. ---
// -------------------------
RunSci2CMainDir = pwd();
// -----------------------------
// --- End input Parameters. ---
// -----------------------------
// -------------------------------
// --- Perform Intializations. ---
// -------------------------------
// --- Load SCI2C directories and files. ---
//cd(fullfile(RunSci2CMainDir,'ToolInitialization'));
//exec('INIT_SCI2CLoader.sce');
//cd(RunSci2CMainDir);
// --- Initialize the SCI2C tool directories and files. ---
[FileInfoDatFile,SharedInfoDatFile] = INIT_SCI2C(UserScilabMainFile, ...
UserSciFilesPaths, SCI2COutputPath, RunMode);
// -- Load FileInfo and SharedInfo
load(SharedInfoDatFile,'SharedInfo');
load(FileInfoDatFile,'FileInfo');
RunMode = SharedInfo.RunMode;
// --- Generation of the library structure. ---
if (RunMode == 'GenLibraryStructure' | RunMode == 'All')
INIT_GenLibraries(FileInfoDatFile);
end
// --- Load Library Info. ---
INIT_LoadLibraries(FileInfoDatFile);
// -----------------------------------
// --- End Perform Intializations. ---
// -----------------------------------
// ----------------------------------
// --- Perform SCI2C Translation. ---
// ----------------------------------
if (RunMode == 'All' | RunMode == 'Translate')
FlagContinueTranslation = 1;
while(FlagContinueTranslation == 1)
UpdateSCI2CInfo(FileInfoDatFile);
AST_GetASTFile(FileInfoDatFile);
AST2Ccode(FileInfoDatFile);
JoinDeclarAndCcode(FileInfoDatFile);
FlagContinueTranslation = ManageNextConversion(FileInfoDatFile);
end
end
// ---------------------------
// --- Copy library files. ---
// ---------------------------
allSources = getAllSources();
allHeaders = getAllHeaders();
allInterfaces = getAllInterfaces();
mkdir(SCI2COutputPath+"/src/");
mkdir(SCI2COutputPath+"/src/c/");
mkdir(SCI2COutputPath+"/includes/");
mkdir(SCI2COutputPath+"/interfaces/");
// -- Sources
PrintStepInfo('Copying sources needed in ' + SCI2COutputPath + ...
"/src/c/", FileInfo.GeneralReport,'both');
for i = 1:size(allSources, "*")
//disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
copyfile(allSources(i), SCI2COutputPath+"/src/c/");
end
// -- Includes
PrintStepInfo('Copying headers needed in ' + SCI2COutputPath + ...
"/includes/", FileInfo.GeneralReport,'both');
for i = 1:size(allHeaders, "*")
//disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/");
copyfile(allHeaders(i), SCI2COutputPath+"/includes/");
end
// -- Interfaces
PrintStepInfo('Copying interfaces needed in ' + SCI2COutputPath + ...
"/interfaces/", FileInfo.GeneralReport,'both');
for i = 1:size(allInterfaces, "*")
//disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/");
copyfile(allInterfaces(i), SCI2COutputPath+"/interfaces/");
end
// --------------------------
// --- Generate Makefile. ---
// --------------------------
C_GenerateMakefile(FileInfo,SharedInfo);
// -----------------
// --- Epilogue. ---
// -----------------
if (RunMode == 'All' | RunMode == 'Translate')
PrintStepInfo('Translation Successfully Completed!!!',FileInfo.GeneralReport,'both');
elseif (RunMode == 'GenLibraryStructure')
PrintStepInfo('Library Structure Successfully Created!!!',FileInfo.GeneralReport,'both');
end
endfunction
|