summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorClément DAVID2017-11-24 09:24:25 +0100
committerClément DAVID2017-11-24 09:24:56 +0100
commit595d1bae76a45ebb7f2bb0b4f805c972377c7e1d (patch)
tree428c3622a9626cdca36460b2d7467ddb38c2b9c6 /macros
parent8ed76898e795b952f509eccc425356a266f22843 (diff)
downloadscilab2c-595d1bae76a45ebb7f2bb0b4f805c972377c7e1d.tar.gz
scilab2c-595d1bae76a45ebb7f2bb0b4f805c972377c7e1d.tar.bz2
scilab2c-595d1bae76a45ebb7f2bb0b4f805c972377c7e1d.zip
fix some tests
Diffstat (limited to 'macros')
-rw-r--r--macros/ASTManagement/AST2Ccode.sci4
-rw-r--r--macros/FunctionAnnotation/FA_GetDefaultPrecision.sci18
-rw-r--r--macros/FunctionAnnotation/FA_GetResizeApproach.sci14
-rw-r--r--macros/GeneralFunctions/filenamefprintf.sci15
-rw-r--r--macros/ToolInitialization/UpdateSCI2CInfo.sci4
5 files changed, 40 insertions, 15 deletions
diff --git a/macros/ASTManagement/AST2Ccode.sci b/macros/ASTManagement/AST2Ccode.sci
index d44a3393..acfefce9 100644
--- a/macros/ASTManagement/AST2Ccode.sci
+++ b/macros/ASTManagement/AST2Ccode.sci
@@ -67,7 +67,7 @@ STACKDEDUG = 0; // 1 -> Every Pop and Push operation on the stack, the stack con
global disp_isthere
disp_isthere = 0;
-FName = null
+clear FName
// -------------------------------------
// --- End parameter Initialization. ---
// -------------------------------------
@@ -174,7 +174,7 @@ while ~meof(fidAST)
end
end
disp_isthere = 0;
- FName = null
+ clear FName
case 'Equal' then
SharedInfo.Equal.Enabled = 1; // 1 means enabled -> we are inside an equal AST block.
AST_PushASTStack(treeline);
diff --git a/macros/FunctionAnnotation/FA_GetDefaultPrecision.sci b/macros/FunctionAnnotation/FA_GetDefaultPrecision.sci
index 3603c572..f4e321aa 100644
--- a/macros/FunctionAnnotation/FA_GetDefaultPrecision.sci
+++ b/macros/FunctionAnnotation/FA_GetDefaultPrecision.sci
@@ -1,5 +1,5 @@
-function defaultprecision = FA_GetDefaultPrecision(scifilename,ReportFileName)
-// function defaultprecision = FA_GetDefaultPrecision(scifilename,ReportFileName)
+function defaultprecision = FA_GetDefaultPrecision(scifilename,scifileid,ReportFileName)
+// function defaultprecision = FA_GetDefaultPrecision(scifilename,scifileid,ReportFileName)
// -----------------------------------------------------------------
// #RNU_RES_B
// Extracts the default precision for the file .sci passed in input.
@@ -28,7 +28,7 @@ function defaultprecision = FA_GetDefaultPrecision(scifilename,ReportFileName)
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
-SCI2CNInArgCheck(argn(2),2,2);
+SCI2CNInArgCheck(argn(2),3,3);
// -----------------------
// --- Initialization. ---
@@ -43,7 +43,11 @@ PrintStringInfo('***Get default precision from: '+scifilename,ReportFileName,'fi
// ---------------------------
// --- Open the .sci file (read only). ---
-scifid = SCI2COpenFileRead(scifilename);
+if scifileid == [] then
+ scifid = SCI2COpenFileRead(scifilename);
+else
+ scifid = scifileid;
+end
// #RNU_RES_B
// --- Loop over the lines of the input file. ---
@@ -93,5 +97,9 @@ else
end
end
-mclose(scifid);
+if scifileid == [] then
+ mclose(scifid);
+else
+ mseek(0, scifid);
+end
endfunction
diff --git a/macros/FunctionAnnotation/FA_GetResizeApproach.sci b/macros/FunctionAnnotation/FA_GetResizeApproach.sci
index 95427001..4db6054c 100644
--- a/macros/FunctionAnnotation/FA_GetResizeApproach.sci
+++ b/macros/FunctionAnnotation/FA_GetResizeApproach.sci
@@ -1,4 +1,4 @@
-function ResizeApproach = FA_GetResizeApproach(scifilename,ReportFileName)
+function ResizeApproach = FA_GetResizeApproach(scifilename,scifileid,ReportFileName)
// function ResizeApproach = FA_GetResizeApproach(scifilename,ReportFileName)
// -----------------------------------------------------------------
@@ -30,7 +30,7 @@ function ResizeApproach = FA_GetResizeApproach(scifilename,ReportFileName)
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
-SCI2CNInArgCheck(argn(2),2,2);
+SCI2CNInArgCheck(argn(2),3,3);
// -----------------------
// --- Initialization. ---
@@ -43,7 +43,11 @@ PrintStringInfo('***Get resize approach from: '+scifilename,ReportFileName,'file
// ---------------------------
// --- Open the .sci file (read only). ---
-scifid = SCI2COpenFileRead(scifilename);
+if scifileid == [] then
+ scifid = SCI2COpenFileRead(scifilename);
+else
+ scifid = scifileid;
+end
// --- Loop over the lines of the input file. ---
// Position file pointer to the desired NInArg/NOutArg section,
@@ -75,5 +79,9 @@ if (foundannotation == 0)
else
ResizeApproach = tmpresize;
end
+if scifileid == [] then
mclose(scifid);
+else
+mseek(0, scifid)
+end
endfunction
diff --git a/macros/GeneralFunctions/filenamefprintf.sci b/macros/GeneralFunctions/filenamefprintf.sci
index f25e603e..de546feb 100644
--- a/macros/GeneralFunctions/filenamefprintf.sci
+++ b/macros/GeneralFunctions/filenamefprintf.sci
@@ -31,7 +31,15 @@ SCI2CNInArgCheck(argn(2),4,4);
// [FidReportFile, mess] = mopen(deblank(filename),'at+');
- [FidReportFile, mess] = mopen(filename,'a+');
+ if type(filename) == 1 then // double
+ FidReportFile = filename;
+ mess = "invalid filename";
+ elseif type(filename) == 10 then // string
+ [FidReportFile, mess] = mopen(filename,'a+');
+ else
+ FidReportFile = -1;
+ mess = "invalid filename type";
+ end
if (FidReportFile == -1) then
error(9999, mess);
end
@@ -43,6 +51,7 @@ SCI2CNInArgCheck(argn(2),4,4);
if ennewline=='y' then
mfprintf(FidReportFile,'\n');
end
- mclose(FidReportFile);
-
+ if type(filename) == 10 then
+ mclose(FidReportFile);
+ end
endfunction
diff --git a/macros/ToolInitialization/UpdateSCI2CInfo.sci b/macros/ToolInitialization/UpdateSCI2CInfo.sci
index ed07907f..9671bf80 100644
--- a/macros/ToolInitialization/UpdateSCI2CInfo.sci
+++ b/macros/ToolInitialization/UpdateSCI2CInfo.sci
@@ -179,12 +179,12 @@ TempVars = [];
// 'NO_RESIZE'
// 'REALLOC_ALL_RESIZE_ALL'
SharedInfo.DefaultPrecision = ...
- FA_GetDefaultPrecision(FileInfo.Funct(funnumber).SCICopyFileName,FileInfo.Funct(funnumber).ReportFileName);
+ FA_GetDefaultPrecision(FileInfo.Funct(funnumber).SCICopyFileName,FileInfo.Funct(funnumber).SCICopyFileFid,FileInfo.Funct(funnumber).ReportFileName);
// ----------------------------------
// --- Determine Resize Approach. ---
// ----------------------------------
-SharedInfo.ResizeApproach = FA_GetResizeApproach(FileInfo.Funct(funnumber).SCICopyFileName,FileInfo.Funct(funnumber).ReportFileName);
+SharedInfo.ResizeApproach = FA_GetResizeApproach(FileInfo.Funct(funnumber).SCICopyFileName,FileInfo.Funct(funnumber).SCICopyFileFid,FileInfo.Funct(funnumber).ReportFileName);
// ---------------------
// --- Save section. ---