diff options
author | jofret | 2010-09-01 12:02:11 +0000 |
---|---|---|
committer | jofret | 2010-09-01 12:02:11 +0000 |
commit | 3ac8b4e57ddac9a07e8171abc5fc6d6df5273ecf (patch) | |
tree | c0fed633f8a87b537b50daac7413598ac639b677 | |
parent | 4cc2f8eb3619467c71726689b19540fdb72c12c3 (diff) | |
download | scilab2c-3ac8b4e57ddac9a07e8171abc5fc6d6df5273ecf.tar.gz scilab2c-3ac8b4e57ddac9a07e8171abc5fc6d6df5273ecf.tar.bz2 scilab2c-3ac8b4e57ddac9a07e8171abc5fc6d6df5273ecf.zip |
Adding size function with 'c', 'r' or '*' as parameter
5 files changed, 41 insertions, 73 deletions
diff --git a/scilab2c/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/scilab2c/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 60b13cbf..30fa92bd 100644 --- a/scilab2c/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/scilab2c/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -1663,6 +1663,8 @@ PrintStringInfo('d2d0'+ArgSeparator+'d0',ClassFileName,'file','y'); PrintStringInfo('c2s0'+ArgSeparator+'s0',ClassFileName,'file','y');
PrintStringInfo('z2d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d2g2'+ArgSeparator+'d0',ClassFileName,'file','y');
+
// --- Annotation Function And Function List Function. ---
FunctionName = 'size'; // AS : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
diff --git a/scilab2c/macros/findDeps/getAllSources.sci b/scilab2c/macros/findDeps/getAllSources.sci index c1d08b23..5221fc7d 100644 --- a/scilab2c/macros/findDeps/getAllSources.sci +++ b/scilab2c/macros/findDeps/getAllSources.sci @@ -61,6 +61,7 @@ function allSources = getAllSources() "src/c/auxiliaryFunctions/pythag/zpythags.c" "src/c/auxiliaryFunctions/pythag/cpythags.c" "src/c/auxiliaryFunctions/pythag/spythags.c" + "src/c/auxiliaryFunctions/size/dallsizea.c" "src/c/type/doubleComplex.c" "src/c/type/floatComplex.c" "src/c/matrixOperations/cat/dcata.c" diff --git a/scilab2c/src/c/auxiliaryFunctions/includes/size.h b/scilab2c/src/c/auxiliaryFunctions/includes/size.h index 3a642e3a..ebc07a05 100644 --- a/scilab2c/src/c/auxiliaryFunctions/includes/size.h +++ b/scilab2c/src/c/auxiliaryFunctions/includes/size.h @@ -14,82 +14,12 @@ #define __SIZE_H__ /** - ** WARNING : - ** We assume size of arrays are known, so we - ** use #define to avoid compilation warnings - ** such as "unused parameter" - **/ - -/** - ** \brief Float Size Scalar function - ** Determine the size of an array. - ** \param in : the float array we must determine size. - ** \param size : the number of elements. - ** \return the size of in. - **/ -#define ssizes(in) 1.0f - -/** - ** \brief Float Size Scalar function - ** Determine the size of an array. - ** \param in : the float array we must determine size. - ** \param size : the number of elements. - ** \return the size of in. - **/ -#define dsizes(in) 1.0 - -/** - ** \brief Complex Float Size Scalar function - ** Determine the size of an array. - ** \param in : the float array we must determine size. - ** \param size : the number of elements. - ** \return the size of in. - **/ -#define csizes(in) 1.0f - -/** - ** \brief Complex Double Size Array function - ** Determine the size of an array. - ** \param in : the float array we must determine size. - ** \param size : the number of elements. - ** \return the size of in. - **/ -#define zsizes(in) 1.0 - -/** - ** \brief Float Size Array function - ** Determine the size of an array. - ** \param in : the float array we must determine size. - ** \param size : the number of elements. - ** \return the size of in. - **/ -#define ssizea(in, size) size - -/** ** \brief Double Size Array function ** Determine the size of an array. ** \param in : the float array we must determine size. ** \param size : the number of elements. ** \return the size of in. **/ -#define dsizea(in, size) size - -/** - ** \brief Complex Float Size Array function - ** Determine the size of an array. - ** \param in : the float array we must determine size. - ** \param size : the number of elements. - ** \return the size of in. - **/ -#define csizea(in, size) size - -/** - ** \brief Complex Double Size Array function - ** Determine the size of an array. - ** \param in : the float array we must determine size. - ** \param size : the number of elements. - ** \return the size of in. - **/ -#define zsizea(in, size) size +double dallsizea(int *size, char *select); #endif /* !__SIZE_H__ */ diff --git a/scilab2c/src/c/auxiliaryFunctions/interfaces/int_size.h b/scilab2c/src/c/auxiliaryFunctions/interfaces/int_size.h index 2608bc81..c529a97d 100644 --- a/scilab2c/src/c/auxiliaryFunctions/interfaces/int_size.h +++ b/scilab2c/src/c/auxiliaryFunctions/interfaces/int_size.h @@ -14,6 +14,7 @@ IMPLEMENTED YET, SEE DRANDS.C */ + #ifndef __INT_SIZE_H__ #define __INT_SIZE_H__ @@ -23,7 +24,7 @@ #define c0sizes2(in,out) out[0]=1.0f;out[1]=1.0f; -#define z0sized2(in,out) out[0]=1.0;out[1]=1.0; +#define z0sized2(in,out) out[0]=1.0;out[1]=1.0; #define s2sizes2(in,size,out) out[0]=size[0];out[1]=size[1]; @@ -65,7 +66,7 @@ #define z2d0sized0(in1,size,in2) (in2==1) ? size[0] : size[1] - +#define d2g2sized0(in1,size1,in2,size2) dallsizea(size1, in2) #endif /* !__INT_SIZE_H__ */ diff --git a/scilab2c/src/c/auxiliaryFunctions/size/dallsizea.c b/scilab2c/src/c/auxiliaryFunctions/size/dallsizea.c new file mode 100644 index 00000000..c757fc3d --- /dev/null +++ b/scilab2c/src/c/auxiliaryFunctions/size/dallsizea.c @@ -0,0 +1,34 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010-2010 - DIGITEO - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <stdio.h> +#include <string.h> +#include "size.h" + +double dallsizea(int *size, char *select) +{ + printf("** DEBUG ** select = [%s]\n", select); + if (strcmp(select, "*")) + { + return size[0] * size[1]; + } + if (strcmp(select, "r")) + { + return size[0]; + } + if (strcmp(select, "c")) + { + return size[1]; + } + + return 0; +} |