summaryrefslogtreecommitdiff
path: root/2.3-1/macros/ASTManagement/AST_CheckPrecSpecifier.sci
blob: e8ffbf1f973db865b762b51c428575e84cebf9e8 (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
function AnnotationFnc = AST_CheckPrecSpecifier(FunctionName,FileInfo,SharedInfo);
// function AnnotationFnc = AST_CheckPrecSpecifier(FunctionName,FileInfo,SharedInfo);
// -----------------------------------------------------------------
// #RNU_RES_B
// Searches for one of the following data annotation functions:
//         Funcall  : int
//         Funcall  : float
//         Funcall  : double
// Note: remember to execute this function before pushing the output
// argument names into the stack.
// #RNU_RES_E
//
// Input data:
// //NUT: add description here
//
// Output data:
// //NUT: add description here
//
// Status:
// 13-Apr-2007 -- Raffaele Nutricato: Author.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------

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

// -----------------------
// --- Initialization. ---
// -----------------------
nxtscifunname   = SharedInfo.NextSCIFunName;
nxtscifunnumber = SharedInfo.NextSCIFunNumber;
ReportFileName  = FileInfo.Funct(nxtscifunnumber).ReportFileName;
PrintStringInfo(' ',ReportFileName,'file','y');
// #RNU_RES_B
PrintStringInfo('   Checking presence of precision specifier',ReportFileName,'file','y');
//NUT: da sistemare senza le global
// #RNU_RES_E
global SCI2CSTACK 
global StackPosition;
global STACKDEDUG

AnnotationFnc = 'default';
// ---------------------------
// --- End Initialization. ---
// ---------------------------

Pop1 = AST_PopASTStack(); //           Rhs    : 
if (mtlb_strcmp(stripblanks(Pop1),'Rhs    :'))
   Pop2 = AST_PopASTStack(); //           #lhs   : 1
   if (mtlb_strcmp(stripblanks(Pop2),'#lhs   : 1'))
      Pop3 = AST_PopASTStack(); //         Funcall  : double
      FunctionName = stripblanks(part(Pop3,12:length(Pop3)));
      for counterdataprec = 1:max(size(SharedInfo.Annotations.DataPrec))
         if (mtlb_strcmp(FunctionName,SharedInfo.Annotations.DataPrec(counterdataprec)))
            AnnotationFnc = FunctionName;
         end
      end
      // --- Repush strings into the AST stack. ---
      AST_PushASTStack(Pop3);
   end
   // --- Repush strings into the AST stack. ---
   AST_PushASTStack(Pop2);
end
// --- Repush strings into the AST stack. ---
AST_PushASTStack(Pop1);

if mtlb_strcmp(AnnotationFnc,'default')
   // #RNU_RES_B
   PrintStringInfo('Function is not annotated',ReportFileName,'file','y');
   PrintStringInfo('The ""'+SharedInfo.DefaultPrecision+'"" default precision will be used.',ReportFileName,'file','y');
   // #RNU_RES_E
else
   // #RNU_RES_B
   PrintStringInfo('Function is annotated with ""'+AnnotationFnc+'"" specifier',ReportFileName,'file','y');
   // #RNU_RES_E
end

endfunction