summaryrefslogtreecommitdiff
path: root/modules/mexlib/examples/cmex
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/mexlib/examples/cmex
downloadscilab_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 'modules/mexlib/examples/cmex')
-rwxr-xr-xmodules/mexlib/examples/cmex/cmex.sce30
-rwxr-xr-xmodules/mexlib/examples/cmex/readme.txt14
2 files changed, 44 insertions, 0 deletions
diff --git a/modules/mexlib/examples/cmex/cmex.sce b/modules/mexlib/examples/cmex/cmex.sce
new file mode 100755
index 000000000..0cbd0df1c
--- /dev/null
+++ b/modules/mexlib/examples/cmex/cmex.sce
@@ -0,0 +1,30 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA
+//
+// 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.1-en.txt
+
+mode(-1);
+clear
+D=pwd()
+cd(TMPDIR)
+mputl("ilib_mex_build(''libmex'',[''mexf16'',''mexfunction16'',''cmex''],[],[],'''','''','''','''')","builder.sce")
+
+mputl([
+"#include ""mex.h"""
+"void mexFunction(nlhs, plhs, nrhs, prhs)"
+" int nlhs, nrhs;"
+" mxArray *plhs[]; mxArray *prhs[];"
+"{"
+" int *dims = mxGetDimensions(prhs[0]);"
+" sciprint(""%d %d %d\n"",dims[0],dims[1],dims[2]);"
+"}"
+],"mexfunction16.c")
+exec(TMPDIR+"/builder.sce");
+exec(TMPDIR+"/loader.sce");
+mexf16(rand(2,3,2))
+cd(D)
diff --git a/modules/mexlib/examples/cmex/readme.txt b/modules/mexlib/examples/cmex/readme.txt
new file mode 100755
index 000000000..ebfefc1ef
--- /dev/null
+++ b/modules/mexlib/examples/cmex/readme.txt
@@ -0,0 +1,14 @@
+The purpose of this contribution is to emulate the Matlab mexfile mechanism.
+
+Only the most useful functions have been emulated.
+
+See SCI/modules/mexlib/src/mexlib.c for additional info and
+in particular the list of emulated mx functions.
+
+-------------------------------------------------------
+To build and load the shared library enter
+ --> exec (SCI+'/modules/mexlib/examples/cmex/cmex.sce')
+ at scilab prompt
+
+-------------------------------------------------------
+INRIA 2006