summaryrefslogtreecommitdiff
path: root/macros/GeneralFunctions/FunName2SciFileName.sci
blob: 39ff5b215bc286f9411c0d94ddc11466cd63ed6b (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
function ScilabFileName = FunName2SciFileName(DirList,InFunName);
// function ScilabFileName = FunName2SciFileName(DirList,InFunName);
// -----------------------------------------------------------------
// #RNU_RES_B
// This function generates the full path of the scilab file
// related to the function name (InFunName) specified. 
// In more detail the file "eval(InFunName).sci" file is searched
// in the directories specified in DirList.
// #RNU_RES_E
//
// Input data:
// //NUT: add description here
//
// Output data:
// //NUT: add description here
//
// Status:
// 16-Apr-2007 -- Nutricato Raffaele: Author.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------

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

if (prod(size(DirList)) == 0)
   error(9999, 'Incorrect DirList parameter.');
end

if (prod(size(InFunName)) == 0)
   error(9999, 'Incorrect InFunName parameter.');
end

// --- Generate the PathList. ---
for tmpcounter = 1:max(size(DirList))
   PathList(tmpcounter) = fullfile(DirList(tmpcounter),(InFunName+'.sci'));
end

// --- Search the .sci file. ---
ScilabFileName = listfiles(PathList);

// --- Check on the number of .sci files found. ---
if ((prod(size(ScilabFileName))) > 1)
   disp(ScilabFileName);
   error(9999, 'Found more than one scilab file.');
end

if ((prod(size(ScilabFileName))) < 1)
   disp(ScilabFileName);
   error(9999, 'Scilab file ""'+InFunName+'.sci"", not found');
end

endfunction