diff options
Diffstat (limited to 'src/c')
43 files changed, 866 insertions, 0 deletions
diff --git a/src/c/auxiliaryFunctions/abs/i16absa.c b/src/c/auxiliaryFunctions/abs/i16absa.c new file mode 100644 index 0000000..ad37cee --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i16absa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - 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 "abs.h" + +void i16absa(int16 *in, int size, int16* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i16abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/i16abss.c b/src/c/auxiliaryFunctions/abs/i16abss.c new file mode 100644 index 0000000..591ab8d --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i16abss.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - 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 "abs.h" + +int16 i16abss(int16 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/i8absa.c b/src/c/auxiliaryFunctions/abs/i8absa.c new file mode 100644 index 0000000..2f015f2 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i8absa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - 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 "abs.h" + +void i8absa(int8 *in, int size, int8* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = i8abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/i8abss.c b/src/c/auxiliaryFunctions/abs/i8abss.c new file mode 100644 index 0000000..7c3d707 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/i8abss.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - 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 "abs.h" + +int8 i8abss(int8 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/u16absa.c b/src/c/auxiliaryFunctions/abs/u16absa.c new file mode 100644 index 0000000..5bc1d14 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u16absa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - 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 "abs.h" + +void u16absa(uint16 *in, int size, uint16* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u16abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/u16abss.c b/src/c/auxiliaryFunctions/abs/u16abss.c new file mode 100644 index 0000000..056ca80 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u16abss.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - 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 "abs.h" + +uint16 u16abss(uint16 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/auxiliaryFunctions/abs/u8absa.c b/src/c/auxiliaryFunctions/abs/u8absa.c new file mode 100644 index 0000000..cc649c8 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u8absa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - 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 "abs.h" + +void u8absa(uint8 *in, int size, uint8* out) { + int i = 0; + for (i = 0; i < size; ++i) { + out[i] = u8abss(in[i]); + } +} diff --git a/src/c/auxiliaryFunctions/abs/u8abss.c b/src/c/auxiliaryFunctions/abs/u8abss.c new file mode 100644 index 0000000..45ea9a5 --- /dev/null +++ b/src/c/auxiliaryFunctions/abs/u8abss.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - 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 "abs.h" + +uint8 u8abss(uint8 num) { + if (num >= 0) { + return num; + } + return -num; +} diff --git a/src/c/elementaryFunctions/ceil/i16ceila.c b/src/c/elementaryFunctions/ceil/i16ceila.c new file mode 100644 index 0000000..a960fa8 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i16ceila.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "ceil.h" + +void i16ceila(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/i16ceils.c b/src/c/elementaryFunctions/ceil/i16ceils.c new file mode 100644 index 0000000..2dee983 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i16ceils.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "ceil.h" + +int16 i16ceils(int16 x) { + return (int16)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/i8ceila.c b/src/c/elementaryFunctions/ceil/i8ceila.c new file mode 100644 index 0000000..3308174 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i8ceila.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "ceil.h" + +void i8ceila(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/i8ceils.c b/src/c/elementaryFunctions/ceil/i8ceils.c new file mode 100644 index 0000000..e87bd61 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/i8ceils.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "ceil.h" + +int8 i8ceils(int8 x) { + return (int8)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/u16ceila.c b/src/c/elementaryFunctions/ceil/u16ceila.c new file mode 100644 index 0000000..c7e83df --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u16ceila.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "ceil.h" + +void u16ceila(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/u16ceils.c b/src/c/elementaryFunctions/ceil/u16ceils.c new file mode 100644 index 0000000..4632eec --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u16ceils.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "ceil.h" + +uint16 u16ceils(uint16 x) { + return (uint16)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/ceil/u8ceila.c b/src/c/elementaryFunctions/ceil/u8ceila.c new file mode 100644 index 0000000..3bb4ca9 --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u8ceila.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "ceil.h" + +void u8ceila(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8ceils(x[i]); +} diff --git a/src/c/elementaryFunctions/ceil/u8ceils.c b/src/c/elementaryFunctions/ceil/u8ceils.c new file mode 100644 index 0000000..7f28bba --- /dev/null +++ b/src/c/elementaryFunctions/ceil/u8ceils.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "ceil.h" + +uint8 u8ceils(uint8 x) { + return (uint8)(ceilf(x)); +} diff --git a/src/c/elementaryFunctions/fix/i16fixa.c b/src/c/elementaryFunctions/fix/i16fixa.c new file mode 100644 index 0000000..2ccb933 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i16fixa.c @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +void i16fixa(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/i16fixs.c b/src/c/elementaryFunctions/fix/i16fixs.c new file mode 100644 index 0000000..5a13ca0 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i16fixs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "fix.h" + +int16 i16fixs(int16 x) { + if (x>=0) return i16floors(x); + else return i16ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/i8fixa.c b/src/c/elementaryFunctions/fix/i8fixa.c new file mode 100644 index 0000000..4e913a3 --- /dev/null +++ b/src/c/elementaryFunctions/fix/i8fixa.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "fix.h" + +void i8fixa(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/i8fixs.c b/src/c/elementaryFunctions/fix/i8fixs.c new file mode 100644 index 0000000..ae331ff --- /dev/null +++ b/src/c/elementaryFunctions/fix/i8fixs.c @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +int8 i8fixs(int8 x) { + if (x>=0) return i8floors(x); + else return i8ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/u16fixa.c b/src/c/elementaryFunctions/fix/u16fixa.c new file mode 100644 index 0000000..5798300 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u16fixa.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "fix.h" + +void u16fixa(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/u16fixs.c b/src/c/elementaryFunctions/fix/u16fixs.c new file mode 100644 index 0000000..cf17847 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u16fixs.c @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +uint16 u16fixs(uint16 x) { + if (x>=0) return u16floors(x); + else return u16ceils(x); +} diff --git a/src/c/elementaryFunctions/fix/u8fixa.c b/src/c/elementaryFunctions/fix/u8fixa.c new file mode 100644 index 0000000..2a3bd3b --- /dev/null +++ b/src/c/elementaryFunctions/fix/u8fixa.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "fix.h" + +void u8fixa(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8fixs(x[i]); +} diff --git a/src/c/elementaryFunctions/fix/u8fixs.c b/src/c/elementaryFunctions/fix/u8fixs.c new file mode 100644 index 0000000..563bfe9 --- /dev/null +++ b/src/c/elementaryFunctions/fix/u8fixs.c @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "fix.h" +#include "floor.h" +#include "ceil.h" + +uint8 u8fixs(uint8 x) { + if (x>=0) return u8floors(x); + else return u8ceils(x); +} diff --git a/src/c/elementaryFunctions/floor/i16floora.c b/src/c/elementaryFunctions/floor/i16floora.c new file mode 100644 index 0000000..69140b0 --- /dev/null +++ b/src/c/elementaryFunctions/floor/i16floora.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "floor.h" + +void i16floora(int16* x, int size, int16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i16floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/i16floors.c b/src/c/elementaryFunctions/floor/i16floors.c new file mode 100644 index 0000000..428a745 --- /dev/null +++ b/src/c/elementaryFunctions/floor/i16floors.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "floor.h" + +int16 i16floors(int16 x) { + return (int16)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/i8floora.c b/src/c/elementaryFunctions/floor/i8floora.c new file mode 100644 index 0000000..0554f1e --- /dev/null +++ b/src/c/elementaryFunctions/floor/i8floora.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "floor.h" + +void i8floora(int8* x, int size, int8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = i8floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/i8floors.c b/src/c/elementaryFunctions/floor/i8floors.c new file mode 100644 index 0000000..e78dfa1 --- /dev/null +++ b/src/c/elementaryFunctions/floor/i8floors.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "floor.h" + +int8 i8floors(int8 x) { + return (int8)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/u16floora.c b/src/c/elementaryFunctions/floor/u16floora.c new file mode 100644 index 0000000..56e35ca --- /dev/null +++ b/src/c/elementaryFunctions/floor/u16floora.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "floor.h" + +void u16floora(uint16* x, int size, uint16* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u16floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/u16floors.c b/src/c/elementaryFunctions/floor/u16floors.c new file mode 100644 index 0000000..65455c1 --- /dev/null +++ b/src/c/elementaryFunctions/floor/u16floors.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "floor.h" + +uint16 u16floors(uint16 x) { + return (uint16)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/floor/u8floora.c b/src/c/elementaryFunctions/floor/u8floora.c new file mode 100644 index 0000000..ace7ff7 --- /dev/null +++ b/src/c/elementaryFunctions/floor/u8floora.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "floor.h" + +void u8floora(uint8* x, int size, uint8* out) { + int i = 0; + for (i=0;i<size;i++) out[i] = u8floors(x[i]); +} diff --git a/src/c/elementaryFunctions/floor/u8floors.c b/src/c/elementaryFunctions/floor/u8floors.c new file mode 100644 index 0000000..efb2e8c --- /dev/null +++ b/src/c/elementaryFunctions/floor/u8floors.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 <math.h> +#include "floor.h" + +uint8 u8floors(uint8 x) { + return (uint8)(floorf(x)); +} diff --git a/src/c/elementaryFunctions/round/i16rounda.c b/src/c/elementaryFunctions/round/i16rounda.c new file mode 100644 index 0000000..5cacafa --- /dev/null +++ b/src/c/elementaryFunctions/round/i16rounda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 "round.h" + +void i16rounda(int16* x, int size, int16* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=i16rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/i16rounds.c b/src/c/elementaryFunctions/round/i16rounds.c new file mode 100644 index 0000000..95bd609 --- /dev/null +++ b/src/c/elementaryFunctions/round/i16rounds.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 "round.h" + +int16 i16rounds(int16 x) { + int result; + + if(x>=0) result = (int16)((float)x+0.5); + else result = (int16)((float)x-0.5); + + return (int16)result; +} diff --git a/src/c/elementaryFunctions/round/i8rounda.c b/src/c/elementaryFunctions/round/i8rounda.c new file mode 100644 index 0000000..c47be51 --- /dev/null +++ b/src/c/elementaryFunctions/round/i8rounda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 "round.h" + +void i8rounda(int8* x, int size, int8* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=i8rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/i8rounds.c b/src/c/elementaryFunctions/round/i8rounds.c new file mode 100644 index 0000000..f37d53c --- /dev/null +++ b/src/c/elementaryFunctions/round/i8rounds.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 "round.h" + +int8 i8rounds(int8 x) { + int result; + + if(x>=0) result = (int8)((float)x+0.5); + else result = (int8)((float)x-0.5); + + return (int8)result; +} diff --git a/src/c/elementaryFunctions/round/u16rounda.c b/src/c/elementaryFunctions/round/u16rounda.c new file mode 100644 index 0000000..38c4b28 --- /dev/null +++ b/src/c/elementaryFunctions/round/u16rounda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 "round.h" + +void u16rounda(uint16* x, int size, uint16* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=u16rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/u16rounds.c b/src/c/elementaryFunctions/round/u16rounds.c new file mode 100644 index 0000000..babda6d --- /dev/null +++ b/src/c/elementaryFunctions/round/u16rounds.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 "round.h" + +uint16 u16rounds(uint16 x) { + int result; + + if(x>=0) result = (uint16)((float)x+0.5); + else result = (uint16)((float)x-0.5); + + return (uint16)result; +} diff --git a/src/c/elementaryFunctions/round/u8rounda.c b/src/c/elementaryFunctions/round/u8rounda.c new file mode 100644 index 0000000..e8f828d --- /dev/null +++ b/src/c/elementaryFunctions/round/u8rounda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 "round.h" + +void u8rounda(uint8* x, int size, uint8* out) { + int i=0; + + for (i=0;i<size;i++) out[i]=u8rounds(x[i]); +} diff --git a/src/c/elementaryFunctions/round/u8rounds.c b/src/c/elementaryFunctions/round/u8rounds.c new file mode 100644 index 0000000..7e3da17 --- /dev/null +++ b/src/c/elementaryFunctions/round/u8rounds.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * 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 "round.h" + +uint8 u8rounds(uint8 x) { + int result; + + if(x>=0) result = (uint8)((float)x+0.5); + else result = (uint8)((float)x-0.5); + + return (uint8)result; +} diff --git a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c new file mode 100644 index 0000000..0d43b86 --- /dev/null +++ b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c @@ -0,0 +1,19 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 "cmd_digital_out.h" + +void u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value) +{ + digitalWrite(pin,value); +} + diff --git a/src/c/scilab-arduino/includes/cmd_digital_out.h b/src/c/scilab-arduino/includes/cmd_digital_out.h new file mode 100644 index 0000000..2d8b0b4 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_digital_out.h @@ -0,0 +1,29 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __CMD_DIGITAL_OUT_H__ +#define __CMD_DIGITAL_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8cmd_digital_ins(uint8 board_no, uint8 pin, uint8 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h b/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h new file mode 100644 index 0000000..7e630e3 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h @@ -0,0 +1,30 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifndef __INT_CMD_DIGITAL_OUT_H__ +#define __INT_CMD_DIGITAL_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_digital_outd0(in1,in2,in3) u8cmd_digital_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_OUT_H__ */ |