summaryrefslogtreecommitdiff
path: root/src/Scilab2C/Annotations/Sci2AnnotationFile.sci
diff options
context:
space:
mode:
authornutricato2007-07-13 10:03:51 +0000
committernutricato2007-07-13 10:03:51 +0000
commitc25b43cf50da3a1e2bbbc459448e6b80806df51c (patch)
treead8f2656b2378314a492a7e5e27c588072fc9834 /src/Scilab2C/Annotations/Sci2AnnotationFile.sci
parent5e99f6ee73b31f683d5b4fb5f88e1bb0b683a9e8 (diff)
downloadscilab2c-c25b43cf50da3a1e2bbbc459448e6b80806df51c.tar.gz
scilab2c-c25b43cf50da3a1e2bbbc459448e6b80806df51c.tar.bz2
scilab2c-c25b43cf50da3a1e2bbbc459448e6b80806df51c.zip
Diffstat (limited to 'src/Scilab2C/Annotations/Sci2AnnotationFile.sci')
-rw-r--r--src/Scilab2C/Annotations/Sci2AnnotationFile.sci73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/Scilab2C/Annotations/Sci2AnnotationFile.sci b/src/Scilab2C/Annotations/Sci2AnnotationFile.sci
new file mode 100644
index 00000000..a7046543
--- /dev/null
+++ b/src/Scilab2C/Annotations/Sci2AnnotationFile.sci
@@ -0,0 +1,73 @@
+function Sci2AnnotationFile(FileInfoDatFile,SciFileName)
+// function Sci2AnnotationFile(FileInfoDatFile,SciFileName)
+// --------------------------------------------------------------------------------
+// This function reads the .sci input file and generates the correspondig .ann
+// file.
+//
+// Input data:
+// FileInfoDatFile: name of the .dat file containing the FileInfo structure.
+//
+// Output data:
+//
+// Status:
+// 25-Jun-2007 -- Nutricato Raffaele: Author.
+// -----------------------------------------------------------------
+
+// ---------------------
+// --- Load section. ---
+// ---------------------
+// --- Load File Info Structure. ---
+load(FileInfoDatFile,'FileInfo');
+
+// --- Load Shared Info Structure. ---
+load(FileInfo.SharedInfoDatFile,'SharedInfo');
+
+// --- Extraction of the function name and number. ---
+funname = SharedInfo.Next(1).SCIFunName;
+funnumber = SharedInfo.NextSCIFunNumber;
+// -------------------------
+// --- End load section. ---
+// -------------------------
+
+// --- File names initialization. ---
+[tmppath,tmpname,tmpext] = fileparts(SciFileName);
+AnnFileName = fullfile(FileInfo.USER2CLibAnnDirName,tmpname+'.ann');
+
+PrintStepInfo('Generate annotations file: '+AnnFileName,...
+ FileInfo.GeneralReport,'both');
+
+// ---------------------------------------
+// --- Open the .sci file (read only). ---
+// ---------------------------------------
+[inscifid,inscierr] = mopen(SciFileName,'r');
+if (inscierr < 0)
+ SCI2Cerror(['Cannot open (in read mode): '+SciFileName]);
+end
+
+// ----------------------------------------------
+// --- Loop over the lines of the input file. ---
+// ----------------------------------------------
+line_position = 0;
+while (meof(inscifid) == 0)
+ check_string = stripblanks(mgetl(inscifid,1));
+ line_position = line_position + 1;
+ if (length(check_string) >= 1)
+ if ((SCI2Cstrncmps1size(SharedInfo.Annotations.GBLVAR,check_string)) | ...
+ (SCI2Cstrncmps1size(SharedInfo.Annotations.VARTYPE,check_string)) | ...
+ (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNOUT,check_string)) | ...
+ (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNSIZE,check_string)) | ...
+ (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNTYPE,check_string)))
+ PrintStringInfo('Line '+string(line_position)+' - Found Annotation:: '+' ""'+check_string+' ""',...
+ FileInfo.GeneralReport,'file','y');
+ PrintStringInfo(check_string,...
+ AnnFileName,'file','y');
+
+ end
+ end
+end
+// --------------------------------------------------
+// --- End loop over the lines of the input file. ---
+// --------------------------------------------------
+
+mclose(inscifid);
+endfunction