summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjofret2008-06-06 15:50:13 +0000
committerjofret2008-06-06 15:50:13 +0000
commit00b3a2f8e0c8c6ca5d79ed96733d37c48cb5bc47 (patch)
tree02098875731c2ce441b1670864017aa36a494baa /src
parent24fea7774ad69b3f8d61333e2d6f31eeff54b8ec (diff)
downloadscilab2c-00b3a2f8e0c8c6ca5d79ed96733d37c48cb5bc47.tar.gz
scilab2c-00b3a2f8e0c8c6ca5d79ed96733d37c48cb5bc47.tar.bz2
scilab2c-00b3a2f8e0c8c6ca5d79ed96733d37c48cb5bc47.zip
- Clean add for Raffaele.
Diffstat (limited to 'src')
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/Array2String.sci26
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/ConvertPathMat2C.sci48
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/File2StringArray.sci27
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/FunName2SciFileName.sci37
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/IsNanSize.sci22
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/KeyStr2FileStrPos.sci58
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/PrintStepInfo.sci54
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/PrintStringInfo.sci45
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/ReadStringCard.sci39
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CCreateDir.sci21
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CFindFile.sci28
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CNInArgCheck.sci16
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2COpenFileRead.sci19
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2COpenFileWrite.sci19
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CTemplate.sci18
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Ccopyfile.sci29
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cerror.sci17
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CerrorFile.sci17
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci26
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cflipud.sci19
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cisnum.sci19
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cmdelete.sci19
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstring.sci16
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci16
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstrncmps1size.sci17
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/SizeInByte.sci24
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/dispina.sci31
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/filenamefprintf.sci27
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/float.sci15
-rw-r--r--src/Scilab2C/Scilab2C/GeneralFunctions/squeezestrings.sci19
30 files changed, 788 insertions, 0 deletions
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/Array2String.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/Array2String.sci
new file mode 100644
index 00000000..0430b0d7
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/Array2String.sci
@@ -0,0 +1,26 @@
+function [StringArray] = Array2String(InArray);
+// function [StringArray] = Array2String(InArray);
+// -----------------------------------------------------------------
+//
+// Status:
+// 13-May-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+[Nrows,Ncols] = size(InArray);
+
+StringArray = '[';
+for counterrows = 1:Nrows
+ for countercols = 1:Ncols
+ StringArray = StringArray + string(InArray(counterrows,countercols)) + ',';
+ end
+ StringArray = part(StringArray,1:(length(StringArray)-1)); // Remove the last ','
+ StringArray = StringArray+';';
+end
+StringArray = part(StringArray,1:(length(StringArray)-1)); // Remove the last ';'
+StringArray = StringArray+']';
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/ConvertPathMat2C.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/ConvertPathMat2C.sci
new file mode 100644
index 00000000..9ba7152d
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/ConvertPathMat2C.sci
@@ -0,0 +1,48 @@
+function OutPath = ConvertPathMat2C(InPath,CPathStyle)
+// function OutPath = ConvertPathMat2C(InPath,CPathStyle)
+// -----------------------------------------------------------------
+//
+// Status:
+// 26-Jan-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),2,2);
+if (CPathStyle == 'windows')
+ OutPath=strsubst(InPath,'/','\');
+elseif (CPathStyle == 'unix')
+ OutPath=strsubst(InPath,'\','/');
+elseif (CPathStyle == 'cygwin')
+ OutPath=strsubst(InPath,'\','/');
+ OutPath=strsubst(OutPath,'A:','/cygdrive/a');
+ OutPath=strsubst(OutPath,'B:','/cygdrive/b');
+ OutPath=strsubst(OutPath,'C:','/cygdrive/c');
+ OutPath=strsubst(OutPath,'D:','/cygdrive/d');
+ OutPath=strsubst(OutPath,'E:','/cygdrive/e');
+ OutPath=strsubst(OutPath,'F:','/cygdrive/f');
+ OutPath=strsubst(OutPath,'G:','/cygdrive/g');
+ OutPath=strsubst(OutPath,'H:','/cygdrive/h');
+ OutPath=strsubst(OutPath,'I:','/cygdrive/i');
+ OutPath=strsubst(OutPath,'J:','/cygdrive/j');
+ OutPath=strsubst(OutPath,'K:','/cygdrive/k');
+ OutPath=strsubst(OutPath,'L:','/cygdrive/l');
+ OutPath=strsubst(OutPath,'M:','/cygdrive/m');
+ OutPath=strsubst(OutPath,'N:','/cygdrive/n');
+ OutPath=strsubst(OutPath,'O:','/cygdrive/o');
+ OutPath=strsubst(OutPath,'P:','/cygdrive/p');
+ OutPath=strsubst(OutPath,'Q:','/cygdrive/q');
+ OutPath=strsubst(OutPath,'R:','/cygdrive/r');
+ OutPath=strsubst(OutPath,'S:','/cygdrive/s');
+ OutPath=strsubst(OutPath,'T:','/cygdrive/t');
+ OutPath=strsubst(OutPath,'U:','/cygdrive/u');
+ OutPath=strsubst(OutPath,'V:','/cygdrive/v');
+ OutPath=strsubst(OutPath,'W:','/cygdrive/w');
+ OutPath=strsubst(OutPath,'X:','/cygdrive/x');
+ OutPath=strsubst(OutPath,'Y:','/cygdrive/y');
+ OutPath=strsubst(OutPath,'Z:','/cygdrive/z');
+else
+ OutPath = InPath;
+end
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/File2StringArray.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/File2StringArray.sci
new file mode 100644
index 00000000..377cca6f
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/File2StringArray.sci
@@ -0,0 +1,27 @@
+function [String_Array,N_Strings] = File2StringArray(InFileName)
+// function [String_Array,N_Strings] = File2StringArray(InFileName)
+// -----------------------------------------------------------------
+//
+// Status:
+// 10-Nov-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+
+N_Strings = 0;
+String_Array = '';
+fidfile = SCI2COpenFileRead(InFileName);
+
+tmpline = mgetl(fidfile,1);
+while (meof(fidfile) == 0)
+ N_Strings = N_Strings + 1;
+ String_Array(N_Strings) = tmpline;
+ tmpline = mgetl(fidfile,1);
+end
+
+mclose(fidfile);
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/FunName2SciFileName.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/FunName2SciFileName.sci
new file mode 100644
index 00000000..51e241d4
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/FunName2SciFileName.sci
@@ -0,0 +1,37 @@
+function ScilabFileName = FunName2SciFileName(DirList,InFunName);
+// function ScilabFileName = FunName2SciFileName(DirList,InFunName);
+// -----------------------------------------------------------------
+// Status:
+// 16-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),2,2);
+
+if (prod(size(DirList)) == 0)
+ SCI2Cerror('Incorrect DirList parameter.');
+end
+
+if (prod(size(InFunName)) == 0)
+ SCI2Cerror('Incorrect InFunName parameter.');
+end
+
+for tmpcounter = 1:max(size(DirList))
+ PathList(tmpcounter) = fullfile(DirList(tmpcounter),(InFunName+'.sci'));
+end
+
+ScilabFileName = listfiles(PathList);
+
+if ((prod(size(ScilabFileName))) > 1)
+ disp(ScilabFileName);
+ SCI2Cerror('Found more than one scilab file.');
+end
+
+if ((prod(size(ScilabFileName))) < 1)
+ disp(ScilabFileName);
+ SCI2Cerror('Scilab file ""'+InFunName+'.sci"", not found');
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/IsNanSize.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/IsNanSize.sci
new file mode 100644
index 00000000..5e726060
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/IsNanSize.sci
@@ -0,0 +1,22 @@
+function outbool = IsNanSize(instring)
+// function outbool = IsNanSize(instring)
+// -----------------------------------------------------------------
+//
+// Status:
+// 11-Feb-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+
+outbool = %F;
+indexval = strindex(instring,'__SCI2CNANSIZE');
+
+if(length(indexval)>=1)
+ outbool = %T;
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/KeyStr2FileStrPos.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/KeyStr2FileStrPos.sci
new file mode 100644
index 00000000..01eb212e
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/KeyStr2FileStrPos.sci
@@ -0,0 +1,58 @@
+function [flag_found,requested_line,line_position] = KeyStr2FileStrPos(filename,key_string,method)
+// function [flag_found,requested_line,line_position] = KeyStr2FileStrPos(filename,key_string,method)
+// --------------------------------------------------------------------------------
+//
+//
+// Status:
+// 08-Jul-2002 -- Author: Raffaele Nutricato
+// 08-Jul-2002 -- Raffaele Nutricato: Revision OK
+// 23-Nov-2004 -- Raffaele Nutricato: Changed disp to warning in if (flag_found == 0).
+// It allows to disable the message it generates
+// by using warning off.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),2,3);
+
+
+if (argn(2) == 2)
+ method = 'no_cut';
+end
+method = convstr(method, 'u');
+
+flag_found = 0;
+requested_line = '';
+line_position = 0;
+
+[fid,mess] = mopen(filename,'r');
+if ( fid == -1 )
+ disp(['Cannot open: '+filename])
+ disp(mess);
+ flag_found = 0;
+ return;
+end
+
+num_chars = length(key_string);
+while (meof(fid) == 0)
+ check_string = fgetl(fid);
+ line_position = line_position + 1;
+ if (key_string == check_string) & (key_string == num_chars) then
+ flag_found = 1;
+ requested_line = check_string;
+ if (method =='cut') then
+ requested_line(1:num_chars) = [];
+ end
+ mclose(fid);
+ return;
+ end
+end
+
+if (flag_found == 0)
+ warning('Warning: string ' + key_string + ' not found in file: ' + filename);
+ mclose(fid);
+end
+
+mclose(fid);
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/PrintStepInfo.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/PrintStepInfo.sci
new file mode 100644
index 00000000..1c9d2a45
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/PrintStepInfo.sci
@@ -0,0 +1,54 @@
+function PrintStepInfo(inputstring,filename,outputtype)
+// function PrintStepInfo(inputstring,filename,outputtype)
+// -----------------------------------------------------------------
+// Output data:
+//
+// Status:
+// 02-Jan-2006 -- Nutricato Raffaele: Author.
+// 02-Jan-2006 -- Nutricato Raffaele: TEST OK.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,3);
+
+
+if argn(2) < 3
+ bothout = 'n';
+ if argn(2) < 2
+ filename = '';
+ end
+end
+if (length(filename) == 0)
+ outputtype = 'stdout'; // Prints only on the stdout.
+end
+
+Nstars = length(inputstring);
+starstring = [];
+for counterstars = 1:Nstars
+ starstring = starstring+'*';
+end
+blankstring = [' '];
+
+if ((outputtype=='both') | (outputtype=='stdout'))
+ // disp(' ')
+ // disp(' ')
+ disp(blankstring+' '+starstring);
+ disp(blankstring+'==> '+inputstring);
+ disp(blankstring+' '+starstring);
+ // disp(' ')
+end
+
+if ((outputtype=='both') | (outputtype=='file'))
+ filenamefprintf(filename,'y',' ');
+ filenamefprintf(filename,'y',' ');
+ filenamefprintf(filename,'y',blankstring+' '+starstring);
+ filenamefprintf(filename,'y',blankstring+'==> '+inputstring);
+ filenamefprintf(filename,'y',blankstring+' '+starstring);
+ filenamefprintf(filename,'y',' ');
+end
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/PrintStringInfo.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/PrintStringInfo.sci
new file mode 100644
index 00000000..3c3dcce9
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/PrintStringInfo.sci
@@ -0,0 +1,45 @@
+function PrintStringInfo(str, filename, outputtype, ennewline)
+// function PrintStringInfo(str,filename,outputtype,ennewline)
+// -----------------------------------------------------------------
+//
+// Status:
+// 02-Jan-2006 -- Nutricato Raffaele: Author.
+// 02-Jan-2006 -- Nutricato Raffaele: TEST OK.
+// 02-May-2006 -- Nutricato Raffaele: Added ennewline.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),0,4);
+
+ if argn(2) < 4
+ ennewline = 'y';
+ if argn(2) < 3
+ outputtype = 'stdout';
+ if argn(2) < 2
+ filename = '';
+ if argn(2) < 1
+ str = '';
+ end
+ end
+ end
+ end
+
+ if (length(filename) == 0) then
+ outputtype = 'stdout'; // Prints only on the stdout.
+ end
+
+ if (outputtype=='both') | (outputtype=='stdout')
+ disp(str)
+ end
+
+ if (outputtype=='both') | (outputtype=='file')
+ if (ennewline=='y')
+ filenamefprintf(filename,'y',str);
+ else
+ filenamefprintf(filename,'n',str);
+ end
+ end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/ReadStringCard.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/ReadStringCard.sci
new file mode 100644
index 00000000..e9c7cd44
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/ReadStringCard.sci
@@ -0,0 +1,39 @@
+function cardvalue = ReadStringCard(filename,cardname,commentdelim,enableerror)
+// function cardvalue = ReadStringCard(filename,cardname,commentdelim,enableerror)
+// -----------------------------------------------------------------
+//
+// Status:
+// 06-Feb-2004 -- Nutricato Raffaele: Author.
+// 06-Feb-2004 -- Nutricato Raffaele: TEST OK.
+// 25-Jun-2004 -- Nutricato Raffaele: Added Comment delimiter
+// and enableerror as input parameter.
+// 13-Apr-2007 -- Intelligente Fabio: Rewritten from Matlab to Scilab.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),2,3);
+
+if argn(2) == 2 then
+ commentdelim = ' ';
+ enableerror = 'y';
+
+elseif argn(2) == 3 then
+ enableerror = 'y';
+end
+
+[flag_found,requested_line,dummy2] = ...
+ KeyString2FileStringPos(filename,cardname,'cut');
+cardvalue = stripblanks(strtok(requested_line,commentdelim));
+clear requested_line dummy2
+
+if (flag_found == 0) then
+ if (enableerror == 'y') then
+ SCI2Cerror([cardname,' not found']);
+ else
+ warning([cardname,' not found']);
+ end
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CCreateDir.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CCreateDir.sci
new file mode 100644
index 00000000..1ccb045a
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CCreateDir.sci
@@ -0,0 +1,21 @@
+function SCI2CCreateDir(OutDir)
+// function SCI2CCreateDir(OutDir)
+// -----------------------------------------------------------------
+//
+// Status:
+// 25-Jun-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+[tmppath,tmpfname,tmpextension]=fileparts(OutDir) ;
+
+status_dir = mkdir(tmppath,tmpfname+tmpextension) ;
+if (status_dir == 0)
+ SCI2Cerror('Cannot create: '+OutDir);
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CFindFile.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CFindFile.sci
new file mode 100644
index 00000000..96fd307a
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CFindFile.sci
@@ -0,0 +1,28 @@
+function [FlagFound,SCIFileName] = SCI2CFindFile(PathList,FileName)
+// function [FlagFound,SCIFileName] = SCI2CFindFile(PathList,FileName)
+// -----------------------------------------------------------------
+// Status:
+// 11-Jul-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),2,2);
+
+FlagFound = 0;
+SCIFileName = '';
+
+Nscipaths = size(PathList,1);
+counterscipaths = 1;
+while ((FlagFound == 0) & (counterscipaths <= Nscipaths))
+ dirscifilename = PathList(counterscipaths);
+ fullpathscifilename = fullfile(dirscifilename,FileName);
+ if (SCI2Cfileexist(dirscifilename,FileName))
+ FlagFound = 1;
+ SCIFileName = fullpathscifilename;
+ end
+ counterscipaths = counterscipaths + 1;
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CNInArgCheck.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CNInArgCheck.sci
new file mode 100644
index 00000000..af21e289
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CNInArgCheck.sci
@@ -0,0 +1,16 @@
+function SCI2CNInArgCheck(NInArgs,MinNArgs,MaxNArgs)
+// function SCI2CNInArgCheck(NInArgs,MinNArgs,MaxNArgs)
+// -----------------------------------------------------------------
+//
+// Status:
+// 23-Nov-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato
+// -----------------------------------------------------------------
+
+if ((NInArgs < MinNArgs) | (NInArgs > MaxNArgs))
+ SCI2Cerror('Incorrect number of input arguments.');
+end
+
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2COpenFileRead.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2COpenFileRead.sci
new file mode 100644
index 00000000..a2d694e0
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2COpenFileRead.sci
@@ -0,0 +1,19 @@
+function fidnumber = SCI2COpenFileRead(filename)
+// function fidnumber = SCI2COpenFileRead(filename)
+// --------------------------------------------------------------------------------
+//
+// Status:
+// 27-Oct-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+[fidnumber,fiderror] = mopen(filename,'r');
+if (fiderror < 0)
+ SCI2Cerror(['Cannot open (in read mode): '+filename]);
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2COpenFileWrite.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2COpenFileWrite.sci
new file mode 100644
index 00000000..f5eb3357
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2COpenFileWrite.sci
@@ -0,0 +1,19 @@
+function fidnumber = SCI2COpenFileWrite(filename)
+// function fidnumber = SCI2COpenFileWrite(filename)
+// --------------------------------------------------------------------------------
+//
+// Status:
+// 27-Oct-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+[fidnumber,fiderror] = mopen(filename,'w');
+if (fiderror < 0)
+ SCI2Cerror(['Cannot open (in write mode): '+filename]);
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CTemplate.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CTemplate.sci
new file mode 100644
index 00000000..486ae0c2
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CTemplate.sci
@@ -0,0 +1,18 @@
+function out = SCI2CTemplate(in1,in2)
+// function out = SCI2CTemplate(in1,in2)
+// -----------------------------------------------------------------
+//
+// Status:
+// 03-Jan-2008 -- Raffaele Nutricato: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,2);
+
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Ccopyfile.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Ccopyfile.sci
new file mode 100644
index 00000000..16378d0f
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Ccopyfile.sci
@@ -0,0 +1,29 @@
+function SCI2Ccopyfile(InFileName,OutFileName,CopyMode)
+// function SCI2Ccopyfile(InFileName,OutFileName,CopyMode)
+// -----------------------------------------------------------------
+//
+// Status:
+// 23-Nov-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),3,3);
+
+if (CopyMode == 'append')
+ fidIn = SCI2COpenFileRead(InFileName);
+
+ tmpline = mgetl(fidIn,1);
+ while (meof(fidIn) == 0)
+ PrintStringInfo(tmpline, OutFileName, 'file', 'y');
+ tmpline = mgetl(fidIn,1);
+ end
+ mclose(fidIn);
+elseif (CopyMode == 'overwrite')
+ PrintStringInfo(' ', OutFileName, 'file', 'y'); // Cannot use scilab copyfile when the directory is empty!.
+ copyfile(InFileName,OutFileName);
+else
+ SCI2Cerror('Unknown CopyMode: ""'+CopyMode+'""');
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cerror.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cerror.sci
new file mode 100644
index 00000000..03b5ed9c
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cerror.sci
@@ -0,0 +1,17 @@
+function SCI2Cerror(errorstring)
+// function SCI2Cerror(errorstring)
+// -----------------------------------------------------------------
+//
+// Status:
+// 02-May-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+
+mclose('all')
+error('###SCI2CERROR: '+errorstring);
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CerrorFile.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CerrorFile.sci
new file mode 100644
index 00000000..24aec4df
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2CerrorFile.sci
@@ -0,0 +1,17 @@
+function SCI2CerrorFile(errorstring,filename);
+// function SCI2CerrorFile(errorstring,filename);
+// -----------------------------------------------------------------
+//
+// Status:
+// 02-May-2006 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),2,2);
+
+mclose('all')
+PrintStringInfo('Error: '+errorstring,filename,'both');
+error('####SCI2C_ERROR -> Read File: '+filename+'.');
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci
new file mode 100644
index 00000000..49dfd512
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci
@@ -0,0 +1,26 @@
+function ExistTest = SCI2Cfileexist(InDir,FileName)
+// function ExistTest = SCI2Cfileexist(InDir,FileName)
+// -----------------------------------------------------------------
+// Status:
+// 12-Jun-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),2,2);
+
+tmppwd = pwd();
+cd(InDir);
+allfiles = ls(FileName);
+cd(tmppwd);
+
+if (size(allfiles,1) == 0)
+ ExistTest = %F;
+elseif (size(allfiles,1) == 1)
+ ExistTest = %T;
+else
+ SCI2Cerror('Very Strange! Found more than one file with the same name.');
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cflipud.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cflipud.sci
new file mode 100644
index 00000000..78e6f3d9
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cflipud.sci
@@ -0,0 +1,19 @@
+function OutputData = SCI2Cflipud(InputData)
+// function OutputData = SCI2Cflipud(InputData)
+// -----------------------------------------------------------------
+//
+// Status:
+// 12-May-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+NInputs = size(InputData,1);
+OutputData = InputData; // To be sure that they will have the same structure.
+for cnt = 1:NInputs
+ OutputData(cnt) = InputData(NInputs-cnt+1);
+end
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cisnum.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cisnum.sci
new file mode 100644
index 00000000..716d3771
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cisnum.sci
@@ -0,0 +1,19 @@
+function outbool = SCI2Cisnum(instring)
+// function outbool = SCI2Cisnum(instring)
+// -----------------------------------------------------------------
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+instring = convstr(instring,'l');
+outbool = isnum(instring);
+firstchar = part(instring,1:1);
+if (firstchar == 'd' | firstchar == 'e')
+ outbool = %F;
+end
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cmdelete.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cmdelete.sci
new file mode 100644
index 00000000..8ab14c29
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cmdelete.sci
@@ -0,0 +1,19 @@
+function SCI2Cmdelete(InFile)
+// function SCI2Cmdelete(InFile)
+// -----------------------------------------------------------------
+//
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+[Inx,Inierr]=fileinfo(InFile);
+if Inierr == 0
+ mdelete(InFile);//NUT: questa stampa a video il file che sta cancellando.
+end
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstring.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstring.sci
new file mode 100644
index 00000000..5d7b73a9
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstring.sci
@@ -0,0 +1,16 @@
+function outstring = SCI2Cstring(innum)
+// function outstring = SCI2Cstring(innum)
+// -----------------------------------------------------------------
+//
+// Status:
+// 07-May-2008 -- Nutricato Raffaele: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+outstring=strsubst(string(innum),'D','e');
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci
new file mode 100644
index 00000000..6ec5369e
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci
@@ -0,0 +1,16 @@
+function res = SCI2Cstrncmp(s1,s2,n)
+// function res = SCI2Cstrncmp(s1,s2,n)
+// -----------------------------------------------------------------
+//
+// Status:
+// 16-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),3,3);
+
+res = (part(s1,1:n) == part(s2,1:n));
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstrncmps1size.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstrncmps1size.sci
new file mode 100644
index 00000000..b27b15b8
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SCI2Cstrncmps1size.sci
@@ -0,0 +1,17 @@
+function res = SCI2Cstrncmps1size(s1,s2);
+// function res = SCI2Cstrncmps1size(s1,s2);
+// -----------------------------------------------------------------
+//
+// Status:
+// 16-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),2,2);
+
+n = length(s1);
+res = (part(s1,1:n) == part(s2,1:n));
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/SizeInByte.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/SizeInByte.sci
new file mode 100644
index 00000000..7ed8a512
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/SizeInByte.sci
@@ -0,0 +1,24 @@
+function SizeIn = SizeInByte(InDataType)
+// function SizeIn = SizeInByte(InDataType)
+// -----------------------------------------------------------------
+// Status:
+// 12-May-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+if (InDataType == 'float')
+ SizeIn = 4;
+elseif (InDataType == 'double')
+ SizeIn = 8;
+elseif (InDataType == 'floatComplex*')
+ SizeIn = 8;
+elseif (InDataType == 'doubleComplex*')
+ SizeIn = 16;
+else
+ error('Unknown data type: '+InDataType);
+end
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/dispina.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/dispina.sci
new file mode 100644
index 00000000..6ce3c489
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/dispina.sci
@@ -0,0 +1,31 @@
+function dispina(instring);
+// function dispina(instring);
+// -----------------------------------------------------------------
+// Quista sacciu sulu iou comu funziona e a ce me serve.
+//
+// Input data:
+//
+// Output data:
+//
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),1,1);
+
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp(instring);
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+disp('++++++++++++++++++++++++++++++++++++++++++++++++++')
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/filenamefprintf.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/filenamefprintf.sci
new file mode 100644
index 00000000..dc08068f
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/filenamefprintf.sci
@@ -0,0 +1,27 @@
+function filenamefprintf(filename,ennewline,str)
+// function filenamefprintf(filename,ennewline,str)
+// --------------------------------------------------------------------------------
+//
+// Status:
+// 31-Jan-2006 -- Nutricato Raffaele: Author.
+// 31-Jan-2006 -- Nutricato Raffaele: TEST OK.
+//
+// Copyright 2006 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),3,3);
+
+
+ [FidReportFile, mess] = mopen(filename,'a+');
+ if (FidReportFile == -1) then
+ SCI2Cerror(mess);
+ end
+ if ennewline=='y' then
+ mfprintf(FidReportFile,'%s\n',str);
+ else
+ mfprintf(FidReportFile,'%s',str);
+ end
+ mclose(FidReportFile);
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/float.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/float.sci
new file mode 100644
index 00000000..b7c13aa1
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/float.sci
@@ -0,0 +1,15 @@
+function y = float(x)
+// -----------------------------------------------------------------
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+
+y = x;
+
+endfunction
diff --git a/src/Scilab2C/Scilab2C/GeneralFunctions/squeezestrings.sci b/src/Scilab2C/Scilab2C/GeneralFunctions/squeezestrings.sci
new file mode 100644
index 00000000..641262b0
--- /dev/null
+++ b/src/Scilab2C/Scilab2C/GeneralFunctions/squeezestrings.sci
@@ -0,0 +1,19 @@
+function OutString = squeezestrings(InStringArray)
+// function OutString = squeezestrings(InStringArray)
+// -----------------------------------------------------------------
+//
+// Status:
+// 12-Apr-2007 -- Nutricato Raffaele: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+SCI2CNInArgCheck(argn(2),1,1);
+
+OutString = [];
+for counterstrings = 1:max(size(InStringArray))
+ OutString = OutString+InStringArray(counterstrings);
+end
+
+endfunction