summaryrefslogtreecommitdiff
path: root/macros/CCodeGeneration/GetClsFileName.sci
blob: 46f082014526de30d1c14ae397a1fa320dd5ecd2 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
function SCI2CClassFileName = GetClsFileName(FunName,FileInfo,SharedInfo)
// function SCI2CClassFileName = GetClsFileName(FunName,FileInfo,SharedInfo)
// -----------------------------------------------------------------
// //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);

// //NUT: verifica che il nome sia accettabile e che non
// //NUT: occorra spezzettarla in piu funzioni.

// --- Extraction of the function name and number. ---
nxtscifunname   = SharedInfo.NextSCIFunName;
nxtscifunnumber = SharedInfo.NextSCIFunNumber;

ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName;

// --- Initialization. ---
tmpannfilename   = FunName+'.ann';
tmpscifilename   = FunName+'.sci';
AnnFileName      = '';
ClsFileName      = ''

SCI2CClassSpecifier = SharedInfo.Annotations.FUNCLASS;
FlagFoundAnnFile = 0;
// #RNU_RES_B
//NUT: qui e' presente la lista delle priorita' di accesso alle annotazioni.
// #RNU_RES_E
if SCI2Cfileexist(FileInfo.USER2CLibCAnnFun,tmpannfilename)
   // #RNU_RES_B
   // It is a C function of the USER2C library.
   // #RNU_RES_E
   FlagFoundAnnFile   = 1;
   AnnFileName        = fullfile(FileInfo.USER2CLibCAnnFun,tmpannfilename);
   SCI2CClassName     = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName);
   SCI2CClassFileName = fullfile(FileInfo.USER2CLibCAnnCls,SCI2CClassName+'.acls');
elseif SCI2Cfileexist(FileInfo.USER2CLibSCIAnnFun,tmpannfilename)
   // #RNU_RES_B
   // It is a scilab function of the USER2C library.
   // #RNU_RES_E
   FlagFoundAnnFile   = 1;
   AnnFileName        = fullfile(FileInfo.USER2CLibSCIAnnFun,tmpannfilename);
   SCI2CClassName     = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName);
   SCI2CClassFileName = fullfile(FileInfo.USER2CLibSCIAnnCls,SCI2CClassName+'.acls');
elseif (SCI2Cfileexist(FileInfo.SCI2CLibCAnnFun,tmpannfilename))
   // #RNU_RES_B
   // It is a C function of the SCI2C library.
   // #RNU_RES_E
   FlagFoundAnnFile   = 1;
   AnnFileName        = fullfile(FileInfo.SCI2CLibCAnnFun,tmpannfilename);
   SCI2CClassName     = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName);
   SCI2CClassFileName = fullfile(FileInfo.SCI2CLibCAnnCls,SCI2CClassName+'.acls');
elseif (SCI2Cfileexist(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename))
   // #RNU_RES_B
   // It is a scilab function of the SCI2C library.
   // #RNU_RES_E
   FlagFoundAnnFile   = 1;
   AnnFileName        = fullfile(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename);
   SCI2CClassName     = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName);
   SCI2CClassFileName = fullfile(FileInfo.SCI2CLibSCIAnnCls,SCI2CClassName+'.acls');
end

if (FlagFoundAnnFile == 0)
   [FlagFoundAnnFile,fullpathscifilename] = SCI2CFindFile(FileInfo.UserSciFilesPaths,FunName+'.sci');
   if (FlagFoundAnnFile == 0)
      // #RNU_RES_B
      PrintStringInfo(' ',ReportFileName,'both','y');
      PrintStringInfo('SCI2CERROR: Missing function annotation. Could not find',ReportFileName,'both','y');
      PrintStringInfo('SCI2CERROR: an associated .sci or .ann file for function: '+FunName,ReportFileName,'both','y');
      PrintStringInfo(' ',ReportFileName,'both','y');
      // #RNU_RES_E
      error(9999, 'SCI2CERROR: Missing function annotation. Could not find an associated .sci or .ann file for function: '+FunName);
   end
   AnnFileName        = fullfile(FileInfo.USER2CLibSCIAnnFun,tmpannfilename);
   SCI2CClassName     = FunName;
   SCI2CClassFileName = fullfile(FileInfo.USER2CLibSCIAnnCls,SCI2CClassName+'.acls');
   Sci2AnnotationFile(fullpathscifilename,SCI2CClassFileName,AnnFileName,...
      SharedInfo.Annotations.USERFUN,ReportFileName);
end
endfunction