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 /modules/mexlib/examples/fmex | |
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 'modules/mexlib/examples/fmex')
-rwxr-xr-x | modules/mexlib/examples/fmex/builder.sce | 33 | ||||
-rwxr-xr-x | modules/mexlib/examples/fmex/demo.sce | 23 | ||||
-rwxr-xr-x | modules/mexlib/examples/fmex/mexfunction1.F | 23 | ||||
-rwxr-xr-x | modules/mexlib/examples/fmex/readme.txt | 14 |
4 files changed, 93 insertions, 0 deletions
diff --git a/modules/mexlib/examples/fmex/builder.sce b/modules/mexlib/examples/fmex/builder.sce new file mode 100755 index 000000000..1e66fba22 --- /dev/null +++ b/modules/mexlib/examples/fmex/builder.sce @@ -0,0 +1,33 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 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 + +// This is the builder.sce +// must be run from this directory + +// interface library name +ilib_name = "libmex" + +// objects files (but do not give mexfiles here) +files = []; + +// other libs needed for linking (must be shared library names) +libs = []; + +// table of (scilab_name,interface-name or mexfile-name, type) + +table =["mexf1","mexfunction1","fmex"]; + +ldflags = ""; +cflags = ""; +fflags = ""; + +// do not modify below +// ---------------------------------------------- +ilib_mex_build(ilib_name,table,files,libs,"",ldflags,cflags,fflags) diff --git a/modules/mexlib/examples/fmex/demo.sce b/modules/mexlib/examples/fmex/demo.sce new file mode 100755 index 000000000..c5da3deaf --- /dev/null +++ b/modules/mexlib/examples/fmex/demo.sce @@ -0,0 +1,23 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 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 + +// Allan CORNET +// INRIA 2007 + +exec(SCI+"/modules/mexlib/examples/fmex/builder.sce"); +exec(SCI+"/modules/mexlib/examples/fmex/loader.sce"); + +[a,b]=mexf1(1,2); + +if (b~=2) then + disp("problem with this example"); +else + disp("ok"); +end diff --git a/modules/mexlib/examples/fmex/mexfunction1.F b/modules/mexlib/examples/fmex/mexfunction1.F new file mode 100755 index 000000000..8501e071a --- /dev/null +++ b/modules/mexlib/examples/fmex/mexfunction1.F @@ -0,0 +1,23 @@ + subroutine mexfunction(nlhs, plhs, nrhs, prhs) +c [a,b]=mexf1(1,2) see builder.sce file + + integer*4 plhs(*), prhs(*) +C Uncomment for 64 bits Dec Alpha machines +C integer*8 plhs(*), prhs(*) +C + integer nlhs, nrhs +c + if (nrhs.ne.2) then + call mexerrmsgtxt('Two inputs needed') + endif + + if (nlhs.gt.2) then + call mexerrmsgtxt('Two many outputs') + endif + + plhs(1)=prhs(1) + plhs(2)=prhs(2) + + return + end + diff --git a/modules/mexlib/examples/fmex/readme.txt b/modules/mexlib/examples/fmex/readme.txt new file mode 100755 index 000000000..03c362d6b --- /dev/null +++ b/modules/mexlib/examples/fmex/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/fmex/demo.sce') + at scilab prompt + +------------------------------------------------------- +INRIA 2007 |