diff options
author | Siddhesh Wani | 2015-05-25 14:46:31 +0530 |
---|---|---|
committer | Siddhesh Wani | 2015-05-25 14:46:31 +0530 |
commit | db464f35f5a10b58d9ed1085e0b462689adee583 (patch) | |
tree | de5cdbc71a54765d9fec33414630ae2c8904c9b8 /macros/ASTManagement/AST_CheckPrecSpecifier.sci | |
download | Scilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.tar.gz Scilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.tar.bz2 Scilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.zip |
Original Version
Diffstat (limited to 'macros/ASTManagement/AST_CheckPrecSpecifier.sci')
-rw-r--r-- | macros/ASTManagement/AST_CheckPrecSpecifier.sci | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/macros/ASTManagement/AST_CheckPrecSpecifier.sci b/macros/ASTManagement/AST_CheckPrecSpecifier.sci new file mode 100644 index 0000000..e8ffbf1 --- /dev/null +++ b/macros/ASTManagement/AST_CheckPrecSpecifier.sci @@ -0,0 +1,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 |