diff options
Diffstat (limited to 'macros/FunctionList')
-rw-r--r-- | macros/FunctionList/FL_ExistCFunction.bin | bin | 0 -> 12304 bytes | |||
-rw-r--r-- | macros/FunctionList/FL_ExistCFunction.sci | 106 | ||||
-rw-r--r-- | macros/FunctionList/FL_ExtractFuncList.bin | bin | 0 -> 7828 bytes | |||
-rw-r--r-- | macros/FunctionList/FL_ExtractFuncList.sci | 62 | ||||
-rw-r--r-- | macros/FunctionList/FL_GetFunctionClass.bin | bin | 0 -> 6832 bytes | |||
-rw-r--r-- | macros/FunctionList/FL_GetFunctionClass.sci | 54 | ||||
-rw-r--r-- | macros/FunctionList/FL_InOutArgs2CFunNames.bin | bin | 0 -> 6452 bytes | |||
-rw-r--r-- | macros/FunctionList/FL_InOutArgs2CFunNames.sci | 51 | ||||
-rw-r--r-- | macros/FunctionList/FL_UpdateConverted.bin | bin | 0 -> 5572 bytes | |||
-rw-r--r-- | macros/FunctionList/FL_UpdateConverted.sci | 46 | ||||
-rw-r--r-- | macros/FunctionList/FL_UpdateToBeConv.bin | bin | 0 -> 14628 bytes | |||
-rw-r--r-- | macros/FunctionList/FL_UpdateToBeConv.sci | 114 | ||||
-rw-r--r-- | macros/FunctionList/buildmacros.sce | 15 | ||||
-rw-r--r-- | macros/FunctionList/lib | bin | 0 -> 544 bytes | |||
-rw-r--r-- | macros/FunctionList/names | 6 |
15 files changed, 454 insertions, 0 deletions
diff --git a/macros/FunctionList/FL_ExistCFunction.bin b/macros/FunctionList/FL_ExistCFunction.bin Binary files differnew file mode 100644 index 0000000..1c85aa2 --- /dev/null +++ b/macros/FunctionList/FL_ExistCFunction.bin diff --git a/macros/FunctionList/FL_ExistCFunction.sci b/macros/FunctionList/FL_ExistCFunction.sci new file mode 100644 index 0000000..5b63ec5 --- /dev/null +++ b/macros/FunctionList/FL_ExistCFunction.sci @@ -0,0 +1,106 @@ +function flagexist = FL_ExistCFunction(CFunName,USER2CAvailableCDat,SCI2CAvailableCDat,ConvertedDat,ToBeConvertedDat,ReportFileName)
+// function flagexist = FL_ExistCFunction(CFunName,USER2CAvailableCDat,SCI2CAvailableCDat,ConvertedDat,ToBeConvertedDat,ReportFileName)
+// -----------------------------------------------------------------
+// //NUT: add description here
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 30-Oct-2007 -- Raffaele Nutricato: Author.
+// 30-Oct-2007 -- Alberto Morea: Test Ok.
+//
+// Copyright 2007 Raffaele Nutricato & Alberto Morea.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),6,6);
+
+// -----------------------
+// --- Initialization. ---
+// -----------------------
+flagexist = %F;
+// ---------------------------
+// --- End Initialization. ---
+// ---------------------------
+
+
+AvailableDat = USER2CAvailableCDat;
+load(AvailableDat,'Available');
+NAvail = size(Available,1);
+
+tmpcnt = 1;
+while ((tmpcnt <=NAvail) & (flagexist == %F))
+ if mtlb_strcmp(Available(tmpcnt),CFunName)
+ flagexist = %T;
+ // #RNU_RES_B
+ PrintStringInfo(' Found C Function Name in : '+AvailableDat,ReportFileName,'file','y');
+ // #RNU_RES_E
+ end
+ tmpcnt = tmpcnt + 1;
+end
+clear Available
+
+if (flagexist == %F)
+ AvailableDat = SCI2CAvailableCDat;
+ load(AvailableDat,'Available');
+ NAvail = size(Available,1);
+
+ tmpcnt = 1;
+ while ((tmpcnt <=NAvail) & (flagexist == %F))
+ if mtlb_strcmp(Available(tmpcnt),CFunName)
+ flagexist = %T;
+ // #RNU_RES_B
+ PrintStringInfo(' Found C Function Name in : '+AvailableDat,ReportFileName,'file','y');
+ // #RNU_RES_E
+ end
+ tmpcnt = tmpcnt + 1;
+ end
+ clear Available
+end
+
+if (flagexist == %F)
+ load(ConvertedDat,'Converted');
+ NConv = size(Converted,1);
+ tmpcnt = 1;
+ while ((tmpcnt <=NConv) & (flagexist == %F))
+ if mtlb_strcmp(Converted(tmpcnt),CFunName)
+ flagexist = %T;
+ // #RNU_RES_B
+ PrintStringInfo(' Found C Function Name in : '+ConvertedDat,ReportFileName,'file','y');
+ // #RNU_RES_E
+ end
+ tmpcnt = tmpcnt + 1;
+ end
+ clear Converted
+end
+
+if (flagexist == %F)
+ load(ToBeConvertedDat,'ToBeConverted');
+ NToBeConv = size(ToBeConverted,1);
+ tmpcnt = 1;
+ while ((tmpcnt <=NToBeConv) & (flagexist == %F))
+ if mtlb_strcmp(ToBeConverted(tmpcnt).CFunctionName,CFunName)
+ flagexist = %T;
+ // #RNU_RES_B
+ PrintStringInfo(' Found C Function Name in : '+ToBeConvertedDat,ReportFileName,'file','y');
+ // #RNU_RES_E
+ end
+ tmpcnt = tmpcnt + 1;
+ end
+ clear ToBeConverted
+end
+
+if (flagexist == %F)
+ // #RNU_RES_B
+ PrintStringInfo(' C Function Name not found in the ""Available"" , ""Converted"" and ""ToBeConverted"" function lists.',ReportFileName,'file','y');
+ // #RNU_RES_E
+end
+
+endfunction
diff --git a/macros/FunctionList/FL_ExtractFuncList.bin b/macros/FunctionList/FL_ExtractFuncList.bin Binary files differnew file mode 100644 index 0000000..ec74708 --- /dev/null +++ b/macros/FunctionList/FL_ExtractFuncList.bin diff --git a/macros/FunctionList/FL_ExtractFuncList.sci b/macros/FunctionList/FL_ExtractFuncList.sci new file mode 100644 index 0000000..cbc1465 --- /dev/null +++ b/macros/FunctionList/FL_ExtractFuncList.sci @@ -0,0 +1,62 @@ +function [CFuncList,NElements] = FL_ExtractFuncList(FunctionDir,ClassDir,SCI2CClassSpecifier,ExtFLCls,ReportFileName)
+// function [CFuncList,NElements] = FL_ExtractFuncList(FunctionDir,ClassDir,SCI2CClassSpecifier,ExtFLCls,ReportFileName)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Extracts the list of the C functions available. To do that
+// this function enters in the directories where the .clst and
+// .lst files are stored.
+// #RNU_RES_E
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 05-Jan-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),5,5);
+
+// #RNU_RES_B
+// ---------------------------------------------------------
+// --- Extract the list of files in Functions directory. ---
+// ---------------------------------------------------------
+// #RNU_RES_E
+tmppwd = pwd();
+cd(FunctionDir);
+// funfiles = ls();
+funfiles = listfiles();
+cd(tmppwd);
+NFunFiles = size(funfiles,1);
+
+// #RNU_RES_B
+// -----------------------------------------------------------
+// --- Extract the C function list from Classes directory. ---
+// -----------------------------------------------------------
+// #RNU_RES_E
+CFuncList = '';
+NElements = 0;
+
+for cntfun = 1:NFunFiles
+ FunFileName = fullfile(FunctionDir,funfiles(cntfun));
+ ClassName = FL_GetFunctionClass(FunFileName,SCI2CClassSpecifier,ReportFileName);
+ ClassFileName = fullfile(ClassDir,ClassName);
+ [tmpfunlist,tmpnelem] = File2StringArray(ClassFileName+ExtFLCls);
+ [tmppath,tmpfunname,tmpext] = fileparts(FunFileName);
+ tmpfunlist = FL_InOutArgs2CFunNames(tmpfunname,tmpfunlist,tmpnelem);
+ for cnttmpfun = 1:tmpnelem
+ NElements = NElements + 1;
+ CFuncList(NElements) = tmpfunlist(cnttmpfun);
+ end
+end
+
+endfunction
diff --git a/macros/FunctionList/FL_GetFunctionClass.bin b/macros/FunctionList/FL_GetFunctionClass.bin Binary files differnew file mode 100644 index 0000000..faa210e --- /dev/null +++ b/macros/FunctionList/FL_GetFunctionClass.bin diff --git a/macros/FunctionList/FL_GetFunctionClass.sci b/macros/FunctionList/FL_GetFunctionClass.sci new file mode 100644 index 0000000..09fad92 --- /dev/null +++ b/macros/FunctionList/FL_GetFunctionClass.sci @@ -0,0 +1,54 @@ +function SCI2CClassName = FL_GetFunctionClass(FunFileName,SCI2CClassSpecifier,ReportFileName)
+// function SCI2CClassName = FL_GetFunctionClass(FunFileName,SCI2CClassSpecifier,ReportFileName)
+// -----------------------------------------------------------------
+// //NUT: add description here
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 11-Jul-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),3,3);
+
+// ---------------------------------------
+// --- Read the class of the function. ---
+// ---------------------------------------
+// --- Open the .sci file (read only). ---
+inannfid = SCI2COpenFileRead(FunFileName);
+
+FoundClass = 0;
+if (meof(inannfid) == 0)
+ check_string = stripblanks(mgetl(inannfid,1));
+ if (~isempty(check_string))
+ if (SCI2Cstrncmps1size(SCI2CClassSpecifier,check_string))
+ SCI2CClassName = part(check_string,length(SCI2CClassSpecifier)+1:length(check_string));
+ // #RNU_RES_B
+ PrintStringInfo(' Function belongs to class: '+SCI2CClassName+'.',ReportFileName,'file','y');
+ // #RNU_RES_E
+ FoundClass = 1;
+ else
+ error(9999, 'Could not find ""'+SCI2CClassSpecifier+'"" in '+FunFileName+'.');
+ end
+ end
+end
+mclose(inannfid);
+if (FoundClass == 0)
+ error(9999, 'Could not find ""'+SCI2CClassSpecifier+'"" specifier.');
+end
+
+// -------------------------------------------
+// --- End read the class of the function. ---
+// -------------------------------------------
+endfunction
+
\ No newline at end of file diff --git a/macros/FunctionList/FL_InOutArgs2CFunNames.bin b/macros/FunctionList/FL_InOutArgs2CFunNames.bin Binary files differnew file mode 100644 index 0000000..09d5eb5 --- /dev/null +++ b/macros/FunctionList/FL_InOutArgs2CFunNames.bin diff --git a/macros/FunctionList/FL_InOutArgs2CFunNames.sci b/macros/FunctionList/FL_InOutArgs2CFunNames.sci new file mode 100644 index 0000000..e559f38 --- /dev/null +++ b/macros/FunctionList/FL_InOutArgs2CFunNames.sci @@ -0,0 +1,51 @@ +function FunNameCFuncList = FL_InOutArgs2CFunNames(FunctionName,CommaSepCFuncList,CFuncListNElem)
+// function FunNameCFuncList = FL_InOutArgs2CFunNames(FunctionName,CommaSepCFuncList,CFuncListNElem)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Reads a Comma Separated Function List and converts it into the
+// corresponding list of C function. In the Comma Separated
+// Function List only input and output arguments are specified
+// and they are separated by a comma.
+// #RNU_RES_E
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 05-Jan-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),3,3);
+
+
+FunNameCFuncList = '';
+SepChar = ',';
+for cntelem = 1:CFuncListNElem
+ tmptokens = tokens(CommaSepCFuncList(cntelem),SepChar);
+ if (size(tmptokens,1) == 0)
+ FunNameCFuncList(cntelem) = FunctionName;
+ elseif (size(tmptokens,1) == 1)
+ if part(tmptokens,1:1) == ','
+ FunNameCFuncList(cntelem) = FunctionName+tmptokens(2);
+ else
+ FunNameCFuncList(cntelem) = tmptokens(1)+FunctionName;
+ end
+ elseif (size(tmptokens,1) == 2)
+ FunNameCFuncList(cntelem) = tmptokens(1)+FunctionName+tmptokens(2);
+ else
+ disp('Incorrect format for the function list class.');
+ error(9999, 'Check the following function list class item: ""'+CommaSepCFuncList(cntelem)+'"".');
+ end
+end
+
+endfunction
diff --git a/macros/FunctionList/FL_UpdateConverted.bin b/macros/FunctionList/FL_UpdateConverted.bin Binary files differnew file mode 100644 index 0000000..73f2cf0 --- /dev/null +++ b/macros/FunctionList/FL_UpdateConverted.bin diff --git a/macros/FunctionList/FL_UpdateConverted.sci b/macros/FunctionList/FL_UpdateConverted.sci new file mode 100644 index 0000000..5f4637e --- /dev/null +++ b/macros/FunctionList/FL_UpdateConverted.sci @@ -0,0 +1,46 @@ +function Converted = FL_UpdateConverted(NFilesToTranslate,ConvertedDatFile)
+// function Converted = FL_UpdateConverted(NFilesToTranslate,ConvertedDatFile)
+// -----------------------------------------------------------------
+// //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),2,2);
+
+// -----------------------
+// --- Initialization. ---
+// -----------------------
+// --- Load Converted .dat file. ---
+load(ConvertedDatFile,'Converted');
+// ---------------------------
+// --- End Initialization. ---
+// ---------------------------
+
+
+if (NFilesToTranslate >= 1)
+ // ---------------------------------------
+ // --- Update Converted Function List. ---
+ // ---------------------------------------
+ // --- Insert the current function into the converted function list. ---
+ NConvP1 = size(Converted,1)+1;
+ Converted(NConvP1) = SharedInfo.NextCFunName;
+ // -------------------------------------------
+ // --- End Update Converted Function List. ---
+ // -------------------------------------------
+end
+
+endfunction
diff --git a/macros/FunctionList/FL_UpdateToBeConv.bin b/macros/FunctionList/FL_UpdateToBeConv.bin Binary files differnew file mode 100644 index 0000000..44b5803 --- /dev/null +++ b/macros/FunctionList/FL_UpdateToBeConv.bin diff --git a/macros/FunctionList/FL_UpdateToBeConv.sci b/macros/FunctionList/FL_UpdateToBeConv.sci new file mode 100644 index 0000000..1ee2e15 --- /dev/null +++ b/macros/FunctionList/FL_UpdateToBeConv.sci @@ -0,0 +1,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
diff --git a/macros/FunctionList/buildmacros.sce b/macros/FunctionList/buildmacros.sce new file mode 100644 index 0000000..60fd284 --- /dev/null +++ b/macros/FunctionList/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/FunctionList/lib b/macros/FunctionList/lib Binary files differnew file mode 100644 index 0000000..9b8cfc8 --- /dev/null +++ b/macros/FunctionList/lib diff --git a/macros/FunctionList/names b/macros/FunctionList/names new file mode 100644 index 0000000..c40e30c --- /dev/null +++ b/macros/FunctionList/names @@ -0,0 +1,6 @@ +FL_ExistCFunction +FL_ExtractFuncList +FL_GetFunctionClass +FL_InOutArgs2CFunNames +FL_UpdateConverted +FL_UpdateToBeConv |