From 9d4cbed90bf28487c52de84e7040ee78e60b4b5d Mon Sep 17 00:00:00 2001 From: nutricato Date: Wed, 4 Jun 2008 08:58:15 +0000 Subject: --- src/Scilab2C/ASTGenerator/%program_p.sci | 153 ------------- src/Scilab2C/ASTGenerator/GetASTFile.sci | 42 ---- src/Scilab2C/Annotations/GenAnnotationFile.sci | 66 ------ .../Annotations/GetFunAnnotationsAnnFile.sci | 96 -------- .../Annotations/GetVarAnnotationsSciFile.sci | 115 ---------- src/Scilab2C/Annotations/GetVarTypeAnnotation.sci | 23 -- .../Annotations/InitializeLibraryAnnotations.sci | 253 --------------------- src/Scilab2C/Annotations/Sci2AnnotationFile.sci | 73 ------ src/Scilab2C/FunAnnotationExample.sci | 9 - .../GeneralFunctions/FunName2SciFileName.sci | 45 ---- src/Scilab2C/GeneralFunctions/PrintStringInfo.sci | 56 ----- src/Scilab2C/GeneralFunctions/ReadStringCard.sci | 51 ----- src/Scilab2C/GeneralFunctions/SCI2CCreateDir.sci | 21 -- src/Scilab2C/GeneralFunctions/SCI2Cerror.sci | 11 - src/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci | 28 --- src/Scilab2C/GeneralFunctions/SCI2Cmdelete.sci | 21 -- src/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci | 19 -- .../GeneralFunctions/SCI2Cstrncmps1size.sci | 21 -- src/Scilab2C/GeneralFunctions/SciFile2ASTFile.sci | 29 --- src/Scilab2C/GeneralFunctions/SizeInByte.sci | 31 --- src/Scilab2C/GeneralFunctions/dispina.sci | 23 -- src/Scilab2C/GeneralFunctions/filenamefprintf.sci | 39 ---- src/Scilab2C/GeneralFunctions/squeezestrings.sci | 21 -- src/Scilab2C/SCI2CGeneral/Array2String.sci | 30 --- src/Scilab2C/SCI2CGeneral/InitializeSCI2C.sci | 106 --------- src/Scilab2C/SCI2CGeneral/PrintStepInfo.sci | 58 ----- src/Scilab2C/SCI2CGeneral/SCI2CInputParameters.sce | 14 -- src/Scilab2C/SCI2CGeneral/Scilab2CLoader.sce | 57 ----- src/Scilab2C/SCI2CGeneral/UpdateSCI2CInfo.sci | 86 ------- 29 files changed, 1597 deletions(-) delete mode 100644 src/Scilab2C/ASTGenerator/%program_p.sci delete mode 100644 src/Scilab2C/ASTGenerator/GetASTFile.sci delete mode 100644 src/Scilab2C/Annotations/GenAnnotationFile.sci delete mode 100644 src/Scilab2C/Annotations/GetFunAnnotationsAnnFile.sci delete mode 100644 src/Scilab2C/Annotations/GetVarAnnotationsSciFile.sci delete mode 100644 src/Scilab2C/Annotations/GetVarTypeAnnotation.sci delete mode 100644 src/Scilab2C/Annotations/InitializeLibraryAnnotations.sci delete mode 100644 src/Scilab2C/Annotations/Sci2AnnotationFile.sci delete mode 100644 src/Scilab2C/FunAnnotationExample.sci delete mode 100644 src/Scilab2C/GeneralFunctions/FunName2SciFileName.sci delete mode 100644 src/Scilab2C/GeneralFunctions/PrintStringInfo.sci delete mode 100644 src/Scilab2C/GeneralFunctions/ReadStringCard.sci delete mode 100644 src/Scilab2C/GeneralFunctions/SCI2CCreateDir.sci delete mode 100644 src/Scilab2C/GeneralFunctions/SCI2Cerror.sci delete mode 100644 src/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci delete mode 100644 src/Scilab2C/GeneralFunctions/SCI2Cmdelete.sci delete mode 100644 src/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci delete mode 100644 src/Scilab2C/GeneralFunctions/SCI2Cstrncmps1size.sci delete mode 100644 src/Scilab2C/GeneralFunctions/SciFile2ASTFile.sci delete mode 100644 src/Scilab2C/GeneralFunctions/SizeInByte.sci delete mode 100644 src/Scilab2C/GeneralFunctions/dispina.sci delete mode 100644 src/Scilab2C/GeneralFunctions/filenamefprintf.sci delete mode 100644 src/Scilab2C/GeneralFunctions/squeezestrings.sci delete mode 100644 src/Scilab2C/SCI2CGeneral/Array2String.sci delete mode 100644 src/Scilab2C/SCI2CGeneral/InitializeSCI2C.sci delete mode 100644 src/Scilab2C/SCI2CGeneral/PrintStepInfo.sci delete mode 100644 src/Scilab2C/SCI2CGeneral/SCI2CInputParameters.sce delete mode 100644 src/Scilab2C/SCI2CGeneral/Scilab2CLoader.sce delete mode 100644 src/Scilab2C/SCI2CGeneral/UpdateSCI2CInfo.sci diff --git a/src/Scilab2C/ASTGenerator/%program_p.sci b/src/Scilab2C/ASTGenerator/%program_p.sci deleted file mode 100644 index 93e43a7a..00000000 --- a/src/Scilab2C/ASTGenerator/%program_p.sci +++ /dev/null @@ -1,153 +0,0 @@ -function %program_p(p) - //overloading function for "program" type tlist display - mprintf("%s\n",string(p)) -endfunction - -function txt=%program_string(p) -//overloading function for "program" type tlist string function -//main (root) node of the Abstract Formal Tree -//fields: -// name : string (the function name) -// outputs : list of "variable" type tlist (the output arg names) -// inputs : list of "variable" type tlist (the intput arg names) -// statements: list of "equal" type tlist and list('EOL') (the -// instructions list) -// nblines : number (the number of lines in the scilab function) - txt=['Program' - 'Name : '+p.name - 'Outputs: '+strcat(objectlist2string(p.outputs),' ') - 'Inputs : '+strcat(objectlist2string(p.inputs),' ') - 'Statements ' - ' '+objectlist2string(p.statements) - 'EndProgram' - ] -endfunction - - -function txt=%equal_string(e) -//overloading function for "equal" type tlist string function -//this is a node of the AST - -//fields: -// expression: "expression" type tlist (the right hand side) -// lhs : list of "variable" type tlist and "operation" type tlist // (the assignment) -// endsymbol : string (the orginal end-of-instruction symbol (, ; )) - txt=['Equal' - ' Expression: ' - ' '+string(e.expression) - ' Lhs : ' - ' '+objectlist2string(e.lhs) - 'EndEqual' - ] -endfunction - - -function txt=%for_string(F) -//overloading function for "for" type tlist string function -//this is a node of the AST -//fields: -// expression : "expression" type tlist (the loop expression) -// statements : list of "equal" type tlist and list('EOL') (the -// for instructions list) - txt=['For' - ' Expression:' - ' '+string(F.expression) - ' Statements:' - ' '+objectlist2string(F.statements) - 'EndFor'] -endfunction - -function txt=%ifthenel_string(I) -//overloading function for "ifthenel" type tlist string function -//this is a node of the AST -//fields: -// expression : "expression" type tlist (the if expression) -// then : list of "equal" type tlist and list('EOL') (the -// then instructions list) -// elseifs : a list of tlists -// else : list of "equal" type tlist and list('EOL') (the -// else instructions list) - txt=['If ' - ' Expression:' - ' '+string(I.expression) - ' If Statements' - ' '+objectlist2string(I.then)] - for e=I.elseifs - txt=[txt; - " Else If Expression' - ' '+string(e.expression) - ' Else If Statements' - ' '+objectlist2string(e.then)] - end - txt=[txt; - " Else Statements' - ' '+objectlist2string(I.else) - 'EndIf'] -endfunction - -function txt=%operatio_string(O) -//overloading function for "operation" type tlist string function -//this is a node of the AST -//fields: -// operands: a list -// operator: a string - txt=['Operation' - ' Operands:' - ' '+objectlist2string(O.operands) - ' Operator: '+O.operator - 'EndOperation' - ] -endfunction - -function txt=%funcall_string(F) -//overloading function for "funcall" type tlist string function -//this is a node of the AST -//fields: -// rhs : a list -// name : string, the name of the function -// lhsnb: number, the number of function lhs - -txt=['Funcall : '+F.name - ' #lhs : '+string(F.lhsnb) - ' Rhs : ' - ' '+objectlist2string(F.rhs) - 'EndFuncall' - ] -endfunction - -function txt=%variable_string(v) -//overloading function for "variable" type tlist string function -//fields: name -//this is a leaf of the AST - txt=v.name -endfunction - -function txt=%cste_string(c) -//overloading function for "cste" type tlist string function -//this is a leaf of the AST -//fields: -// value : a number or a string - txt=string(c.value) -endfunction - -function txt=%comment_string(e) -//overloading function for "comment" type tlist string function -//fields: -// text: a string -//this is a leaf of the AST - txt=['Comment : '+e.text] -endfunction - -function txt=objectlist2string(L) -//auxiliary function for conversion of a list of objects -//into a string vector - txt=[]; - for o=L, - if type(o)==15 then //EOL case - txt=[txt;'<'+o(1)+'>'], - else - txt=[txt; string(o)], - end - end - if txt==[] then txt='',end -endfunction diff --git a/src/Scilab2C/ASTGenerator/GetASTFile.sci b/src/Scilab2C/ASTGenerator/GetASTFile.sci deleted file mode 100644 index 3c9b4f48..00000000 --- a/src/Scilab2C/ASTGenerator/GetASTFile.sci +++ /dev/null @@ -1,42 +0,0 @@ -function GetASTFile(FileInfoDatFile); -// function GetASTFile(FileInfoDatFile); -// ----------------------------------------------------------------- -// Generates the AST file starting from the .sci file specified -// in SharedInfo.Next(1).SCIFileName. -// -// Input data: -// FileInfoDatFile: name of the .dat file containing the FileInfo structure. -// SharedInfoDatFile: it is a buffer containing parameters that are exchanged by the -// functions of the SCI2C tool. -// -// Output data: -// -// Status: -// 11-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -// --------------------------------- -// --- 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; - -PrintStepInfo('Generate the AST in '+FileInfo.Funct(funnumber).ASTFileName,... - FileInfo.GeneralReport,'both'); - -// --- Generation of the AST file. --- -SciFile2ASTFile(FileInfo.Funct(funnumber).SCIFileName,... - FileInfo.Funct(funnumber).ASTFileName); - -// --- Save File Info Structure. --- -// save(FileInfoDatFile,FileInfo); - -endfunction diff --git a/src/Scilab2C/Annotations/GenAnnotationFile.sci b/src/Scilab2C/Annotations/GenAnnotationFile.sci deleted file mode 100644 index cba33f53..00000000 --- a/src/Scilab2C/Annotations/GenAnnotationFile.sci +++ /dev/null @@ -1,66 +0,0 @@ -function GenAnnotationFile(AnnStyle,FunName,OutDir) -// function GenAnnotationFile(AnnStyle,FunName,OutDir) -// ----------------------------------------------------------------- -// Generates the annotation for the function "FunName" according to -// the style specified by AnnStyle. -// The annotation file will be stored into the OutDir. -// Examples of annotation styles: -// AnnStyle = 'I1O1' -> input and output have the same size and type. -// AnnStyle = 'I2O1' -> inputs and output have the same size and type. -// -// Input data: -// -// Output data: -// -// Status: -// 17-Jun-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - - -// --------------------------- -// --- Open the .ann file. --- -// --------------------------- -annotationfilename = fullfile(OutDir,FunName+'.ann'); -[inannfid,inannerr] = mopen(annotationfilename,'w+'); -if (inannerr < 0) - SCI2Cerror(['Cannot open: '+annotationfilename]); -end - -// ------------------------------ -// --- Write annotation file. --- -// ------------------------------ -if (AnnStyle=='I1O1') - fprintf(inannfid,'//_SCI2C_NOUT: 1\n'); - fprintf(inannfid,'//_SCI2C_FUNSIZE: OutArg(1).Size = InArg(1).Size\n'); - fprintf(inannfid,'//_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type\n'); -elseif (AnnStyle=='I2O1') - fprintf(inannfid,'//_SCI2C_NOUT: 1\n'); - fprintf(inannfid,'//_SCI2C_FUNSIZE: OutArg(1).Size = InArg(1).Size\n'); - fprintf(inannfid,'//_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type\n'); -elseif (AnnStyle=='INON') - // Cosa si puo' fare per la equal che puo' avere anche N input e N output? - fprintf(inannfid,'//_SCI2C_NOUT: 1\n'); - fprintf(inannfid,'//_SCI2C_FUNSIZE: OutArg(1).Size = InArg(1).Size\n'); - fprintf(inannfid,'//_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type\n'); - - fprintf(inannfid,'//_SCI2C_NOUT: 2\n'); - fprintf(inannfid,'//_SCI2C_FUNSIZE: OutArg(1).Size = InArg(1).Size\n'); - fprintf(inannfid,'//_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type\n'); - fprintf(inannfid,'//_SCI2C_FUNSIZE: OutArg(2).Size = InArg(2).Size\n'); - fprintf(inannfid,'//_SCI2C_FUNTYPE: OutArg(2).Type = InArg(2).Type\n'); -elseif (AnnStyle=='DET') - // Cosa si puo' fare per la equal che puo' avere anche N input e N output? - fprintf(inannfid,'//_SCI2C_NOUT: 1\n'); - fprintf(inannfid,'//_SCI2C_FUNSIZE: OutArg(1).Size = [1,1]\n'); - fprintf(inannfid,'//_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type\n'); -elseif (AnnStyle=='TRANS') - // Cosa si puo' fare per la equal che puo' avere anche N input e N output? - fprintf(inannfid,'//_SCI2C_NOUT: 1\n'); - fprintf(inannfid,'//_SCI2C_FUNSIZE: OutArg(1).Size = InArg(1).Size.''\n'); - fprintf(inannfid,'//_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type\n'); -else - SCI2Cerror('Unknown Annotation style: '+AnnStyle); -end - -mclose(inannfid); -endfunction diff --git a/src/Scilab2C/Annotations/GetFunAnnotationsAnnFile.sci b/src/Scilab2C/Annotations/GetFunAnnotationsAnnFile.sci deleted file mode 100644 index d1981ff3..00000000 --- a/src/Scilab2C/Annotations/GetFunAnnotationsAnnFile.sci +++ /dev/null @@ -1,96 +0,0 @@ -function [FunTypeAnnot,FunSizeAnnot] = ... - GetFunAnnotationsAnnFile(SharedInfo_Annotations,NOut,AnnFileName,ReportFileName); -// function [FunTypeAnnot,FunSizeAnnot] = ... -// GetFunAnnotationsAnnFile(SharedInfo_Annotations,NOut,AnnFileName,ReportFileName); -// ----------------------------------------------------------------- -// This function extracts the FUN TYPE and SIZE annotations from the -// input .ann file. -// Example of annotation: -// //_SCI2C_NOUT: 1 -// //_SCI2C_FUNSIZE: OutArg(1).Size = InArg(1).Size -// //_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type -// No blank lines are allowed between function annotations. -// -// Input data: -// -// Output data: -// -// Status: -// 11-Jul-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -// ------------------------------ -// --- Check input arguments. --- -// ------------------------------ -if (argn(2) ~= 4) - SCI2Cerror('Incorrect number of input arguments.'); -end - -// --------------------------------------- -// --- Open the .sci file (read only). --- -// --------------------------------------- -[inscifid,inscierr] = mopen(AnnFileName,'r'); -if (inscierr < 0) - SCI2Cerror(['Cannot open: '+AnnFileName]) -end - -// ---------------------------------------------- -// --- Loop over the lines of the input file. --- -// ---------------------------------------------- -// Position file pointer to the desired NOUT section, -// and read the NOUT annotation. -FoundNout = 0; -line_position = 0; -while ((meof(inscifid) == 0) & (FoundNout == 0)) - check_string = stripblanks(mgetl(inscifid,1)); - line_position = line_position + 1; - if (~isempty(check_string)) - if (SCI2Cstrncmps1size(SharedInfo_Annotations.FUNNOUT,check_string)) - FunNOutAnnot = part(check_string,length(SharedInfo_Annotations.FUNNOUT)+1:length(check_string)); - if (eval(FunNOutAnnot) == NOut) - PrintStringInfo('Line '+string(line_position)+' - Function NOut Annotation: '+' ""'+check_string+' ""',... - ReportFileName,'file','y'); - FoundNout = 1; - end - end - end -end - -if (FoundNout == 0) - disp('Please check file: '+AnnFileName); - SCI2Cerror('Could not find ""'+SharedInfo_Annotations.FUNNOUT+' '+string(NOut)+'"" annotation.'); -else - for cntout = 1:NOut - // Read the Fun size annotation. - check_string = stripblanks(mgetl(inscifid,1)); - line_position = line_position + 1; - if (isempty(check_string) == %F) - if (SCI2Cstrncmps1size(SharedInfo_Annotations.FUNSIZE,check_string)) - PrintStringInfo('Line '+string(line_position)+' - Function Size Annotation: '+' ""'+check_string+' ""',... - ReportFileName,'file','y'); - FunSizeAnnot(cntout) = ... - stripblanks(part(check_string,length(SharedInfo_Annotations.FUNSIZE)+1:length(check_string))); - else - SCI2Cerror('Line '+string(line_position)+' Function type annotation (//_SCI2C_FUNSIZE:) not found in file: '+AnnFileName,... - ReportFileName,'file','y'); - end - // Read the Fun type annotation. - check_string = stripblanks(mgetl(inscifid,1)); - line_position = line_position + 1; - if (SCI2Cstrncmps1size(SharedInfo_Annotations.FUNTYPE,check_string)) - PrintStringInfo('Line '+string(line_position)+' - Function Type Annotation: '+' ""'+check_string+' ""',... - ReportFileName,'file','y'); - FunTypeAnnot(cntout) = ... - stripblanks(part(check_string,length(SharedInfo_Annotations.FUNTYPE)+1:length(check_string))); - else - SCI2Cerror('Line '+string(line_position)+' Function type annotation (//_SCI2C_FUNTYPE:) not found in file: '+AnnFileName,... - ReportFileName,'file','y'); - end - end - end -end -// -------------------------------------------------- -// --- End loop over the lines of the input file. --- -// -------------------------------------------------- -mclose(inscifid); -endfunction diff --git a/src/Scilab2C/Annotations/GetVarAnnotationsSciFile.sci b/src/Scilab2C/Annotations/GetVarAnnotationsSciFile.sci deleted file mode 100644 index 9fafce8b..00000000 --- a/src/Scilab2C/Annotations/GetVarAnnotationsSciFile.sci +++ /dev/null @@ -1,115 +0,0 @@ -function GetVarAnnotationsSciFile(FileInfoDatFile); -// function GetVarAnnotationsSciFile(FileInfoDatFile); -// -------------------------------------------------------------------------------- -// This function reads the .sci input file and returns all the variable annotations -// found in that file. -// -// Input data: -// FileInfoDatFile: name of the .dat file containing the FileInfo structure. -// SharedInfoDatFile: it is a buffer containing parameters that are exchanged by the -// functions of the SCI2C tool. -// -// Output data: -// -// Status: -// 21-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; - -// --- Load GlobalVars Structure. --- -load(FileInfo.GlobalVarFileName,'GlobalVars'); - -// --- Load LocalVars Structure. --- -load(FileInfo.Funct(funnumber).LocalVarFileName,'LocalVars'); -// ------------------------- -// --- End load section. --- -// ------------------------- - -SciFileName = FileInfo.Funct(funnumber).SCIFileName; - -PrintStepInfo('Get annotations from '+SciFileName,... - FileInfo.GeneralReport,'both'); - -// --------------------------------------- -// --- Open the .sci file (read only). --- -// --------------------------------------- -[inscifid,inscierr] = mopen(SciFileName,'r'); -if (inscierr < 0) - SCI2Cerror(['Cannot open: '+SciFileName]) -end - - -// --- Loop Initialization. --- -GlobalVarNames = []; - -// ---------------------------------------------- -// --- 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)) - PrintStringInfo('Line '+string(line_position)+' - Global Variables: '+' ""'+check_string+' ""',... - FileInfo.GeneralReport,'both','y'); - TmpGlobalAnn = stripblanks(tokens(check_string,' ')); - GlobalVarNames = [GlobalVarNames,TmpGlobalAnn(2:max(size(TmpGlobalAnn)))]; - clear TmpGlobalAnn - elseif (SCI2Cstrncmps1size(SharedInfo.Annotations.VARTYPE,check_string)) - // Assuming the following annotation: - // //_SCI2C_VARTYPE: name | type | size - // Ex.: - // //_SCI2C_VARTYPE: myvar | z | [10,4] - TmpVarAnn = GetVarTypeAnnotation(check_string); - PrintStringInfo('Line '+string(line_position)+' - VARTYPE annotation: '+' ""'+check_string+' ""',... - FileInfo.GeneralReport,'file','y'); - // Check if the variable is global or local - if length(find(GlobalVarNames==TmpVarAnn(2))) > 0 - //RN Qui manca un check per verificare se sto ridefinendo una global gia definita - GlobalVarsNum = size(GlobalVars,1) + 1; - GlobalVars(GlobalVarsNum).Name = TmpVarAnn(2); - GlobalVars(GlobalVarsNum).CName = TmpVarAnn(2); - GlobalVars(GlobalVarsNum).Type = TmpVarAnn(3); - GlobalVars(GlobalVarsNum).Size = eval(TmpVarAnn(4)); - else - //RN Qui manca un check per verificare se sto ridefinendo una local gia definita - LocalVarsNum = size(LocalVars,1) + 1; - LocalVars(LocalVarsNum).Name = TmpVarAnn(2); - LocalVars(LocalVarsNum).CName = TmpVarAnn(2); - LocalVars(LocalVarsNum).Type = TmpVarAnn(3); - LocalVars(LocalVarsNum).Size = eval(TmpVarAnn(4)); - end - clear TmpVarAnn - end - end -end -// -------------------------------------------------- -// --- End loop over the lines of the input file. --- -// -------------------------------------------------- - -mclose(inscifid); - -// --------------------- -// --- Save section. --- -// --------------------- -// --- Save File Info Structure. --- -save(FileInfoDatFile,FileInfo); - -// Save Global and Local variables info into .dat files. -save(FileInfo.GlobalVarFileName,GlobalVars); -save(FileInfo.Funct(funnumber).LocalVarFileName,LocalVars); - -endfunction diff --git a/src/Scilab2C/Annotations/GetVarTypeAnnotation.sci b/src/Scilab2C/Annotations/GetVarTypeAnnotation.sci deleted file mode 100644 index b362fdfd..00000000 --- a/src/Scilab2C/Annotations/GetVarTypeAnnotation.sci +++ /dev/null @@ -1,23 +0,0 @@ - -function VarTypeAnnotation = GetVarTypeAnnotation(InputString); -// function VarTypeAnnotation = GetVarTypeAnnotation(InputString); -// -------------------------------------------------------------------------------- -// This function extracts the VAR TYPE annotation from the input string. -// -// Input data: -// -// Output data: -// -// Status: -// 11-Jul-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -tmp1 = stripblanks(tokens(InputString,'|')); -tmp2 = stripblanks(tokens(tmp1(1),' ')); -tmp1(1) = []; -VarTypeAnnotation = [tmp2; tmp1]; - -if ((max(size(VarTypeAnnotation))) ~= 4) - SCI2Cerror('Incorrect VARTYPE ANNOTATION in string ""'+InputString+'"".'); -end -endfunction diff --git a/src/Scilab2C/Annotations/InitializeLibraryAnnotations.sci b/src/Scilab2C/Annotations/InitializeLibraryAnnotations.sci deleted file mode 100644 index 742bf5e0..00000000 --- a/src/Scilab2C/Annotations/InitializeLibraryAnnotations.sci +++ /dev/null @@ -1,253 +0,0 @@ -function InitializeLibraryAnnotations(FileInfoDatFile) -// function InitializeLibraryAnnotations(FileInfoDatFile) -// ----------------------------------------------------------------- -// This function initializes the SCI2C and USER library annotation -// files. -// For each Scilab function a .ann file is created where the function -// annotations are listed into it. -// -// Input data: -// FileInfoDatFile: name of the .dat file containing the FileInfo structure. -// -// Output data: -// -// Status: -// 12-Jun-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -// --------------------- -// --- Load section. --- -// --------------------- -// --- Load File Info Structure. --- -load(FileInfoDatFile,'FileInfo'); - -// --- Load Shared Info Structure. --- -load(FileInfo.SharedInfoDatFile,'SharedInfo'); -// ------------------------- -// --- End load section. --- -// ------------------------- - - -PrintStepInfo('Initialize Library Annotation Files.',... - FileInfo.GeneralReport,'both'); - -OutDir = FileInfo.SCI2CLibAnnDirName; -SCI2CCreateDir(OutDir); - -// ------------------------------------------------------ -// --- Add elementary functions to the SCI2C library. --- -// ------------------------------------------------------ -PrintStringInfo('Adding elementary functions to the SCI2C library.',... - FileInfo.GeneralReport,'both','y'); - -//RN non so comet trattare la equal -AnnStyle = 'INON'; - -//RN equal funziona come le sin ma occorre fare diversi controlli per capire se l'output -//e' compatibile con l'input. Per ora la lascio cosi'. -NewFunctionName = 'Equal'; -PrintStringInfo(' Adding function ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - - // ---------------------- - // --- Style: 'I1O1'. --- - // ---------------------- -AnnStyle = 'I1O1'; - -NewFunctionName = 'sin'; -PrintStringInfo(' Adding function ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - -NewFunctionName = 'cos'; -PrintStringInfo(' Adding function ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - -// SCI2CLib = AddElementaryFunction("tan",SCI2CLib); -// SCI2CLib = AddElementaryFunction("cotg",SCI2CLib); -// SCI2CLib = AddElementaryFunction("asin",SCI2CLib); -// SCI2CLib = AddElementaryFunction("acos",SCI2CLib); -// SCI2CLib = AddElementaryFunction("sinh",SCI2CLib); -// SCI2CLib = AddElementaryFunction("cosh",SCI2CLib); -// SCI2CLib = AddElementaryFunction("tanh",SCI2CLib); -// SCI2CLib = AddElementaryFunction("asinh",SCI2CLib); -// SCI2CLib = AddElementaryFunction("acosh",SCI2CLib); -// SCI2CLib = AddElementaryFunction("atanh",SCI2CLib); -// SCI2CLib = AddElementaryFunction("exp",SCI2CLib); -// SCI2CLib = AddElementaryFunction("log",SCI2CLib); -// SCI2CLib = AddElementaryFunction("log10",SCI2CLib); -// SCI2CLib = AddElementaryFunction("abs",SCI2CLib); -// SCI2CLib = AddElementaryFunction("inv",SCI2CLib); -// SCI2CLib = AddElementaryFunction("sqrtR",SCI2CLib); - - // ---------------------- - // --- Style: 'DET'. --- - // ---------------------- -AnnStyle = 'DET'; - -NewFunctionName = 'det'; -PrintStringInfo(' Adding function ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - -// ---------------------------------------------------------- -// --- End add elementary functions to the SCI2C library. --- -// ---------------------------------------------------------- - - -// ---------------------------------------------------- -// --- Add operator functions to the SCI2C library. --- -// ---------------------------------------------------- -PrintStringInfo('Adding operator functions to the SCI2C library.',... - FileInfo.GeneralReport,'both','y'); - - // ---------------------- - // --- Style: 'I2O1'. --- - // ---------------------- -AnnStyle = 'I2O1'; - -NewFunctionName = 'OpPlus'; -PrintStringInfo(' Adding operator ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - -NewFunctionName = 'OpMinus'; -PrintStringInfo(' Adding operator ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - -NewFunctionName = 'OpMul'; -PrintStringInfo(' Adding operator ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - -NewFunctionName = 'OpDiv'; -PrintStringInfo(' Adding operator ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - - // ----------------------- - // --- Style: 'TRANS'. --- - // ----------------------- -AnnStyle = 'TRANS'; - -NewFunctionName = 'OpTrans'; -PrintStringInfo(' Adding operator ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - -NewFunctionName = 'OpTransConj'; -PrintStringInfo(' Adding operator ""'+NewFunctionName+'"".',FileInfo.GeneralReport,'both','y'); -GenAnnotationFile(AnnStyle,NewFunctionName,OutDir); - -// -------------------------------------------------------- -// --- End add operator functions to the SCI2C library. --- -// -------------------------------------------------------- - - - -if (1==2) -// determinant function - - - [FuncStruct, CINFO, NumFunc] = AddLeafDet("det"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - -// sqrt function - - - [FuncStruct, CINFO, NumFunc] = AddLeafSqrt("sqrt"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - -// I add the function with 2 Input - -// dot function - - - [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotAdd"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - - [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotSub"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - - [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotMul"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - - [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotDiv"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - -// op function - - [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpAdd"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - - [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpSub"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - - [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpMul"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - - [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpDiv"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - -// atan function - - - [FuncStruct, CINFO, NumFunc] = AddLeafAtan("atan"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - -// convol function - - - [FuncStruct, CINFO, NumFunc] = AddLeafConvol("convol"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - -// fft function - - - [FuncStruct, CINFO, NumFunc] = AddLeafFFT("fft"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end - -// ifft function - - - [FuncStruct, CINFO, NumFunc] = AddLeafIFFT("ifft"); - - for ind = 1 : NumFunc, - SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) ); - end -end // end if (1==2) - -endfunction diff --git a/src/Scilab2C/Annotations/Sci2AnnotationFile.sci b/src/Scilab2C/Annotations/Sci2AnnotationFile.sci deleted file mode 100644 index a7046543..00000000 --- a/src/Scilab2C/Annotations/Sci2AnnotationFile.sci +++ /dev/null @@ -1,73 +0,0 @@ -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 diff --git a/src/Scilab2C/FunAnnotationExample.sci b/src/Scilab2C/FunAnnotationExample.sci deleted file mode 100644 index 6c950650..00000000 --- a/src/Scilab2C/FunAnnotationExample.sci +++ /dev/null @@ -1,9 +0,0 @@ -//_SCI2C_NOUT: 1 -//_SCI2C_FUNSIZE: OutArg(1).Size = InArg(1).Size*3 -//_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type - -//_SCI2C_NOUT: 2 -//_SCI2C_FUNSIZE: OutArg(1).Size = InArg(1).Size*2 -//_SCI2C_FUNTYPE: OutArg(1).Type = InArg(1).Type -//_SCI2C_FUNSIZE: OutArg(2).Size = InArg(1).Size+InArg(2).Size -//_SCI2C_FUNTYPE: OutArg(2).Type = InArg(2).Type diff --git a/src/Scilab2C/GeneralFunctions/FunName2SciFileName.sci b/src/Scilab2C/GeneralFunctions/FunName2SciFileName.sci deleted file mode 100644 index c2f6db34..00000000 --- a/src/Scilab2C/GeneralFunctions/FunName2SciFileName.sci +++ /dev/null @@ -1,45 +0,0 @@ -function ScilabFileName = FunName2SciFileName(DirList,InFunName); -// function ScilabFileName = FunName2SciFileName(DirList,InFunName); -// ----------------------------------------------------------------- -// 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. -// -// Input data: -// -// -// Output data: -// -// Status: -// 16-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -if (prod(size(DirList)) == 0) - SCI2Cerror('Incorrect DirList parameter.'); -end - -if (prod(size(InFunName)) == 0) - SCI2Cerror('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); - 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/GeneralFunctions/PrintStringInfo.sci b/src/Scilab2C/GeneralFunctions/PrintStringInfo.sci deleted file mode 100644 index 36377bdc..00000000 --- a/src/Scilab2C/GeneralFunctions/PrintStringInfo.sci +++ /dev/null @@ -1,56 +0,0 @@ -function PrintStringInfo(str, filename, outputtype, ennewline); -// function PrintStringInfo(str,filename,outputtype,ennewline); -// ----------------------------------------------------------------- -// Prints a string into a file or on the stdout or on both. -// -// Input data: -// filename: optional parameter, that specifies the output file. -// If filename is '' or it is not provided to the function, -// the string will be printed on the stdout. -// outputtype: 'file' -> prints only on file. -// 'stdout' -> prints only on the stdout. -// 'both' -> prints on both file and stdout. -// Default is 'stdout'. -// ennewline: optional (default = 'y'); If y adds a newline character -// at the end of the input string. -// Output data: -// -// Status: -// 02-Jan-2006 -- Nutricato Raffaele: Author. -// 02-Jan-2006 -- Nutricato Raffaele: TEST OK. -// 02-May-2006 -- Nutricato Raffaele: Added ennewline. -// ----------------------------------------------------------------- - - 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 - else if argn(2) > 4 - SCI2CSCI2Cerror('Incorrect number of input arguments.'); - 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/GeneralFunctions/ReadStringCard.sci b/src/Scilab2C/GeneralFunctions/ReadStringCard.sci deleted file mode 100644 index a6abfcb7..00000000 --- a/src/Scilab2C/GeneralFunctions/ReadStringCard.sci +++ /dev/null @@ -1,51 +0,0 @@ -function cardvalue = ReadStringCard(filename,cardname,commentdelim,enableerror); -// function cardvalue = ReadStringCard(filename,cardname,commentdelim,enableerror); -// ----------------------------------------------------------------- -// Reads the string associated to the card cardname placed -// in filename. -// The value of cardname is assumed to be a string. -// If the card is not found an error will occur. -// -// Input data: -// filename: full path + name of the file where the card -// is being searched. -// cardname: string with the name of the card. -// commentdelim: specifies a character for an eventual comment -// (to be discarded) after the card value. -// enableerror: 'y' enable error message. -// 'n' enable warning message. -// -// Output data: -// cardvalue: string associated to the card. Blanks characters -// are discarded. -// -// 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. -// ----------------------------------------------------------------- - -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/GeneralFunctions/SCI2CCreateDir.sci b/src/Scilab2C/GeneralFunctions/SCI2CCreateDir.sci deleted file mode 100644 index 606c662a..00000000 --- a/src/Scilab2C/GeneralFunctions/SCI2CCreateDir.sci +++ /dev/null @@ -1,21 +0,0 @@ -function SCI2CCreateDir(OutDir); -// function SCI2CCreateDir(OutDir); -// ----------------------------------------------------------------- -// Create the dir OutDir. -// -// Input data: -// OutDir: -// -// Output data: -// --- -// -// Status: -// 25-Jun-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -status_dir = mkdir(OutDir) ; -if (status_dir == 0) - SCI2Cerror('Cannot create: '+OutDir); -end - -endfunction diff --git a/src/Scilab2C/GeneralFunctions/SCI2Cerror.sci b/src/Scilab2C/GeneralFunctions/SCI2Cerror.sci deleted file mode 100644 index 444dcff5..00000000 --- a/src/Scilab2C/GeneralFunctions/SCI2Cerror.sci +++ /dev/null @@ -1,11 +0,0 @@ -function SCI2Cerror(errorstring); -// function SCI2Cerror(errorstring); -// ----------------------------------------------------------------- -// It is the error function but before issuing the error, perorms -// the mclose('all'); -// 02-May-2006 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -mclose('all') -error('###########SCI2C_ERROR: '+errorstring); -endfunction diff --git a/src/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci b/src/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci deleted file mode 100644 index 87cc1777..00000000 --- a/src/Scilab2C/GeneralFunctions/SCI2Cfileexist.sci +++ /dev/null @@ -1,28 +0,0 @@ -function ExistTest = SCI2Cfileexist(InDir,FileName) -// function ExistTest = SCI2Cfileexist(InDir,FileName) -// ----------------------------------------------------------------- -// Searches for the file FileName in the directory InDir. -// Return %F if it doesn't exist. -// -// Input data: -// -// Output data: -// -// Status: -// 12-Jun-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -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/GeneralFunctions/SCI2Cmdelete.sci b/src/Scilab2C/GeneralFunctions/SCI2Cmdelete.sci deleted file mode 100644 index 772cff98..00000000 --- a/src/Scilab2C/GeneralFunctions/SCI2Cmdelete.sci +++ /dev/null @@ -1,21 +0,0 @@ -function SCI2Cmdelete(InFile); -// function SCI2Cmdelete(InFile); -// ----------------------------------------------------------------- -// Deletes the input files only if the file really exists. -// This avoids the issuing of the error generated by mdelete. -// -// Input data: -// InFile: full path of the file to be deleted. -// -// Output data: -// -// Status: -// 12-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -[Inx,Inierr]=fileinfo(InFile) -if Inierr == 0 - mdelete(InFile); -end - -endfunction diff --git a/src/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci b/src/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci deleted file mode 100644 index 81bc2f5b..00000000 --- a/src/Scilab2C/GeneralFunctions/SCI2Cstrncmp.sci +++ /dev/null @@ -1,19 +0,0 @@ -function res = SCI2Cstrncmp(s1,s2,n); -// function res = SCI2Cstrncmp(s1,s2,n); -// ----------------------------------------------------------------- -// This function compares first n characters of strings s1 and s2. -// SCI2Cstrncmp(s1,s2,n) returns logical T (true) if the first n characters of -// the strings s1 and s2 are the same and logical 0 (false) otherwise. -// -// Input data: -// -// -// Output data: -// -// Status: -// 16-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -res = (part(s1,1:n) == part(s2,1:n)); - -endfunction diff --git a/src/Scilab2C/GeneralFunctions/SCI2Cstrncmps1size.sci b/src/Scilab2C/GeneralFunctions/SCI2Cstrncmps1size.sci deleted file mode 100644 index d560b850..00000000 --- a/src/Scilab2C/GeneralFunctions/SCI2Cstrncmps1size.sci +++ /dev/null @@ -1,21 +0,0 @@ -function res = SCI2Cstrncmps1size(s1,s2); -// function res = SCI2Cstrncmps1size(s1,s2); -// ----------------------------------------------------------------- -// This function compares first n characters of strings s1 and s2. -// n is the size of the string s1. -// SCI2Cstrncmps1size returns logical T (true) if the first n characters of -// the strings s1 and s2 are the same and logical 0 (false) otherwise. -// -// Input data: -// -// -// Output data: -// -// Status: -// 16-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -n = length(s1); -res = (part(s1,1:n) == part(s2,1:n)); - -endfunction diff --git a/src/Scilab2C/GeneralFunctions/SciFile2ASTFile.sci b/src/Scilab2C/GeneralFunctions/SciFile2ASTFile.sci deleted file mode 100644 index 8930564d..00000000 --- a/src/Scilab2C/GeneralFunctions/SciFile2ASTFile.sci +++ /dev/null @@ -1,29 +0,0 @@ -function SciFile2ASTFile(SciFile,ASTFile); -// function SciFile2ASTFile(SciFile,ASTFile); -// ----------------------------------------------------------------- -// This function makes use of the macr2tree function to generate -// the ASTFile containing the AST (Abstract Syntactic Tree) of the -// input Scilab function (SciFile). -// -// Input data: -// SciFile: full path of the input function. -// ASTFile: full path of the file that will store the AST. -// -// Output data: -// -// Status: -// 12-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -getf(SciFile); -[tmppath,ScilabFunName,tmpext] = fileparts(SciFile); -AST=eval('macr2tree('+ScilabFunName+')'); - - -[ASTx,ASTierr]=fileinfo(ASTFile) -if ASTierr == 0 - mdelete(ASTFile); -end -write(ASTFile,string(AST)); - -endfunction diff --git a/src/Scilab2C/GeneralFunctions/SizeInByte.sci b/src/Scilab2C/GeneralFunctions/SizeInByte.sci deleted file mode 100644 index 5fcf4e08..00000000 --- a/src/Scilab2C/GeneralFunctions/SizeInByte.sci +++ /dev/null @@ -1,31 +0,0 @@ -function SizeIn = SizeInByte(InDataType); -// function SizeIn = SizeInByte(InDataType); -// ----------------------------------------------------------------- -// Returns the size in bytes of the input data type. -// -// Input data: -// InDataType: input data type. It can be: -// 'float' -// 'double' -// 'floatComplex*' -// 'doubleComplex*' -// -// Output data: -// SizeIn: size in bytes of the input data type. -// -// Status: -// 12-May-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -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/GeneralFunctions/dispina.sci b/src/Scilab2C/GeneralFunctions/dispina.sci deleted file mode 100644 index a1d85a68..00000000 --- a/src/Scilab2C/GeneralFunctions/dispina.sci +++ /dev/null @@ -1,23 +0,0 @@ -function dispina(instring); -// function dispina(instring); -// ----------------------------------------------------------------- -// Quista sacciu sulu iou comu funziona e a ce me server. -// -// Input data: -// -// Output data: -// -// Status: -// 12-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -disp('++++++++++++++++++++++++++++++++++++++++++++++++++') -disp('++++++++++++++++++++++++++++++++++++++++++++++++++') -disp('++++++++++++++++++++++++++++++++++++++++++++++++++') -disp('++++++++++++++++++++++++++++++++++++++++++++++++++') -disp(instring); -disp('++++++++++++++++++++++++++++++++++++++++++++++++++') -disp('++++++++++++++++++++++++++++++++++++++++++++++++++') -disp('++++++++++++++++++++++++++++++++++++++++++++++++++') -disp('++++++++++++++++++++++++++++++++++++++++++++++++++') -endfunction diff --git a/src/Scilab2C/GeneralFunctions/filenamefprintf.sci b/src/Scilab2C/GeneralFunctions/filenamefprintf.sci deleted file mode 100644 index 98a0cba2..00000000 --- a/src/Scilab2C/GeneralFunctions/filenamefprintf.sci +++ /dev/null @@ -1,39 +0,0 @@ -function filenamefprintf(filename,ennewline,str) -// function filenamefprintf(filename,ennewline,str) -// -------------------------------------------------------------------------------- -// Uses the printf to print the string specified by varargin. filenamefprintf -// uses the filename instead of the fid parameter used by fprintf. -// Everytime filenamefprintf is called it -// opens the file, prints the string in it and then closes it. -// Opening is performed in read/append mode (at+). -// -// Input data: -// filename: string that specifies the name of the file. -// varargin are the input arguments for the printf. -// -// Output data: -// -// Status: -// 31-Jan-2006 -- Nutricato Raffaele: Author. -// 31-Jan-2006 -- Nutricato Raffaele: TEST OK. -// -------------------------------------------------------------------------------- - - - if argn(2) < 3 then - SCI2Cerror('Incorrect number of input arguments.'); - end - -// [FidReportFile, mess] = mopen(deblank(filename),'at+'); - [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/GeneralFunctions/squeezestrings.sci b/src/Scilab2C/GeneralFunctions/squeezestrings.sci deleted file mode 100644 index 97e8f9a1..00000000 --- a/src/Scilab2C/GeneralFunctions/squeezestrings.sci +++ /dev/null @@ -1,21 +0,0 @@ -function OutString = squeezestrings(InStringArray); -// function OutString = squeezestrings(InStringArray); -// ----------------------------------------------------------------- -// Converts an array of strings into a single string. -// -// Input data: -// InStringArray: Array of strings. -// -// Output data: -// OutString: Output string. -// -// Status: -// 12-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -OutString = []; -for counterstrings = 1:max(size(InStringArray)) - OutString = OutString+InStringArray(counterstrings); -end - -endfunction diff --git a/src/Scilab2C/SCI2CGeneral/Array2String.sci b/src/Scilab2C/SCI2CGeneral/Array2String.sci deleted file mode 100644 index 1fd15f66..00000000 --- a/src/Scilab2C/SCI2CGeneral/Array2String.sci +++ /dev/null @@ -1,30 +0,0 @@ -function [StringArray] = Array2String(InArray); -// function [StringArray] = Array2String(InArray); -// ----------------------------------------------------------------- -// Converts an input array into a string. Maximum 2D array are allowed. -// Ex.: InArray = [10, 4]; -// StringArray = "[10, 4]"; -// -// Input data: -// InArray: Input array. -// -// Output data: -// StringArray: array converted into a string. -// -// Status: -// 13-May-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -[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/SCI2CGeneral/InitializeSCI2C.sci b/src/Scilab2C/SCI2CGeneral/InitializeSCI2C.sci deleted file mode 100644 index db3a459c..00000000 --- a/src/Scilab2C/SCI2CGeneral/InitializeSCI2C.sci +++ /dev/null @@ -1,106 +0,0 @@ -function [FileInfoDatFile,SharedInfoDatFile] = InitializeSCI2C(SCI2CInputPrmFile); -// function [FileInfoDatFile,SharedInfoDatFile] = InitializeSCI2C(SCI2CInputPrmFile); -// ----------------------------------------------------------------- -// This function initializes the SCI2C tool according -// to the input parameters recorded in the SCI2CParameters. -// All info will be stored into FileInfoDatFile. -// -// Input data: -// SCI2CInputPrmFile: name of the .sce file containing input parameters. -// -// Output data: -// FileInfoDatFile: name of the .dat file containing the FileInfo structure. -// SharedInfoDatFile: it is a buffer containing parameters that are exchanged by the -// functions of the SCI2C tool. -// Status: -// 13-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -// --- Read Input Parameters. --- -exec(SCI2CInputPrmFile); - -FileInfoDatFile = fullfile(ResultDir,'FileInfo.dat'); -SharedInfoDatFile = fullfile(ResultDir,'SharedInfo.dat'); - -// ---------------------------- -// --- Initialize FileInfo. --- -// ---------------------------- -FileInfo.FileInfoDatFile = FileInfoDatFile; -FileInfo.SharedInfoDatFile = SharedInfoDatFile; -FileInfo.ResultDir = ResultDir; -FileInfo.SCI2CLibAnnDirName = fullfile(FileInfo.ResultDir,'SCI2CLibAnnotations'); -FileInfo.USER2CLibAnnDirName = fullfile(FileInfo.ResultDir,'USER2CLibAnnotations'); -FileInfo.SCI2CLibTreeFileName = fullfile(FileInfo.ResultDir,'SCI2CLibTree.dat'); -FileInfo.USER2CLibTreeFileName = fullfile(FileInfo.ResultDir,'USER2CLibTree.dat'); -FileInfo.GeneralReport = fullfile(FileInfo.ResultDir,'SCI2CGeneralReport.txt'); -FileInfo.GlobalVarFileName = fullfile(FileInfo.ResultDir,'GBLVAR.dat'); -FileInfo.UserSciFilesPaths = UserSciFilesPaths; - -// ------------------------------ -// --- Initialize SharedInfo. --- -// ------------------------------ -// File names of the next .sci files to be converted in AST and -// successively into C. -SharedInfo.Next(1).SCIFileName = ScilabMainFile; -[scipath,funname,sciext] = fileparts(ScilabMainFile); -SharedInfo.Next(1).SCIFunName = funname; //RN per ora no so cosa metter -SharedInfo.Next(1).CFunName = funname; //RN per ora no so cosa metter -SharedInfo.Next(1).InArg = 1; //RN per ora non so che mettere. -SharedInfo.Next(1).OutArg = 1; //RN per ora non so che mettere. -SharedInfo.NextSCIFunNumber = 1; - -SharedInfo.Annotations.GBLVAR = 'global'; -SharedInfo.Annotations.VARTYPE = '//_SCI2C_VARTYPE:'; -SharedInfo.Annotations.FUNNOUT = '//_SCI2C_NOUT:'; -SharedInfo.Annotations.FUNSIZE = '//_SCI2C_FUNSIZE:'; -SharedInfo.Annotations.FUNTYPE = '//_SCI2C_FUNTYPE:'; // Type includes also precision. - -// Info related to temp variables used in the C code. -SharedInfo.WorkAreaSizeBytes = WorkAreaSizeBytes; -SharedInfo.WorkAreaUsedBytes = 0; -SharedInfo.WorkAreaName = '__WorkAreaPtr'; -SharedInfo.TotTempScalarVars = TotTempScalarVars; -SharedInfo.UsedTempScalarVars = 0; -SharedInfo.TempScalarVarsName = '__Scalar'; -// Info related to temp variables used in the AST reading phase. -SharedInfo.ASTReader.UsedTempVars = 0; -SharedInfo.ASTReader.TempVarsName = '__temp'; -SharedInfo.ASTReader.ReusableTempVars = [];//RN to be removed - -// ------------------------------ -// --- Initialize GlobalVars. --- -// ------------------------------ -GlobalVars = []; - -// ---------------------------------------------------- -// --- Remove previous versions of SCI2C files/dir. --- -// ---------------------------------------------------- -//SCI2Cmdelete(FileInfo.FileInfoDatFile); -//SCI2Cmdelete(FileInfo.SharedInfoDatFile); -//SCI2Cmdelete(FileInfo.SCI2CLibTreeFileName); -//SCI2Cmdelete(FileInfo.USER2CLibTreeFileName); -//SCI2Cmdelete(FileInfo.GeneralReport); -//SCI2Cmdelete(FileInfo.GlobalVarFileName); -disp('Removing directory: '+FileInfo.ResultDir); -yesno=input('Are you sure [y/n]?','string'); -if (yesno=='y') - rmdir(FileInfo.ResultDir,'s'); -else - SCI2Cerror('Cannot continue, because you don''t want to delete: '+FileInfo.ResultDir); -end - -// --------------------------- -// --- Create Directories. --- -// --------------------------- -SCI2CCreateDir(FileInfo.ResultDir); -SCI2CCreateDir(FileInfo.SCI2CLibAnnDirName); -SCI2CCreateDir(FileInfo.USER2CLibAnnDirName); - -// --------------------------------------------- -// --- Generate new versions of SCI2C files. --- -// --------------------------------------------- -save(FileInfo.FileInfoDatFile,FileInfo); -save(FileInfo.SharedInfoDatFile,SharedInfo); -save(FileInfo.GlobalVarFileName,GlobalVars); - -endfunction diff --git a/src/Scilab2C/SCI2CGeneral/PrintStepInfo.sci b/src/Scilab2C/SCI2CGeneral/PrintStepInfo.sci deleted file mode 100644 index 66d0653e..00000000 --- a/src/Scilab2C/SCI2CGeneral/PrintStepInfo.sci +++ /dev/null @@ -1,58 +0,0 @@ -function PrintStepInfo(inputstring,filename,outputtype); -// function PrintStepInfo(inputstring,filename,outputtype); -// ----------------------------------------------------------------- -// Prints a string by using a predefined format into a file or on -// the stdout. -// -// Input data: -// filename: optional parameter, that specifies the output file. -// If filename is '' or it is not provided to the function, -// the string will be printed on the stdout. -// outputtype: 'file' -> prints only on file. -// 'stdout' -> prints only on the stdout. -// 'both' -> prints on both file and stdoud. -// Default is 'stdout'. -// Output data: -// -// Status: -// 02-Jan-2006 -- Nutricato Raffaele: Author. -// 02-Jan-2006 -- Nutricato Raffaele: TEST OK. -// ----------------------------------------------------------------- - -if argn(2) < 3 - bothout = 'n'; - if argn(2) < 2 - filename = ''; - else - SCI2Cerror('Incorrect number of input arguments.'); - 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/SCI2CGeneral/SCI2CInputParameters.sce b/src/Scilab2C/SCI2CGeneral/SCI2CInputParameters.sce deleted file mode 100644 index b8771326..00000000 --- a/src/Scilab2C/SCI2CGeneral/SCI2CInputParameters.sce +++ /dev/null @@ -1,14 +0,0 @@ -// This script contains all the input parameters needed by the SCI2C tool. -ScilabMainFile = 'C:\Nutricato\Projects\FP6_hArtes\Software\SVNScilab2C\src\Scilab2C\Tests\foo.sci'; // Input Parameter. - -// Directory where all the products of SCI2C tool will be written. -ResultDir = 'Results'; - -// Memory allocation. -WorkAreaSizeBytes = 2000*8; // 2000 locations of double -TotTempScalarVars = 20; // maximum number of temporary scalar variables that can be used. - -// Paths that contain the .sci files written by the user. -UserSciFilesPaths = ... - ['C:\Nutricato\Projects\FP6_hArtes\Software\SVNScilab2C\src\Scilab2C\Tests';... - 'C:\Nutricato\Projects\FP6_hArtes\Software\SVNScilab2C\src\Scilab2C\']; diff --git a/src/Scilab2C/SCI2CGeneral/Scilab2CLoader.sce b/src/Scilab2C/SCI2CGeneral/Scilab2CLoader.sce deleted file mode 100644 index 92fdb20a..00000000 --- a/src/Scilab2C/SCI2CGeneral/Scilab2CLoader.sce +++ /dev/null @@ -1,57 +0,0 @@ -exec full_reset.sce -mode(-1); -clc - -// ------------------------- -// --- Input Parameters. --- -// ------------------------- -// root directory. -maindir = 'C:\Nutricato\Projects\FP6_hArtes\Software\SVNScilab2C\src\Scilab2C'; -// ----------------------------- -// --- End Input Parameters. --- -// ----------------------------- - -// ------------- -// --- exec. --- -// ------------- -exec(fullfile(maindir,'ASTGenerator','%program_p.sci')); -// ----------------- -// --- End exec. --- -// ----------------- - -// --------------------------- -// --- Define Directories. --- -// --------------------------- -// Directory containing functions that perform general tasks. -GeneralFunctions = 'GeneralFunctions'; - -// Directory containing functions that perform general tasks for the SCI2C tool. -SCI2CGeneral = 'SCI2CGeneral'; - -// Directory containing functions that perform the C code generation for the SCI2C tool. -Translation = 'Translation'; - -// Directory containing functions related to the generation of the Abstract Syntactic tree. -ASTGenerator = 'ASTGenerator' - -// Directory containing functions to read/generate SCI2C annotations. -Annotations = 'Annotations'; - -// Directory containing functions to read the AST and to generate the corresponding C code. -AST_reader = 'ASTReader'; -// ------------------------------- -// --- End Define Directories. --- -// ------------------------------- - -// ------------- -// --- getd. --- -// ------------- -getd(fullfile(maindir,GeneralFunctions)); -getd(fullfile(maindir,SCI2CGeneral)); -getd(fullfile(maindir,Translation)); -getd(fullfile(maindir,ASTGenerator)); -getd(fullfile(maindir,Annotations)); -getd(fullfile(maindir,AST_reader)); -// ----------------- -// --- End getd. --- -// ----------------- diff --git a/src/Scilab2C/SCI2CGeneral/UpdateSCI2CInfo.sci b/src/Scilab2C/SCI2CGeneral/UpdateSCI2CInfo.sci deleted file mode 100644 index d697907c..00000000 --- a/src/Scilab2C/SCI2CGeneral/UpdateSCI2CInfo.sci +++ /dev/null @@ -1,86 +0,0 @@ -function UpdateSCI2CInfo(FileInfoDatFile); -// function UpdateSCI2CInfo(FileInfoDatFile); -// ----------------------------------------------------------------- -// Updates the FileInfo struct according to the new scilab function -// to be converted in C. -// -// Input data: -// FileInfoDatFile: name of the .dat file containing the FileInfo structure. -// SharedInfoDatFile: it is a buffer containing parameters that are exchanged by the -// functions of the SCI2C tool. -// -// Output data: -// -// Status: -// 13-Apr-2007 -- Nutricato Raffaele: Author. -// ----------------------------------------------------------------- - -// --------------------------------- -// --- 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; - -PrintStepInfo('Translate function '+funname,... - FileInfo.GeneralReport,'both'); - -PrintStepInfo('Update the File Info Struct.',... - FileInfo.GeneralReport,'both'); - -// ----------------------------------- -// --- Update File Info structure. --- -// ----------------------------------- -FileInfo.Funct(funnumber).Name = funname; -FileInfo.Funct(funnumber).SCIFileName = SharedInfo.Next(1).SCIFileName; -FileInfo.Funct(funnumber).ASTFileName = fullfile(FileInfo.ResultDir,funname,funname+'.ast'); -FileInfo.Funct(funnumber).CPass1V1FileName = fullfile(FileInfo.ResultDir,funname,funname+'_pass1V1.c'); -FileInfo.Funct(funnumber).CPass1V2FileName = fullfile(FileInfo.ResultDir,funname,funname+'_pass1V2.c'); -FileInfo.Funct(funnumber).ReportFileName = fullfile(FileInfo.ResultDir,funname,funname+'.rpt'); -FileInfo.Funct(funnumber).LocalVarFileName = fullfile(FileInfo.ResultDir,funname,funname+'_LOCVAR.dat'); -FileInfo.Funct(funnumber).TempVarFileName = fullfile(FileInfo.ResultDir,funname,funname+'_TMPVAR.dat'); - -// -------------------------------------- -// --- Create the function directory. --- -// -------------------------------------- -mkdir(FileInfo.ResultDir,funname); - -// ------------------------- -// --- Delete old files. --- -// ------------------------- -SCI2Cmdelete(FileInfo.Funct(funnumber).ASTFileName); -SCI2Cmdelete(FileInfo.Funct(funnumber).CPass1V1FileName); -SCI2Cmdelete(FileInfo.Funct(funnumber).CPass1V2FileName); -SCI2Cmdelete(FileInfo.Funct(funnumber).ReportFileName); -SCI2Cmdelete(FileInfo.Funct(funnumber).LocalVarFileName); -SCI2Cmdelete(FileInfo.Funct(funnumber).TempVarFileName); - -// ----------------------------------- -// --- Initialize Local/Temp Vars. --- -// ----------------------------------- -LocalVars = []; -TempVars = []; - -// --------------------- -// --- Save section. --- -// --------------------- -// --- Save File Info Structure. --- -save(FileInfoDatFile,FileInfo); - -// --- Save Local/Temp Vars. --- -save(FileInfo.Funct(funnumber).LocalVarFileName,LocalVars); -save(FileInfo.Funct(funnumber).TempVarFileName,TempVars); -// ------------------------- -// --- End save section. --- -// ------------------------- - -endfunction -- cgit