From 3a19a1a1520a3f1c776564f0614755c70bdef9d7 Mon Sep 17 00:00:00 2001 From: jofret Date: Fri, 6 Jun 2008 15:07:30 +0000 Subject: Test files. Ignore generated directories C_code and Temp. --- .../test999_WorkingDir/SCI2CInputParameters.sce | 94 ++++++++++++++++++++++ .../test999_WorkingDir/scilabcode/mainfunction.sci | 29 +++++++ 2 files changed, 123 insertions(+) create mode 100644 src/Scilab2C/SCI2CTests/test999_WorkingDir/SCI2CInputParameters.sce create mode 100644 src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci diff --git a/src/Scilab2C/SCI2CTests/test999_WorkingDir/SCI2CInputParameters.sce b/src/Scilab2C/SCI2CTests/test999_WorkingDir/SCI2CInputParameters.sce new file mode 100644 index 00000000..15a3ace1 --- /dev/null +++ b/src/Scilab2C/SCI2CTests/test999_WorkingDir/SCI2CInputParameters.sce @@ -0,0 +1,94 @@ +// ----------------------------------------------------------------- +// === hArtes/PoliBa/GAP SCI2C tool === +// === Authors: === +// === Raffaele Nutricato === +// === raffaele.nutricato@tiscali.it === +// === Alberto Morea === +// === === +// === *************** === +// === USER PARAMETERS === +// === *************** === +// === === +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------------------ +// --- Specify Paths of User Scilab code. --- +// ------------------------------------------ +// +// FIXME : Must be a relative path or user input but neither absolute path. +// +//UserSciCodeMainDir = 'D:\NutricatoGAPSVN\PROGETTI_APERTI\POLIBA\hArtes\WP2_SCI2C\Software\Version_alpha\SCI2CTests\test999_WorkingDir'; +UserSciCodeMainDir = '/home/bruno/work/hArtes/scilab2c/src/Scilab2C/SCI2CTests/test999_WorkingDir'; + +// --- Path + filename of the .sci main file of the code to be translated. --- +// It is the entry point. +UserScilabMainFile = fullfile(UserSciCodeMainDir,'scilabcode/mainfunction.sci'); + +// --- List of the paths containing the .sci files written by the user. --- +UserSciFilesPaths = ... + [... + fullfile(UserSciCodeMainDir,'scilabcode');... + ]; + +// -------------------------- +// --- End Specify paths. --- +// -------------------------- + + +// ---------------------------- +// --- Select the run mode. --- +// ---------------------------- +//RunMode = 'GenLibraryStructure'; +//RunMode = 'Translate'; +RunMode = 'All'; + +// --- Select one of the following options. --- + +// 'GenLibraryStructure'; +// Generates the library structure and exits. It is very +// useful when the user wants to manually change the files stored in that structure +// before running the translation. 'GenLibraryStructure' option forces SCI2C to remove +// the already existing WorkingDir and OutCCCodeDir directories. + +// 'Translate'; +// Performs the translation without generating the library structure. It means that the library +// structure must be already existing. This is useful when the user doesn't want to spend time +// to generate again that structure or when he wants to force the SCI2C tool to access to +// a manually-changed library structure. 'Translate' option forces SCI2C to don't remove +// the already existing WorkingDir. Only OutCCCodeDir directory will be removed. + +// 'All'; +// Performs all the actions listed above. + +// -------------------------------- +// --- End Select the run mode. --- +// -------------------------------- + + +// ---------------------------- +// --- Translation Options. --- +// ---------------------------- +// --- Enable (1) / Disable (0) copy of Scilab code into C code. --- +// If 1 the Scilab code will be copied into the C code in order to show +// how each Scilab code line has been translated into C code. +CopySciCodeIntoCCode = 1; + +// --- Select the path style for the C code. --- +// It can be: +// windows +// unix +// cygwin +CCompilerPathStyle = 'cygwin'; + +// --- Path + File name of the main SCI2C library header file. +// +// FIXME : Must be a relative path or user input but neither absolute path. +// +Sci2CLibMainHeaderFName = 'D:\NutricatoGAPSVN\PROGETTI_APERTI\POLIBA\hArtes\WP2_SCI2C\Software\Version_alpha\Scilab2C\CFiles\sci2cincludes\sci2clib.h'; +// -------------------------------- +// --- End Translation Options. --- +// -------------------------------- diff --git a/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci b/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci new file mode 100644 index 00000000..bfb5fc3f --- /dev/null +++ b/src/Scilab2C/SCI2CTests/test999_WorkingDir/scilabcode/mainfunction.sci @@ -0,0 +1,29 @@ +//SCI2C: DEFAULT_PRECISION= DOUBLE + +function mainfunction() + +// ------------------------------ +// --- Simple Scalar Addition --- +// ------------------------------ +a = 1; +b = 2; +c = 0; +c = a + b; +disp(c); + +// ------------------------------ +// --- Trigonometric Identity --- +// ------------------------------ +x = (1:3)' * (4:9); +y = (sin(x).^2) + (cos(x).^2); +disp(x); +disp(y-ones(3,6)); + +// ------------------------------- +// --- Computation of Distance --- +// ------------------------------- +// generate a vector w +w = cos(sin(cos(x*3)*2).* x+ones(3,6).*cos(x-sin(y*2))); +distxw = sqrt(x.^2 + w.^2); +disp(distxw); +endfunction -- cgit