summaryrefslogtreecommitdiff
path: root/macros/FunctionList/FL_UpdateToBeConv.sci
blob: 1ee2e15dd4db5e4b635b1972edecbe715988f0ad (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
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
function SharedInfo = FL_UpdateToBeConv(ASTFunName,CFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,FileInfo,SharedInfo)
// function SharedInfo = FL_UpdateToBeConv(ASTFunName,CFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,FileInfo,SharedInfo)
// -----------------------------------------------------------------
// //NUT: add description here
//
// Input data:
// //NUT: add description here
//
// Output data:
// //NUT: add description here
//
// Status:
// 27-Oct-2007 -- Raffaele Nutricato: Author.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------

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

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

ReportFileName      = FileInfo.Funct(nxtscifunnumber).ReportFileName;
SCI2CAvailableCDat  = FileInfo.FunctionList.SCI2CAvailableCDat;
USER2CAvailableCDat = FileInfo.FunctionList.USER2CAvailableCDat;
ConvertedDat        = FileInfo.FunctionList.ConvertedDat;
ToBeConvertedDat    = FileInfo.FunctionList.ToBeConvertedDat;
FunInfoDatDir       = FileInfo.FunctionList.FunInfoDatDir;

// #RNU_RES_B
PrintStringInfo(' ',ReportFileName,'file','y');
PrintStringInfo('***Updating C Function List***',ReportFileName,'file','y');
PrintStringInfo('   C Function Name: '+CFunName,ReportFileName,'file','y');
// #RNU_RES_E
// ---------------------------
// --- End Initialization. ---
// ---------------------------

// #RNU_RES_B
// --------------------------------------------------
// --- Manage anticipated exit from the function. ---
// --------------------------------------------------
//NUT: questo codice e' identico quasi a quello della CFunCall, si pu0 pensare di
//NUT: di fare un'unica funzione.
// #RNU_RES_E

if (SharedInfo.SkipNextFun > 0)
   // #RNU_RES_B
   PrintStringInfo('   Current function will not be inserted in the Function List.',ReportFileName,'file','y');
   // #RNU_RES_E
   return;
end

// #RNU_RES_B
// Exit if the function is a precision specifier and the corresponding flag is 1.
// #RNU_RES_E
if ((sum(mtlb_strcmp(ASTFunName,SharedInfo.Annotations.DataPrec)) > 0) & ...
    (SharedInfo.SkipNextPrec == 1))
   // #RNU_RES_B
   PrintStringInfo('   Current function will not be inserted in the Function List.',ReportFileName,'file','y');
   // #RNU_RES_E
   return;
end

// #RNU_RES_B
// Exit if the function is OpEqual and the corresponding skip flag is enabled.
// #RNU_RES_E
if ((mtlb_strcmp(ASTFunName,'OpEqual')) & ...
    (SharedInfo.SkipNextEqual == 1))
   // #RNU_RES_B
   PrintStringInfo('   Current function will not be inserted in the Function List.',ReportFileName,'file','y');
   // #RNU_RES_E
   return;
end

// #RNU_RES_B
// ---------------------------------------
// --- If the function is not skipped. ---
// ---------------------------------------
// --- Check existence of the C function. ---
// #RNU_RES_E
flagexist = FL_ExistCFunction(CFunName,USER2CAvailableCDat,SCI2CAvailableCDat,ConvertedDat,ToBeConvertedDat,ReportFileName);

// #RNU_RES_B
// --- Update C function list and dat files. ---
// #RNU_RES_E
if (flagexist  == %F)

   // #RNU_RES_B
   // --- Add C function to the "ToBeConverted" function list. ---
   // #RNU_RES_E
   load(ToBeConvertedDat,'ToBeConverted');

   NToConvP1 = size(ToBeConverted,1)+1;
   ToBeConverted(NToConvP1).SCIFunctionName = ASTFunName;
   ToBeConverted(NToConvP1).CFunctionName   = CFunName;

   save(ToBeConvertedDat, "ToBeConverted");
   SharedInfo.NFilesToTranslate = SharedInfo.NFilesToTranslate + 1;

   // #RNU_RES_B
   // --- Generate C Function dat file. ---
   PrintStringInfo('   Add C Function ""'+CFunName+'"" to: '+ToBeConvertedDat,ReportFileName,'file','y');
   // #RNU_RES_E
end

endfunction