diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /contrib/toolbox_skeleton/src | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'contrib/toolbox_skeleton/src')
-rwxr-xr-x | contrib/toolbox_skeleton/src/builder_src.sce | 10 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/c/builder_c.sce | 22 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/c/csub.c | 12 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/c/csub.h | 18 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/c/csum.c | 12 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/c/csum.h | 18 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/c/multiplybypi.c | 16 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/c/multiplybypi.h | 17 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/cleaner_src.sce | 16 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/fortran/builder_fortran.sce | 13 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/fortran/fsum.f | 12 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/java/builder_java.sce | 25 | ||||
-rwxr-xr-x | contrib/toolbox_skeleton/src/java/org/scilab/contrib/toolboxskeleton/Sum.java | 12 |
13 files changed, 203 insertions, 0 deletions
diff --git a/contrib/toolbox_skeleton/src/builder_src.sce b/contrib/toolbox_skeleton/src/builder_src.sce new file mode 100755 index 000000000..db7ff7f1d --- /dev/null +++ b/contrib/toolbox_skeleton/src/builder_src.sce @@ -0,0 +1,10 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function builder_src() + langage_src = ["fortran" "c" "java"]; + path_src = get_absolute_file_path("builder_src.sce"); + tbx_builder_src_lang(langage_src, path_src); +endfunction + +builder_src(); +clear builder_src; // remove builder_src on stack diff --git a/contrib/toolbox_skeleton/src/c/builder_c.sce b/contrib/toolbox_skeleton/src/c/builder_c.sce new file mode 100755 index 000000000..e1bb2ea44 --- /dev/null +++ b/contrib/toolbox_skeleton/src/c/builder_c.sce @@ -0,0 +1,22 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +// This macro compiles the files + +function builder_c() + + src_c_path = get_absolute_file_path("builder_c.sce"); + + CFLAGS = ilib_include_flag(src_c_path); + + tbx_build_src(["csum","csub","multiplybypi"], .. + ["csum.c","csub.c","multiplybypi.c"], .. + "c", .. + src_c_path, .. + "", .. + "", .. + CFLAGS); + +endfunction + +builder_c(); +clear builder_c; // remove builder_c on stack diff --git a/contrib/toolbox_skeleton/src/c/csub.c b/contrib/toolbox_skeleton/src/c/csub.c new file mode 100755 index 000000000..7892acd37 --- /dev/null +++ b/contrib/toolbox_skeleton/src/c/csub.c @@ -0,0 +1,12 @@ +/* ==================================================================== */ +/* Template toolbox_skeleton */ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ +/* ==================================================================== */ +#include "csub.h" +/* ==================================================================== */ +int csub(double *a, double *b, double *c) +{ + *c = *a - *b; + return 0; +} +/* ==================================================================== */ diff --git a/contrib/toolbox_skeleton/src/c/csub.h b/contrib/toolbox_skeleton/src/c/csub.h new file mode 100755 index 000000000..50e3fa0ed --- /dev/null +++ b/contrib/toolbox_skeleton/src/c/csub.h @@ -0,0 +1,18 @@ +/* ==================================================================== */ +/* Template toolbox_skeleton */ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ +/* ==================================================================== */ +#ifndef __CSUB_H__ +#define __CSUB_H__ + +/** +* csub function +* @param[in] a +* @param[in] b +* @param[in,out] c result of a - b +* @return 0 +*/ +int csub(double *a, double *b, double *c); + +#endif /* __CSUB_H__ */ + diff --git a/contrib/toolbox_skeleton/src/c/csum.c b/contrib/toolbox_skeleton/src/c/csum.c new file mode 100755 index 000000000..738f2ae17 --- /dev/null +++ b/contrib/toolbox_skeleton/src/c/csum.c @@ -0,0 +1,12 @@ +/* ==================================================================== */ +/* Template toolbox_skeleton */ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ +/* ==================================================================== */ +#include "csum.h" +/* ==================================================================== */ +int csum(double *a, double *b, double *c) +{ + *c = *a + *b; + return 0; +} +/* ==================================================================== */ diff --git a/contrib/toolbox_skeleton/src/c/csum.h b/contrib/toolbox_skeleton/src/c/csum.h new file mode 100755 index 000000000..151d72cac --- /dev/null +++ b/contrib/toolbox_skeleton/src/c/csum.h @@ -0,0 +1,18 @@ +/* ==================================================================== */ +/* Template toolbox_skeleton */ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ +/* ==================================================================== */ +#ifndef __CSUM_H__ +#define __CSUM_H__ + +/** +* csum function +* @param[in] a +* @param[in] b +* @param[in,out] c result of a + b +* @return 0 +*/ +int csum(double *a, double *b, double *c); + +#endif /* __CSUM_H__ */ + diff --git a/contrib/toolbox_skeleton/src/c/multiplybypi.c b/contrib/toolbox_skeleton/src/c/multiplybypi.c new file mode 100755 index 000000000..42a8c8d89 --- /dev/null +++ b/contrib/toolbox_skeleton/src/c/multiplybypi.c @@ -0,0 +1,16 @@ +/* ==================================================================== */ +/* Template toolbox_skeleton */ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ +/* ==================================================================== */ +#include <math.h> +#include "multiplybypi.h" +/* ==================================================================== */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif +/* ==================================================================== */ +double multiplybypi(double a) +{ + return a * M_PI; +} +/* ==================================================================== */ diff --git a/contrib/toolbox_skeleton/src/c/multiplybypi.h b/contrib/toolbox_skeleton/src/c/multiplybypi.h new file mode 100755 index 000000000..c354b8843 --- /dev/null +++ b/contrib/toolbox_skeleton/src/c/multiplybypi.h @@ -0,0 +1,17 @@ +/* ==================================================================== */ +/* Template toolbox_skeleton */ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ +/* ==================================================================== */ +#ifndef __MULTIPLYBYTWO_H__ +#define __MULTIPLYBYTWO_H__ + +/** +* multiplybypi function +* @param[in] a a double +* @return a multiplied by two +*/ +double multiplybypi(double a); + + +#endif /* __MULTIPLYBYTWO_H__ */ + diff --git a/contrib/toolbox_skeleton/src/cleaner_src.sce b/contrib/toolbox_skeleton/src/cleaner_src.sce new file mode 100755 index 000000000..5de6a02a0 --- /dev/null +++ b/contrib/toolbox_skeleton/src/cleaner_src.sce @@ -0,0 +1,16 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function cleaner_src() + src_dir = get_absolute_file_path("cleaner_src.sce"); + + for language = ["c","cpp","fortran"] + cleaner_file = src_dir + filesep() + language + filesep() + "cleaner.sce"; + if isfile(cleaner_file) then + exec(cleaner_file); + mdelete(cleaner_file); + end + end +endfunction + +cleaner_src(); +clear cleaner_src; // remove cleaner_src on stack
\ No newline at end of file diff --git a/contrib/toolbox_skeleton/src/fortran/builder_fortran.sce b/contrib/toolbox_skeleton/src/fortran/builder_fortran.sce new file mode 100755 index 000000000..6bc32857a --- /dev/null +++ b/contrib/toolbox_skeleton/src/fortran/builder_fortran.sce @@ -0,0 +1,13 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function builder_fortran() + + tbx_build_src(["fsum"], .. + ["fsum.f"], .. + "f", .. + get_absolute_file_path("builder_fortran.sce")); + +endfunction + +builder_fortran(); +clear builder_fortran; // remove builder_fortran on stack diff --git a/contrib/toolbox_skeleton/src/fortran/fsum.f b/contrib/toolbox_skeleton/src/fortran/fsum.f new file mode 100755 index 000000000..b58ce28fd --- /dev/null +++ b/contrib/toolbox_skeleton/src/fortran/fsum.f @@ -0,0 +1,12 @@ +c ================================= +c Template toolbox_skeleton +c This file is released under the 3-clause BSD license. See COPYING-BSD. + +c ================================= + subroutine fsum(a,b,c) +c ================================= + double precision a,b,c + c = a + b + end +c ================================= + diff --git a/contrib/toolbox_skeleton/src/java/builder_java.sce b/contrib/toolbox_skeleton/src/java/builder_java.sce new file mode 100755 index 000000000..f089090fb --- /dev/null +++ b/contrib/toolbox_skeleton/src/java/builder_java.sce @@ -0,0 +1,25 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +// This macro compiles JAR from Java files + +function builder_java() + src_java_dir = get_absolute_file_path("builder_java.sce"); + + curdir = pwd(); + cd(src_java_dir); + + jar_dir = fullpath(fullfile(src_java_dir, "../../jar")); + if ~isdir(jar_dir) + mkdir(jar_dir); + end + + package_name = "org.scilab.contrib.toolboxskeleton"; + jar_file_path = fullfile(jar_dir, package_name + ".jar"); + ilib_build_jar(jar_file_path, package_name, src_java_dir); + + cd(curdir); +endfunction + +builder_java(); +clear builder_java; + diff --git a/contrib/toolbox_skeleton/src/java/org/scilab/contrib/toolboxskeleton/Sum.java b/contrib/toolbox_skeleton/src/java/org/scilab/contrib/toolboxskeleton/Sum.java new file mode 100755 index 000000000..aa7a7c3ec --- /dev/null +++ b/contrib/toolbox_skeleton/src/java/org/scilab/contrib/toolboxskeleton/Sum.java @@ -0,0 +1,12 @@ +/* ====================================================================== */ +/* Template toolbox_skeleton */ +/* This file is released under the 3-clause BSD license. See COPYING-BSD. */ +/* ====================================================================== */ + +package org.scilab.contrib.toolboxskeleton; + +public class Sum { + public static double sum(double a, double b) { + return a + b; + } +} |