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/api_scilab | |
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/api_scilab')
482 files changed, 77929 insertions, 0 deletions
diff --git a/modules/api_scilab/.libs/libsciapi_scilab.a b/modules/api_scilab/.libs/libsciapi_scilab.a Binary files differnew file mode 100755 index 000000000..2c365f86f --- /dev/null +++ b/modules/api_scilab/.libs/libsciapi_scilab.a diff --git a/modules/api_scilab/.libs/libsciapi_scilab.la b/modules/api_scilab/.libs/libsciapi_scilab.la new file mode 120000 index 000000000..14fdc429b --- /dev/null +++ b/modules/api_scilab/.libs/libsciapi_scilab.la @@ -0,0 +1 @@ +../libsciapi_scilab.la
\ No newline at end of file diff --git a/modules/api_scilab/Core_f_Import.def b/modules/api_scilab/Core_f_Import.def new file mode 100755 index 000000000..825fc8faf --- /dev/null +++ b/modules/api_scilab/Core_f_Import.def @@ -0,0 +1,11 @@ +LIBRARY core_f.dll + + +EXPORTS +;core_f + +cvname_ +cvnamel_ +stackg_ +stackp_ +funs_
\ No newline at end of file diff --git a/modules/api_scilab/Localization_Import.def b/modules/api_scilab/Localization_Import.def new file mode 100755 index 000000000..402535247 --- /dev/null +++ b/modules/api_scilab/Localization_Import.def @@ -0,0 +1,6 @@ + LIBRARY scilocalization.dll + + +EXPORTS +to_wide_string +wide_string_to_UTF8
\ No newline at end of file diff --git a/modules/api_scilab/Makefile b/modules/api_scilab/Makefile new file mode 100755 index 000000000..7b1482b86 --- /dev/null +++ b/modules/api_scilab/Makefile @@ -0,0 +1,1449 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# modules/api_scilab/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2009 - Digiteo - Allan CORNET +# +# This file is distributed under the same license as the Scilab package. + +### SOURCES ### + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2006-2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +# Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +# +# 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 +# + +########## +### Makefile included stuff +### Target, variable, suffixes which are supposed to be useful in every makefile.am +########## + + + + +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/scilab +pkgincludedir = $(includedir)/scilab +pkglibdir = $(libdir)/scilab +pkglibexecdir = $(libexecdir)/scilab +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +DIST_COMMON = $(top_srcdir)/Makefile.incl.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/config/mkinstalldirs \ + $(top_srcdir)/config/depcomp \ + $(libsciapi_scilab_la_include_HEADERS) +am__append_1 = java +subdir = modules/api_scilab +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/backtrace.m4 \ + $(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/curl.m4 \ + $(top_srcdir)/m4/docbook.m4 $(top_srcdir)/m4/doxygen.m4 \ + $(top_srcdir)/m4/fftw.m4 $(top_srcdir)/m4/fortran.m4 \ + $(top_srcdir)/m4/giws.m4 $(top_srcdir)/m4/hdf5.m4 \ + $(top_srcdir)/m4/intel_compiler.m4 \ + $(top_srcdir)/m4/java-thirdparty.m4 $(top_srcdir)/m4/java.m4 \ + $(top_srcdir)/m4/largefile.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/libsmath.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/libxml2.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/macosx.m4 \ + $(top_srcdir)/m4/mpi.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/m4/pcre.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/relocatable.m4 $(top_srcdir)/m4/swig.m4 \ + $(top_srcdir)/m4/symlinks.m4 $(top_srcdir)/m4/tcltk.m4 \ + $(top_srcdir)/m4/umfpack.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/modules/core/includes/machine.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkglibdir)" \ + "$(DESTDIR)$(libsciapi_scilab_la_etcdir)" \ + "$(DESTDIR)$(libsciapi_scilab_la_rootdir)" \ + "$(DESTDIR)$(libsciapi_scilab_la_includedir)" +LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES) +libsciapi_scilab_la_DEPENDENCIES = +am__dirstamp = $(am__leading_dot)dirstamp +am__objects_1 = src/cpp/libsciapi_scilab_la-api_boolean.lo \ + src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo \ + src/cpp/libsciapi_scilab_la-api_common.lo \ + src/cpp/libsciapi_scilab_la-api_double.lo \ + src/cpp/libsciapi_scilab_la-api_int.lo \ + src/cpp/libsciapi_scilab_la-api_list.lo \ + src/cpp/libsciapi_scilab_la-api_poly.lo \ + src/cpp/libsciapi_scilab_la-api_sparse.lo \ + src/cpp/libsciapi_scilab_la-api_string.lo \ + src/cpp/libsciapi_scilab_la-api_pointer.lo \ + src/cpp/libsciapi_scilab_la-api_handle.lo \ + src/cpp/libsciapi_scilab_la-api_error.lo \ + src/cpp/libsciapi_scilab_la-api_optional.lo \ + src/cpp/libsciapi_scilab_la-api_hypermat.lo +am_libsciapi_scilab_la_OBJECTS = $(am__objects_1) +libsciapi_scilab_la_OBJECTS = $(am_libsciapi_scilab_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +am_libsciapi_scilab_la_rpath = +#am_libsciapi_scilab_la_rpath = -rpath \ +# $(pkglibdir) +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir)/modules/core/includes +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_$(V)) +am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_$(V)) +am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libsciapi_scilab_la_SOURCES) +DIST_SOURCES = $(libsciapi_scilab_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(libsciapi_scilab_la_etc_DATA) \ + $(libsciapi_scilab_la_root_DATA) +HEADERS = $(libsciapi_scilab_la_include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing aclocal-1.14 +ALL_LINGUAS = en_US fr_FR zh_CN zh_TW ru_RU ca_ES de_DE es_ES pt_BR ja_JP it_IT uk_UA pl_PL cs_CZ +ALL_LINGUAS_DOC = en_US fr_FR pt_BR ja_JP ru_RU +AMTAR = $${TAR-tar} +AM_DEFAULT_VERBOSITY = 1 +ANT = /usr/bin/ant +ANTLR = /usr/share/java/antlr.jar +AR = ar +ARPACK_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -larpack +ASM3 = /usr/share/java/asm3-3.3.2.jar +AUTOCONF = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing autoconf +AUTOHEADER = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing autoheader +AUTOMAKE = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing automake-1.14 +AVALON_FRAMEWORK = /home/shashank/scilab-master_5.5.2/thirdparty/avalon-framework.jar +AWK = mawk +BATIK = /home/shashank/scilab-master_5.5.2/thirdparty/batik-all-1.7.jar +BLAS_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lblas +CC = gcc +CCACHE = +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CHECKSTYLE = +COBERTURA = /usr/share/java/cobertura.jar +COMMONS_BEANUTILS = +COMMONS_IO = /home/shashank/scilab-master_5.5.2/thirdparty/commons-io.jar +COMMONS_LOGGING = /home/shashank/scilab-master_5.5.2/thirdparty/commons-logging.jar +CPP = gcc -E +CPPFLAGS = +CURL_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +CURL_CONFIG = /home/shashank/scilab-master_5.5.2/usr/bin/curl-config +CURL_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lcurl -L/home/scilab/work/linux-prerequisites-sources/trunk/Dev-Tools/SE/Prerequirements/linux_x64/usr/lib -L/home/scilab/work/linux-prerequisites-sources/trunk/Dev-Tools/SE/Prerequirements/linux_x64/usr/lib -lssl -lcrypto -lrt -lz +CURL_VERSION = libcurl 7.19.7 +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEMOTOOLS_ENABLE = yes +DEPDIR = .deps +DLLTOOL = false +DOCBOOK_ROOT = /home/shashank/scilab-master_5.5.2/thirdparty/docbook/ +DOXYGEN_BIN = +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +ECJ = /home/shashank/scilab-master_5.5.2/thirdparty/ecj.jar +EGREP = /bin/grep -E +EXEEXT = +F77 = gfortran +FFLAGS = -g -O2 +FFTW3_LIB = -L/home/shashank/scilab-master_5.5.2/usr/lib -lfftw3 +FFTW_ENABLE = yes +FGREP = /bin/grep -F +FLEXDOCK = /home/shashank/scilab-master_5.5.2/thirdparty/flexdock-1.2.4.jar +FLIBS = -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -lpthread -ldl -lcurses -lgfortran -lm -lquadmath +FOP = /home/shashank/scilab-master_5.5.2/thirdparty/fop.jar +FREEHEP_GRAPHICS2D = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-graphics2d.jar +FREEHEP_GRAPHICSIO = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-graphicsio.jar +FREEHEP_GRAPHICSIO_EMF = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-graphicsio-emf.jar +FREEHEP_IO = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-io.jar +FREEHEP_UTIL = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-util.jar +GENHTML = +GETTEXT_MACRO_VERSION = 0.19 +GIWS_BIN = +GLUEGEN2_RT = /home/shashank/scilab-master_5.5.2/thirdparty/gluegen2-rt.jar +GMSGFMT = /usr/bin/msgfmt +GMSGFMT_015 = /usr/bin/msgfmt +GRAPHICS_ENABLE = yes +GREP = /bin/grep +GUI_ENABLE = yes +HDF5_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +HDF5_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lhdf5 -lhdf5_hl +HELP_ENABLE = yes +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +INTLLIBS = +INTL_MACOSX_LIBS = +JAR = /usr/lib/jvm/java-8-openjdk-amd64/bin/jar +JAVA = /usr/lib/jvm/java-8-openjdk-amd64/bin/java +JAVAC = /usr/lib/jvm/java-8-openjdk-amd64/bin/javac +JAVAC_DEBUG = off +JAVADOC = /usr/lib/jvm/java-8-openjdk-amd64/bin/javadoc +JAVAH = /usr/lib/jvm/java-8-openjdk-amd64/bin/javah +JAVASCI_ENABLE = yes +JAVA_ENABLE = yes +JAVA_G = /usr/lib/jvm/java-8-openjdk-amd64/bin/java +JAVA_HOME = /usr/lib/jvm/java-8-openjdk-amd64 +JAVA_JNI_INCLUDE = -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux +JAVA_JNI_LIBS = -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64 -ljava -lverify -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm +JDB = /usr/lib/jvm/java-8-openjdk-amd64/bin/jdb +JEUCLID_CORE = /home/shashank/scilab-master_5.5.2/thirdparty/jeuclid-core.jar +JGRAPHX = /home/shashank/scilab-master_5.5.2/thirdparty/jgraphx.jar +JHALL = /home/shashank/scilab-master_5.5.2/thirdparty/jhall.jar +JLATEXMATH = /home/shashank/scilab-master_5.5.2/thirdparty/jlatexmath-1.0.3.jar +JLATEXMATH_FOP = /home/shashank/scilab-master_5.5.2/thirdparty/jlatexmath-fop-1.0.3.jar +JOGL2 = /home/shashank/scilab-master_5.5.2/thirdparty/jogl2.jar +JROSETTA_API = /home/shashank/scilab-master_5.5.2/thirdparty/jrosetta-API.jar +JROSETTA_ENGINE = /home/shashank/scilab-master_5.5.2/thirdparty/jrosetta-engine.jar +JUNIT4 = /usr/share/java/junit4.jar +LAPACK_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -llapack +LCOV = +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = -Wl,--no-as-needed +LIBICONV = -liconv +LIBINTL = +LIBM = -lm +LIBOBJS = +LIBS = -lpthread -ldl -lcurses -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LOGGING_LEVEL = SEVERE +LOOKS = /home/shashank/scilab-master_5.5.2/thirdparty/looks-2.1.1.jar +LTLIBICONV = -liconv +LTLIBINTL = +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing makeinfo +MANIFEST_TOOL = : +MATIO_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +MATIO_ENABLE = yes +MATIO_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lm -lz -lmatio -lhdf5 +MKDIR_P = /bin/mkdir -p +MPI_ENABLE = no +MSGCAT = /usr/bin/msgcat +MSGFMT = /usr/bin/msgfmt +MSGFMT_015 = /usr/bin/msgfmt +MSGMERGE = /usr/bin/msgmerge +NM = nm +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OCAMLC = ocamlc +OCAMLDEP = ocamldep +OCAMLLEX = ocamllex +OCAMLOPT = ocamlopt +OCAMLYACC = ocamlyacc +OPENMPI_CC = +OPENMPI_CFLAGS = +OPENMPI_CXX = +OPENMPI_CXXFLAGS = +OPENMPI_LIBS = +OPENMP_CFLAGS = -fopenmp +OPENMP_CXXFLAGS = -fopenmp +OPENMP_ENABLE = yes +OPENMP_LIBS = -lgomp -lstdc++ +OTOOL = +OTOOL64 = +PACKAGE = scilab +PACKAGE_BUGREPORT = http://bugzilla.scilab.org/ +PACKAGE_NAME = Scilab +PACKAGE_STRING = Scilab 5 +PACKAGE_TARNAME = scilab +PACKAGE_URL = +PACKAGE_VERSION = 5 +PATH_SEPARATOR = : +PCRE_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +PCRE_CONFIG = /home/shashank/scilab-master_5.5.2/usr/bin/pcre-config +PCRE_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lpcreposix -lpcre +PCRE_VERSION = 8.35 +PKG_CONFIG = /usr/bin/pkg-config +POSUB = po +POW_LIB = +PYTHON = +RANLIB = ranlib +RELOCATABLE = no +RT_LIB = -lrt +SAXON = /home/shashank/scilab-master_5.5.2/thirdparty/saxon9he.jar +SCILAB_BINARY_VERSION = 5.5.2 +SCILAB_LIBRARY_VERSION = 5:5:2 +SCILAB_VERSION_MAINTENANCE = 2 +SCILAB_VERSION_MAJOR = 5 +SCILAB_VERSION_MINOR = 5 +SCIRENDERER = ${modules.dir}/scirenderer/${build.jar.dir}/scirenderer.jar +SCIRENDERER_CP = $SCILAB/modules/scirenderer/jar/scirenderer.jar +SCI_CFLAGS = -D_LARGEFILE64_SOURCE -DNDEBUG -m64 -fno-stack-protector +SCI_CXXFLAGS = -DNDEBUG -fno-stack-protector +SCI_FFLAGS = -DNDEBUG -m64 -fPIC +SCI_LDFLAGS = +SED = /bin/sed +SET_MAKE = +SET_RELOCATABLE = +SHELL = /bin/bash +SKINLF = /home/shashank/scilab-master_5.5.2/thirdparty/skinlf.jar +SPLINT = no +STRIP = strip +SWIG_BIN = +SWIG_JAVA = +SWIG_RUNTIME_LIBS_DIR = +SWIG_SCILAB = +TCLTK_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -ltk8.5 -L/home/shashank/scilab-master_5.5.2/usr/lib -ltcl8.5 -ldl +TCL_INC_PATH = -I/home/shashank/scilab-master_5.5.2/usr/include +TK_INC_PATH = -I/home/shashank/scilab-master_5.5.2/usr/include +UMFPACK_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +UMFPACK_ENABLE = yes +UMFPACK_LIB = -L/home/shashank/scilab-master_5.5.2/usr/lib -lumfpack -lamd +USE_NLS = yes +VERSION = 5 +WITH_OCAML = +WITH_TKSCI = yes +XCOS_ENABLE = yes +XGETTEXT = /usr/bin/xgettext +XGETTEXT_015 = /usr/bin/xgettext +XGETTEXT_EXTRA_OPTIONS = +XMKMF = +XMLGRAPHICS_COMMONS = /home/shashank/scilab-master_5.5.2/thirdparty/xmlgraphics-commons-1.4.jar +XML_APIS_EXT = /home/shashank/scilab-master_5.5.2/thirdparty/xml-apis-ext.jar +XML_CONFIG = /home/shashank/scilab-master_5.5.2/usr/bin/xml2-config +XML_FLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include/libxml2 +XML_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lxml2 -L/home/scilab/work/linux-prerequisites-sources/trunk/Dev-Tools/SE/Prerequirements/linux_x64/usr/lib -lz -lm -ldl +XML_VERSION = 2.9.1 +X_CFLAGS = +X_EXTRA_LIBS = +X_LIBS = +X_PRE_LIBS = +abs_builddir = /home/shashank/scilab-master_5.5.2/modules/api_scilab +abs_srcdir = /home/shashank/scilab-master_5.5.2/modules/api_scilab +abs_top_builddir = /home/shashank/scilab-master_5.5.2 +abs_top_srcdir = /home/shashank/scilab-master_5.5.2 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +ac_ct_F77 = gfortran +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +cxx_present = yes +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/shashank/scilab-master_5.5.2/config/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +API_SCILAB_CXX_SOURCES = src/cpp/api_boolean.cpp \ +src/cpp/api_boolean_sparse.cpp \ +src/cpp/api_common.cpp \ +src/cpp/api_double.cpp \ +src/cpp/api_int.cpp \ +src/cpp/api_list.cpp \ +src/cpp/api_poly.cpp \ +src/cpp/api_sparse.cpp \ +src/cpp/api_string.cpp \ +src/cpp/api_pointer.cpp \ +src/cpp/api_handle.cpp \ +src/cpp/api_error.cpp \ +src/cpp/api_optional.cpp \ +src/cpp/api_hypermat.cpp + +libsciapi_scilab_la_CPPFLAGS = -I$(srcdir)/includes/ \ +-I$(srcdir)/src/cpp/ \ +-I$(top_srcdir)/modules/core/includes/ \ +-I$(top_srcdir)/modules/call_scilab/includes/ \ +-I$(top_srcdir)/modules/localization/includes/ \ +-I$(top_srcdir)/modules/output_stream/includes/ \ +-I$(top_srcdir)/modules/string/includes/ \ +$(AM_CPPFLAGS) + +#pkglib_LTLIBRARIES = libsciapi_scilab.la +noinst_LTLIBRARIES = libsciapi_scilab.la +libsciapi_scilab_la_SOURCES = $(API_SCILAB_C_SOURCES) $(API_SCILAB_CXX_SOURCES) + +# For the code check (splint) +CHECK_SRC = $(libsciapi_scilab_la_SOURCES) +INCLUDE_FLAGS = $(libsciapi_scilab_la_CPPFLAGS) +libsciapi_scilab_la_LIBADD = +# + +#### Target ###### +modulename = api_scilab + +#### api_scilab : Conf files #### +libsciapi_scilab_la_rootdir = $(mydatadir) +libsciapi_scilab_la_root_DATA = license.txt + +#### api_scilab : init scripts #### +libsciapi_scilab_la_etcdir = $(mydatadir)/etc +libsciapi_scilab_la_etc_DATA = etc/api_scilab.quit etc/api_scilab.start + +#### api_scilab : include files #### +libsciapi_scilab_la_includedir = $(pkgincludedir) +libsciapi_scilab_la_include_HEADERS = includes/api_boolean.h \ +includes/api_boolean_sparse.h \ +includes/api_common.h \ +includes/api_error.h \ +includes/api_double.h \ +includes/api_hypermat.h \ +includes/api_int.h \ +includes/api_list.h \ +includes/api_pointer.h \ +includes/api_poly.h \ +includes/api_sparse.h \ +includes/api_string.h \ +includes/api_handle.h \ +includes/api_optional.h \ +includes/api_scilab.h + + +# Where all the Scilab stuff is installed (macros, help, ...) +mydatadir = $(pkgdatadir)/modules/$(modulename) + +# Set AM_* SCI detected settings +AM_CPPFLAGS = $(SCI_CPPFLAGS) +AM_CFLAGS = $(SCI_CFLAGS) +AM_CXXFLAGS = $(SCI_CXXFLAGS) +# append includes to AM_FFLAGS to manage fortran includes +AM_FFLAGS = $(SCI_FFLAGS) -I$(top_srcdir)/modules/core/includes/ + +# Tag shared libraries with the Scilab version +AM_LDFLAGS = $(SCI_LDFLAGS) -version-number $(SCILAB_LIBRARY_VERSION) + +# splint options +SPLINT_OPTIONS = -weak -booltype BOOL + +########################### JAVA ###################################### +#### We are delegating java compilation to ant... Thanks to that +#### the procedure will be the same with Microsoft Windows (C) +#### and Linux/Unix +####################################################################### +TARGETS_ALL = $(am__append_1) + +################ MACROS ###################### +# Rule to build a macro +# NOT USED AT THE MOMENT +SUFFIXES = .sci + +########### INSTALL DOCUMENTATION ################### + +# Install documentation files into the right target +# We do not use the automake mechanism (libxxxx_la_help_fr_DATA) because +# automake needs the html files to be present which is not the case when +# we are building Scilab + +# Where it should be installed +pkgdocdir = $(mydatadir) + +# What is the mask of the help source +DOCMASKXML = *.xml + +# What is the mask of the MathML sources +DOCMASKMML = *.mml + +########### INSTALL DATA ################### +# Install macros, help & demos +# Where it should be installed +pkgmacrosdir = $(mydatadir) +# Which directory we process +MACRODIRS = macros/ +# Mask of the Scilab sources macros +MACROMASK = *.sci +# Mask of the Scilab executable sources macros +MACROBUILDMASK = *.sce +# Mask of the Scilab compiled macros +MACROBINMASK = *.bin +# List of the standard directory for tests +TESTS_DIR = tests/benchmarks tests/nonreg_tests tests/unit_tests tests/java +# Where the demos should be installed +pkgdemosdir = $(mydatadir) +# List of the standard directory for demos +DEMOS_DIR = demos +# List of the standard directory for examples +EXAMPLES_DIR = examples +# Where to export JAVA archives (.jar) +JARDIR = jar/ +# JAR files mask +JARMASK = *.jar +# Chapter file +HELP_CHAPTERDIR = help/ +HELP_CHAPTERFILE = addchapter.sce +HELP_CHAPTERLANG = en_US fr_FR pt_BR +all: all-am + +.SUFFIXES: +.SUFFIXES: .sci .bin .cpp .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(top_srcdir)/Makefile.incl.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/api_scilab/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign modules/api_scilab/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/Makefile.incl.am: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ + } + +uninstall-pkglibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +src/cpp/$(am__dirstamp): + @$(MKDIR_P) src/cpp + @: > src/cpp/$(am__dirstamp) +src/cpp/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/cpp/$(DEPDIR) + @: > src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_boolean.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo: \ + src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_common.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_double.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_int.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_list.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_poly.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_sparse.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_string.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_pointer.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_handle.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_error.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_optional.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_hypermat.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) + +libsciapi_scilab.la: $(libsciapi_scilab_la_OBJECTS) $(libsciapi_scilab_la_DEPENDENCIES) $(EXTRA_libsciapi_scilab_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) $(am_libsciapi_scilab_la_rpath) $(libsciapi_scilab_la_OBJECTS) $(libsciapi_scilab_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f src/cpp/*.$(OBJEXT) + -rm -f src/cpp/*.lo + +distclean-compile: + -rm -f *.tab.c + +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_sparse.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_common.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_double.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_optional.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_pointer.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_poly.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_sparse.Plo +include src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_string.Plo + +.cpp.o: + $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ + $(am__mv) $$depbase.Tpo $$depbase.Po +# $(AM_V_CXX)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: + $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ + $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ + $(am__mv) $$depbase.Tpo $$depbase.Po +# $(AM_V_CXX)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: + $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ + $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ + $(am__mv) $$depbase.Tpo $$depbase.Plo +# $(AM_V_CXX)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LTCXXCOMPILE) -c -o $@ $< + +src/cpp/libsciapi_scilab_la-api_boolean.lo: src/cpp/api_boolean.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_boolean.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean.Tpo -c -o src/cpp/libsciapi_scilab_la-api_boolean.lo `test -f 'src/cpp/api_boolean.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean.Plo +# $(AM_V_CXX)source='src/cpp/api_boolean.cpp' object='src/cpp/libsciapi_scilab_la-api_boolean.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_boolean.lo `test -f 'src/cpp/api_boolean.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean.cpp + +src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo: src/cpp/api_boolean_sparse.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_sparse.Tpo -c -o src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo `test -f 'src/cpp/api_boolean_sparse.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean_sparse.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_sparse.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_sparse.Plo +# $(AM_V_CXX)source='src/cpp/api_boolean_sparse.cpp' object='src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo `test -f 'src/cpp/api_boolean_sparse.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean_sparse.cpp + +src/cpp/libsciapi_scilab_la-api_common.lo: src/cpp/api_common.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_common.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_common.Tpo -c -o src/cpp/libsciapi_scilab_la-api_common.lo `test -f 'src/cpp/api_common.cpp' || echo '$(srcdir)/'`src/cpp/api_common.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_common.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_common.Plo +# $(AM_V_CXX)source='src/cpp/api_common.cpp' object='src/cpp/libsciapi_scilab_la-api_common.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_common.lo `test -f 'src/cpp/api_common.cpp' || echo '$(srcdir)/'`src/cpp/api_common.cpp + +src/cpp/libsciapi_scilab_la-api_double.lo: src/cpp/api_double.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_double.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_double.Tpo -c -o src/cpp/libsciapi_scilab_la-api_double.lo `test -f 'src/cpp/api_double.cpp' || echo '$(srcdir)/'`src/cpp/api_double.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_double.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_double.Plo +# $(AM_V_CXX)source='src/cpp/api_double.cpp' object='src/cpp/libsciapi_scilab_la-api_double.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_double.lo `test -f 'src/cpp/api_double.cpp' || echo '$(srcdir)/'`src/cpp/api_double.cpp + +src/cpp/libsciapi_scilab_la-api_int.lo: src/cpp/api_int.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_int.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Tpo -c -o src/cpp/libsciapi_scilab_la-api_int.lo `test -f 'src/cpp/api_int.cpp' || echo '$(srcdir)/'`src/cpp/api_int.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Plo +# $(AM_V_CXX)source='src/cpp/api_int.cpp' object='src/cpp/libsciapi_scilab_la-api_int.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_int.lo `test -f 'src/cpp/api_int.cpp' || echo '$(srcdir)/'`src/cpp/api_int.cpp + +src/cpp/libsciapi_scilab_la-api_list.lo: src/cpp/api_list.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_list.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Tpo -c -o src/cpp/libsciapi_scilab_la-api_list.lo `test -f 'src/cpp/api_list.cpp' || echo '$(srcdir)/'`src/cpp/api_list.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Plo +# $(AM_V_CXX)source='src/cpp/api_list.cpp' object='src/cpp/libsciapi_scilab_la-api_list.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_list.lo `test -f 'src/cpp/api_list.cpp' || echo '$(srcdir)/'`src/cpp/api_list.cpp + +src/cpp/libsciapi_scilab_la-api_poly.lo: src/cpp/api_poly.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_poly.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_poly.Tpo -c -o src/cpp/libsciapi_scilab_la-api_poly.lo `test -f 'src/cpp/api_poly.cpp' || echo '$(srcdir)/'`src/cpp/api_poly.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_poly.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_poly.Plo +# $(AM_V_CXX)source='src/cpp/api_poly.cpp' object='src/cpp/libsciapi_scilab_la-api_poly.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_poly.lo `test -f 'src/cpp/api_poly.cpp' || echo '$(srcdir)/'`src/cpp/api_poly.cpp + +src/cpp/libsciapi_scilab_la-api_sparse.lo: src/cpp/api_sparse.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_sparse.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_sparse.Tpo -c -o src/cpp/libsciapi_scilab_la-api_sparse.lo `test -f 'src/cpp/api_sparse.cpp' || echo '$(srcdir)/'`src/cpp/api_sparse.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_sparse.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_sparse.Plo +# $(AM_V_CXX)source='src/cpp/api_sparse.cpp' object='src/cpp/libsciapi_scilab_la-api_sparse.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_sparse.lo `test -f 'src/cpp/api_sparse.cpp' || echo '$(srcdir)/'`src/cpp/api_sparse.cpp + +src/cpp/libsciapi_scilab_la-api_string.lo: src/cpp/api_string.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_string.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_string.Tpo -c -o src/cpp/libsciapi_scilab_la-api_string.lo `test -f 'src/cpp/api_string.cpp' || echo '$(srcdir)/'`src/cpp/api_string.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_string.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_string.Plo +# $(AM_V_CXX)source='src/cpp/api_string.cpp' object='src/cpp/libsciapi_scilab_la-api_string.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_string.lo `test -f 'src/cpp/api_string.cpp' || echo '$(srcdir)/'`src/cpp/api_string.cpp + +src/cpp/libsciapi_scilab_la-api_pointer.lo: src/cpp/api_pointer.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_pointer.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_pointer.Tpo -c -o src/cpp/libsciapi_scilab_la-api_pointer.lo `test -f 'src/cpp/api_pointer.cpp' || echo '$(srcdir)/'`src/cpp/api_pointer.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_pointer.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_pointer.Plo +# $(AM_V_CXX)source='src/cpp/api_pointer.cpp' object='src/cpp/libsciapi_scilab_la-api_pointer.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_pointer.lo `test -f 'src/cpp/api_pointer.cpp' || echo '$(srcdir)/'`src/cpp/api_pointer.cpp + +src/cpp/libsciapi_scilab_la-api_handle.lo: src/cpp/api_handle.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_handle.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Tpo -c -o src/cpp/libsciapi_scilab_la-api_handle.lo `test -f 'src/cpp/api_handle.cpp' || echo '$(srcdir)/'`src/cpp/api_handle.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Plo +# $(AM_V_CXX)source='src/cpp/api_handle.cpp' object='src/cpp/libsciapi_scilab_la-api_handle.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_handle.lo `test -f 'src/cpp/api_handle.cpp' || echo '$(srcdir)/'`src/cpp/api_handle.cpp + +src/cpp/libsciapi_scilab_la-api_error.lo: src/cpp/api_error.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_error.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Tpo -c -o src/cpp/libsciapi_scilab_la-api_error.lo `test -f 'src/cpp/api_error.cpp' || echo '$(srcdir)/'`src/cpp/api_error.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Plo +# $(AM_V_CXX)source='src/cpp/api_error.cpp' object='src/cpp/libsciapi_scilab_la-api_error.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_error.lo `test -f 'src/cpp/api_error.cpp' || echo '$(srcdir)/'`src/cpp/api_error.cpp + +src/cpp/libsciapi_scilab_la-api_optional.lo: src/cpp/api_optional.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_optional.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_optional.Tpo -c -o src/cpp/libsciapi_scilab_la-api_optional.lo `test -f 'src/cpp/api_optional.cpp' || echo '$(srcdir)/'`src/cpp/api_optional.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_optional.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_optional.Plo +# $(AM_V_CXX)source='src/cpp/api_optional.cpp' object='src/cpp/libsciapi_scilab_la-api_optional.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_optional.lo `test -f 'src/cpp/api_optional.cpp' || echo '$(srcdir)/'`src/cpp/api_optional.cpp + +src/cpp/libsciapi_scilab_la-api_hypermat.lo: src/cpp/api_hypermat.cpp + $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_hypermat.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Tpo -c -o src/cpp/libsciapi_scilab_la-api_hypermat.lo `test -f 'src/cpp/api_hypermat.cpp' || echo '$(srcdir)/'`src/cpp/api_hypermat.cpp + $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Plo +# $(AM_V_CXX)source='src/cpp/api_hypermat.cpp' object='src/cpp/libsciapi_scilab_la-api_hypermat.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_hypermat.lo `test -f 'src/cpp/api_hypermat.cpp' || echo '$(srcdir)/'`src/cpp/api_hypermat.cpp + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf src/cpp/.libs src/cpp/_libs +install-libsciapi_scilab_la_etcDATA: $(libsciapi_scilab_la_etc_DATA) + @$(NORMAL_INSTALL) + @list='$(libsciapi_scilab_la_etc_DATA)'; test -n "$(libsciapi_scilab_la_etcdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libsciapi_scilab_la_etcdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libsciapi_scilab_la_etcdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libsciapi_scilab_la_etcdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(libsciapi_scilab_la_etcdir)" || exit $$?; \ + done + +uninstall-libsciapi_scilab_la_etcDATA: + @$(NORMAL_UNINSTALL) + @list='$(libsciapi_scilab_la_etc_DATA)'; test -n "$(libsciapi_scilab_la_etcdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libsciapi_scilab_la_etcdir)'; $(am__uninstall_files_from_dir) +install-libsciapi_scilab_la_rootDATA: $(libsciapi_scilab_la_root_DATA) + @$(NORMAL_INSTALL) + @list='$(libsciapi_scilab_la_root_DATA)'; test -n "$(libsciapi_scilab_la_rootdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libsciapi_scilab_la_rootdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libsciapi_scilab_la_rootdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libsciapi_scilab_la_rootdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(libsciapi_scilab_la_rootdir)" || exit $$?; \ + done + +uninstall-libsciapi_scilab_la_rootDATA: + @$(NORMAL_UNINSTALL) + @list='$(libsciapi_scilab_la_root_DATA)'; test -n "$(libsciapi_scilab_la_rootdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libsciapi_scilab_la_rootdir)'; $(am__uninstall_files_from_dir) +install-libsciapi_scilab_la_includeHEADERS: $(libsciapi_scilab_la_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(libsciapi_scilab_la_include_HEADERS)'; test -n "$(libsciapi_scilab_la_includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libsciapi_scilab_la_includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libsciapi_scilab_la_includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libsciapi_scilab_la_includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(libsciapi_scilab_la_includedir)" || exit $$?; \ + done + +uninstall-libsciapi_scilab_la_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(libsciapi_scilab_la_include_HEADERS)'; test -n "$(libsciapi_scilab_la_includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libsciapi_scilab_la_includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) all-local +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(libsciapi_scilab_la_etcdir)" "$(DESTDIR)$(libsciapi_scilab_la_rootdir)" "$(DESTDIR)$(libsciapi_scilab_la_includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f src/cpp/$(DEPDIR)/$(am__dirstamp) + -rm -f src/cpp/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local \ + clean-noinstLTLIBRARIES clean-pkglibLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf src/cpp/$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-local distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local \ + install-libsciapi_scilab_la_etcDATA \ + install-libsciapi_scilab_la_includeHEADERS \ + install-libsciapi_scilab_la_rootDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkglibLTLIBRARIES + +install-html: install-html-am + +install-html-am: install-html-local + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf src/cpp/$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libsciapi_scilab_la_etcDATA \ + uninstall-libsciapi_scilab_la_includeHEADERS \ + uninstall-libsciapi_scilab_la_rootDATA \ + uninstall-pkglibLTLIBRARIES + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am \ + check-local clean clean-generic clean-libtool clean-local \ + clean-noinstLTLIBRARIES clean-pkglibLTLIBRARIES cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-local distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-data-local install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-html-local install-info \ + install-info-am install-libsciapi_scilab_la_etcDATA \ + install-libsciapi_scilab_la_includeHEADERS \ + install-libsciapi_scilab_la_rootDATA install-man install-pdf \ + install-pdf-am install-pkglibLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-libsciapi_scilab_la_etcDATA \ + uninstall-libsciapi_scilab_la_includeHEADERS \ + uninstall-libsciapi_scilab_la_rootDATA \ + uninstall-pkglibLTLIBRARIES + + +# This target enables tests for Scilab +check-local: $(top_builddir)/scilab-bin test + if test -d $(mydatadir)/tests; then \ + @COMMAND="try test_run('$(modulename)');catch exit(-1);end;exit(0)"; export LANG=C; $(top_builddir)/bin/scilab -nwni -nb -e "$$COMMAND"; \ + fi +check-code: + if test -f build.xml; then \ + $(ANT) checkstyle; \ + fi + if test -x "$(SPLINT)"; then \ + $(SPLINT) $(SPLINT_OPTIONS) -I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/ $(INCLUDE_FLAGS) $(CHECK_SRC); \ + fi +java: +# Some configurations needs to export JAVA_HOME in the current env + @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \ + if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ + if test -f build.xml -a $$USEANT -eq 1; then \ + $(ANT); \ + fi + +clean-java: +# Some configurations needs to export JAVA_HOME in the current env + @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \ + if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ + if test -f build.xml -a $$USEANT -eq 1; then \ + $(ANT) clean; \ + fi; + +# If the user request for the SWIG generation of the wrappers Java => C/C++ +# We call the target swig-build on the variable SWIG_WRAPPERS + +#swig: $(SWIG_WRAPPERS) +# @SWIG_PACKAGENAME=org.scilab.modules.$(modulename); \ +# SWIG_OUTDIR=src/java/org/scilab/modules/$(modulename)/; \ +# if test -n "$(SWIG_WRAPPERS)"; then \ +# for file in $(SWIG_WRAPPERS) ; do \ +# echo "Swig process of $$file (Java) ..."; \ +# $(SWIG_BIN) $(SWIG_JAVA) -package $$SWIG_PACKAGENAME -outdir $$SWIG_OUTDIR $$file; \ +# done; \ +# fi + +#swig-scilab: $(SWIG_SCILAB_WRAPPERS) +# @SWIG_OUTDIR=src/swig/; \ +# if test -n "$(SWIG_SCILAB_WRAPPERS)"; then \ +# for file in $(SWIG_SCILAB_WRAPPERS) ; do \ +# echo "Swig process of $$file (Scilab) ..."; \ +# $(SWIG_BIN) $(SWIG_SCILAB) -outdir $$SWIG_OUTDIR $$file; \ +# done; \ +# fi + +# If the user request for the SWIG generation of the wrappers Java => C/C++ +# We call the target swig-build on the variable SWIG_WRAPPERS + +#giws: $(GIWS_WRAPPERS) +# @GIWS_OUTPUTDIR=src/jni/; \ +# MANDATORY_OPTIONS="--throws-exception-on-error --description-file"; \ +# if test -n "$(GIWS_WRAPPERS)"; then \ +# for file in $(GIWS_WRAPPERS) ; do \ +# echo "GIWS process of $$file ..."; \ +# if test -z "$(GIWS_OPTIONS)"; then \ +# $(GIWS_BIN) --disable-return-size-array --output-dir $$GIWS_OUTPUTDIR $$MANDATORY_OPTIONS $$file; \ +# else \ +# echo "Custom GIWS call with '$$GIWS_OPTIONS'"; \ +# $(GIWS_BIN) $$GIWS_OPTIONS --output-dir $$GIWS_OUTPUTDIR $$MANDATORY_OPTIONS $$file; \ +# fi \ +# done; \ +# fi + +#giws-exception: +# @GIWS_OUTPUTDIR=src/jni/;\ +# echo "GIWS: Generation of exception class ..."; \ +# $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR + +macros: + -@( if test ! -x $(top_builddir)/scilab-bin; then \ + echo "Error : Cannot build $< : Scilab has not been built"; \ + else \ + $(top_builddir)/bin/scilab -ns -nwni -e "exec('macros/buildmacros.sce');quit;";\ + fi) + +# Removes the macros +clean-macros: +# Removes macros (*.bin generated from .sci) + @for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ + echo "rm -f $(builddir)/$$dir/$(MACROBINMASK)"; \ + rm -f $(builddir)/$$dir/$(MACROBINMASK); \ + done + +test: +# More tests could be added here + @if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ + if test -f build.xml -a $$USEANT -eq 1; then \ + $(ANT) test; \ + fi + +all-local: $(TARGETS_ALL) + +.sci.bin: + -@( if test ! -x $(top_builddir)/scilab-bin; then \ + echo "Error : Cannot build $< : Scilab has not been build"; \ + else \ + echo "Creating $@"; \ + $(top_builddir)/bin/scilab -ns -nwni -e "exec('$(abs_srcdir)/$<');save('$(abs_srcdir)/$@');exit;"; \ + fi ) + +install-html-local: + +install-data-local-local: +# Mainly for javasci + @if test -d $(srcdir)/javadoc; then \ + cp -R $(srcdir)/javadoc $(DESTDIR)/$(mydatadir)/; \ + fi +# If the user wants the help sources to be installed + @echo "-------- Install of XML sources of help files --------"; \ + for lang in $(ALL_LINGUAS); do \ + if test -d $(srcdir)/help/$$lang; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/$$lang && \ + if ls -lLd $(srcdir)/help/$$lang/$(DOCMASKXML) >/dev/null 2>&1; then \ + for file in $(srcdir)/help/$$lang/$(DOCMASKXML) ; do \ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/$$lang" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/$$lang ; \ + done ; \ + fi; \ + fi; \ + done; \ + @echo "-------- Install of MathML sources --------"; \ + if test -d $(srcdir)/help/mml/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/mml/ && \ + if ls -lLd $(srcdir)/help/mml/$(DOCMASKMML) >/dev/null 2>&1; then \ + for file in $(srcdir)/help/mml/$(DOCMASKMML) ; do \ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/mml" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/mml ; \ + done ; \ + fi; \ + fi +install-data-local: +# Install the tests + @echo "-------- Install tests (if any) --------"; \ + for dir in $(TESTS_DIR) $(TESTS_DIREXT) ; do \ + if test -d $(srcdir)/$$dir/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ + for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \ + if test -d "$(srcdir)/$$dir/$$file"; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir/$$file; \ + $(mkinstalldirs) "$(DESTDIR)$(pkgmacrosdir)/$$dir/$$file"; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \ + $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \ + fi \ + done; \ + fi; \ + done +# Install the help chapter + @echo "-------- Install the help chapter (if any) --------"; \ + for lang in $(HELP_CHAPTERLANG); do \ + HELPFILE=$(srcdir)/$(HELP_CHAPTERDIR)$$lang/$(HELP_CHAPTERFILE); \ + if test -f $$HELPFILE; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \ + echo $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \ + $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \ + fi; \ + done +# Install the demos & examples + @echo "-------- Install demos & examples (if any) --------"; \ + for dir in $(DEMOS_DIR) $(DEMOS_DIREXT) $(EXAMPLES_DIR) $(EXAMPLES_DIREXT) ; do \ + if test -d $(srcdir)/$$dir/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ + for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \ + if test -d "$(srcdir)/$$dir/$$file"; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir/$$file; \ + $(mkinstalldirs) "$(DESTDIR)$(pkgdocdir)/$$dir/$$file"; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \ + $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \ + fi \ + done; \ + fi; \ + done +# Install the macros + @echo "-------- Install macros (if any) --------"; \ + for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ + $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ + if test -d $(srcdir)/$$dir/; then \ + FILELIST="$(srcdir)/$$dir/$(MACROMASK) $(srcdir)/$$dir/$(MACROBINMASK) $(srcdir)/$$dir/$(MACROBUILDMASK) $(srcdir)/$$dir/names $(srcdir)/$$dir/lib";\ + if test -n "$(MACROSSPECIALEXT)"; then \ + specialExtDir=""; \ + for specialExt in $(MACROSSPECIALEXT); do \ + specialExtDir="$$specialExtDir $(srcdir)/$$dir/$$specialExt"; \ + done; \ + FILELIST="$$FILELIST $$specialExtDir"; \ + fi; \ + for file in `ls -1 $$FILELIST 2>/dev/null`; do \ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgmacrosdir)/$$dir" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgmacrosdir)/$$dir ; \ + done; \ + fi; \ + done +# Install java files (.jar) + @if ls -lLd $(srcdir)/$(JARDIR)$(JARMASK) >/dev/null 2>&1; then \ + echo "-------- Install jar files --------"; \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(JARDIR); \ + for file in $(srcdir)/$(JARDIR)$(JARMASK); do\ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$(JARDIR)" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$(JARDIR) ; \ + done ; \ + fi + +########### CLEAN ################### +# Clean help (generated automatically by Scilab) +# It used to clean the macro (clean-macros) but this was causing +# make clean && make to fail Scilab startup +clean-local: clean-java +#clean-local: + +distclean-local: + rm -f $(builddir)/help/*/.last_successful_build_javaHelp $(builddir)/help/*/.list_* + +.PHONY: macros java swig giws + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/modules/api_scilab/Makefile.am b/modules/api_scilab/Makefile.am new file mode 100755 index 000000000..9e0fc4083 --- /dev/null +++ b/modules/api_scilab/Makefile.am @@ -0,0 +1,85 @@ +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2009 - Digiteo - Allan CORNET +# +# This file is distributed under the same license as the Scilab package. + +### SOURCES ### + + +API_SCILAB_CXX_SOURCES = src/cpp/api_boolean.cpp \ +src/cpp/api_boolean_sparse.cpp \ +src/cpp/api_common.cpp \ +src/cpp/api_double.cpp \ +src/cpp/api_int.cpp \ +src/cpp/api_list.cpp \ +src/cpp/api_poly.cpp \ +src/cpp/api_sparse.cpp \ +src/cpp/api_string.cpp \ +src/cpp/api_pointer.cpp \ +src/cpp/api_handle.cpp \ +src/cpp/api_error.cpp \ +src/cpp/api_optional.cpp \ +src/cpp/api_hypermat.cpp + + +libsciapi_scilab_la_CPPFLAGS=-I$(srcdir)/includes/ \ +-I$(srcdir)/src/cpp/ \ +-I$(top_srcdir)/modules/core/includes/ \ +-I$(top_srcdir)/modules/call_scilab/includes/ \ +-I$(top_srcdir)/modules/localization/includes/ \ +-I$(top_srcdir)/modules/output_stream/includes/ \ +-I$(top_srcdir)/modules/string/includes/ \ +$(AM_CPPFLAGS) + + +if MAINTAINER_MODE +pkglib_LTLIBRARIES = libsciapi_scilab.la +else +noinst_LTLIBRARIES = libsciapi_scilab.la +endif + + + +libsciapi_scilab_la_SOURCES = $(API_SCILAB_C_SOURCES) $(API_SCILAB_CXX_SOURCES) + +# For the code check (splint) +CHECK_SRC= $(libsciapi_scilab_la_SOURCES) +INCLUDE_FLAGS = $(libsciapi_scilab_la_CPPFLAGS) + +libsciapi_scilab_la_LIBADD = +# + + +#### Target ###### +modulename=api_scilab + + +#### api_scilab : Conf files #### +libsciapi_scilab_la_rootdir = $(mydatadir) +libsciapi_scilab_la_root_DATA = license.txt + + +#### api_scilab : init scripts #### +libsciapi_scilab_la_etcdir = $(mydatadir)/etc +libsciapi_scilab_la_etc_DATA = etc/api_scilab.quit etc/api_scilab.start + + +#### api_scilab : include files #### +libsciapi_scilab_la_includedir=$(pkgincludedir) +libsciapi_scilab_la_include_HEADERS = includes/api_boolean.h \ +includes/api_boolean_sparse.h \ +includes/api_common.h \ +includes/api_error.h \ +includes/api_double.h \ +includes/api_hypermat.h \ +includes/api_int.h \ +includes/api_list.h \ +includes/api_pointer.h \ +includes/api_poly.h \ +includes/api_sparse.h \ +includes/api_string.h \ +includes/api_handle.h \ +includes/api_optional.h \ +includes/api_scilab.h + +include $(top_srcdir)/Makefile.incl.am diff --git a/modules/api_scilab/Makefile.in b/modules/api_scilab/Makefile.in new file mode 100755 index 000000000..f7551fe6a --- /dev/null +++ b/modules/api_scilab/Makefile.in @@ -0,0 +1,1449 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2009 - Digiteo - Allan CORNET +# +# This file is distributed under the same license as the Scilab package. + +### SOURCES ### + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2006-2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +# Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +# +# 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 +# + +########## +### Makefile included stuff +### Target, variable, suffixes which are supposed to be useful in every makefile.am +########## + + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/Makefile.incl.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/config/mkinstalldirs \ + $(top_srcdir)/config/depcomp \ + $(libsciapi_scilab_la_include_HEADERS) +@NEED_JAVA_TRUE@am__append_1 = java +subdir = modules/api_scilab +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/backtrace.m4 \ + $(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/curl.m4 \ + $(top_srcdir)/m4/docbook.m4 $(top_srcdir)/m4/doxygen.m4 \ + $(top_srcdir)/m4/fftw.m4 $(top_srcdir)/m4/fortran.m4 \ + $(top_srcdir)/m4/giws.m4 $(top_srcdir)/m4/hdf5.m4 \ + $(top_srcdir)/m4/intel_compiler.m4 \ + $(top_srcdir)/m4/java-thirdparty.m4 $(top_srcdir)/m4/java.m4 \ + $(top_srcdir)/m4/largefile.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/libsmath.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/libxml2.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/macosx.m4 \ + $(top_srcdir)/m4/mpi.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/m4/pcre.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/relocatable.m4 $(top_srcdir)/m4/swig.m4 \ + $(top_srcdir)/m4/symlinks.m4 $(top_srcdir)/m4/tcltk.m4 \ + $(top_srcdir)/m4/umfpack.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/modules/core/includes/machine.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkglibdir)" \ + "$(DESTDIR)$(libsciapi_scilab_la_etcdir)" \ + "$(DESTDIR)$(libsciapi_scilab_la_rootdir)" \ + "$(DESTDIR)$(libsciapi_scilab_la_includedir)" +LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES) +libsciapi_scilab_la_DEPENDENCIES = +am__dirstamp = $(am__leading_dot)dirstamp +am__objects_1 = src/cpp/libsciapi_scilab_la-api_boolean.lo \ + src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo \ + src/cpp/libsciapi_scilab_la-api_common.lo \ + src/cpp/libsciapi_scilab_la-api_double.lo \ + src/cpp/libsciapi_scilab_la-api_int.lo \ + src/cpp/libsciapi_scilab_la-api_list.lo \ + src/cpp/libsciapi_scilab_la-api_poly.lo \ + src/cpp/libsciapi_scilab_la-api_sparse.lo \ + src/cpp/libsciapi_scilab_la-api_string.lo \ + src/cpp/libsciapi_scilab_la-api_pointer.lo \ + src/cpp/libsciapi_scilab_la-api_handle.lo \ + src/cpp/libsciapi_scilab_la-api_error.lo \ + src/cpp/libsciapi_scilab_la-api_optional.lo \ + src/cpp/libsciapi_scilab_la-api_hypermat.lo +am_libsciapi_scilab_la_OBJECTS = $(am__objects_1) +libsciapi_scilab_la_OBJECTS = $(am_libsciapi_scilab_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +@MAINTAINER_MODE_FALSE@am_libsciapi_scilab_la_rpath = +@MAINTAINER_MODE_TRUE@am_libsciapi_scilab_la_rpath = -rpath \ +@MAINTAINER_MODE_TRUE@ $(pkglibdir) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/modules/core/includes +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libsciapi_scilab_la_SOURCES) +DIST_SOURCES = $(libsciapi_scilab_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(libsciapi_scilab_la_etc_DATA) \ + $(libsciapi_scilab_la_root_DATA) +HEADERS = $(libsciapi_scilab_la_include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +ALL_LINGUAS_DOC = @ALL_LINGUAS_DOC@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ANT = @ANT@ +ANTLR = @ANTLR@ +AR = @AR@ +ARPACK_LIBS = @ARPACK_LIBS@ +ASM3 = @ASM3@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AVALON_FRAMEWORK = @AVALON_FRAMEWORK@ +AWK = @AWK@ +BATIK = @BATIK@ +BLAS_LIBS = @BLAS_LIBS@ +CC = @CC@ +CCACHE = @CCACHE@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECKSTYLE = @CHECKSTYLE@ +COBERTURA = @COBERTURA@ +COMMONS_BEANUTILS = @COMMONS_BEANUTILS@ +COMMONS_IO = @COMMONS_IO@ +COMMONS_LOGGING = @COMMONS_LOGGING@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_CONFIG = @CURL_CONFIG@ +CURL_LIBS = @CURL_LIBS@ +CURL_VERSION = @CURL_VERSION@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEMOTOOLS_ENABLE = @DEMOTOOLS_ENABLE@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DOXYGEN_BIN = @DOXYGEN_BIN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECJ = @ECJ@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FFTW3_LIB = @FFTW3_LIB@ +FFTW_ENABLE = @FFTW_ENABLE@ +FGREP = @FGREP@ +FLEXDOCK = @FLEXDOCK@ +FLIBS = @FLIBS@ +FOP = @FOP@ +FREEHEP_GRAPHICS2D = @FREEHEP_GRAPHICS2D@ +FREEHEP_GRAPHICSIO = @FREEHEP_GRAPHICSIO@ +FREEHEP_GRAPHICSIO_EMF = @FREEHEP_GRAPHICSIO_EMF@ +FREEHEP_IO = @FREEHEP_IO@ +FREEHEP_UTIL = @FREEHEP_UTIL@ +GENHTML = @GENHTML@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GIWS_BIN = @GIWS_BIN@ +GLUEGEN2_RT = @GLUEGEN2_RT@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GRAPHICS_ENABLE = @GRAPHICS_ENABLE@ +GREP = @GREP@ +GUI_ENABLE = @GUI_ENABLE@ +HDF5_CFLAGS = @HDF5_CFLAGS@ +HDF5_LIBS = @HDF5_LIBS@ +HELP_ENABLE = @HELP_ENABLE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +JAR = @JAR@ +JAVA = @JAVA@ +JAVAC = @JAVAC@ +JAVAC_DEBUG = @JAVAC_DEBUG@ +JAVADOC = @JAVADOC@ +JAVAH = @JAVAH@ +JAVASCI_ENABLE = @JAVASCI_ENABLE@ +JAVA_ENABLE = @JAVA_ENABLE@ +JAVA_G = @JAVA_G@ +JAVA_HOME = @JAVA_HOME@ +JAVA_JNI_INCLUDE = @JAVA_JNI_INCLUDE@ +JAVA_JNI_LIBS = @JAVA_JNI_LIBS@ +JDB = @JDB@ +JEUCLID_CORE = @JEUCLID_CORE@ +JGRAPHX = @JGRAPHX@ +JHALL = @JHALL@ +JLATEXMATH = @JLATEXMATH@ +JLATEXMATH_FOP = @JLATEXMATH_FOP@ +JOGL2 = @JOGL2@ +JROSETTA_API = @JROSETTA_API@ +JROSETTA_ENGINE = @JROSETTA_ENGINE@ +JUNIT4 = @JUNIT4@ +LAPACK_LIBS = @LAPACK_LIBS@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOGGING_LEVEL = @LOGGING_LEVEL@ +LOOKS = @LOOKS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MATIO_CFLAGS = @MATIO_CFLAGS@ +MATIO_ENABLE = @MATIO_ENABLE@ +MATIO_LIBS = @MATIO_LIBS@ +MKDIR_P = @MKDIR_P@ +MPI_ENABLE = @MPI_ENABLE@ +MSGCAT = @MSGCAT@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAMLC = @OCAMLC@ +OCAMLDEP = @OCAMLDEP@ +OCAMLLEX = @OCAMLLEX@ +OCAMLOPT = @OCAMLOPT@ +OCAMLYACC = @OCAMLYACC@ +OPENMPI_CC = @OPENMPI_CC@ +OPENMPI_CFLAGS = @OPENMPI_CFLAGS@ +OPENMPI_CXX = @OPENMPI_CXX@ +OPENMPI_CXXFLAGS = @OPENMPI_CXXFLAGS@ +OPENMPI_LIBS = @OPENMPI_LIBS@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ +OPENMP_ENABLE = @OPENMP_ENABLE@ +OPENMP_LIBS = @OPENMP_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCRE_CFLAGS = @PCRE_CFLAGS@ +PCRE_CONFIG = @PCRE_CONFIG@ +PCRE_LIBS = @PCRE_LIBS@ +PCRE_VERSION = @PCRE_VERSION@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +POW_LIB = @POW_LIB@ +PYTHON = @PYTHON@ +RANLIB = @RANLIB@ +RELOCATABLE = @RELOCATABLE@ +RT_LIB = @RT_LIB@ +SAXON = @SAXON@ +SCILAB_BINARY_VERSION = @SCILAB_BINARY_VERSION@ +SCILAB_LIBRARY_VERSION = @SCILAB_LIBRARY_VERSION@ +SCILAB_VERSION_MAINTENANCE = @SCILAB_VERSION_MAINTENANCE@ +SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@ +SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@ +SCIRENDERER = @SCIRENDERER@ +SCIRENDERER_CP = @SCIRENDERER_CP@ +SCI_CFLAGS = @SCI_CFLAGS@ +SCI_CXXFLAGS = @SCI_CXXFLAGS@ +SCI_FFLAGS = @SCI_FFLAGS@ +SCI_LDFLAGS = @SCI_LDFLAGS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SET_RELOCATABLE = @SET_RELOCATABLE@ +SHELL = @SHELL@ +SKINLF = @SKINLF@ +SPLINT = @SPLINT@ +STRIP = @STRIP@ +SWIG_BIN = @SWIG_BIN@ +SWIG_JAVA = @SWIG_JAVA@ +SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ +SWIG_SCILAB = @SWIG_SCILAB@ +TCLTK_LIBS = @TCLTK_LIBS@ +TCL_INC_PATH = @TCL_INC_PATH@ +TK_INC_PATH = @TK_INC_PATH@ +UMFPACK_CFLAGS = @UMFPACK_CFLAGS@ +UMFPACK_ENABLE = @UMFPACK_ENABLE@ +UMFPACK_LIB = @UMFPACK_LIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WITH_OCAML = @WITH_OCAML@ +WITH_TKSCI = @WITH_TKSCI@ +XCOS_ENABLE = @XCOS_ENABLE@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +XMLGRAPHICS_COMMONS = @XMLGRAPHICS_COMMONS@ +XML_APIS_EXT = @XML_APIS_EXT@ +XML_CONFIG = @XML_CONFIG@ +XML_FLAGS = @XML_FLAGS@ +XML_LIBS = @XML_LIBS@ +XML_VERSION = @XML_VERSION@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cxx_present = @cxx_present@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +API_SCILAB_CXX_SOURCES = src/cpp/api_boolean.cpp \ +src/cpp/api_boolean_sparse.cpp \ +src/cpp/api_common.cpp \ +src/cpp/api_double.cpp \ +src/cpp/api_int.cpp \ +src/cpp/api_list.cpp \ +src/cpp/api_poly.cpp \ +src/cpp/api_sparse.cpp \ +src/cpp/api_string.cpp \ +src/cpp/api_pointer.cpp \ +src/cpp/api_handle.cpp \ +src/cpp/api_error.cpp \ +src/cpp/api_optional.cpp \ +src/cpp/api_hypermat.cpp + +libsciapi_scilab_la_CPPFLAGS = -I$(srcdir)/includes/ \ +-I$(srcdir)/src/cpp/ \ +-I$(top_srcdir)/modules/core/includes/ \ +-I$(top_srcdir)/modules/call_scilab/includes/ \ +-I$(top_srcdir)/modules/localization/includes/ \ +-I$(top_srcdir)/modules/output_stream/includes/ \ +-I$(top_srcdir)/modules/string/includes/ \ +$(AM_CPPFLAGS) + +@MAINTAINER_MODE_TRUE@pkglib_LTLIBRARIES = libsciapi_scilab.la +@MAINTAINER_MODE_FALSE@noinst_LTLIBRARIES = libsciapi_scilab.la +libsciapi_scilab_la_SOURCES = $(API_SCILAB_C_SOURCES) $(API_SCILAB_CXX_SOURCES) + +# For the code check (splint) +CHECK_SRC = $(libsciapi_scilab_la_SOURCES) +INCLUDE_FLAGS = $(libsciapi_scilab_la_CPPFLAGS) +libsciapi_scilab_la_LIBADD = +# + +#### Target ###### +modulename = api_scilab + +#### api_scilab : Conf files #### +libsciapi_scilab_la_rootdir = $(mydatadir) +libsciapi_scilab_la_root_DATA = license.txt + +#### api_scilab : init scripts #### +libsciapi_scilab_la_etcdir = $(mydatadir)/etc +libsciapi_scilab_la_etc_DATA = etc/api_scilab.quit etc/api_scilab.start + +#### api_scilab : include files #### +libsciapi_scilab_la_includedir = $(pkgincludedir) +libsciapi_scilab_la_include_HEADERS = includes/api_boolean.h \ +includes/api_boolean_sparse.h \ +includes/api_common.h \ +includes/api_error.h \ +includes/api_double.h \ +includes/api_hypermat.h \ +includes/api_int.h \ +includes/api_list.h \ +includes/api_pointer.h \ +includes/api_poly.h \ +includes/api_sparse.h \ +includes/api_string.h \ +includes/api_handle.h \ +includes/api_optional.h \ +includes/api_scilab.h + + +# Where all the Scilab stuff is installed (macros, help, ...) +mydatadir = $(pkgdatadir)/modules/$(modulename) + +# Set AM_* SCI detected settings +AM_CPPFLAGS = $(SCI_CPPFLAGS) +AM_CFLAGS = $(SCI_CFLAGS) +AM_CXXFLAGS = $(SCI_CXXFLAGS) +# append includes to AM_FFLAGS to manage fortran includes +AM_FFLAGS = $(SCI_FFLAGS) -I$(top_srcdir)/modules/core/includes/ + +# Tag shared libraries with the Scilab version +AM_LDFLAGS = $(SCI_LDFLAGS) -version-number $(SCILAB_LIBRARY_VERSION) + +# splint options +SPLINT_OPTIONS = -weak -booltype BOOL + +########################### JAVA ###################################### +#### We are delegating java compilation to ant... Thanks to that +#### the procedure will be the same with Microsoft Windows (C) +#### and Linux/Unix +####################################################################### +TARGETS_ALL = $(am__append_1) + +################ MACROS ###################### +# Rule to build a macro +# NOT USED AT THE MOMENT +SUFFIXES = .sci + +########### INSTALL DOCUMENTATION ################### + +# Install documentation files into the right target +# We do not use the automake mechanism (libxxxx_la_help_fr_DATA) because +# automake needs the html files to be present which is not the case when +# we are building Scilab + +# Where it should be installed +pkgdocdir = $(mydatadir) + +# What is the mask of the help source +DOCMASKXML = *.xml + +# What is the mask of the MathML sources +DOCMASKMML = *.mml + +########### INSTALL DATA ################### +# Install macros, help & demos +# Where it should be installed +pkgmacrosdir = $(mydatadir) +# Which directory we process +MACRODIRS = macros/ +# Mask of the Scilab sources macros +MACROMASK = *.sci +# Mask of the Scilab executable sources macros +MACROBUILDMASK = *.sce +# Mask of the Scilab compiled macros +MACROBINMASK = *.bin +# List of the standard directory for tests +TESTS_DIR = tests/benchmarks tests/nonreg_tests tests/unit_tests tests/java +# Where the demos should be installed +pkgdemosdir = $(mydatadir) +# List of the standard directory for demos +DEMOS_DIR = demos +# List of the standard directory for examples +EXAMPLES_DIR = examples +# Where to export JAVA archives (.jar) +JARDIR = jar/ +# JAR files mask +JARMASK = *.jar +# Chapter file +HELP_CHAPTERDIR = help/ +HELP_CHAPTERFILE = addchapter.sce +HELP_CHAPTERLANG = en_US fr_FR pt_BR +all: all-am + +.SUFFIXES: +.SUFFIXES: .sci .bin .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.incl.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/api_scilab/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign modules/api_scilab/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/Makefile.incl.am: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ + } + +uninstall-pkglibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +src/cpp/$(am__dirstamp): + @$(MKDIR_P) src/cpp + @: > src/cpp/$(am__dirstamp) +src/cpp/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/cpp/$(DEPDIR) + @: > src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_boolean.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo: \ + src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_common.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_double.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_int.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_list.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_poly.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_sparse.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_string.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_pointer.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_handle.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_error.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_optional.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) +src/cpp/libsciapi_scilab_la-api_hypermat.lo: src/cpp/$(am__dirstamp) \ + src/cpp/$(DEPDIR)/$(am__dirstamp) + +libsciapi_scilab.la: $(libsciapi_scilab_la_OBJECTS) $(libsciapi_scilab_la_DEPENDENCIES) $(EXTRA_libsciapi_scilab_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) $(am_libsciapi_scilab_la_rpath) $(libsciapi_scilab_la_OBJECTS) $(libsciapi_scilab_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f src/cpp/*.$(OBJEXT) + -rm -f src/cpp/*.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_sparse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_common.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_double.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_optional.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_pointer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_poly.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_sparse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_string.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +src/cpp/libsciapi_scilab_la-api_boolean.lo: src/cpp/api_boolean.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_boolean.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean.Tpo -c -o src/cpp/libsciapi_scilab_la-api_boolean.lo `test -f 'src/cpp/api_boolean.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_boolean.cpp' object='src/cpp/libsciapi_scilab_la-api_boolean.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_boolean.lo `test -f 'src/cpp/api_boolean.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean.cpp + +src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo: src/cpp/api_boolean_sparse.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_sparse.Tpo -c -o src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo `test -f 'src/cpp/api_boolean_sparse.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean_sparse.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_sparse.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_sparse.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_boolean_sparse.cpp' object='src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo `test -f 'src/cpp/api_boolean_sparse.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean_sparse.cpp + +src/cpp/libsciapi_scilab_la-api_common.lo: src/cpp/api_common.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_common.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_common.Tpo -c -o src/cpp/libsciapi_scilab_la-api_common.lo `test -f 'src/cpp/api_common.cpp' || echo '$(srcdir)/'`src/cpp/api_common.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_common.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_common.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_common.cpp' object='src/cpp/libsciapi_scilab_la-api_common.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_common.lo `test -f 'src/cpp/api_common.cpp' || echo '$(srcdir)/'`src/cpp/api_common.cpp + +src/cpp/libsciapi_scilab_la-api_double.lo: src/cpp/api_double.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_double.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_double.Tpo -c -o src/cpp/libsciapi_scilab_la-api_double.lo `test -f 'src/cpp/api_double.cpp' || echo '$(srcdir)/'`src/cpp/api_double.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_double.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_double.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_double.cpp' object='src/cpp/libsciapi_scilab_la-api_double.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_double.lo `test -f 'src/cpp/api_double.cpp' || echo '$(srcdir)/'`src/cpp/api_double.cpp + +src/cpp/libsciapi_scilab_la-api_int.lo: src/cpp/api_int.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_int.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Tpo -c -o src/cpp/libsciapi_scilab_la-api_int.lo `test -f 'src/cpp/api_int.cpp' || echo '$(srcdir)/'`src/cpp/api_int.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_int.cpp' object='src/cpp/libsciapi_scilab_la-api_int.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_int.lo `test -f 'src/cpp/api_int.cpp' || echo '$(srcdir)/'`src/cpp/api_int.cpp + +src/cpp/libsciapi_scilab_la-api_list.lo: src/cpp/api_list.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_list.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Tpo -c -o src/cpp/libsciapi_scilab_la-api_list.lo `test -f 'src/cpp/api_list.cpp' || echo '$(srcdir)/'`src/cpp/api_list.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_list.cpp' object='src/cpp/libsciapi_scilab_la-api_list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_list.lo `test -f 'src/cpp/api_list.cpp' || echo '$(srcdir)/'`src/cpp/api_list.cpp + +src/cpp/libsciapi_scilab_la-api_poly.lo: src/cpp/api_poly.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_poly.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_poly.Tpo -c -o src/cpp/libsciapi_scilab_la-api_poly.lo `test -f 'src/cpp/api_poly.cpp' || echo '$(srcdir)/'`src/cpp/api_poly.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_poly.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_poly.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_poly.cpp' object='src/cpp/libsciapi_scilab_la-api_poly.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_poly.lo `test -f 'src/cpp/api_poly.cpp' || echo '$(srcdir)/'`src/cpp/api_poly.cpp + +src/cpp/libsciapi_scilab_la-api_sparse.lo: src/cpp/api_sparse.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_sparse.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_sparse.Tpo -c -o src/cpp/libsciapi_scilab_la-api_sparse.lo `test -f 'src/cpp/api_sparse.cpp' || echo '$(srcdir)/'`src/cpp/api_sparse.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_sparse.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_sparse.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_sparse.cpp' object='src/cpp/libsciapi_scilab_la-api_sparse.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_sparse.lo `test -f 'src/cpp/api_sparse.cpp' || echo '$(srcdir)/'`src/cpp/api_sparse.cpp + +src/cpp/libsciapi_scilab_la-api_string.lo: src/cpp/api_string.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_string.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_string.Tpo -c -o src/cpp/libsciapi_scilab_la-api_string.lo `test -f 'src/cpp/api_string.cpp' || echo '$(srcdir)/'`src/cpp/api_string.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_string.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_string.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_string.cpp' object='src/cpp/libsciapi_scilab_la-api_string.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_string.lo `test -f 'src/cpp/api_string.cpp' || echo '$(srcdir)/'`src/cpp/api_string.cpp + +src/cpp/libsciapi_scilab_la-api_pointer.lo: src/cpp/api_pointer.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_pointer.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_pointer.Tpo -c -o src/cpp/libsciapi_scilab_la-api_pointer.lo `test -f 'src/cpp/api_pointer.cpp' || echo '$(srcdir)/'`src/cpp/api_pointer.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_pointer.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_pointer.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_pointer.cpp' object='src/cpp/libsciapi_scilab_la-api_pointer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_pointer.lo `test -f 'src/cpp/api_pointer.cpp' || echo '$(srcdir)/'`src/cpp/api_pointer.cpp + +src/cpp/libsciapi_scilab_la-api_handle.lo: src/cpp/api_handle.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_handle.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Tpo -c -o src/cpp/libsciapi_scilab_la-api_handle.lo `test -f 'src/cpp/api_handle.cpp' || echo '$(srcdir)/'`src/cpp/api_handle.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_handle.cpp' object='src/cpp/libsciapi_scilab_la-api_handle.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_handle.lo `test -f 'src/cpp/api_handle.cpp' || echo '$(srcdir)/'`src/cpp/api_handle.cpp + +src/cpp/libsciapi_scilab_la-api_error.lo: src/cpp/api_error.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_error.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Tpo -c -o src/cpp/libsciapi_scilab_la-api_error.lo `test -f 'src/cpp/api_error.cpp' || echo '$(srcdir)/'`src/cpp/api_error.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_error.cpp' object='src/cpp/libsciapi_scilab_la-api_error.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_error.lo `test -f 'src/cpp/api_error.cpp' || echo '$(srcdir)/'`src/cpp/api_error.cpp + +src/cpp/libsciapi_scilab_la-api_optional.lo: src/cpp/api_optional.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_optional.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_optional.Tpo -c -o src/cpp/libsciapi_scilab_la-api_optional.lo `test -f 'src/cpp/api_optional.cpp' || echo '$(srcdir)/'`src/cpp/api_optional.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_optional.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_optional.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_optional.cpp' object='src/cpp/libsciapi_scilab_la-api_optional.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_optional.lo `test -f 'src/cpp/api_optional.cpp' || echo '$(srcdir)/'`src/cpp/api_optional.cpp + +src/cpp/libsciapi_scilab_la-api_hypermat.lo: src/cpp/api_hypermat.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_hypermat.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Tpo -c -o src/cpp/libsciapi_scilab_la-api_hypermat.lo `test -f 'src/cpp/api_hypermat.cpp' || echo '$(srcdir)/'`src/cpp/api_hypermat.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/api_hypermat.cpp' object='src/cpp/libsciapi_scilab_la-api_hypermat.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_hypermat.lo `test -f 'src/cpp/api_hypermat.cpp' || echo '$(srcdir)/'`src/cpp/api_hypermat.cpp + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf src/cpp/.libs src/cpp/_libs +install-libsciapi_scilab_la_etcDATA: $(libsciapi_scilab_la_etc_DATA) + @$(NORMAL_INSTALL) + @list='$(libsciapi_scilab_la_etc_DATA)'; test -n "$(libsciapi_scilab_la_etcdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libsciapi_scilab_la_etcdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libsciapi_scilab_la_etcdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libsciapi_scilab_la_etcdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(libsciapi_scilab_la_etcdir)" || exit $$?; \ + done + +uninstall-libsciapi_scilab_la_etcDATA: + @$(NORMAL_UNINSTALL) + @list='$(libsciapi_scilab_la_etc_DATA)'; test -n "$(libsciapi_scilab_la_etcdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libsciapi_scilab_la_etcdir)'; $(am__uninstall_files_from_dir) +install-libsciapi_scilab_la_rootDATA: $(libsciapi_scilab_la_root_DATA) + @$(NORMAL_INSTALL) + @list='$(libsciapi_scilab_la_root_DATA)'; test -n "$(libsciapi_scilab_la_rootdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libsciapi_scilab_la_rootdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libsciapi_scilab_la_rootdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libsciapi_scilab_la_rootdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(libsciapi_scilab_la_rootdir)" || exit $$?; \ + done + +uninstall-libsciapi_scilab_la_rootDATA: + @$(NORMAL_UNINSTALL) + @list='$(libsciapi_scilab_la_root_DATA)'; test -n "$(libsciapi_scilab_la_rootdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libsciapi_scilab_la_rootdir)'; $(am__uninstall_files_from_dir) +install-libsciapi_scilab_la_includeHEADERS: $(libsciapi_scilab_la_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(libsciapi_scilab_la_include_HEADERS)'; test -n "$(libsciapi_scilab_la_includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libsciapi_scilab_la_includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libsciapi_scilab_la_includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libsciapi_scilab_la_includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(libsciapi_scilab_la_includedir)" || exit $$?; \ + done + +uninstall-libsciapi_scilab_la_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(libsciapi_scilab_la_include_HEADERS)'; test -n "$(libsciapi_scilab_la_includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libsciapi_scilab_la_includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) all-local +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(libsciapi_scilab_la_etcdir)" "$(DESTDIR)$(libsciapi_scilab_la_rootdir)" "$(DESTDIR)$(libsciapi_scilab_la_includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f src/cpp/$(DEPDIR)/$(am__dirstamp) + -rm -f src/cpp/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local \ + clean-noinstLTLIBRARIES clean-pkglibLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf src/cpp/$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-local distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local \ + install-libsciapi_scilab_la_etcDATA \ + install-libsciapi_scilab_la_includeHEADERS \ + install-libsciapi_scilab_la_rootDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkglibLTLIBRARIES + +install-html: install-html-am + +install-html-am: install-html-local + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf src/cpp/$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libsciapi_scilab_la_etcDATA \ + uninstall-libsciapi_scilab_la_includeHEADERS \ + uninstall-libsciapi_scilab_la_rootDATA \ + uninstall-pkglibLTLIBRARIES + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am \ + check-local clean clean-generic clean-libtool clean-local \ + clean-noinstLTLIBRARIES clean-pkglibLTLIBRARIES cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-local distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-data-local install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-html-local install-info \ + install-info-am install-libsciapi_scilab_la_etcDATA \ + install-libsciapi_scilab_la_includeHEADERS \ + install-libsciapi_scilab_la_rootDATA install-man install-pdf \ + install-pdf-am install-pkglibLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-libsciapi_scilab_la_etcDATA \ + uninstall-libsciapi_scilab_la_includeHEADERS \ + uninstall-libsciapi_scilab_la_rootDATA \ + uninstall-pkglibLTLIBRARIES + + +# This target enables tests for Scilab +check-local: $(top_builddir)/scilab-bin test + if test -d $(mydatadir)/tests; then \ + @COMMAND="try test_run('$(modulename)');catch exit(-1);end;exit(0)"; export LANG=C; $(top_builddir)/bin/scilab -nwni -nb -e "$$COMMAND"; \ + fi +check-code: + if test -f build.xml; then \ + $(ANT) checkstyle; \ + fi + if test -x "$(SPLINT)"; then \ + $(SPLINT) $(SPLINT_OPTIONS) -I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/ $(INCLUDE_FLAGS) $(CHECK_SRC); \ + fi +@NEED_JAVA_TRUE@java: +# Some configurations needs to export JAVA_HOME in the current env +@NEED_JAVA_TRUE@ @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \ +@NEED_JAVA_TRUE@ if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ +@NEED_JAVA_TRUE@ if test -f build.xml -a $$USEANT -eq 1; then \ +@NEED_JAVA_TRUE@ $(ANT); \ +@NEED_JAVA_TRUE@ fi + +@NEED_JAVA_TRUE@clean-java: +# Some configurations needs to export JAVA_HOME in the current env +@NEED_JAVA_TRUE@ @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \ +@NEED_JAVA_TRUE@ if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ +@NEED_JAVA_TRUE@ if test -f build.xml -a $$USEANT -eq 1; then \ +@NEED_JAVA_TRUE@ $(ANT) clean; \ +@NEED_JAVA_TRUE@ fi; + +# If the user request for the SWIG generation of the wrappers Java => C/C++ +# We call the target swig-build on the variable SWIG_WRAPPERS + +@SWIG_TRUE@swig: $(SWIG_WRAPPERS) +@SWIG_TRUE@ @SWIG_PACKAGENAME=org.scilab.modules.$(modulename); \ +@SWIG_TRUE@ SWIG_OUTDIR=src/java/org/scilab/modules/$(modulename)/; \ +@SWIG_TRUE@ if test -n "$(SWIG_WRAPPERS)"; then \ +@SWIG_TRUE@ for file in $(SWIG_WRAPPERS) ; do \ +@SWIG_TRUE@ echo "Swig process of $$file (Java) ..."; \ +@SWIG_TRUE@ $(SWIG_BIN) $(SWIG_JAVA) -package $$SWIG_PACKAGENAME -outdir $$SWIG_OUTDIR $$file; \ +@SWIG_TRUE@ done; \ +@SWIG_TRUE@ fi + +@SWIG_TRUE@swig-scilab: $(SWIG_SCILAB_WRAPPERS) +@SWIG_TRUE@ @SWIG_OUTDIR=src/swig/; \ +@SWIG_TRUE@ if test -n "$(SWIG_SCILAB_WRAPPERS)"; then \ +@SWIG_TRUE@ for file in $(SWIG_SCILAB_WRAPPERS) ; do \ +@SWIG_TRUE@ echo "Swig process of $$file (Scilab) ..."; \ +@SWIG_TRUE@ $(SWIG_BIN) $(SWIG_SCILAB) -outdir $$SWIG_OUTDIR $$file; \ +@SWIG_TRUE@ done; \ +@SWIG_TRUE@ fi + +# If the user request for the SWIG generation of the wrappers Java => C/C++ +# We call the target swig-build on the variable SWIG_WRAPPERS + +@GIWS_TRUE@giws: $(GIWS_WRAPPERS) +@GIWS_TRUE@ @GIWS_OUTPUTDIR=src/jni/; \ +@GIWS_TRUE@ MANDATORY_OPTIONS="--throws-exception-on-error --description-file"; \ +@GIWS_TRUE@ if test -n "$(GIWS_WRAPPERS)"; then \ +@GIWS_TRUE@ for file in $(GIWS_WRAPPERS) ; do \ +@GIWS_TRUE@ echo "GIWS process of $$file ..."; \ +@GIWS_TRUE@ if test -z "$(GIWS_OPTIONS)"; then \ +@GIWS_TRUE@ $(GIWS_BIN) --disable-return-size-array --output-dir $$GIWS_OUTPUTDIR $$MANDATORY_OPTIONS $$file; \ +@GIWS_TRUE@ else \ +@GIWS_TRUE@ echo "Custom GIWS call with '$$GIWS_OPTIONS'"; \ +@GIWS_TRUE@ $(GIWS_BIN) $$GIWS_OPTIONS --output-dir $$GIWS_OUTPUTDIR $$MANDATORY_OPTIONS $$file; \ +@GIWS_TRUE@ fi \ +@GIWS_TRUE@ done; \ +@GIWS_TRUE@ fi + +@GIWS_TRUE@giws-exception: +@GIWS_TRUE@ @GIWS_OUTPUTDIR=src/jni/;\ +@GIWS_TRUE@ echo "GIWS: Generation of exception class ..."; \ +@GIWS_TRUE@ $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR + +macros: + -@( if test ! -x $(top_builddir)/scilab-bin; then \ + echo "Error : Cannot build $< : Scilab has not been built"; \ + else \ + $(top_builddir)/bin/scilab -ns -nwni -e "exec('macros/buildmacros.sce');quit;";\ + fi) + +# Removes the macros +clean-macros: +# Removes macros (*.bin generated from .sci) + @for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ + echo "rm -f $(builddir)/$$dir/$(MACROBINMASK)"; \ + rm -f $(builddir)/$$dir/$(MACROBINMASK); \ + done + +test: +# More tests could be added here + @if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ + if test -f build.xml -a $$USEANT -eq 1; then \ + $(ANT) test; \ + fi + +all-local: $(TARGETS_ALL) + +.sci.bin: + -@( if test ! -x $(top_builddir)/scilab-bin; then \ + echo "Error : Cannot build $< : Scilab has not been build"; \ + else \ + echo "Creating $@"; \ + $(top_builddir)/bin/scilab -ns -nwni -e "exec('$(abs_srcdir)/$<');save('$(abs_srcdir)/$@');exit;"; \ + fi ) + +install-html-local: + +install-data-local-local: +# Mainly for javasci + @if test -d $(srcdir)/javadoc; then \ + cp -R $(srcdir)/javadoc $(DESTDIR)/$(mydatadir)/; \ + fi +# If the user wants the help sources to be installed +@INSTALL_HELP_XML_TRUE@ @echo "-------- Install of XML sources of help files --------"; \ +@INSTALL_HELP_XML_TRUE@ for lang in $(ALL_LINGUAS); do \ +@INSTALL_HELP_XML_TRUE@ if test -d $(srcdir)/help/$$lang; then \ +@INSTALL_HELP_XML_TRUE@ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/$$lang && \ +@INSTALL_HELP_XML_TRUE@ if ls -lLd $(srcdir)/help/$$lang/$(DOCMASKXML) >/dev/null 2>&1; then \ +@INSTALL_HELP_XML_TRUE@ for file in $(srcdir)/help/$$lang/$(DOCMASKXML) ; do \ +@INSTALL_HELP_XML_TRUE@ echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/$$lang" ; \ +@INSTALL_HELP_XML_TRUE@ $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/$$lang ; \ +@INSTALL_HELP_XML_TRUE@ done ; \ +@INSTALL_HELP_XML_TRUE@ fi; \ +@INSTALL_HELP_XML_TRUE@ fi; \ +@INSTALL_HELP_XML_TRUE@ done; \ +@INSTALL_HELP_XML_TRUE@ @echo "-------- Install of MathML sources --------"; \ +@INSTALL_HELP_XML_TRUE@ if test -d $(srcdir)/help/mml/; then \ +@INSTALL_HELP_XML_TRUE@ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/mml/ && \ +@INSTALL_HELP_XML_TRUE@ if ls -lLd $(srcdir)/help/mml/$(DOCMASKMML) >/dev/null 2>&1; then \ +@INSTALL_HELP_XML_TRUE@ for file in $(srcdir)/help/mml/$(DOCMASKMML) ; do \ +@INSTALL_HELP_XML_TRUE@ echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/mml" ; \ +@INSTALL_HELP_XML_TRUE@ $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/mml ; \ +@INSTALL_HELP_XML_TRUE@ done ; \ +@INSTALL_HELP_XML_TRUE@ fi; \ +@INSTALL_HELP_XML_TRUE@ fi +install-data-local: +# Install the tests + @echo "-------- Install tests (if any) --------"; \ + for dir in $(TESTS_DIR) $(TESTS_DIREXT) ; do \ + if test -d $(srcdir)/$$dir/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ + for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \ + if test -d "$(srcdir)/$$dir/$$file"; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir/$$file; \ + $(mkinstalldirs) "$(DESTDIR)$(pkgmacrosdir)/$$dir/$$file"; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \ + $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \ + fi \ + done; \ + fi; \ + done +# Install the help chapter + @echo "-------- Install the help chapter (if any) --------"; \ + for lang in $(HELP_CHAPTERLANG); do \ + HELPFILE=$(srcdir)/$(HELP_CHAPTERDIR)$$lang/$(HELP_CHAPTERFILE); \ + if test -f $$HELPFILE; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \ + echo $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \ + $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \ + fi; \ + done +# Install the demos & examples + @echo "-------- Install demos & examples (if any) --------"; \ + for dir in $(DEMOS_DIR) $(DEMOS_DIREXT) $(EXAMPLES_DIR) $(EXAMPLES_DIREXT) ; do \ + if test -d $(srcdir)/$$dir/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ + for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \ + if test -d "$(srcdir)/$$dir/$$file"; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir/$$file; \ + $(mkinstalldirs) "$(DESTDIR)$(pkgdocdir)/$$dir/$$file"; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \ + $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \ + fi \ + done; \ + fi; \ + done +# Install the macros + @echo "-------- Install macros (if any) --------"; \ + for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ + $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ + if test -d $(srcdir)/$$dir/; then \ + FILELIST="$(srcdir)/$$dir/$(MACROMASK) $(srcdir)/$$dir/$(MACROBINMASK) $(srcdir)/$$dir/$(MACROBUILDMASK) $(srcdir)/$$dir/names $(srcdir)/$$dir/lib";\ + if test -n "$(MACROSSPECIALEXT)"; then \ + specialExtDir=""; \ + for specialExt in $(MACROSSPECIALEXT); do \ + specialExtDir="$$specialExtDir $(srcdir)/$$dir/$$specialExt"; \ + done; \ + FILELIST="$$FILELIST $$specialExtDir"; \ + fi; \ + for file in `ls -1 $$FILELIST 2>/dev/null`; do \ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgmacrosdir)/$$dir" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgmacrosdir)/$$dir ; \ + done; \ + fi; \ + done +# Install java files (.jar) + @if ls -lLd $(srcdir)/$(JARDIR)$(JARMASK) >/dev/null 2>&1; then \ + echo "-------- Install jar files --------"; \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(JARDIR); \ + for file in $(srcdir)/$(JARDIR)$(JARMASK); do\ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$(JARDIR)" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$(JARDIR) ; \ + done ; \ + fi + +########### CLEAN ################### +# Clean help (generated automatically by Scilab) +# It used to clean the macro (clean-macros) but this was causing +# make clean && make to fail Scilab startup +@NEED_JAVA_TRUE@clean-local: clean-java +@NEED_JAVA_FALSE@clean-local: + +distclean-local: + rm -f $(builddir)/help/*/.last_successful_build_javaHelp $(builddir)/help/*/.list_* + +.PHONY: macros java swig giws + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/modules/api_scilab/Scilab_windows_Import.def b/modules/api_scilab/Scilab_windows_Import.def new file mode 100755 index 000000000..323775088 --- /dev/null +++ b/modules/api_scilab/Scilab_windows_Import.def @@ -0,0 +1,8 @@ +LIBRARY scilab_windows.dll + + +EXPORTS +; --------------------------------------- +; scilab_windows +; --------------------------------------- +strdup_windows diff --git a/modules/api_scilab/String_Import.def b/modules/api_scilab/String_Import.def new file mode 100755 index 000000000..ae80e0ebc --- /dev/null +++ b/modules/api_scilab/String_Import.def @@ -0,0 +1,6 @@ +LIBRARY string.dll + + +EXPORTS +code2str +str2code
\ No newline at end of file diff --git a/modules/api_scilab/api_scilab.iss b/modules/api_scilab/api_scilab.iss new file mode 100755 index 000000000..bd15e8e7f --- /dev/null +++ b/modules/api_scilab/api_scilab.iss @@ -0,0 +1,38 @@ +; +; Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +; Copyright (C) DIGITEO - 2010 - Allan CORNET +; +; 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 +; +;-------------------------------------------------------------------------------------------------------------- +; Inno Setup Script (5.3 and more) for Scilab (UNICODE version required) +; +;-------------------------------------------------------------------------------------------------------------- +; api_scilab module +;-------------------------------------------------------------------------------------------------------------- +; +#define API_SCILAB "api_scilab" +; +Source: bin\{#API_SCILAB}.dll; DestDir: {app}\bin; Components: {#COMPN_SCILAB} +Source: bin\{#API_SCILAB}.lib; DestDir: {app}\bin; Components: {#COMPN_SCILAB} +; +Source: modules\{#API_SCILAB}\license.txt; DestDir: {app}\modules\{#API_SCILAB}; Components: {#COMPN_SCILAB} +; +Source: modules\{#API_SCILAB}\includes\*.h; DestDir: {app}\modules\{#API_SCILAB}\includes; Components: {#COMPN_SCILAB} +; +Source: modules\{#API_SCILAB}\etc\{#API_SCILAB}.quit; DestDir: {app}\modules\{#API_SCILAB}\etc; Components: {#COMPN_SCILAB} +Source: modules\{#API_SCILAB}\etc\{#API_SCILAB}.start; DestDir: {app}\modules\{#API_SCILAB}\etc; Components: {#COMPN_SCILAB} +; +Source: modules\{#API_SCILAB}\macros\buildmacros.sce; DestDir: {app}\modules\{#API_SCILAB}\macros; Components: {#COMPN_SCILAB} +Source: modules\{#API_SCILAB}\macros\buildmacros.bat; DestDir: {app}\modules\{#API_SCILAB}\macros; Components: {#COMPN_SCILAB} +Source: modules\{#API_SCILAB}\macros\cleanmacros.bat; DestDir: {app}\modules\{#API_SCILAB}\macros; Components: {#COMPN_SCILAB} +; +;Source: modules\{#API_SCILAB}\examples\*.*; DestDir: {app}\modules\{#API_SCILAB}\examples; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +; +Source: modules\{#API_SCILAB}\tests\*.*; DestDir: {app}\modules\{#API_SCILAB}\tests; Flags: recursesubdirs; Components: {#COMPN_SCILAB} and {#COMPN_TESTS} +; +;-------------------------------------------------------------------------------------------------------------- diff --git a/modules/api_scilab/api_scilab.vcxproj b/modules/api_scilab/api_scilab.vcxproj new file mode 100755 index 000000000..ffbec784c --- /dev/null +++ b/modules/api_scilab/api_scilab.vcxproj @@ -0,0 +1,333 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{43C5BAB1-1DCA-4743-A183-77E0D42FE7D0}</ProjectGuid> + <RootNamespace>api_scilab</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>includes;src/c;../core/includes;../call_scilab/includes;../string/includes;../output_stream/includes;../localization/includes;../../libs/intl;../windows_tools/includes;../elementary_functions/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;API_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>cd $(IntDir) >nul +for %%f in (*.obj) do ..\..\..\bin\dumpexts -o %%~nf.def -n api_scilab.dll %%f >nul +copy *.def api_scilabtmp.def >nul +copy ..\api_scilab_header.def+api_scilabtmp.def ..\api_scilab_export.def >nul +del *.def >nul +cd .. >nul</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>elementary_functions_f.lib;linpack_f.lib;core.lib;string.lib;scilocalization.lib;scilab_windows.lib;core_f.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <ModuleDefinitionFile>api_scilab_export.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + <PreBuildEvent> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilab_windows.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)linpack_f.lib" 1>NUL 2>NUL +</Command> + <Message>Make dependencies</Message> + </PreBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>includes;src/c;../core/includes;../call_scilab/includes;../string/includes;../output_stream/includes;../localization/includes;../../libs/intl;../windows_tools/includes;../elementary_functions/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;API_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>cd $(IntDir) >nul +for %%f in (*.obj) do ..\..\..\bin\dumpexts -o %%~nf.def -n api_scilab.dll %%f >nul +copy *.def api_scilabtmp.def >nul +copy ..\api_scilab_header.def+api_scilabtmp.def ..\api_scilab_export.def >nul +del *.def >nul +cd .. >nul</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>elementary_functions_f.lib;linpack_f.lib;core.lib;string.lib;scilocalization.lib;scilab_windows.lib;core_f.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <ModuleDefinitionFile>api_scilab_export.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + <PreBuildEvent> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilab_windows.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)linpack_f.lib" 1>NUL 2>NUL +</Command> + <Message>Make dependencies</Message> + </PreBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>includes;src/c;../core/includes;../call_scilab/includes;../string/includes;../output_stream/includes;../localization/includes;../../libs/intl;../windows_tools/includes;../elementary_functions/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;API_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>cd $(IntDir) >nul +for %%f in (*.obj) do ..\..\..\bin\dumpexts -o %%~nf.def -n api_scilab.dll %%f >nul +copy *.def api_scilabtmp.def >nul +copy ..\api_scilab_header.def+api_scilabtmp.def ..\api_scilab_export.def >nul +del *.def >nul +cd .. >nul</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>elementary_functions_f.lib;linpack_f.lib;core.lib;string.lib;scilocalization.lib;scilab_windows.lib;core_f.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <ModuleDefinitionFile>api_scilab_export.def</ModuleDefinitionFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + <PreBuildEvent> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilab_windows.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)linpack_f.lib" 1>NUL 2>NUL +</Command> + <Message>Make dependencies</Message> + </PreBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>includes;src/c;../core/includes;../call_scilab/includes;../string/includes;../output_stream/includes;../localization/includes;../../libs/intl;../windows_tools/includes;../elementary_functions/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;API_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>cd $(IntDir) >nul +for %%f in (*.obj) do ..\..\..\bin\dumpexts -o %%~nf.def -n api_scilab.dll %%f >nul +copy *.def api_scilabtmp.def >nul +copy ..\api_scilab_header.def+api_scilabtmp.def ..\api_scilab_export.def >nul +del *.def >nul +cd .. >nul</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>elementary_functions_f.lib;linpack_f.lib;core.lib;string.lib;scilocalization.lib;scilab_windows.lib;core_f.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <ModuleDefinitionFile>api_scilab_export.def</ModuleDefinitionFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + <PreBuildEvent> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)String_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)string.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilab_windows.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)core_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core_f.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)linpack_f.lib" 1>NUL 2>NUL +</Command> + <Message>Make dependencies</Message> + </PreBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="src\cpp\api_boolean.cpp" /> + <ClCompile Include="src\cpp\api_boolean_sparse.cpp" /> + <ClCompile Include="src\cpp\api_common.cpp" /> + <ClCompile Include="src\cpp\api_double.cpp" /> + <ClCompile Include="src\cpp\api_error.cpp" /> + <ClCompile Include="src\cpp\api_handle.cpp" /> + <ClCompile Include="src\cpp\api_hypermat.cpp" /> + <ClCompile Include="src\cpp\api_int.cpp" /> + <ClCompile Include="src\cpp\api_list.cpp" /> + <ClCompile Include="src\cpp\api_optional.cpp" /> + <ClCompile Include="src\cpp\api_pointer.cpp" /> + <ClCompile Include="src\cpp\api_poly.cpp" /> + <ClCompile Include="src\cpp\api_sparse.cpp" /> + <ClCompile Include="src\cpp\api_string.cpp" /> + <ClCompile Include="src\c\DllmainApi_scilab.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="includes\api_boolean.h" /> + <ClInclude Include="includes\api_boolean_sparse.h" /> + <ClInclude Include="includes\api_common.h" /> + <ClInclude Include="includes\api_double.h" /> + <ClInclude Include="includes\api_error.h" /> + <ClInclude Include="includes\api_handle.h" /> + <ClInclude Include="includes\api_hypermat.h" /> + <ClInclude Include="includes\api_int.h" /> + <ClInclude Include="includes\api_internal_handle.h" /> + <ClInclude Include="includes\api_optional.h" /> + <ClInclude Include="src\cpp\api_internal_boolean.h" /> + <ClInclude Include="src\cpp\api_internal_boolean_sparse.h" /> + <ClInclude Include="src\cpp\api_internal_common.h" /> + <ClInclude Include="src\cpp\api_internal_double.h" /> + <ClInclude Include="src\cpp\api_internal_int.h" /> + <ClInclude Include="src\cpp\api_internal_pointer.h" /> + <ClInclude Include="src\cpp\api_internal_poly.h" /> + <ClInclude Include="src\cpp\api_internal_sparse.h" /> + <ClInclude Include="src\cpp\api_internal_string.h" /> + <ClInclude Include="includes\api_list.h" /> + <ClInclude Include="includes\api_pointer.h" /> + <ClInclude Include="includes\api_poly.h" /> + <ClInclude Include="includes\api_scilab.h" /> + <ClInclude Include="includes\api_sparse.h" /> + <ClInclude Include="includes\api_string.h" /> + <ClInclude Include="includes\dynlib_api_scilab.h" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="src\c\api_scilab.rc" /> + </ItemGroup> + <ItemGroup> + <None Include="Core_f_Import.def" /> + <None Include="core_import.def" /> + <None Include="elementary_functions_f_Import.def" /> + <None Include="linpack_f_Import.def" /> + <None Include="locales\api_scilab.pot" /> + <None Include="Localization_Import.def" /> + <None Include="Scilab_windows_Import.def" /> + <None Include="String_Import.def" /> + <None Include="api_scilab_export.def" /> + <None Include="api_scilab_header.def" /> + <None Include="api_scilab.iss" /> + <None Include="Makefile.am" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\tools\Dumpexts\Dumpexts.vcxproj"> + <Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\output_stream\src\c\output_stream.vcxproj"> + <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/api_scilab/api_scilab.vcxproj.filters b/modules/api_scilab/api_scilab.vcxproj.filters new file mode 100755 index 000000000..3f2f650ed --- /dev/null +++ b/modules/api_scilab/api_scilab.vcxproj.filters @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="localization"> + <UniqueIdentifier>{15edb4c6-d082-4cbe-9dff-d8ec59b8000b}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies"> + <UniqueIdentifier>{464ed1fa-a4c4-4f6d-b93a-fdd224b948dc}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies\Imports"> + <UniqueIdentifier>{b932a4d2-93a8-4158-baf6-1c16745c908f}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies\Export"> + <UniqueIdentifier>{e48e7300-dca0-44e2-b801-cb27b30871fe}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\cpp\api_boolean.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_boolean_sparse.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_common.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_double.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_error.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_int.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_list.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_pointer.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_poly.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_sparse.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_string.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\c\DllmainApi_scilab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_handle.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_optional.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\cpp\api_hypermat.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="includes\api_boolean.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_boolean_sparse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_common.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_double.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_error.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_boolean.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_boolean_sparse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_common.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_double.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_pointer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_poly.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_sparse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\cpp\api_internal_string.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_list.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_pointer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_poly.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_scilab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_sparse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_string.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\dynlib_api_scilab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_handle.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_internal_handle.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_optional.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="includes\api_hypermat.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="src\c\api_scilab.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> + <ItemGroup> + <None Include="core_import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="Localization_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="Scilab_windows_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="String_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="api_scilab_export.def"> + <Filter>Libraries Dependencies\Export</Filter> + </None> + <None Include="api_scilab_header.def"> + <Filter>Libraries Dependencies\Export</Filter> + </None> + <None Include="api_scilab.iss" /> + <None Include="Makefile.am" /> + <None Include="locales\api_scilab.pot"> + <Filter>localization</Filter> + </None> + <None Include="Core_f_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="elementary_functions_f_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="linpack_f_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/api_scilab/api_scilab_header.def b/modules/api_scilab/api_scilab_header.def new file mode 100755 index 000000000..d19faaaef --- /dev/null +++ b/modules/api_scilab/api_scilab_header.def @@ -0,0 +1,9 @@ +LIBRARY api_scilab.dll + + + +EXPORTS +; --------------------------------------- +; api_scilab explicit export (SEP 35) +; --------------------------------------- +pvApiCtx DATA diff --git a/modules/api_scilab/core_Import.def b/modules/api_scilab/core_Import.def new file mode 100755 index 000000000..83e814333 --- /dev/null +++ b/modules/api_scilab/core_Import.def @@ -0,0 +1,25 @@ +LIBRARY core.dll + + +EXPORTS +;core +intersci_ +str2name_ +vstk_ +com_ +putlhsvar_ +recu_ +overload_ +stack_ +iop_ +vGetPointerFromDoubleComplex +oGetDoubleComplexFromPointer +getExecMode +getstackinfo_ +freeArrayOfString +isopt_ +numopt_ +SciToF77 +MyHeapAlloc +MyHeapFree + diff --git a/modules/api_scilab/elementary_functions_f_Import.def b/modules/api_scilab/elementary_functions_f_Import.def new file mode 100755 index 000000000..30aed3aa5 --- /dev/null +++ b/modules/api_scilab/elementary_functions_f_Import.def @@ -0,0 +1,5 @@ +LIBRARY elementary_functions_f.dll + + +EXPORTS +entier_
\ No newline at end of file diff --git a/modules/api_scilab/etc/api_scilab.quit b/modules/api_scilab/etc/api_scilab.quit new file mode 100755 index 000000000..ab83f0c89 --- /dev/null +++ b/modules/api_scilab/etc/api_scilab.quit @@ -0,0 +1,10 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA +// Copyright (C) 2009 - DIGITEO +// +// 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 + diff --git a/modules/api_scilab/etc/api_scilab.start b/modules/api_scilab/etc/api_scilab.start new file mode 100755 index 000000000..5c8a760a5 --- /dev/null +++ b/modules/api_scilab/etc/api_scilab.start @@ -0,0 +1,9 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Allan CORNET +// +// 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 + diff --git a/modules/api_scilab/help/en_US/addchapter.sce b/modules/api_scilab/help/en_US/addchapter.sce new file mode 100755 index 000000000..8726a369b --- /dev/null +++ b/modules/api_scilab/help/en_US/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// 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 + +add_help_chapter("API Scilab",SCI+"/modules/api_scilab/help/en_US",%T); + diff --git a/modules/api_scilab/help/en_US/api_scilab.xml b/modules/api_scilab/help/en_US/api_scilab.xml new file mode 100755 index 000000000..fcf7b7e9a --- /dev/null +++ b/modules/api_scilab/help/en_US/api_scilab.xml @@ -0,0 +1,297 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="api_scilab" scilab:needs-examples="no" xml:lang="en"> + <refnamediv> + <refname>api_scilab</refname> + <refpurpose>api_scilab is the Scilab interface to read/write data from/to Scilab memory </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>Since Scilab 5.2.0, Scilab provides a consistent, documented and easy way API. + </para> + <para>This API provides functions to read/write data from/to Scilab memory.</para> + <para>It provides many advantages:</para> + <itemizedlist> + <listitem> + <para>Management of all Scilab data types</para> + </listitem> + <listitem> + <para>Consistency over all data types</para> + </listitem> + <listitem> + <para>Error management</para> + </listitem> + <listitem> + <para>Fully documented</para> + </listitem> + <listitem> + <para>Fully tested by unitary tests</para> + </listitem> + <listitem> + <para> + Straight and named access (See the <link linkend="call_scilab">call_scilab API</link>) to variables. + </para> + </listitem> + <listitem> + <para>And it will be maintained over future versions of Scilab</para> + </listitem> + </itemizedlist> + <para>Usually, this API is used to extend Scilab capabilities but can be used in other contexts</para> + <itemizedlist> + <listitem> + <para> + Libraries or C/C++ functions: Many libraries have been developed on the free/Open source or proprietary markets. This library can be loaded and used in a high level language like Scilab. API Scilab provides the capabilities to interact with such libraries. + </para> + </listitem> + <listitem> + <para> + Scilab can be used as computing engine from a third party software. This feature is called <link linkend="call_scilab">call_scilab</link> when Scilab is used from C/C++ code or <link linkend="javasci">javasci</link> when used from Java. Access to variable is done through their names (named variable). + </para> + </listitem> + </itemizedlist> + <para>Note that old APIs (stackX.h) will not be available after Scilab 6.0 (included).</para> + </refsection> + <refsection> + <title>History</title> + <revhistory> + <revision> + <revnumber>5.4.0</revnumber> + <revdescription> + Add some functions/macros in replacement of stack functions/macros + <itemizedlist> + <listitem> + nbInputArgument + <para> + Replaces <literal>Rhs</literal> + </para> + </listitem> + <listitem> + nbOutputArgument + <para> + Replaces <literal>Lhs</literal> + </para> + </listitem> + <listitem> + AssignOutputVariable + <para> + Replaces <literal>LhsVar</literal> + </para> + </listitem> + <listitem> + ReturnArguments + <para> + Replaces <literal>PutLhsVar</literal> + </para> + </listitem> + <listitem> + CheckInputArgument + <para> + Replaces <literal>CheckRhs</literal> + </para> + </listitem> + <listitem> + CheckOutputArgument + <para> + Replaces <literal>CheckLhs</literal> + </para> + </listitem> + </itemizedlist> + <para> + Add functions to identify list datatypes: + <literal>isListType</literal>, <literal>isNamedListType</literal>, <literal>isTListType</literal>, <literal>isNamedTListType</literal>, <literal>isMListType</literal>, + <literal>isNamedMListType</literal> + </para> + </revdescription> + </revision> + <revision> + <revnumber>5.5.0</revnumber> + <revdescription> + Add functions to manage handles + <itemizedlist> + <listitem>getMatrixOfHandle</listitem> + <listitem>allocMatrixOfHandle</listitem> + <listitem>createMatrixOfHandle</listitem> + <listitem>isHandleType</listitem> + <listitem>getScalarHandle</listitem> + <listitem>createScalarHandle</listitem> + </itemizedlist> + </revdescription> + </revision> + </revhistory> + </refsection> + <refsection> + <title>See Also - API_Scilab</title> + <simplelist type="inline"> + <member> + <link linkend="boolean_reading_API">boolean reading API</link>, + </member> + <member> + <link linkend="boolean_writing_API">boolean writing API</link>, + </member> + <member> + <link linkend="bsparse_reading_API">boolean sparse reading API</link>, + </member> + <member> + <link linkend="bsparse_writing_API">boolean sparse writing API</link>, + </member> + <member> + <link linkend="Common_getvaraddr_API">Common getvaraddr API</link>, + </member> + <member> + <link linkend="Common_getvardimension_API">Common getvardimension API</link>, + </member> + <member> + <link linkend="Common_getvartype_API">Common getvartype API</link>, + </member> + <member> + <link linkend="Common_iscomplex_API">Common iscomplex API</link>, + </member> + <member> + <link linkend="Common_isvarmatrixtype_API">Common isvarmatrixtype API</link>, + </member> + <member> + <link linkend="Double_management_reading_API">Double management reading API</link>, + </member> + <member> + <link linkend="Double_management_writing_API">Double management writing API</link>, + </member> + <member> + <link linkend="Integer_management_reading_API">Integer management reading API</link>, + </member> + <member> + <link linkend="Integer_management_writing_API">Integer management writing API</link>, + </member> + <member> + <link linkend="int_getmatrixofintegerprecision_API">getmatrixofintegerprecision API</link>, + </member> + <member> + <link linkend="Pointer_reading_API">Pointer reading API</link>, + </member> + <member> + <link linkend="Pointer_writing_API">Pointer writing API</link>, + </member> + <member> + <link linkend="poly_getpolyvariablename_API">poly getpolyvariablename API</link>, + </member> + <member> + <link linkend="Polynomial_management_reading_API">Polynomial management reading API</link>, + </member> + <member> + <link linkend="Polynomial_management_writing_API">Polynomial management writing API</link>, + </member> + <member> + <link linkend="Sparse_management_reading_API">Sparse management reading API</link>, + </member> + <member> + <link linkend="Sparse_management_writing_API">Sparse management writing_API</link>, + </member> + <member> + <link linkend="String_management_reading_API">String management reading API</link>, + </member> + <member> + <link linkend="String_management_writing_API">String management writing API</link> + </member> + <member> + <link linkend="handle_reading_API">handle reading API</link>, + </member> + <member> + <link linkend="handle_writing_API">handle writing API</link>, + </member> + </simplelist> + </refsection> + <refsection> + <title>See Also - API_Scilab list management</title> + <simplelist type="inline"> + <member> + <link linkend="list_boolean_reading_API">list boolean reading API</link> + </member> + <member> + <link linkend="list_boolean_writing_API">list boolean writing API</link> + </member> + <member> + <link linkend="list_bsparse_reading_API">list boolean sparse reading API</link> + </member> + <member> + <link linkend="list_bsparse_writing_API">list boolean sparse writing API</link> + </member> + <member> + <link linkend="list_createlist_API">list_createlist API</link> + </member> + <member> + <link linkend="list_double_reading_API">list double reading API</link> + </member> + <member> + <link linkend="list_double_writing_API">list double writing API</link> + </member> + <member> + <link linkend="list_getlistitemaddress_API">list getlistitemaddress API</link> + </member> + <member> + <link linkend="list_getlistitemnumber_API">list getlistitemnumber API</link> + </member> + <member> + <link linkend="list_integer_reading_API">list integer reading API</link> + </member> + <member> + <link linkend="list_integer_writing_API">list integer writing API</link> + </member> + <member> + <link linkend="list_pointer_reading_API">list pointer reading API</link> + </member> + <member> + <link linkend="list_pointer_writing_API">list pointer writing API</link> + </member> + <member> + <link linkend="list_poly_reading_API">list poly reading API</link> + </member> + <member> + <link linkend="list_poly_writing_API">list poly writing API</link> + </member> + <member> + <link linkend="list_sparse_reading_API">list sparse reading API</link> + </member> + <member> + <link linkend="list_sparse_writing_API">list sparse writing API</link> + </member> + <member> + <link linkend="list_string_reading_API">list string reading API</link> + </member> + <member> + <link linkend="list_string_writing_API">list string writing API</link> + </member> + </simplelist> + </refsection> + <refsection> + <title>See Also - call_scilab</title> + <simplelist type="inline"> + <member> + <link linkend="call_scilab">Call_Scilab</link> + </member> + <member> + <link linkend="compile_and_run_call_scilab">Compile and run with call_scilab</link> + </member> + <member> + <link linkend="DoubleManagement_callscilab">Matrix Management</link> + </member> + <member> + <link linkend="BooleanManagement_callscilab">Boolean Management</link> + </member> + <member> + <link linkend="ComplexManagement_callscilab">Complex Management</link> + </member> + <member> + <link linkend="StringManagement_callscilab">String Management</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/boolean/A_isBooleanType.xml b/modules/api_scilab/help/en_US/boolean/A_isBooleanType.xml new file mode 100755 index 000000000..d0c70ef00 --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean/A_isBooleanType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isBooleanType" xml:lang="en"> + <refnamediv> + <refname>isBooleanType</refname> + <refpurpose> + Check if it is a boolean variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isBooleanType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedBooleanType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a boolean type, otherwise 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/boolean/B_getScalarBoolean.xml b/modules/api_scilab/help/en_US/boolean/B_getScalarBoolean.xml new file mode 100755 index 000000000..e6bd76add --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean/B_getScalarBoolean.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarBoolean" xml:lang="en"> + <refnamediv> + <refname>getScalarBoolean</refname> + <refpurpose> + Read scalar boolean data from a gateway argument. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getScalarBoolean(void* _pvCtx, int* _piAddress, int* _piBool)</synopsis> + <synopsis>int getNamedScalarBoolean(void* _pvCtx, const char* _pstName, int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + Return boolean value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/boolean/C_createScalarBoolean.xml b/modules/api_scilab/help/en_US/boolean/C_createScalarBoolean.xml new file mode 100755 index 000000000..e36d5cd91 --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean/C_createScalarBoolean.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarBoolean" xml:lang="en"> + <refnamediv> + <refname>createScalarBoolean</refname> + <refpurpose> + Create scalar boolean variable in Scilab memory. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int createScalarBoolean(void* _pvCtx, int _iVar, int _iBool)</synopsis> + <synopsis>int createNamedScalarBoolean(void* _pvCtx, const char* _pstName, int _iBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iBool</term> + <listitem> + <para> + Boolean value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/boolean/D_booleanExample.xml b/modules/api_scilab/help/en_US/boolean/D_booleanExample.xml new file mode 100755 index 000000000..0cb989680 --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean/D_booleanExample.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="booleanExample" xml:lang="en"> + <refnamediv> + <refname>boolean example</refname> + <refpurpose> + Boolean use case. + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>This example shows how to get a boolean variable and return it to Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/booleanExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/booleanExample.tst--> + <!--Lib_name: booleanExample--> + <!--Func_list: booleanExample--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" + +int booleanExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isBooleanType(pvApiCtx, piAddr)) + { + if(isScalar(pvApiCtx, piAddr)) + { + int iBool = 0; + iRet = getScalarBoolean(pvApiCtx, piAddr, &iBool); + if(iRet) + { + return 0; + } + iRet = createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iBool); + if(iRet) + { + return 0; + } + } + else + { + int iRows = 0; + int iCols = 0; + int *piBool = NULL; + + sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = %t; +b = %f; +c = [a,b;b,a;a,b;b,a]; +d = c'; + +booleanExample(a) == a +booleanExample(b) == b +booleanExample(c) == c +booleanExample(d) == d + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/boolean_sparse/A_isBooleanSparseType.xml b/modules/api_scilab/help/en_US/boolean_sparse/A_isBooleanSparseType.xml new file mode 100755 index 000000000..4b3c7f3d3 --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean_sparse/A_isBooleanSparseType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isBooleanSparseType" xml:lang="en"> + <refnamediv> + <refname>isBooleanSparseType</refname> + <refpurpose> + Check if it is a boolean sparse variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isBooleanSparseType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedBooleanSparseType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a boolean sparse type, otherwise 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/boolean_sparse/B_getAllocatedBooleanSparseMatrix.xml b/modules/api_scilab/help/en_US/boolean_sparse/B_getAllocatedBooleanSparseMatrix.xml new file mode 100755 index 000000000..1e97cb2a3 --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean_sparse/B_getAllocatedBooleanSparseMatrix.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedBooleanSparseMatrix" xml:lang="en"> + <refnamediv> + <refname>getAllocatedBooleanSparseMatrix</refname> + <refpurpose> + Get sparse matrix attributs. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + <synopsis>int getNamedAllocatedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + Return number of non %f value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Return number of item in each rows (size: *_piRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Return column position for each item (size: *_piNbItem). + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/boolean_sparse/CHAPTER b/modules/api_scilab/help/en_US/boolean_sparse/CHAPTER new file mode 100755 index 000000000..548447144 --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean_sparse/CHAPTER @@ -0,0 +1 @@ +title = Boolean Sparse
\ No newline at end of file diff --git a/modules/api_scilab/help/en_US/boolean_sparse/C_freeAllocatedBooleanSparse.xml b/modules/api_scilab/help/en_US/boolean_sparse/C_freeAllocatedBooleanSparse.xml new file mode 100755 index 000000000..dd4f126ed --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean_sparse/C_freeAllocatedBooleanSparse.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedBooleanSparse" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedBooleanSparse</refname> + <refpurpose> + Free memory allocated by getAllocatedBooleanSparseMatrix function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void freeAllocatedBooleanSparse(int* _piNbItemRow, int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Pointer "_piNbItemRow" allocated by getAllocatedBooleanSparseMatrix. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Pointer "_piColPos" allocated by getAllocatedBooleanSparseMatrix. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/boolean_sparse/D_booleanSparseExample.xml b/modules/api_scilab/help/en_US/boolean_sparse/D_booleanSparseExample.xml new file mode 100755 index 000000000..bc5402f9e --- /dev/null +++ b/modules/api_scilab/help/en_US/boolean_sparse/D_booleanSparseExample.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="booleanSparseExample" xml:lang="en"> + <refnamediv> + <refname>boolean sparse example</refname> + <refpurpose> + Boolean sparse use case. + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>This example shows how to get a boolean sparse variable and return it to Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/booleanSparseExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/booleanSparseExample.tst--> + <!--Lib_name: booleanSparseExample--> + <!--Func_list: booleanSparseExample--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" + +int booleanSparseExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(isBooleanSparseType(pvApiCtx, piAddr)) + { + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + + iRet = getAllocatedBooleanSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos); + if(iRet) + { + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + return iRet; + } + + sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos); + if(sciErr.iErr) + { + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +bsp = sparse([1,1;2,2;3,3],[%t,%t,%t]); +or(booleanSparseExample(bsp) == bsp) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/CHAPTER b/modules/api_scilab/help/en_US/capi/CHAPTER new file mode 100755 index 000000000..42e18dc5e --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/CHAPTER @@ -0,0 +1 @@ +title = Scilab Gateway API diff --git a/modules/api_scilab/help/en_US/capi/CheckLhs.xml b/modules/api_scilab/help/en_US/capi/CheckLhs.xml new file mode 100755 index 000000000..353708713 --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/CheckLhs.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CheckLhs" xml:lang="en"> + <refnamediv> + <refname>CheckLhs (deprecated)</refname> + <refpurpose> + C macro which checks the number of output arguments present in + the calling Scilab function. + <emphasis role="bold">This function is obsolete.</emphasis> + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>CheckLhs(nb_min_params,nb_max_params)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>nb_min_params</term> + <listitem> + <para> + the minimum number of output arguments which must be present + in the calling Scilab function + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_max_params</term> + <listitem> + <para> + the maximum number of output arguments which must be present + in the calling Scilab function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + C macro which checks the number of output arguments present in the + calling Scilab function. You must include stack-c.h to benefit from this + function. + </para> + <para> + If the number of arguments is not between nb_min_params and + nb_max_params, we quit the C interface (<literal>return 0;</literal>) and + an error is returned in the Scilab console. + </para> + <para> + Since <literal>CheckLhs</literal> is doing a <literal> + return + 0; + </literal> + within the gateway function, it is important to call this + macro before any memory allocation in order to avoid any memory + leak. + </para> + <para> + WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use <link linkend="api_scilab">API Scilab</link> (the new Scilab API). + This function has been replaced by <link linkend="CheckOutputArgument">CheckOutputArgument</link>. + </para> + </refsection> + + <refsection> + <title>Examples</title> + <programlisting role="code_gateway"><![CDATA[ +#include "stack-c.h" + +#error This code is deprecated + +int sci_my_function(char *fname, unsigned long l) +{ +/* The expected profile of the function will be: +* a = my_function(a,b,c); +*/ + CheckRhs(3,3); + CheckLhs(1,1); + +} + ]]></programlisting> + </refsection> + + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="CheckOutputArgument">CheckOutputArgument</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/CheckRhs.xml b/modules/api_scilab/help/en_US/capi/CheckRhs.xml new file mode 100755 index 000000000..988341ef2 --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/CheckRhs.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CheckRhs" xml:lang="en"> + <refnamediv> + <refname>CheckRhs (deprecated)</refname> + <refpurpose> + C macro which checks the number of input arguments present in + the calling Scilab function. + <emphasis role="bold">This function is obsolete.</emphasis> + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>CheckRhs(nb_min_params,nb_max_params)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>nb_min_params</term> + <listitem> + <para> + The minimum number of input arguments which must be present in + the calling Scilab function + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_max_params</term> + <listitem> + <para> + the maximum number of input arguments which must be present in + the calling Scilab function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + C macro which checks the number of input arguments present in the + calling Scilab function. You must include stack-c.h to benefit from this + function. + </para> + <para> + If the number of input arguments is not between nb_min_params and + nb_max_params, we quit the C interface (<literal>return 0;</literal>) and + an error is returned in the Scilab console. + </para> + <para> + Since <literal>CheckRhs</literal> is doing a <literal> + return + 0; + </literal> + within the gateway function, it is important to call this + macro before any memory allocation in order to avoid any memory + leak. + </para> + <para> + WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use <link linkend="api_scilab">API Scilab</link> (the new Scilab API). + This function has been replaced by <link linkend="CheckInputArgument">CheckInputArgument</link>. + </para> + </refsection> + + <refsection> + <title>Examples</title> + <programlisting role="code_gateway"><![CDATA[ +#include "stack-c.h" + +#error This code is deprecated + +int sci_my_function(char *fname, unsigned long l) +{ +/* The expected profile of the function will be: +* a = my_function(a,b,c); +*/ + CheckRhs(3,3); + CheckLhs(1,1); + +} + ]]></programlisting> + </refsection> + + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="CheckInputArgument">CheckInputArgument</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/Lhs.xml b/modules/api_scilab/help/en_US/capi/Lhs.xml new file mode 100755 index 000000000..34e3c525e --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/Lhs.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Lhs" xml:lang="en"> + <refnamediv> + <refname>Lhs (deprecated)</refname> + <refpurpose> + A C gateway function which provides the number of output + arguments present in the calling Scilab function + <emphasis role="bold">This function is obsolete.</emphasis> + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>nb_params Lhs</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>nb_params</term> + <listitem> + <para> + the number of output arguments present in the calling Scilab + function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + Lhs provides a C gateway function which provides the number of + output arguments present in the calling Scilab function. You must include + stack-c.h to benefit from this function. + </para> + <para>Note: Lhs means Left Hand Side.</para> + <para> + WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use <link linkend="api_scilab">API Scilab</link> (the new Scilab API). + </para> + </refsection> + <refsection> + <title>Examples</title> + <para> + In this example, the C gateway function can take several output + arguments and prints in the Scilab console the integer corresponding to + the number of output arguments detected in the calling Scilab + function. + </para> + <programlisting role="example"><![CDATA[ +#include <stack-c.h> +#include <sciprint.h> + +int sci_mylhs(char * fname) +{ + sciprint("The number of output arguments is %d\n", Lhs); + + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="getNbOutputArgument">getNbOutputArgument</link> + </member> + <member> + <link linkend="getNbInputArgument">getNbInputArgument</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + <member> + <link linkend="Rhs">Rhs</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/LhsVar.xml b/modules/api_scilab/help/en_US/capi/LhsVar.xml new file mode 100755 index 000000000..e906f39b0 --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/LhsVar.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="LhsVar"> + <refnamediv> + <refname>LhsVar (deprecated)</refname> + <refpurpose> + a C gateway function which specifies which parameters created + inside the C gateway will be returned as an output argument into + Scilab. + <emphasis role="bold">This function is obsolete.</emphasis> + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>LhsVar(RankPos) = RankVar;</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>RankPos</term> + <listitem> + <para>as integer providing the rank of the output argument</para> + </listitem> + </varlistentry> + <varlistentry> + <term>RankVar</term> + <listitem> + <para> + the rank of the parameter created inside the C gateway to be + returned as an Scilab output argument + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + A C gateway function which specifies which variables created inside + the C interface will be returned as an output argument into Scilab. + </para> + <para> + WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use <link linkend="api_scilab">API Scilab</link> (the new Scilab API). + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>This example takes a matrix of doubles as input and returns:</para> + <itemizedlist> + <listitem> + <para>the number of lines (first output argument)</para> + </listitem> + <listitem> + <para>the number of rows (second output argument)</para> + </listitem> + </itemizedlist> + <para> + We create an intermediate Scilab parameter which will handle an + integer but will neither be used nor returned as an output + argument. + </para> + <para>TODO: insert an example in the Scilab language</para> + <programlisting role="example"><![CDATA[ +#include "stack-c.h" +#include "api_scilab.h" +int sci_mysizedouble(char * fname, unsigned long fname_len) +{ + int m_in_row; + int n_in_col; + int *piAddr = NULL; + double *pdblData = NULL; + SciErr sciErr; + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + /* get dimensions */ + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &m_in_row, &n_in_col, &pdblData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger32(pvApiCtx, 2, 1, 1, &m_in_row); // the out_lines_pos parameter handles the number of lines of the matrix sent as argument + sciErr = createMatrixOfInteger32(pvApiCtx, 3, 1, 1, &m_in_row); // store a mere value, but will neither be used nor returned to Scilab + sciErr = createMatrixOfInteger32(pvApiCtx, 4, 1, 1, &n_in_col); // store a mere value, but will neither be used nor returned to Scilab + + LhsVar(1) = 2; // We set the parameter 2 as an output argument + LhsVar(2) = 4; // We set the parameter 4 as an output argument + PutLhsVar(); + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="AssignOutputVariable">AssignOutputVariable</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/Rhs.xml b/modules/api_scilab/help/en_US/capi/Rhs.xml new file mode 100755 index 000000000..93479cd0a --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/Rhs.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Rhs" xml:lang="en"> + <refnamediv> + <refname>Rhs (deprecated)</refname> + <refpurpose> + A C gateway function which provides the number of input + arguments present in the calling Scilab function + <emphasis role="bold">This function is obsolete.</emphasis> + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>nb_params Rhs</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>nb_params</term> + <listitem> + <para> + the number of input arguments present in the calling Scilab + function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + A C gateway function which provides the number of input arguments + present in the calling Scilab function. You must include stack-c.h to + benefit from this function. + </para> + <para>Note: Rhs means Right Hand Side.</para> + <para> + WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use <link linkend="api_scilab">API Scilab</link> (the new Scilab API). + </para> + </refsection> + <refsection> + <title>Examples</title> + <para> + In this example, the C interface function can take several input + arguments and prints in the Scilab console the integer corresponding to + the number of input arguments detected in the calling Scilab + function. + </para> + <programlisting role="example"><![CDATA[ +#include <stack-c.h> +#include <sciprint.h> + +int sci_myrhs(char * fname) +{ + sciprint("The number of input parameters is %d\n", Rhs); + + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="getNbInputArgument">getNbInputArgument</link> + </member> + <member> + <link linkend="getNbOutputArgument">getNbOutputArgument</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + <member> + <link linkend="Rhs">Lhs</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/Scierror.xml b/modules/api_scilab/help/en_US/capi/Scierror.xml new file mode 100755 index 000000000..f0c667a9d --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/Scierror.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Scierror" xml:lang="en"> + <refnamediv> + <refname>Scierror</refname> + <refpurpose>C gateway function which displays an error message to the user + (same profil as the printf function) and returns an integer value + specifying an error level + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void Scierror(error_level,format,value_1,..,value_n)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>error_level</term> + <listitem> + <para>an integer value specifying an error level</para> + </listitem> + </varlistentry> + <varlistentry> + <term>format</term> + <listitem> + <para>a char* string. Specifies a character string combining literal + characters with conversion specifications. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>value_i</term> + <listitem> + <para>Specifies the data to be converted according to the format + parameter. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>returns</term> + <listitem> + <para>If the operation is successfull, this function returns the + number of characters printed (not including the trailing '\0' used + to end output to strings). + </para> + <para>If an error occurred, a negative value is returned.</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>Scierror is a C gateway function which displays an error message to + the user (same profil as the printf function) and returns an integer value + specifying an error level. You must include Scierror.h to benefit from + this function. This header is provided in the output_stream module (this + directory should be included by default). + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>In this example, the C gateway function prints an error message and + returns the error level 133. + </para> + <programlisting role="example"><![CDATA[ +#include <stack-c.h> +#include <Scierror.h> + +int sci_myscierror(char * fname) +{ + Scierror(133,"An error has occurred: %d\n", 1); + + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="printf_conversion">printf_conversion</link> + </member> + <member> + <link linkend="mprintf">mprintf</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/howto/CHAPTER b/modules/api_scilab/help/en_US/capi/howto/CHAPTER new file mode 100755 index 000000000..c59f6c35c --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/howto/CHAPTER @@ -0,0 +1 @@ +title = How to diff --git a/modules/api_scilab/help/en_US/capi/howto/CallingAScilabFunctionFromACInterface.xml b/modules/api_scilab/help/en_US/capi/howto/CallingAScilabFunctionFromACInterface.xml new file mode 100755 index 000000000..ab8cee11e --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/howto/CallingAScilabFunctionFromACInterface.xml @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CallingAScilabFunctionFromACInterface" xml:lang="en"> + <refnamediv> + <refname>Calling a scilab function (macros) from a C gateway</refname> + <refpurpose>Calling a scilab function (macros) from a C interface</refpurpose> + </refnamediv> + <refsection> + <title>Calling a scilab function (macros) from a C interface</title> + <para> + <warning> + WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use <link linkend="api_scilab">API Scilab</link> (the new Scilab API). + </warning> + </para> + <para>When you write a interface with scilab, you can need to call another + function directly from your function. You can pass a pointer on scilab + function to your function. + </para> + <para>The source files of this example are stored in the directory + examples/call_scifunction. + </para> + <para>How to use this example:</para> + <programlisting role=""><![CDATA[ +exec call_scifunction.sce; // launch scilab +v = call_scifunc(30,12,scilabfoo); + ]]></programlisting> + <para>you pass a pointer on a scilab function (scilabfoo macro) to your + function 'call_scifunc'. + </para> + <para>C2F(scifunction) calls another scilab function (here + scilabfoo). + </para> + <para>You need to indicate :</para> + <itemizedlist> + <listitem> + <para>position of the first element (Rhs) in the Scilab memory</para> + </listitem> + <listitem> + <para>pointer on scilab function</para> + </listitem> + <listitem> + <para>number of Lhs (output of scilab function called)</para> + </listitem> + <listitem> + <para>number of Rhs (input of scilab function called)</para> + </listitem> + </itemizedlist> + <para>The script call_scifunction.sce used to build and load the C + interface into Scilab is the following: + </para> + <programlisting role=""><![CDATA[ +files=['sci_call_scifunc.c']; // Defines the list of file +ilib_build('callscifunc',['call_scifunc','sci_call_scifunc'],files,[]); // Build the files and creates the loader + +exec loader.sce; + +function r = scilabfoo(x,y) + r = x + y; +endfunction + +v = call_scifunc(30,12,scilabfoo); +disp('result : ' + string(v)); + +v = call_scifunc(300,120,scilabfoo); +disp('result : ' + string(v)); + +ulink(); // unload the dynamic library + ]]></programlisting> + <para>The file sci_call_scifunc.c is the following:</para> + <programlisting role="code_gateway"><![CDATA[ + +#include "stack-c.h" +#include "Scierror.h" +#include "localization.h" + +#error This code is deprecated + +int sci_call_scifunc(char *fname) +{ + int m1 = 0, n1 = 0, l1 = 0; + int m2 = 0, n2 = 0, l2 = 0; + int m3 = 0, n3 = 0, l3 = 0; + int rm1 = 0, rn1 = 0, rl1 = 0; + int m_out = 1, n_out = 1, l_out = 0; + double v1 = 0, v2 = 0, r = 0; + int positionFirstElementOnStackForScilabFunction = 0; + int numberOfRhsOnScilabFunction = 0; + int numberOfLhsOnScilabFunction = 0; + int pointerOnScilabFunction = 0; + + CheckRhs(3,3); + CheckLhs(1,1); + + if (GetType(1) != sci_matrix) + { + Scierror(999,_("%s: Wrong type for input argument #%d: A real expected.\n"),fname,1); + return 0; + } + + GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1); + if ( (m1 == n1) && (n1 == 1) ) + { + v1 = *stk(l1); + } + else + { + Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"),fname,1); + return 0; + } + + if (GetType(2) != sci_matrix) + { + Scierror(999,_("%s: Wrong type for input argument #%d: A real expected.\n"),fname,2); + return 0; + } + + GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &l2); + if ( (m2 == n2) && (n2 == 1) ) + { + v2 = *stk(l2); + } + else + { + Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"),fname,2); + return 0; + } + + if (GetType(3) != sci_c_function) + { + Scierror(999,_("%s: Wrong type for input argument #%d: A scilab function expected.\n"),fname,3); + return 0; + } + + // get pointer on external function (here scilabfoo) + GetRhsVar(3, EXTERNAL_DATATYPE, &m3, &n3, &l3); + + // r = scilabfoo(x, y) + // rhs eq. 2 + // lhs eq. 1 + + // Position first element in the Scilab memory to use by Scilab Function + // v = call_scifunc(300,120,scilabfoo); + // On stack : 300 is on Top position (1) + // 120 second position + // scilabfoo third position + // we want to pass 300 & 120 to scilab Function + // First position is here : 1 + + positionFirstElementOnStackForScilabFunction = 1; + numberOfRhsOnScilabFunction = 2; + numberOfLhsOnScilabFunction = 1; + pointerOnScilabFunction = l3; + + // r = scilabfoo(x, y) + // Scifunction call a scilab function + Scifunction(&positionFirstElementOnStackForScilabFunction, + &pointerOnScilabFunction, + &numberOfLhsOnScilabFunction, + &numberOfRhsOnScilabFunction); + + // result r is now on position positionFirstElementOnStackForScilabFunction on stack + GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &rm1, &rn1, &rl1); + r = *stk(rl1); + + CreateVar(Rhs+1, MATRIX_OF_DOUBLE_DATATYPE, &m_out, &n_out, &l_out); + *stk(l_out) = r; + + LhsVar(1) = Rhs + 1; + + return 0; +} + ]]></programlisting> + <para>The main function in this C file is Scifunction. It allows to call a + Scilab function inside a C interface. + </para> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="Scierror">Scierror</link> + </member> + <!--<member><link linkend="Scifunction">Scifunction</link></member>--> + <member> + <link linkend="sci_types">sci_types</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/sci_types.xml b/modules/api_scilab/help/en_US/capi/sci_types.xml new file mode 100755 index 000000000..e042f5c04 --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/sci_types.xml @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="sci_types" xml:lang="en"> + <refnamediv> + <refname>sci_types</refname> + <refpurpose>a C enumeration which defines the types available for a + variable + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>A C enumeration which defines the types available for a variable. + You must include stack-c.h to benefit from this type definition. + </para> + <para>The list of available types is the following:</para> + <itemizedlist> + <listitem> + <para> + 1 - <emphasis>sci_matrix</emphasis>: a matrix of doubles + </para> + </listitem> + <listitem> + <para> + 2 - <emphasis>sci_poly</emphasis>: a polynomials matrix + </para> + </listitem> + <listitem> + <para> + 4 - <emphasis>sci_boolean</emphasis>: a boolean matrix + </para> + </listitem> + <listitem> + <para> + 5 - <emphasis>sci_sparse</emphasis>: a sparse matrix + </para> + </listitem> + <listitem> + <para> + 6 - <emphasis>sci_boolean_sparse</emphasis>: a sparse boolean + matrix + </para> + </listitem> + <listitem> + <para> + 7 - <emphasis>sci_matlab_sparse</emphasis>: a sparse matlab + matrix + </para> + </listitem> + <listitem> + <para> + 8 - <emphasis>sci_ints</emphasis>: a matrix of integers + </para> + </listitem> + <listitem> + <para> + 9 - <emphasis>sci_handles</emphasis>: a graphical handle + </para> + </listitem> + <listitem> + <para> + 10 - <emphasis>sci_strings</emphasis>: a matrix of + strings + </para> + </listitem> + <listitem> + <para> + 11 - <emphasis>sci_u_function</emphasis>: an uncompiled Scilab + function + </para> + </listitem> + <listitem> + <para> + 13 - <emphasis>sci_c_function</emphasis>: a compiled Scilab + function + </para> + </listitem> + <listitem> + <para> + 14 - <emphasis>sci_lib</emphasis>: a library of Scilab + functions + </para> + </listitem> + <listitem> + <para> + 15 - <emphasis>sci_list</emphasis>: a Scilab list + </para> + </listitem> + <listitem> + <para> + 16 - <emphasis>sci_tlist</emphasis>: a Scilab tlist + </para> + </listitem> + <listitem> + <para> + 17 - <emphasis>sci_mlist</emphasis>: a Scilab mlist + </para> + </listitem> + <listitem> + <para> + 128 - <emphasis>sci_pointer (was: sci_lufact_pointer before Scilab 5.2)</emphasis>: a pointer + </para> + </listitem> + </itemizedlist> + <para>Integers or enumeration types can be used to check the type of the + variables. Using the enumeration type is recommended because of the + explicit meaning of the value of the enumeration type. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>In this example, the C gateway function takes one argument. Through + a switch case structure, we display the type of the variable sent as a + parameter. + </para> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" + + +int sci_mysci_typesrhs(char * fname, unsigned long fname_len) +{ + int iType = 0; + int* piAddr = NULL; + SciErr sciErr; + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + switch(iType) + { + case sci_matrix: + sciprint("A matrix of doubles\n"); + break; + case sci_poly: + sciprint("A matrix of polynomials\n"); + break; + case sci_boolean: + sciprint("A matrix of booleans\n"); + break; + case sci_sparse: + sciprint("A sparse matrix of doubles\n"); + break; + case sci_boolean_sparse: + sciprint("A sparse matrix of booleans\n"); + break; + case sci_matlab_sparse: + sciprint("A sparse matlab matrix\n"); + break; + case sci_ints: + sciprint("A matrix of integers\n"); + break; + case sci_handles: + sciprint("A graphic handle\n"); + break; + case sci_strings: + sciprint("A matrix of strings\n"); + break; + case sci_u_function: + sciprint("An uncompiled Scilab function\n"); + break; + case sci_c_function: + sciprint("A compiled Scilab function\n"); + break; + case sci_lib: + sciprint("A library of Scilab functions\n"); + break; + case sci_list: + sciprint("A Scilab list\n"); + break; + case sci_tlist: + sciprint("A Scilab tlist\n"); + break; + case sci_mlist: + sciprint("A Scilab mlist\n"); + break; + case sci_pointer: + sciprint("A pointer\n"); + break; + default: + sciprint("Unknown type !\n"); // Should never happen + } + + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/capi/sciprint.xml b/modules/api_scilab/help/en_US/capi/sciprint.xml new file mode 100755 index 000000000..cb7bbad8c --- /dev/null +++ b/modules/api_scilab/help/en_US/capi/sciprint.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="sciprint" xml:lang="en"> + <refnamediv> + <refname>sciprint</refname> + <refpurpose>A C gateway function which displays standard messages to the + user (same profil as the C printf function) + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void sciprint(format,value_1,..,value_n)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>format</term> + <listitem> + <para>a char* string. Specifies a character string combining literal + characters with conversion specifications. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>value_i</term> + <listitem> + <para>Specifies the data to be converted according to the format + parameter (%s, %d, ...). + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This C gateway function provides the capabilities to display + messages to the Scilab user. Basically; it emulates the C language printf + function. You must include sciprint.h to benefit from this function. This + header is provided in the output_stream module (this directory should be + included by default). + </para> + <para>Note that if you want to trigger an error, the function Scierror is + more appropriate. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>In this example, the C gateway function prints several messages + illustrating the use of the sciprint function in the Scilab + console. + </para> + <programlisting role="example"><![CDATA[ +#include <stack-c.h> +#include <sciprint.h> + +int sci_mysciprint(char * fname) +{ + sciprint("printing an integer: %d\n", 1); + sciprint("printing a double: %f\n", 2.1); + sciprint("printing a string: %s\n", "test"); + + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="printf_conversion">printf_conversion</link> + </member> + <member> + <link linkend="mprintf">mprintf</link> + </member> + <member> + <link linkend="Scierror">Scierror</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/double/A_isDoubleType.xml b/modules/api_scilab/help/en_US/double/A_isDoubleType.xml new file mode 100755 index 000000000..08c417de4 --- /dev/null +++ b/modules/api_scilab/help/en_US/double/A_isDoubleType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isDoubleType" xml:lang="en"> + <refnamediv> + <refname>isDoubleType</refname> + <refpurpose> + Check if it is a double variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isDoubleType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedDoubleType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a double type, otherwise 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/double/B_getScalarDouble.xml b/modules/api_scilab/help/en_US/double/B_getScalarDouble.xml new file mode 100755 index 000000000..f7e9808ee --- /dev/null +++ b/modules/api_scilab/help/en_US/double/B_getScalarDouble.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarDouble" xml:lang="en"> + <refnamediv> + <refname>getScalarDouble</refname> + <refpurpose> + Get scalar double variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getScalarDouble(void* _pvCtx, int* _piAddress, double* _pdblReal)</synopsis> + <synopsis>int getNamedScalarDouble(void* _pvCtx, const char* _pstName, double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Double value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/double/C_getScalarComplexDouble.xml b/modules/api_scilab/help/en_US/double/C_getScalarComplexDouble.xml new file mode 100755 index 000000000..5c0895282 --- /dev/null +++ b/modules/api_scilab/help/en_US/double/C_getScalarComplexDouble.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarComplexDouble" xml:lang="en"> + <refnamediv> + <refname>getScalarComplexDouble</refname> + <refpurpose> + Get scalar complex double variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getScalarComplexDouble(void* _pvCtx, int* _piAddress, double* _pdblReal, double* _pdblImg)</synopsis> + <synopsis>int getNamedScalarComplexDouble(void* _pvCtx, const char* _pstName, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Real part value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Imaginary part value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/double/D_createScalarDouble.xml b/modules/api_scilab/help/en_US/double/D_createScalarDouble.xml new file mode 100755 index 000000000..67aab5e4d --- /dev/null +++ b/modules/api_scilab/help/en_US/double/D_createScalarDouble.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarDouble" xml:lang="en"> + <refnamediv> + <refname>createScalarDouble</refname> + <refpurpose> + Create a scalar double in Scilab memory. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int createScalarDouble(void* _pvCtx, int _iVar, double _dblReal)</synopsis> + <synopsis>int createNamedScalarDouble(void* _pvCtx, const char* _pstName, double _dblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dblReal</term> + <listitem> + <para> + Double value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/double/E_createScalarComplexDouble.xml b/modules/api_scilab/help/en_US/double/E_createScalarComplexDouble.xml new file mode 100755 index 000000000..58da63839 --- /dev/null +++ b/modules/api_scilab/help/en_US/double/E_createScalarComplexDouble.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarComplexDouble" xml:lang="en"> + <refnamediv> + <refname>createScalarComplexDouble</refname> + <refpurpose> + Create a scalar complex double in Scilab memory. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int createScalarComplexDouble(void* _pvCtx, int _iVar, double _dblReal, double _dblImg)</synopsis> + <synopsis>int createNamedScalarComplexDouble(void* _pvCtx, const char* _pstName, double _dblReal, double _dblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dblReal</term> + <listitem> + <para> + Real part value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dblImg</term> + <listitem> + <para> + imaginary part value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/double/F_doubleExample.xml b/modules/api_scilab/help/en_US/double/F_doubleExample.xml new file mode 100755 index 000000000..441ec4cae --- /dev/null +++ b/modules/api_scilab/help/en_US/double/F_doubleExample.xml @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="doubleExample" xml:lang="en"> + <refnamediv> + <refname>double example</refname> + <refpurpose> + Double use case. + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>This example shows how to get a double variable and return it to Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/doubleExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/doubleExample.tst--> + <!--Lib_name: doubleExample--> + <!--Func_list: doubleExample--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" + +int doubleExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if(iRet) + { + return iRet; + } + + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if(isDoubleType(pvApiCtx, piAddr)) + { + if(isScalar(pvApiCtx, piAddr)) + { + double dblReal = 0; + double dblImg = 0; + + if(isVarComplex(pvApiCtx, piAddr)) + { + iRet = getScalarComplexDouble(pvApiCtx, piAddr, &dblReal, &dblImg); + if(iRet) + { + return iRet; + } + + iRet = createScalarComplexDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblReal, dblImg); + if(iRet) + { + return iRet; + } + } + else + { + iRet = getScalarDouble(pvApiCtx, piAddr, &dblReal); + if(iRet) + { + return iRet; + } + + iRet = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblReal); + if(iRet) + { + return iRet; + } + } + } + else + { + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(isVarComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = 1; +b = %i; +c = [1,2,3;4,5,6]; +d = c(1:$) + c($:-1:1) * %i; + +doubleExample(a) == a +doubleExample(b) == b +doubleExample(c) == c +doubleExample(d) == d + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/getting_started.xml b/modules/api_scilab/help/en_US/getting_started.xml new file mode 100755 index 000000000..3391d4f08 --- /dev/null +++ b/modules/api_scilab/help/en_US/getting_started.xml @@ -0,0 +1,407 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2012 - Scilab Enterprises - Sylvestre LEDRU +* +* 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 +* +--> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="api_scilab_getting_started" xml:lang="en"> + <refnamediv> + <refname>Getting started with API_Scilab</refname> + <refpurpose>How to load a C, C++ or fortran code in the Scilab engine as a new function</refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para> + As described in the <link linkend="api_scilab">api_scilab presentation</link>, Scilab offers an API to extend the language with C, C++ or Fortran code (sources or libraries). + </para> + <para> + The link between the Scilab engine and the application code is called <literal>gateway</literal>. + </para> + <para> + Most of the time, the process is always the same: + <orderedlist> + <listitem> + <para>Check the number of arguments (both input and output) provided by the user.</para> + <para> + For example, if the function <literal>foo(x)</literal> is called with <literal>foo()</literal> or <literal>foo(2,3)</literal>, the user must get an answer. + </para> + <para> + More: <link linkend="CheckInputArgument">CheckInputArgument</link> and <link linkend="CheckOutputArgument">CheckOutputArgument</link> + </para> + </listitem> + <listitem> + <para>Manage input arguments</para> + <para> + Several tasks are performed: + <orderedlist inheritnum="inherit"> + <listitem> + <para>Get the address to the variable for input argument X</para> + <para> + Function + <literal> + SciErr <link linkend="Common_getvaraddr_API">getVarAddressFromPosition</link>(void* context, int positionOfTheVariable, int** address) + </literal> + </para> + </listitem> + <listitem> + <para>Check the type of the variable: matrix of double (complex or not), string, etc</para> + <para> + <literal> + SciErr <link linkend="Common_getvartype_API">getVarType</link>(void* context, int* positionOfTheVariable, int* Type) + </literal> + </para> + <para> + Other functions are also provided: + <itemizedlist> + <listitem> + <para> + <literal>int isBooleanType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isBooleanSparseType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isDoubleType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isIntegerType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isPointerType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isPolyType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isSparseType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isStringType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isListType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isTListType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isMListType(void* context, int* address)</literal> + </para> + </listitem> + </itemizedlist> + </para> + </listitem> + <listitem> + <para>If it is relevant, check if the input argument is complex or not.</para> + <para> + <literal> + int <link linkend="Common_iscomplex_API">isVarComplex</link>(void* context, int* address) + </literal> + </para> + </listitem> + <listitem> + <para>Dealing with integer, further checks should be done on the precision of the integer</para> + <para> + <literal> + SciErr <link linkend="int_getmatrixofintegerprecision_API">getMatrixOfIntegerPrecision</link>(void* context, int* address, int* precision) + </literal> + </para> + </listitem> + <listitem> + <para>Check the size of the variable: square matrix, scalar, etc</para> + <para> + The retrieval of the size information will be done with the same functions used to retrieve the actual data. For example, for a matrix of double, the function call + <literal> + SciErr <link linkend="Double_management_reading_API">getMatrixOfDouble</link>(void* context, int* address, int* nbRows, int* nbCols, double** theActualData) + </literal> + will provide the dimension of the matrix. + </para> + <para>Almost all Scilab datatypes have an equivalent C function to perform such task.</para> + </listitem> + <listitem> + <para>Other checks can be done like specific values expected, consitency between the first and second input arguments, etc.</para> + </listitem> + <listitem> + <para>Data transformation (optional).</para> + <para>Depending on the code or library targeted, some transformations can be applied to the data. A classical example is changing the storage of a matrix from column-stored to line-stored.</para> + <para>Please note that it is usually a performance killer.</para> + </listitem> + </orderedlist> + </para> + </listitem> + <listitem> + <para>Application code</para> + <para>Once all the checks and data retrieval have been performed, the actual core code can be called. The actual intelligence (processes, data transformations, etc) will be performed here.</para> + <para> + This can be done through a thirdparty code stored and built in <literal>src/c</literal>, <literal>src/cpp</literal> or <literal>src/fortran</literal> but also under the form of a library. Virtually, any library could be linked to Scilab. + </para> + </listitem> + <listitem> + <para>Create the output arguments for the Scilab engine</para> + <para>Once the application code has been executed, usually, some data will be returned to the Scilab interpreter.</para> + <para> + For example, to create in the Scilab engine memory a matrix of double, the C function <literal> + SciErr <link linkend="Double_management_writing_API">createMatrixOfDouble</link>(void* context, int position, int nbRows, int nbCols, const double* matrixOfDouble) + </literal> + should be called. + </para> + <para> + The position is usually provided by <literal>nbInputArgument(pvApiCtx) + X</literal>. <literal>X</literal> being the position of the returned output argument. For example, with the function profile <literal>[a, b, c] = foo();</literal> the <literal>nbInputArgument(pvApiCtx) + 3</literal> will be the variable <literal>c</literal>. + </para> + <para>Note that the order of creation must be respected in the gateway.</para> + <para>Almost all Scilab datatypes have an equivalent C function to perform such task.</para> + </listitem> + <listitem> + <para>Return the output arguments to the Scilab engine</para> + <para>Following, the task 4, the created variable will be returned.</para> + <para> + Taking the previous example <literal>[a, b, c] = foo();</literal>, to return <literal>a</literal>, the following declaration must be done: <literal>AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;</literal> + </para> + <para> + To commit the new variable to the Scilab engine, the function <link linkend="ReturnArguments">ReturnArguments(pvApiCtx)</link> must be called. + </para> + </listitem> + </orderedlist> + + </para> + <para>Note that almost all the API_Scilab functions returns a C structure called SciErr which contains many information about the error.</para> + <para> + By default, Scilab numerical values are stored with the C type <literal>double</literal>. + </para> + <para> + As convention, gateways are stored in <literal>sci_gateway/c/</literal> (or <literal>/cpp/</literal>) and are called <literal>sci_functionName.c</literal>. + </para> + <para> + <literal>pvApiCtx</literal> is the global context variable. Useless in the 5 family, it has been introduced to manage multithread aspects coming with the version 6 of Scilab. + </para> + </refsection> + <refsection> + <title>Real life example</title> + <para>Taking the sample Scilab function:</para> + <para> + <literal>[c,d] = foo(a,b)</literal> + </para> + <para> + with <literal>a</literal> being a matrix of double and <literal>b</literal> a matrix of boolean with the same size of <literal>a</literal>, foo will multiply each element of <literal>a</literal> by 2 and return it as <literal>c</literal> and transform each element of element of b to its opposite. + </para> + <para> + The example is available in the toolbox skeleton provided with the Scilab binary. The path is <literal>contrib/toolbox_skeleton/sci_gateway/c/sci_foo.c</literal> + </para> + <para>Detailed explanations are provided under the form of C comment in the following example.</para> + <programlisting role="code_gateway"> + <![CDATA[ +// Full source can be found in the sci_gateway/c/ directory of the +// toolbox skeleton + +// Standard header +#include "api_scilab.h" +#include "BOOL.h" + +// Function declaration +int sci_foo(char *fname, unsigned long fname_len) +{ + // Error management variable + SciErr sciErr; + + ////////// Variables declaration ////////// + int m1 = 0, n1 = 0; + int *piAddressVarOne = NULL; + double *matrixOfDouble = NULL; + double *newMatrixOfDouble = NULL; + + int m2 = 0, n2 = 0; + int *piAddressVarTwo = NULL; + int *matrixOfBoolean = NULL; + int *newMatrixOfBoolean = NULL; + int i = 0; + + + ////////// Check the number of input and output arguments ////////// + /* --> [c, d] = foo(a, b) */ + /* check that we have only 2 input arguments */ + /* check that we have only 2 output argument */ + CheckInputArgument(pvApiCtx, 2, 2) ; + CheckOutputArgument(pvApiCtx, 2, 2) ; + + + ////////// Manage the first input argument (double) ////////// + /* get Address of inputs */ + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + /* Check that the first input argument is a real matrix (and not complex) */ + if ( !isDoubleType(pvApiCtx, piAddressVarOne) || isVarComplex(pvApiCtx, piAddressVarOne) ) + { + Scierror(999, "%s: Wrong type for input argument #%d: A real matrix expected.\n", fname, 1); + return 0; + } + + /* get matrix */ + sciErr = getMatrixOfDouble(pvApiCtx, piAddressVarOne, &m1, &n1, &matrixOfDouble); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + ////////// Manage the second input argument (boolean) ////////// + + /* get Address of inputs */ + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if ( !isBooleanType(pvApiCtx, piAddressVarTwo) ) + { + Scierror(999, "%s: Wrong type for input argument #%d: A boolean matrix expected.\n", fname, 2); + return 0; + } + + /* get matrix */ + sciErr = getMatrixOfBoolean(pvApiCtx, piAddressVarTwo, &m2, &n2, &matrixOfBoolean); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + ////////// Check the consistency of the two input arguments ////////// + + if ((m1 != m2) || (n1 != n2)) + { + Scierror(999, "%s: Wrong size for input arguments: Same size expected.\n", fname, 1); + return 0; + } + + + newMatrixOfDouble = (double*)malloc(sizeof(double) * m1 * n1); + ////////// Application code ////////// + // Could be replaced by a call to a library + + for (i = 0; i < m1 * n1; i++) + { + /* For each element of the matrix, multiply by 2 */ + newMatrixOfDouble[i] = matrixOfDouble[i] * 2; + } + + newMatrixOfBoolean = (int*)malloc(sizeof(BOOL) * m2 * n2); + for (i = 0; i < m2 * n2; i++) + { + /* For each element of the matrix, invert the value */ + newMatrixOfBoolean[i] = ((matrixOfBoolean[i] == TRUE) ? FALSE : TRUE); + } + + ////////// Create the output arguments ////////// + + /* Create the matrix as return of the function */ + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, m1, n1, newMatrixOfDouble); + free(newMatrixOfDouble); // Data have been copied into Scilab memory + if (sciErr.iErr) + { + free(newMatrixOfBoolean); // Make sure everything is cleanup in case of error + printError(&sciErr, 0); + return 0; + } + + /* Create the matrix as return of the function */ + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 2, m2, n2, newMatrixOfBoolean); + free(newMatrixOfBoolean); // Data have been copied into Scilab memory + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + + ////////// Return the output arguments to the Scilab engine ////////// + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + + return 0; +} + ]]> + </programlisting> + <para> + To build this code and load it to Scilab, we use the dynamic link capabilities of Scilab. Delegating the build process to Scilab, this code is multiplaform. + <programlisting role="scilab"> + <![CDATA[ + files=["sci_foo.c"]; + // TODO: WTF ? + WITHOUT_AUTO_PUTLHSVAR = %t; + ilib_build('build_lib',['foo','sci_foo'],files,[]); + exec loader.sce + [c, d] = foo([2,%pi], [%t, %f]) + ]]> + </programlisting> + </para> + <para> + Various checks can be performed: + <programlisting role="no-scilab-exec"> + <![CDATA[ +-->[c, d] = foo(2, 2) + !--error 999 +foo: Wrong type for input argument #2: A boolean matrix expected. + ]]> + </programlisting> + <programlisting role="no-scilab-exec"> + <![CDATA[ +-->[c, d] = foo([2,2], %t) + !--error 999 +foo: Wrong size for input arguments: Same size expected. + ]]> + </programlisting> + <programlisting role="no-scilab-exec"> + <![CDATA[ +-->[a,b]=foo(2+%i,%t) + !--error 999 +foo: Wrong type for input argument #1: A real matrix expected. + ]]> + </programlisting> + <programlisting role="no-scilab-exec"> + <![CDATA[ +-->[c, d] = foo([2,%pi], [%t, %f]) + d = + + F T + c = + + 4. 6.2831853 + ]]> + </programlisting> + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/handle/A_isHandleType.xml b/modules/api_scilab/help/en_US/handle/A_isHandleType.xml new file mode 100755 index 000000000..f7c3e5009 --- /dev/null +++ b/modules/api_scilab/help/en_US/handle/A_isHandleType.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isHandleType" xml:lang="en"> + <refnamediv> + <refname>isHandleType</refname> + <refpurpose> + Check if it is a handle variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isHandleType(void* _pvCtx, int* _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a handle type, otherwise 0</para> + </refsection> + <title>History</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>This function added in Scilab 5.5.0</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/en_US/handle/B_getScalarHandle.xml b/modules/api_scilab/help/en_US/handle/B_getScalarHandle.xml new file mode 100755 index 000000000..001b7cd0b --- /dev/null +++ b/modules/api_scilab/help/en_US/handle/B_getScalarHandle.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarHandle" xml:lang="en"> + <refnamediv> + <refname>getScalarHandle</refname> + <refpurpose> + Read scalar handle data from a gateway argument. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getScalarHandle(void* _pvCtx, int* _piAddress, long long* _pllHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pllHandle</term> + <listitem> + <para> + Return handle value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> + <title>History</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>This function added in Scilab 5.5.0</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/en_US/handle/C_createScalarHandle.xml b/modules/api_scilab/help/en_US/handle/C_createScalarHandle.xml new file mode 100755 index 000000000..5d555553f --- /dev/null +++ b/modules/api_scilab/help/en_US/handle/C_createScalarHandle.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarHandle" xml:lang="en"> + <refnamediv> + <refname>createScalarHandle</refname> + <refpurpose> + Create scalar handle variable in Scilab memory. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int createScalarHandle(void* _pvCtx, int _iVar, long long _llHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_llHandle</term> + <listitem> + <para> + Handle value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> + <title>History</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>This function added in Scilab 5.5.0</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/en_US/handle/D_handleExample.xml b/modules/api_scilab/help/en_US/handle/D_handleExample.xml new file mode 100755 index 000000000..5db9f459b --- /dev/null +++ b/modules/api_scilab/help/en_US/handle/D_handleExample.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="handleExample" xml:lang="en"> + <refnamediv> + <refname>handle example</refname> + <refpurpose> + Handle use case. + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>This example shows how to get a handle variable and return it to Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/handleExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/handleExample.tst--> + <!--Lib_name: handleExample--> + <!--Func_list: handleExample--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" + +int handleExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isHandleType(pvApiCtx, piAddr)) + { + if(isScalar(pvApiCtx, piAddr)) + { + long long llHandle = 0; + iRet = getScalarHandle(pvApiCtx, piAddr, &llHandle); + if(iRet) + { + return 0; + } + iRet = createScalarHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, llHandle); + if(iRet) + { + return 0; + } + } + else + { + int iRows = 0; + int iCols = 0; + long long *pllHandle = NULL; + + sciErr = getMatrixOfHandle(pvApiCtx, piAddr, &iRows, &iCols, &pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = %t; +b = %f; +c = [a,b;b,a;a,b;b,a]; +d = c'; + +handleExample(a) == a +handleExample(b) == b +handleExample(c) == c +handleExample(d) == d + ]]></programlisting> + </refsection> + <title>History</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>This function added in Scilab 5.5.0</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/en_US/hypermat/A_isHypermatType.xml b/modules/api_scilab/help/en_US/hypermat/A_isHypermatType.xml new file mode 100755 index 000000000..fdf8c8b31 --- /dev/null +++ b/modules/api_scilab/help/en_US/hypermat/A_isHypermatType.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isHypermatType" xml:lang="en"> + <refnamediv> + <refname>isHypermatType</refname> + <refpurpose> + Check if it is a hypermatrix variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isHypermatType(void* _pvCtx, int* _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a double type, otherwise 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/hypermat/B_getHypermatOfDouble.xml b/modules/api_scilab/help/en_US/hypermat/B_getHypermatOfDouble.xml new file mode 100755 index 000000000..1741626a4 --- /dev/null +++ b/modules/api_scilab/help/en_US/hypermat/B_getHypermatOfDouble.xml @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfDouble" xml:lang="en"> + <refnamediv> + <refname>getHypermatOfDouble</refname> + <refpurpose> + Get a hypermatrix of double variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dims</term> + <listitem> + <para> + the hypermatrix dimensions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_ndims</term> + <listitem> + <para> + the number of dimensions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Double values. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>A SciErr struct, the field iErr would contain the error number (0 if no error).</para> + </refsection> + <refsection> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" + +int hypermatExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if (iRet) + { + return iRet; + } + + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if (isHypermatType(pvApiCtx, piAddr)) + { + int * dims = NULL; + int ndims; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (isHypermatComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createComplexHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal, pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + else + { + sciErr = getHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + + return 0; +}]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = hypermat([1 2 3], ones(1,6)); +b = a + %i*hypermat([1 2 3], 1:6); + +hypermatExample(a) == a +hypermatExample(b) == b + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/hypermat/C_getHypermatOfInt.xml b/modules/api_scilab/help/en_US/hypermat/C_getHypermatOfInt.xml new file mode 100755 index 000000000..a5acc4535 --- /dev/null +++ b/modules/api_scilab/help/en_US/hypermat/C_getHypermatOfInt.xml @@ -0,0 +1,264 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfInt" xml:lang="en"> + <refnamediv> + <refname>getHypermatOfInt</refname> + <refpurpose> + Get a hypermatrix of integer variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>SciErr getHypermatOfInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char* _pcData)</synopsis> + <synopsis>SciErr getHypermatOfUnsignedInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char* _pucData)</synopsis> + <synopsis>SciErr getHypermatOfInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short* _psData)</synopsis> + <synopsis>SciErr getHypermatOfUnsignedInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short* _pusData)</synopsis> + <synopsis>SciErr getHypermatOfInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piData)</synopsis> + <synopsis>SciErr getHypermatOfUnsignedInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int* _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dims</term> + <listitem> + <para> + the hypermatrix dimensions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_ndims</term> + <listitem> + <para> + the number of dimensions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_p*Data</term> + <listitem> + <para> + the data. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>A SciErr struct, the field iErr would contain the error number (0 if no error).</para> + </refsection> + <refsection> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int hypermatIntExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if (iRet) + { + return iRet; + } + + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if (isHypermatType(pvApiCtx, piAddr)) + { + int * dims = NULL; + int ndims; + void * data = NULL; + int htype = 0; + int precision; + + sciErr = getHypermatType(pvApiCtx, piAddr, &htype); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (htype == sci_ints) + { + sciErr = getHypermatOfIntegerPrecision(pvApiCtx, piAddr, &precision); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + switch (precision) + { + case SCI_INT8: + sciErr = getHypermatOfInteger8(pvApiCtx, piAddr, &dims, &ndims, (char*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const char*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT8: + sciErr = getHypermatOfUnsignedInteger8(pvApiCtx, piAddr, &dims, &ndims, (unsigned char*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned char*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_INT16: + sciErr = getHypermatOfInteger16(pvApiCtx, piAddr, &dims, &ndims, (short*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const short*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT16: + sciErr = getHypermatOfUnsignedInteger16(pvApiCtx, piAddr, &dims, &ndims, (unsigned short*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned short*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_INT32: + sciErr = getHypermatOfInteger32(pvApiCtx, piAddr, &dims, &ndims, (int*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const int*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT32: + sciErr = getHypermatOfUnsignedInteger32(pvApiCtx, piAddr, &dims, &ndims, (unsigned int*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned int*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + } + } + else + { + Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname, 1); + return 1; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + + return 0; +}]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = hypermat([1 2 3], int8(1:6)); +b = hypermat([1 2 3], uint8(1:6)); +c = hypermat([1 2 3], int16(1:6)); +d = hypermat([1 2 3], uint16(1:6)); +e = hypermat([1 2 3], int32(1:6)); +f = hypermat([1 2 3], uint32(1:6)); + +hypermatExampleInt(a) == a +hypermatExampleInt(b) == b +hypermatExampleInt(c) == c +hypermatExampleInt(d) == d +hypermatExampleInt(e) == e +hypermatExampleInt(f) == f + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/integer/A_isIntegerType.xml b/modules/api_scilab/help/en_US/integer/A_isIntegerType.xml new file mode 100755 index 000000000..96c1ca41c --- /dev/null +++ b/modules/api_scilab/help/en_US/integer/A_isIntegerType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isIntegerType" xml:lang="en"> + <refnamediv> + <refname>isIntegerType</refname> + <refpurpose> + Check if it is a double variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isIntegerType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedIntegerType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is of integer type, otherwise 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/integer/B_getScalarInteger.xml b/modules/api_scilab/help/en_US/integer/B_getScalarInteger.xml new file mode 100755 index 000000000..7602ae547 --- /dev/null +++ b/modules/api_scilab/help/en_US/integer/B_getScalarInteger.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarInteger8" xml:lang="en"> + <refnamediv> + <refname>getScalarInteger8</refname> + <refpurpose> + Get scalar integer variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getScalarInteger8(void* _pvCtx, int* _piAddress, char* _pcData)</synopsis> + <synopsis>int getNamedScalarInteger8(void* _pvCtx, const char* _pstName, char* _pcData)</synopsis> + <synopsis>int getScalarInteger16(void* _pvCtx, int* _piAddress, short* _psData)</synopsis> + <synopsis>int getNamedScalarInteger16(void* _pvCtx, const char* _pstName, short* _psData)</synopsis> + <synopsis>int getScalarInteger32(void* _pvCtx, int* _piAddress, int* _piData)</synopsis> + <synopsis>int getNamedScalarInteger32(void* _pvCtx, const char* _pstName, int* _piData)</synopsis> + <synopsis>int getScalarUnsignedInteger8(void* _pvCtx, int* _piAddress, unsigned char* _pucData)</synopsis> + <synopsis>int getNamedScalarUnsignedInteger8(void* _pvCtx, const char* _pstName, unsigned char* _pucData)</synopsis> + <synopsis>int getScalarUnsignedInteger16(void* _pvCtx, int* _piAddress, unsigned short* _pusData)</synopsis> + <synopsis>int getNamedScalarUnsignedInteger16(void* _pvCtx, const char* _pstName, unsigned short* _pusData)</synopsis> + <synopsis>int getScalarUnsignedInteger32(void* _pvCtx, int* _piAddress, unsigned int* _puiData)</synopsis> + <synopsis>int getNamedScalarUnsignedInteger32(void* _pvCtx, const char* _pstName, unsigned int* _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_cData</term> + <listitem> + <para> + Integer 8 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_sData</term> + <listitem> + <para> + Integer 16 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iData</term> + <listitem> + <para> + Integer 32 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_ucData</term> + <listitem> + <para> + Unsigned integer 8 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_usData</term> + <listitem> + <para> + Unsigned integer 16 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_uiData</term> + <listitem> + <para> + Unsigned integer 32 bits value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/integer/C_createScalarInteger.xml b/modules/api_scilab/help/en_US/integer/C_createScalarInteger.xml new file mode 100755 index 000000000..68a067a1d --- /dev/null +++ b/modules/api_scilab/help/en_US/integer/C_createScalarInteger.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarInteger8" xml:lang="en"> + <refnamediv> + <refname>createScalarInteger8</refname> + <refpurpose> + Create scalar integer variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int createScalarInteger8(void* _pvCtx, int _iVar, char cData)</synopsis> + <synopsis>int createNamedScalarInteger8(void* _pvCtx, const char* _pstName, char _cData)</synopsis> + <synopsis>int createScalarInteger16(void* _pvCtx, int _iVar, short sData)</synopsis> + <synopsis>int createNamedScalarInteger16(void* _pvCtx, const char* _pstName, short _sData)</synopsis> + <synopsis>int createScalarInteger32(void* _pvCtx, int _iVar, int iData)</synopsis> + <synopsis>int createNamedScalarInteger32(void* _pvCtx, const char* _pstName, int _iData)</synopsis> + <synopsis>int createScalarUnsignedInteger8(void* _pvCtx, int _iVar, unsigned char ucData)</synopsis> + <synopsis>int createNamedScalarUnsignedInteger8(void* _pvCtx, const char* _pstName, unsigned char _ucData)</synopsis> + <synopsis>int createScalarUnsignedInteger16(void* _pvCtx, int _iVar, unsigned short usData)</synopsis> + <synopsis>int createNamedScalarUnsignedInteger16(void* _pvCtx, const char* _pstName, unsigned short _usData)</synopsis> + <synopsis>int createScalarUnsignedInteger32(void* _pvCtx, int _iVar, unsigned int uiData)</synopsis> + <synopsis>int createNamedScalarUnsignedInteger32(void* _pvCtx, const char* _pstName, unsigned int _uiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_cData</term> + <listitem> + <para> + Integer 8 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_sData</term> + <listitem> + <para> + Integer 16 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iData</term> + <listitem> + <para> + Integer 32 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_ucData</term> + <listitem> + <para> + Unsigned integer 8 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_usData</term> + <listitem> + <para> + Unsigned integer 16 bits value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_uiData</term> + <listitem> + <para> + Unsigned integer 32 bits value. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/integer/D_integerExample.xml b/modules/api_scilab/help/en_US/integer/D_integerExample.xml new file mode 100755 index 000000000..9b5c18108 --- /dev/null +++ b/modules/api_scilab/help/en_US/integer/D_integerExample.xml @@ -0,0 +1,337 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="integerExample" xml:lang="en"> + <refnamediv> + <refname>integer example</refname> + <refpurpose> + Integer use case. + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>This example shows how to get an integer variable and return it to Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/integerExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/integerExample.tst--> + <!--Lib_name: integerExample--> + <!--Func_list: integerExample--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int integerExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + int iPrec = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + + if(isIntegerType(pvApiCtx, piAddr)) + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + switch(iPrec) + { + case SCI_INT8 : + if(isScalar(pvApiCtx, piAddr)) + { + char cData = 0; + iRet = getScalarInteger8(pvApiCtx, piAddr, &cData); + if(iRet) + { + return iRet; + } + + iRet = createScalarInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, cData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + + sciErr = getMatrixOfInteger8(pvApiCtx, piAddr, &iRows, &iCols, &pcData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pcData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + case SCI_INT16 : + if(isScalar(pvApiCtx, piAddr)) + { + short sData = 0; + iRet = getScalarInteger16(pvApiCtx, piAddr, &sData); + if(iRet) + { + return iRet; + } + + iRet = createScalarInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, sData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + short* psData = NULL; + + sciErr = getMatrixOfInteger16(pvApiCtx, piAddr, &iRows, &iCols, &psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + case SCI_INT32 : + if(isScalar(pvApiCtx, piAddr)) + { + int iData = 0; + iRet = getScalarInteger32(pvApiCtx, piAddr, &iData); + if(iRet) + { + return iRet; + } + + iRet = createScalarInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + int* piData = NULL; + + sciErr = getMatrixOfInteger32(pvApiCtx, piAddr, &iRows, &iCols, &piData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; +#ifdef __SCILAB_INT64__ + case SCI_INT64 : +#endif + case SCI_UINT8 : + if(isScalar(pvApiCtx, piAddr)) + { + unsigned char ucData = 0; + iRet = getScalarUnsignedInteger8(pvApiCtx, piAddr, &ucData); + if(iRet) + { + return iRet; + } + + iRet = createScalarUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, ucData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + unsigned char* pucData = NULL; + + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddr, &iRows, &iCols, &pucData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pucData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + + case SCI_UINT16 : + if(isScalar(pvApiCtx, piAddr)) + { + unsigned short usData = 0; + iRet = getScalarUnsignedInteger16(pvApiCtx, piAddr, &usData); + if(iRet) + { + return iRet; + } + + iRet = createScalarUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, usData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + unsigned short* pusData = NULL; + + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddr, &iRows, &iCols, &pusData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pusData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + case SCI_UINT32 : + if(isScalar(pvApiCtx, piAddr)) + { + unsigned int uiData = 0; + iRet = getScalarUnsignedInteger32(pvApiCtx, piAddr, &uiData); + if(iRet) + { + return iRet; + } + + iRet = createScalarUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, uiData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + unsigned int* puiData = NULL; + + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddr, &iRows, &iCols, &puiData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, puiData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + +#ifdef __SCILAB_INT64__ + case SCI_UINT64 : +#endif + default : + break; + } + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +i8_1 = int8(1); +i8_2 = int8([1,2,3;4,5,6]); +ui8_1 = uint8(1); +ui8_2 = uint8([1,2,3;4,5,6]); + +i16_1 = int16(1); +i16_2 = int16([1,2,3;4,5,6]); +ui16_1 = uint16(1); +ui16_2 = uint16([1,2,3;4,5,6]); + +i32_1 = int32(1); +i32_2 = int32([1,2,3;4,5,6]); +ui32_1 = uint32(1); +ui32_2 = uint32([1,2,3;4,5,6]); + +if integerExample(i8_1) <> i8_1 then pause;end +if integerExample(i8_2) <> i8_2 then pause;end +if integerExample(ui8_1) <> ui8_1 then pause;end +if integerExample(ui8_2) <> ui8_2 then pause;end + +if integerExample(i16_1) <> i16_1 then pause;end +if integerExample(i16_2) <> i16_2 then pause;end +if integerExample(ui16_1) <> ui16_1 then pause;end +if integerExample(ui16_2) <> ui16_2 then pause;end + +if integerExample(i8_1) <> i16_1 then pause;end +if integerExample(i8_2) <> i16_2 then pause;end +if integerExample(ui8_1) <> ui16_1 then pause;end +if integerExample(ui8_2) <> ui16_2 then pause;end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/CHAPTER b/modules/api_scilab/help/en_US/list_management/CHAPTER new file mode 100755 index 000000000..4e72a7af1 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/CHAPTER @@ -0,0 +1 @@ +title = List manipulation diff --git a/modules/api_scilab/help/en_US/list_management/isListType.xml b/modules/api_scilab/help/en_US/list_management/isListType.xml new file mode 100755 index 000000000..a687c9eda --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/isListType.xml @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isListType" xml:lang="en"> + <refnamediv> + <refname>isListType, isTListType, isMListType</refname> + <refpurpose> + Check if it is a list, mlist, tlist variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isListType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedListType(void* _pvCtx, const char* _pstName)</synopsis> + <synopsis>int isTListType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedTListType(void* _pvCtx, const char* _pstName)</synopsis> + <synopsis>int isMListType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedMListType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a list type, otherwise 0</para> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +fileData = [ +'#include <api_scilab.h>' +'#include <Scierror.h>' +'#include <MALLOC.h>' +'/* ========================================================================== */' +'int sci_getListType(char *fname)' +'{' +' int* piAddr = NULL;' +' char pstRet[64];' +'' +' getVarAddressFromPosition(pvApiCtx, 1, &piAddr);' +'' +' if(isStringType(pvApiCtx, piAddr))' +' {//named check' +' char* pstVar = NULL;' +' getAllocatedSingleString(pvApiCtx, piAddr, &pstVar);' +'' +' if(isNamedListType(pvApiCtx, pstVar))' +' {' +' sprintf(pstRet, ""%s"", ""isNamedList"");' +' }' +' else if(isNamedTListType(pvApiCtx, pstVar))' +' {' +' sprintf(pstRet, ""%s"", ""isNamedTList"");' +' }' +' else if(isNamedMListType(pvApiCtx, pstVar))' +' {' +' sprintf(pstRet, ""%s"", ""isNamedMList"");' +' }' +' else' +' {' +' sprintf(pstRet, ""%s"", ""unmanaged named type"");' +' }' +' FREE(pstVar);' +' }' +' else' +' {' +' if(isListType(pvApiCtx, piAddr))' +' {' +' sprintf(pstRet, ""%s"", ""isList"");' +' }' +' else if(isTListType(pvApiCtx, piAddr))' +' {' +' sprintf(pstRet, ""%s"", ""isTList"");' +' }' +' else if(isMListType(pvApiCtx, piAddr))' +' {' +' sprintf(pstRet, ""%s"", ""isMList"");' +' }' +' else' +' {' +' sprintf(pstRet, ""%s"", ""unmanaged type"");' +' }' +' }' +' createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstRet);' +' AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;' +' return 0;' +'}' +] + +currentPath = pwd(); +mkdir(TMPDIR + "/getListType"); +cd(TMPDIR + "/getListType"); +mputl(fileData, "getListType.c"); + +ilib_verbose(0); +files = ['getListType.c']; +ilib_build('libgetListType', ['getListType', 'sci_getListType'], files, []); +exec loader.sce; + +a = list(); +b = tlist("test"); +c = mlist("test"); +d = 1; + +assert_checkequal(getListType(a), "isList"); +assert_checkequal(getListType(b), "isTList"); +assert_checkequal(getListType(c), "isMList"); +assert_checkequal(getListType(d), "unmanaged type"); + +assert_checkequal(getListType("a"), "isNamedList"); +assert_checkequal(getListType("b"), "isNamedTList"); +assert_checkequal(getListType("c"), "isNamedMList"); +assert_checkequal(getListType("d"), "unmanaged named type"); + +//unload lib +[bOK, ilib] = c_link('libgetListType'); +if bOK then + ulink(ilib); +end + +cd(currentPath); +]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_boolean_reading_api.xml b/modules/api_scilab/help/en_US/list_management/list_boolean_reading_api.xml new file mode 100755 index 000000000..663367714 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_boolean_reading_api.xml @@ -0,0 +1,722 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_boolean_reading_API" xml:lang="en"> + <refnamediv> + <refname>Boolean reading (Scilab gateway)</refname> + <refpurpose> + How to read matrix of boolean in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfBooleanInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int** _piBool)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + Return address of data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read matrix of boolean in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if(iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_boolean_writing_api.xml b/modules/api_scilab/help/en_US/list_management/list_boolean_writing_api.xml new file mode 100755 index 000000000..9927afb58 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_boolean_writing_api.xml @@ -0,0 +1,330 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_boolean_writing_API" xml:lang="en"> + <refnamediv> + <refname>Boolean writing (Scilab gateway)</refname> + <refpurpose> + How to add matrix of boolean in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + Create from existing data. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piBool)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + Address of data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr allocMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + Returns address of data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add matrix of boolean in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_bsparse_reading_api.xml b/modules/api_scilab/help/en_US/list_management/list_bsparse_reading_api.xml new file mode 100755 index 000000000..202ed49a1 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_bsparse_reading_api.xml @@ -0,0 +1,738 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_bsparse_reading_API" xml:lang="en"> + <refnamediv> + <refname>Boolean sparse reading (Scilab gateway)</refname> + <refpurpose> + How to read boolean sparse in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getBooleanSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readBooleanSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + Return number of non zero value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Return number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Return column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read boolean sparse in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if(iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_bsparse_writing_api.xml b/modules/api_scilab/help/en_US/list_management/list_bsparse_writing_api.xml new file mode 100755 index 000000000..3dac6a73a --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_bsparse_writing_api.xml @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_bsparse_writing_API" xml:lang="en"> + <refnamediv> + <refname>Boolean sparse writing (Scilab gateway)</refname> + <refpurpose> + How to add boolean sparse matrix in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createBooleanSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createBooleanSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + Number of non zero itmes in the sparse. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add boolean sparse matrix in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_createlist_api.xml b/modules/api_scilab/help/en_US/list_management/list_createlist_api.xml new file mode 100755 index 000000000..b72f48228 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_createlist_api.xml @@ -0,0 +1,230 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_createlist_API" xml:lang="en"> + <refnamediv> + <refname>Create List (Scilab gateway)</refname> + <refpurpose> + How to get create a list in Scilab memory. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress)</synopsis> + <synopsis>SciErr createMList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress)</synopsis> + <synopsis>SciErr createTList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress)</synopsis> + <synopsis>SciErr createNamedTList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress)</synopsis> + <synopsis>SciErr createNamedMList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + Number of items in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Return address of the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to get the address of a list in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_double_reading_api.xml b/modules/api_scilab/help/en_US/list_management/list_double_reading_api.xml new file mode 100755 index 000000000..054cbf740 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_double_reading_api.xml @@ -0,0 +1,732 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_double_reading_API" xml:lang="en"> + <refnamediv> + <refname>Double reading (Scilab gateway)</refname> + <refpurpose> + How to read matrix of double in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double* _pdblReal)</synopsis> + <synopsis>SciErr readComplexMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return address of real part data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Return address of imaginary part data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read matrix of double in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if(iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_double_writing_api.xml b/modules/api_scilab/help/en_US/list_management/list_double_writing_api.xml new file mode 100755 index 000000000..01913eaa4 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_double_writing_api.xml @@ -0,0 +1,350 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_double_writing_API" xml:lang="en"> + <refnamediv> + <refname>Double writing (Scilab gateway)</refname> + <refpurpose> + How to add matrix of double in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + Create from existing data. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of real data array (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of imaginary data array (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr allocMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, double** _pdblReal)</synopsis> + <synopsis>SciErr allocComplexMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return address of real data array (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Return address of imaginary data array (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add matrix of double in a list.</para> + <para>Two types of functions can be used to write in the memory of Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_getlistitemaddress_api.xml b/modules/api_scilab/help/en_US/list_management/list_getlistitemaddress_api.xml new file mode 100755 index 000000000..cf9c78652 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_getlistitemaddress_api.xml @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_getlistitemaddress_API" xml:lang="en"> + <refnamediv> + <refname>Get child item (Scilab gateway)</refname> + <refpurpose> + How to get the address of a list child. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>SciErr getListItemAddress(void* _pvCtx, int* _piAddress, int _iItemNum, int** _piItemAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemNum</term> + <listitem> + <para> + Item number. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piItemAddress</term> + <listitem> + <para> + Return address of the item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to get the address of a list child.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_list_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_list_api.tst--> + <!--Lib_name: common_list--> + <!--Func_list: common_list--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int get_list_info(int* _piAddress); +void insert_indent(void); + +static int iLocalTab = 0; + +int common_list(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_list_info(piAddr); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_list_info(int* _piAddress) +{ + SciErr sciErr; + int i = 0; + int iRet = 0; + int iItem = 0; + + //get list item number, failed if variable is not a kind of list + sciErr = getListItemNumber(pvApiCtx, _piAddress, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + sciprint("This variable is not a list"); + return 0; + } + + sciprint("List (%d items) -> address : 0x%08X) : \n", iItem, _piAddress); + + for(i = 0 ; i < iItem ; i++) + { + int iType = 0; + int* piAddrChild = NULL; + + sciErr = getListItemAddress(pvApiCtx, _piAddress, i + 1, &piAddrChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarType(pvApiCtx, piAddrChild, &iType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(iType == sci_list || iType == sci_tlist || iType == sci_mlist) + { + insert_indent(); + sciprint("Child %d -> ", i + 1); + iLocalTab++; + iRet = get_list_info(piAddrChild); + iLocalTab--; + + if(iRet) + { + return 1; + } + } + else + { + insert_indent(); + sciprint("Child %d -> address : 0x%08X\n", i + 1, piAddrChild); + } + } + + return 0; +} +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iLocalTab ; i++) + { + sciprint("\t"); + } +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l5 = list(l1,l2,l3); +l4 = list(l5, list(l5,l5)); +l6 = uint16([1000,2000,3000]); +l = list(l1,l2,l3,l6,l4,l5); +common_list(l) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_getlistitemnumber_api.xml b/modules/api_scilab/help/en_US/list_management/list_getlistitemnumber_api.xml new file mode 100755 index 000000000..5e5fa9838 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_getlistitemnumber_api.xml @@ -0,0 +1,179 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_getlistitemnumber_API" xml:lang="en"> + <refnamediv> + <refname>Item Number (Scilab gateway)</refname> + <refpurpose> + How to get the number of items in a list (list, mlist, tlist). + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>SciErr getListItemNumber(void* _pvCtx, int* _piAddress, int* _piNbItem)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + Return the number of items. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to get the number of items in a list (list, mlist, tlist).</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_list_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_list_api.tst--> + <!--Lib_name: common_list--> + <!--Func_list: common_list--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int get_list_info(int* _piAddress); +void insert_indent(void); + +static int iLocalTab = 0; + +int common_list(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_list_info(piAddr); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_list_info(int* _piAddress) +{ + SciErr sciErr; + int i = 0; + int iRet = 0; + int iItem = 0; + + //get list item number, failed if variable is not a kind of list + sciErr = getListItemNumber(pvApiCtx, _piAddress, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + sciprint("This variable is not a list"); + return 0; + } + + sciprint("List (%d items) -> address : 0x%08X) : \n", iItem, _piAddress); + + for(i = 0 ; i < iItem ; i++) + { + int iType = 0; + int* piAddrChild = NULL; + + sciErr = getListItemAddress(pvApiCtx, _piAddress, i + 1, &piAddrChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarType(pvApiCtx, piAddrChild, &iType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(iType == sci_list || iType == sci_tlist || iType == sci_mlist) + { + insert_indent(); + sciprint("Child %d -> ", i + 1); + iLocalTab++; + iRet = get_list_info(piAddrChild); + iLocalTab--; + + if(iRet) + { + return 1; + } + } + else + { + insert_indent(); + sciprint("Child %d -> address : 0x%08X\n", i + 1, piAddrChild); + } + } + + return 0; +} +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iLocalTab ; i++) + { + sciprint("\t"); + } +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l5 = list(l1,l2,l3); +l4 = list(l5, list(l5,l5)); +l6 = uint16([1000,2000,3000]); +l = list(l1,l2,l3,l6,l4,l5); +common_list(l) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_integer_reading_api.xml b/modules/api_scilab/help/en_US/list_management/list_integer_reading_api.xml new file mode 100755 index 000000000..fe5100914 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_integer_reading_api.xml @@ -0,0 +1,736 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_integer_reading_API" xml:lang="en"> + <refnamediv> + <refname>Integer reading (Scilab gateway)</refname> + <refpurpose> + How to read matrix of integer in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr getMatrixOfInteger8InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, char** _pcData)</synopsis> + <synopsis>SciErr getMatrixOfInteger16InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, short** _psData)</synopsis> + <synopsis>SciErr getMatrixOfInteger32InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int** _piData)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr getMatrixOfUnsignedInteger8InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned char** _pucData)</synopsis> + <synopsis>SciErr getMatrixOfUnsignedInteger16InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned short** _pusData)</synopsis> + <synopsis>SciErr getMatrixOfUnsignedInteger32InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned int** _puiData)</synopsis> + <para>Named variable profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr readMatrixOfIntger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, char* _pcData)</synopsis> + <synopsis>SciErr readMatrixOfIntger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, short* _psData)</synopsis> + <synopsis>SciErr readMatrixOfIntger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piData)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr readMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned char* _pucData)</synopsis> + <synopsis>SciErr readMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned short* _pusData)</synopsis> + <synopsis>SciErr readMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned int* _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData, _pucData, _psData, _pusData, _piData, _puiData</term> + <listitem> + <para> + Return address of data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read matrix of integer in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if(iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_integer_writing_api.xml b/modules/api_scilab/help/en_US/list_management/list_integer_writing_api.xml new file mode 100755 index 000000000..c7f2f6dec --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_integer_writing_api.xml @@ -0,0 +1,352 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_integer_writing_API" xml:lang="en"> + <refnamediv> + <refname>Integer writing (Scilab gateway)</refname> + <refpurpose> + How to add matrix of integer in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + Create from existing data. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr createMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData)</synopsis> + <synopsis>SciErr createMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData)</synopsis> + <synopsis>SciErr createMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr createMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData)</synopsis> + <para>Named variable profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr createMatrixOfInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData)</synopsis> + <synopsis>SciErr createMatrixOfInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData)</synopsis> + <synopsis>SciErr createMatrixOfInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr createMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term> + <listitem> + <para> + Address of data array (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr allocMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, char** _pcData)</synopsis> + <synopsis>SciErr allocMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, short** _psData)</synopsis> + <synopsis>SciErr allocMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piData)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr allocMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned char** _pucData)</synopsis> + <synopsis>SciErr allocMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned short** _pusData)</synopsis> + <synopsis>SciErr allocMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned int** _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term> + <listitem> + <para> + Return address of data array (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add matrix of integer in a list.</para> + <para>Two types of functions can be used to write in the memory of Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_pointer_reading_api.xml b/modules/api_scilab/help/en_US/list_management/list_pointer_reading_api.xml new file mode 100755 index 000000000..958c9f03b --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_pointer_reading_api.xml @@ -0,0 +1,714 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_pointer_reading_API" xml:lang="en"> + <refnamediv> + <refname>Pointer reading (Scilab gateway)</refname> + <refpurpose> + How to read pointer in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getPointerInList(void* _pvCtx, int* _piParent, int _iItemPos, void** _pvPtr)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readPointerInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, void** _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + Return pointer on data. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read pointer in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if(iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_pointer_writing_api.xml b/modules/api_scilab/help/en_US/list_management/list_pointer_writing_api.xml new file mode 100755 index 000000000..5a0b0de7c --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_pointer_writing_api.xml @@ -0,0 +1,233 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_pointer_writing_API" xml:lang="en"> + <refnamediv> + <refname>Pointer writing (Scilab gateway)</refname> + <refpurpose> + How to add pointer in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createPointerInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, void* _pvPtr)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createPointerInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, void* _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + Address of the pointer. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add pointer in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_poly_reading_api.xml b/modules/api_scilab/help/en_US/list_management/list_poly_reading_api.xml new file mode 100755 index 000000000..843b6ab43 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_poly_reading_api.xml @@ -0,0 +1,739 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_poly_reading_API" xml:lang="en"> + <refnamediv> + <refname>Polynomial reading (Scilab gateway)</refname> + <refpurpose> + How to read matrix of polynomial in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>SciErr readComplexMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + Return number of coefficient for each polynomial. (must be allocated) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of array of double* with imaginary part of coefficient (size: _iCols * _iRows, must be allocated) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of array of double* with imaginary part of coefficient (size: _iCols * _iRows, must be allocated) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read matrix of polynomial in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if(iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_poly_writing_api.xml b/modules/api_scilab/help/en_US/list_management/list_poly_writing_api.xml new file mode 100755 index 000000000..70e939416 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_poly_writing_api.xml @@ -0,0 +1,275 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_poly_writing_API" xml:lang="en"> + <refnamediv> + <refname>Polynomial writing (Scilab gateway)</refname> + <refpurpose> + How to add matrix of polynomial in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstVarName</term> + <listitem> + <para> + Variable name in polynomials (Scilab5: 4 characters max). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + Number of coefficient for each polynomial. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of array of double* with real part of coefficient (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of array of double* with imaginary part of coefficient (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add matrix of polynomial in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_sparse_reading_api.xml b/modules/api_scilab/help/en_US/list_management/list_sparse_reading_api.xml new file mode 100755 index 000000000..c7b5e06d7 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_sparse_reading_api.xml @@ -0,0 +1,755 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_sparse_reading_API" xml:lang="en"> + <refnamediv> + <refname>Sparse reading (Scilab gateway)</refname> + <refpurpose> + How to read sparse in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal)</synopsis> + <synopsis>SciErr readComplexSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + Return number of non zero value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Return number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Return column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return array on real part data (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Return array on imaginary part data (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read sparse in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if(iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_sparse_writing_api.xml b/modules/api_scilab/help/en_US/list_management/list_sparse_writing_api.xml new file mode 100755 index 000000000..9e416b915 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_sparse_writing_api.xml @@ -0,0 +1,286 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_sparse_writing_API" xml:lang="en"> + <refnamediv> + <refname>Sparse writing (Scilab gateway)</refname> + <refpurpose> + How to add sparse matrix in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + Create from existing data. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + Number of non zero itmes in the sparse. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of real data array (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of imaginary data array (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add sparse matrix in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_string_reading_api.xml b/modules/api_scilab/help/en_US/list_management/list_string_reading_api.xml new file mode 100755 index 000000000..04e5c5f00 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_string_reading_api.xml @@ -0,0 +1,729 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_string_reading_API" xml:lang="en"> + <refnamediv> + <refname>String reading (Scilab gateway)</refname> + <refpurpose> + How to read matrix of string in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfStringInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readMatrixOfStringInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piLength</term> + <listitem> + <para> + Address of array of strings length (must be allocated size: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + Address of array of char* (must be allocated size: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read matrix of string in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if(iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/list_management/list_string_writing_api.xml b/modules/api_scilab/help/en_US/list_management/list_string_writing_api.xml new file mode 100755 index 000000000..99ed8d050 --- /dev/null +++ b/modules/api_scilab/help/en_US/list_management/list_string_writing_api.xml @@ -0,0 +1,249 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_string_writing_API" xml:lang="en"> + <refnamediv> + <refname>String writing (Scilab gateway)</refname> + <refpurpose> + How to add matrix of string in a list. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfStringInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createMatrixOfStringInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + Address of the parent of the new item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + Position of the new item in the list. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + Address of array of char* (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add matrix of string in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); + +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/AssignOutputVariable.xml b/modules/api_scilab/help/en_US/low_level_functions/AssignOutputVariable.xml new file mode 100755 index 000000000..d03a852b6 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/AssignOutputVariable.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="AssignOutputVariable"> + <refnamediv> + <refname>AssignOutputVariable</refname> + <refpurpose> + a C gateway function which specifies which parameters created + inside the C gateway will be returned as an output argument into + Scilab. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>AssignOutputVariable(pvApiCtx, RankPos) = RankVar;</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>RankPos</term> + <listitem> + <para>as integer providing the rank of the output argument</para> + </listitem> + </varlistentry> + <varlistentry> + <term>RankVar</term> + <listitem> + <para> + the rank of the parameter created inside the C gateway to be + returned as an Scilab output argument + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + A C gateway function which specifies which variables created inside + the C interface will be returned as an output argument into Scilab. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>This example takes a matrix of doubles as input and returns:</para> + <itemizedlist> + <listitem> + <para>the number of lines (first output argument)</para> + </listitem> + <listitem> + <para>the number of rows (second output argument)</para> + </listitem> + </itemizedlist> + <para> + We create an intermediate Scilab parameter which will handle an + integer but will neither be used nor returned as an output + argument. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +int sci_mysizedouble(char * fname, unsigned long fname_len) +{ + SciErr sciErr; + int m_in_row; + int n_in_col; + int* piAddr = NULL; + double* pdblData = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + /* get dimensions */ + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &m_in_row, &n_in_col, &pdblData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &m_in_row); // the m_in_row parameter handles the number of lines of the matrix sent as argument + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 1, &m_in_row); // store a same value, but will neither be used nor returned to Scilab + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 3, 1, 1, &n_in_col); // the n_in_col parameter handles the number of columns of the matrix sent as argument + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; // We set the parameter "nbInputArgument(pvApiCtx) + 1" as an output argument + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 3; // We set the parameter "nbInputArgument(pvApiCtx) + 3" as an output argument + ReturnArguments(pvApiCtx); + return 0; +} + ]]> + </programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/CHAPTER b/modules/api_scilab/help/en_US/low_level_functions/CHAPTER new file mode 100755 index 000000000..aaf2bd287 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/CHAPTER @@ -0,0 +1 @@ +title = Low level functions diff --git a/modules/api_scilab/help/en_US/low_level_functions/CallOverloadFunction.xml b/modules/api_scilab/help/en_US/low_level_functions/CallOverloadFunction.xml new file mode 100755 index 000000000..62259fb45 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/CallOverloadFunction.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CallOverloadFunction"> + <refnamediv> + <refname>CallOverloadFunction</refname> + <refpurpose> + a C gateway function uses to call overload function or macro + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>CallOverloadFunction(_iVar)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>iVar</term> + <listitem> + <para> + Specifies which input argument will be used to create + the name of overload function/macro + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + a C gateway function uses to call overload function or macro + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>This example returns the size:</para> + <itemizedlist> + <listitem> + <para>returns the size of input argument</para> + </listitem> + <listitem> + <para>if input argument is a string returns the length</para> + </listitem> + </itemizedlist> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.tst--> + <!--Lib_name: calloverloadfunction--> + <!--Func_list: callOverload--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +int callOverload(char *fname,unsigned long fname_len) +{ + CheckRhs(1, 1); + CheckLhs(0, 1); + + CallOverloadFunction(1); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +function x = %c_getSize(a) + x = lenght(a); +endfunction + +function x = %s_getSize(a) + x = size(a); +endfunction + + +a = [1,2,3,4]; +a_ref = [2,2]; +assert_checkequal(getSize(a) == a_ref); + +b = ["May","the","puffin";"be","with","you"]; +b_ref = [3,3,6;2,4,3]; +assert_checkequal(getSize(b) == b_ref); + + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/CheckInputArgument.xml b/modules/api_scilab/help/en_US/low_level_functions/CheckInputArgument.xml new file mode 100755 index 000000000..26de64903 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/CheckInputArgument.xml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CheckInputArgument" xml:lang="en"> + <refnamediv> + <refname>CheckInputArgument</refname> + <refpurpose> + C function which checks the number of input arguments present in + the calling Scilab function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>CheckInputArgument(void* pvCtx, int iMin, int iMax)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>pvApiCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>iMin</term> + <listitem> + <para> + the minimum number of input arguments which must be present + in the calling Scilab function + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>iMax</term> + <listitem> + <para> + the maximum number of input arguments which must be present + in the calling Scilab function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + C function which checks the number of input arguments present in the + calling Scilab function. You must include api_scilab.h to benefit from this + function. + </para> + <para> + If the number of arguments is not between _iMin and + _iMax, we quit the C interface (<literal>return 0;</literal>) and + an error is returned in the Scilab console. + </para> + <para> + Since <literal>CheckInputArgument</literal> is doing a <literal> + return + 0; + </literal> + within the gateway function, it is important to call this + function before any memory allocation in order to avoid any memory + leak. + </para> + <para> + This function replaces the deprecated <literal>CheckLhs</literal> function + </para> + </refsection> + <refsection> + <title>Examples</title> + <para> + In this example, the C gateway function checks for a number of + input arguments which must be between 2 and 3. + </para> + <programlisting role="example"><![CDATA[ +#include <api_scilab.h> + +int sci_mycheckrhs(char * fname) +{ + CheckInputArgument(pvApiCtx, 2, 3); + + // Read input argument + + // Perform some operations + + // Return output argument + + return 0; +} + ]]></programlisting> + <para>Now, some functions testing this interface:</para> + <programlisting role="example"><![CDATA[ +mycheckrhs(A,B); // OK, 2 input arguments +mycheckrhs(A,B,C); // OK, 3 input arguments +mycheckrhs(A); // ERROR, 1 input argument +mycheckrhs(A,B,C,D); // ERROR, 4 input arguments]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="CheckOutputArgument">CheckOutputArgument</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/CheckOutputArgument.xml b/modules/api_scilab/help/en_US/low_level_functions/CheckOutputArgument.xml new file mode 100755 index 000000000..377d9ac05 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/CheckOutputArgument.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CheckOutputArgument" xml:lang="en"> + <refnamediv> + <refname>CheckOutputArgument</refname> + <refpurpose> + C function which checks the number of output arguments present in + the calling Scilab function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>CheckOutputArgument(void* _pvCtx, int iMin, int iMax)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>pvApiCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>iMin</term> + <listitem> + <para> + the minimum number of output arguments which must be present + in the calling Scilab function + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>iMax</term> + <listitem> + <para> + the maximum number of output arguments which must be present + in the calling Scilab function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + C function which checks the number of output arguments present in the + calling Scilab function. You must include api_scilab.h to benefit from this + function. + </para> + <para> + If the number of arguments is not between _iMin and + _iMax, we quit the C interface (<literal>return 0;</literal>) and + an error is returned in the Scilab console. + </para> + <para> + Since <literal>CheckOutputArgument</literal> is doing a <literal> + return + 0; + </literal> + within the gateway function, it is important to call this + function before any memory allocation in order to avoid any memory + leak. + </para> + <para> + This function replaces the deprecated <literal>CheckLhs</literal> function + </para> + </refsection> + <refsection> + <title>Examples</title> + <para> + In this example, the C gateway function checks for a number of + output arguments which must be between 2 and 3. + </para> + <programlisting role="example"><![CDATA[ +#include <api_scilab.h> + +int sci_mychecklhs(char * fname) +{ + CheckOutputArgument(pvApiCtx, 2, 3); + + // Read input argument + + // Perform some operations + + // Return output argument + return 0; +} + ]]></programlisting> + <para>Now, some functions testing this interface:</para> + <programlisting role="example"><![CDATA[ +[A,B] = mychecklhs(); // OK, 2 output arguments +[A,B,C] = mychecklhs(); // OK, 3 output arguments +[A] = mychecklhs(); // ERROR, 1 output argument +[A,B,C,D] = mychecklhs(); // ERROR, 4 output arguments]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="CheckInputArgument">CheckInputArgument</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/ReturnArguments.xml b/modules/api_scilab/help/en_US/low_level_functions/ReturnArguments.xml new file mode 100755 index 000000000..25b8c5e83 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/ReturnArguments.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="ReturnArguments"> + <refnamediv> + <refname>ReturnArguments</refname> + <refpurpose> + A C gateway function which returns the various variables. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>ReturnArguments(pvApiCtx);</synopsis> + </refsynopsisdiv> + <refsection> + <title>Description</title> + <para> + ReturnArguments(pvApiCtx) will return the various variables declared through + AssignOutputVariable(pvApiCtx, X). + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>This example takes a matrix of doubles as input and returns:</para> + <itemizedlist> + <listitem> + <para>the number of lines (first output argument)</para> + </listitem> + <listitem> + <para>the number of rows (second output argument)</para> + </listitem> + </itemizedlist> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +int sci_mysizedouble(char * fname, unsigned long fname_len) +{ + SciErr sciErr; + int m_in_row; + int n_in_col; + int* piAddr = NULL; + double* pdblData = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + /* get dimensions */ + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &m_in_row, &n_in_col, &pdblData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &m_in_row); // the m_in_row parameter handles the number of lines of the matrix sent as argument + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 1, &m_in_row); // store a same value, but will neither be used nor returned to Scilab + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 3, 1, 1, &n_in_col); // the n_in_col parameter handles the number of columns of the matrix sent as argument + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; // We set the parameter "nbInputArgument(pvApiCtx) + 1" as an output argument + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 3; // We set the parameter "nbInputArgument(pvApiCtx) + 3" as an output argument + ReturnArguments(pvApiCtx); + return 0; +} + ]]> + </programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/boolean_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/boolean_reading_api.xml new file mode 100755 index 000000000..83aa3ad7e --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/boolean_reading_api.xml @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="boolean_reading_API" xml:lang="en"> + <refnamediv> + <refname>Boolean reading (Scilab gateway)</refname> + <refpurpose> + How to read matrix of boolean. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfBoolean(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piBool)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + Return address of data array (size: _iRows * _iCols). + For "Named" function, _piBool must be allocated before calling function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read matrix of boolean.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_boolean_api.tst--> + <!--Lib_name: read_write_boolean--> + <!--Func_list: read_write_boolean--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_write_boolean(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + //first variable info : real matrix of double + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int* piBool = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1,1); + CheckOutputArgument(pvApiCtx, 1,1); + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //get size and data from Scilab memory + sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with data + for(i = 0 ; i < iRows * iCols ; i++) + { + piBool[i] = piBool[i] == 0 ? 1 : 0; + } + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = [%t, %f, %t ; %f, %t, %f ; %t, %f, %t]; +a_ref = [%f, %t, %f ; %t, %f, %t ; %f, %t, %f]; +b = read_write_boolean(a); + +if or(b <> a_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/boolean_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/boolean_writing_api.xml new file mode 100755 index 000000000..b6cd247c1 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/boolean_writing_api.xml @@ -0,0 +1,220 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="boolean_writing_API" xml:lang="en"> + <refnamediv> + <refname>Boolean writing (Scilab gateway)</refname> + <refpurpose> + How to write matrices of boolean. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piBool)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + Return address of data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr allocMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Numbers of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + Returns address of real data array (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to write matrix of boolean.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_boolean_api.tst--> + <!--Lib_name: read_write_boolean--> + <!--Func_list: read_write_boolean--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" + +int read_write_boolean(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + //first variable info : real matrix of double + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int* piBool = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1,1); + CheckOutputArgument(pvApiCtx, 1,1); + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //get size and data from Scilab memory + sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with data + for(i = 0 ; i < iRows * iCols ; i++) + { + piBool[i] = piBool[i] == 0 ? 1 : 0; + } + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = [%t, %f, %t ; %f, %t, %f ; %t, %f, %t]; +a_ref = [%f, %t, %f ; %t, %f, %t ; %f, %t, %f]; +b = read_write_boolean(a); + +if or(b <> a_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/bsparse_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/bsparse_reading_api.xml new file mode 100755 index 000000000..af018a188 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/bsparse_reading_api.xml @@ -0,0 +1,209 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="bsparse_reading_API" xml:lang="en"> + <refnamediv> + <refname>Boolean sparse reading (Scilab gateway)</refname> + <refpurpose> + How to read boolean sparse in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + Return number of non zero value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Return number of item in each rows (size: _iRows). + For "Named" function, _piNbItemRow must be allocated before calling function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Return column position for each item (size: _iNbItem). + For "Named" function, _piColPos must be allocated before calling function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read boolean sparse.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst--> + <!--Lib_name: read_write_bsparse--> + <!--Func_list: read_write_bsparse--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_write_bsparse(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i = 0; + int j = 0; + int k = 0; + //first variable info : real matrix of double + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + int iCol = 0; + int iNewCol = 0; + int iNewItem = 0; + int* piNewRow = NULL; + int* piNewCol = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //get size and data from Scilab memory + sciErr = getBooleanSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with data + //convert %T -> %F and %F -> %T + iNewItem = (iRows * iCols) - iNbItem; + piNewRow = (int*)MALLOC(sizeof(int) * iRows); + piNewCol = (int*)MALLOC(sizeof(int) * iNewItem); + + for(i = 0 ; i < iRows ; i++) + { + piNewRow[i] = iCols - piNbItemRow[i]; + for(j = 0 ; j < iCols ; j++) + { + int iFind = 0; + for(k = 0 ; k < piNbItemRow[i] ; k++) + { + if(piColPos[iCol + k] == (j + 1)) + { + iFind = 1; + break; + } + } + + if(iFind == 0) + { + piNewCol[iNewCol++] = (j + 1); + } + } + + iCol += piNbItemRow[i]; + } + + sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNewItem, piNewRow, piNewCol); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = sparse([%t, %f, %t ; %f, %t, %f ; %t, %f, %t]); +a_ref = sparse([%f, %t, %f ; %t, %f, %t ; %f, %t, %f]); + +b = read_write_bsparse(a); +if or(b <> a_ref) then error("failed");end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/bsparse_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/bsparse_writing_api.xml new file mode 100755 index 000000000..3149ff565 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/bsparse_writing_api.xml @@ -0,0 +1,284 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="bsparse_writing_API" xml:lang="en"> + <refnamediv> + <refname>Boolean sparse writing (Scilab gateway)</refname> + <refpurpose> + How to add boolean sparse matrix in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + Number of non zero itmes in the sparse. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr allocBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + Number of non zero itmes in the sparse. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add boolean sparse matrix in a list.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst--> + <!--Lib_name: read_write_bsparse--> + <!--Func_list: read_write_bsparse--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_write_bsparse(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i = 0; + int j = 0; + int k = 0; + //first variable info : real matrix of double + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + int iCol = 0; + int iNewCol = 0; + int iNewItem = 0; + int* piNewRow = NULL; + int* piNewCol = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //get size and data from Scilab memory + sciErr = getBooleanSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with data + //convert %T -> %F and %F -> %T + iNewItem = (iRows * iCols) - iNbItem; + piNewRow = (int*)MALLOC(sizeof(int) * iRows); + piNewCol = (int*)MALLOC(sizeof(int) * iNewItem); + + for(i = 0 ; i < iRows ; i++) + { + piNewRow[i] = iCols - piNbItemRow[i]; + for(j = 0 ; j < iCols ; j++) + { + int iFind = 0; + for(k = 0 ; k < piNbItemRow[i] ; k++) + { + if(piColPos[iCol + k] == (j + 1)) + { + iFind = 1; + break; + } + } + + if(iFind == 0) + { + piNewCol[iNewCol++] = (j + 1); + } + } + + iCol += piNbItemRow[i]; + } + + sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNewItem, piNewRow, piNewCol); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = sparse([%t, %f, %t ; %f, %t, %f ; %t, %f, %t]); +a_ref = sparse([%f, %t, %f ; %t, %f, %t ; %f, %t, %f]); + +b = read_write_bsparse(a); +if or(b <> a_ref) then error("failed");end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/check_matrix_dimension.xml b/modules/api_scilab/help/en_US/low_level_functions/check_matrix_dimension.xml new file mode 100755 index 000000000..073028180 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/check_matrix_dimension.xml @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="check_matrix_dimension" xml:lang="en"> + <refnamediv> + <refname>Check variable dimensions (Scilab gateway)</refname> + <refpurpose>A C gateway functions which check dimensions of a variable.</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int checkVarDimension(void* _pvCtx, int* _piAddress, int _iRows, int _iCols)</synopsis> + <synopsis>int isRowVector(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isColumnVector(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isVector(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isScalar(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isSquareMatrix(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isEmptyMatrix(void* _pvCtx, int* _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para>Expected row count</para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para>Expected col count</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + A C gateway functions which check dimensions of a variable. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para> + In this example, the C interface function can take several input + arguments and prints input dimensions and several test results. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" + +int check_matrix_dimension(char * fname) +{ + SciErr sciErr; + int* piAddr = NULL; + int iRows = 0; + int iCols = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + if(checkVarDimension(pvApiCtx, piAddr, iCols, iRows)) + { + sciprint("checkVarDimension returns false\n"); + } + else + { + sciprint("checkVarDimension returns true\n"); + } + + if(isRowVector(pvApiCtx, piAddr)) + { + sciprint("isRowVector\n"); + } + + if(isColumnVector(pvApiCtx, piAddr)) + { + sciprint("isColumnVector\n"); + } + + if(isVector(pvApiCtx, piAddr)) + { + sciprint("isVector\n"); + } + + if(isScalar(pvApiCtx, piAddr)) + { + sciprint("isScalar\n"); + } + + if(isSquareMatrix(pvApiCtx, piAddr)) + { + sciprint("isSquareMatrix\n"); + } + + if(isEmptyMatrix(pvApiCtx, piAddr)) + { + sciprint("isEmptyMatrix\n"); + } + + //no return value + AssignOutputVariable(pvApiCtx, 0) = 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"> + <![CDATA[ +check_matrix_dimension([1,2,3;4,5,6]); +check_matrix_dimension([1,2,3]); +check_matrix_dimension([1;2;3]); +check_matrix_dimension([1]); +check_matrix_dimension([1,2;3,4]); +check_matrix_dimension([]); + ]]> + </programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/common_getvaraddr_api.xml b/modules/api_scilab/help/en_US/low_level_functions/common_getvaraddr_api.xml new file mode 100755 index 000000000..adaf1ef16 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/common_getvaraddr_api.xml @@ -0,0 +1,242 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_getvaraddr_API" xml:lang="en"> + <refnamediv> + <refname>Variable Reference (Scilab gateway)</refname> + <refpurpose> + How to get the address of an argument or a variable in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getVarAddressFromPosition(void* _pvCtx, int _iVar, int** _piAddress)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr getVarAddressFromName(void* _pvCtx, const char* _pstName, int** _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position of the argument in the function call. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Scilab variable name. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Return address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This function retrieves the address of an argument in a gateway.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); + +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + + //1 for true, 0 for false + iBool = sciErr.iErr == 0 ? 1 : 0; + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("Variable %d information:\n", _iVar); + + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d", iItem); + } + return sciErr; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/common_getvardimension_api.xml b/modules/api_scilab/help/en_US/low_level_functions/common_getvardimension_api.xml new file mode 100755 index 000000000..5460d944b --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/common_getvardimension_api.xml @@ -0,0 +1,250 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_getvardimension_API" xml:lang="en"> + <refnamediv> + <refname>Variable dimension (Scilab gateway)</refname> + <refpurpose> + How to get the dimensions of an argument or a variable stored as matrix. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getVarDimension(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr getNamedVarDimension(void* _pvCtx, const char *_pstName, int* _piRows, int* _piCols)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + The address of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Scilab variable name. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to get the dimensions of a variable in a gateway.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); + +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + + //1 for true, 0 for false + iBool = sciErr.iErr == 0 ? 1 : 0; + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("Variable %d information:\n", _iVar); + + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d", iItem); + } + return sciErr; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/common_getvartype_api.xml b/modules/api_scilab/help/en_US/low_level_functions/common_getvartype_api.xml new file mode 100755 index 000000000..ff3998d04 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/common_getvartype_api.xml @@ -0,0 +1,278 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_getvartype_API" xml:lang="en"> + <refnamediv> + <refname>Variable Type (Scilab gateway)</refname> + <refpurpose> + How to get the type of an argument or a variable within a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getVarType(void* _pvCtx, int* _piAddress, int* _piType)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr getNamedVarType(void* _pvCtx, const char* _pstName, int* _piType)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + The address of the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Scilab variable name. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piType</term> + <listitem> + <para> + Scilab type of the variable (sci_matrix, sci_strings, sci_ints, ...). + </para> + <para> + Note that the list of the different variable types is available as an enum in <link linkend="sci_types">sci_types.h</link>. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to retrieve the Scilab type of a variable in a gateway.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); + +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + + //1 for true, 0 for false + iBool = sciErr.iErr == 0 ? 1 : 0; + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("Variable %d information:\n", _iVar); + + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d", iItem); + } + return sciErr; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="sci_types">sci_types</link> + </member> + <member> + <link linkend="isPolyType">isPolyType</link> + </member> + <member> + <link linkend="isBooleanType">isBooleanType</link> + </member> + <member> + <link linkend="isListType">isListType</link> + </member> + <member> + <link linkend="isDoubleType">isDoubleType</link> + </member> + <member> + <link linkend="isIntegerType">isIntegerType</link> + </member> + <member> + <link linkend="isSparseType">isSparseType</link> + </member> + <member> + <link linkend="isBooleanSparseType">isBooleanSparseType</link> + </member> + <member> + <link linkend="isStringType">isStringType</link> + </member> + + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/common_iscomplex_api.xml b/modules/api_scilab/help/en_US/low_level_functions/common_iscomplex_api.xml new file mode 100755 index 000000000..b16d4094a --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/common_iscomplex_api.xml @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_iscomplex_API" xml:lang="en"> + <refnamediv> + <refname>Variable Complexity (Scilab gateway)</refname> + <refpurpose> + How to get the argument or variable complexity. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>int isVarComplex(void* _pvCtx, int* _piAddress)</synopsis> + <para>Named variable profile:</para> + <synopsis>int isNamedVarComplex(void* _pvCtx, const char *_pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Scilab variable name. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Returned value</term> + <listitem> + <para> + 0 for real variables and 1 for complex variables. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to retrieve the variable complexity.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); + +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + + //1 for true, 0 for false + iBool = sciErr.iErr == 0 ? 1 : 0; + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("Variable %d information:\n", _iVar); + + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d", iItem); + } + return sciErr; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/common_isvarmatrixtype_api.xml b/modules/api_scilab/help/en_US/low_level_functions/common_isvarmatrixtype_api.xml new file mode 100755 index 000000000..bc4749ae5 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/common_isvarmatrixtype_api.xml @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_isvarmatrixtype_API" xml:lang="en"> + <refnamediv> + <refname>Matrix Type (Scilab gateway)</refname> + <refpurpose> + How to know if an argument or a variable is stored as a matrix. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>int isVarMatrixType(void* _pvCtx, int* _piAddress)</synopsis> + <para>Named variable profile:</para> + <synopsis>int isNamedVarMatrixType(void* _pvCtx, const char *_pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Returned value</term> + <listitem> + <para> + 1 if the variable is stored as matrix otherwise 0. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to know if a variable is stored as a matrix.</para> + <para>In some cases (exemple: list), a variable is not stored as a standard Scilab matrix. This function provides a way to handle both cases.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); + +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + + //1 for true, 0 for false + iBool = sciErr.iErr == 0 ? 1 : 0; + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("Variable %d information:\n", _iVar); + + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("%d", iItem); + } + return sciErr; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/deleteNamedVariable.xml b/modules/api_scilab/help/en_US/low_level_functions/deleteNamedVariable.xml new file mode 100755 index 000000000..025840048 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/deleteNamedVariable.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="deleteNamedVariable"> + <refnamediv> + <refname>deleteNamedVariable</refname> + <refpurpose> + a C gateway function uses to delete a variable from name + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int deleteNamedVariable(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + a C gateway function uses to delete a variable from name + </para> + </refsection> + <refsection> + <title>Examples</title> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +fileData = ['#include ""api_scilab.h""' +'#include ""MALLOC.h""' +'' +'int sci_deleteNamedVariable(char *fname, unsigned long fname_len)' +'{' +' SciErr sciErr;' +' int iRet = 0;' +' int* piAddr = NULL;' +' char* pstVarName = NULL;' +'' +' CheckRhs(1,1);' +' CheckLhs(1,1);' +'' +' sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);' +' if(sciErr.iErr)' +' {' +' printError(&sciErr, 0);' +' return 1;' +' }' +'' +' if(getAllocatedSingleString(pvApiCtx, piAddr, &pstVarName))' +' {' +' //error' +' return 1;' +' }' +'' +' if(isNamedVarExist(pvApiCtx, pstVarName))' +' {' +' iRet = deleteNamedVariable(pvApiCtx, pstVarName);' +' }' +'' +' createScalarBoolean(pvApiCtx, Rhs + 1, iRet);' +' AssignOutputVariable(pvApiCtx, 1) = Rhs + 1;' +' return 0;' +'}']; + +currentPath = pwd(); +mkdir(TMPDIR + "/deleteNamedVariable"); +cd(TMPDIR + "/deleteNamedVariable"); +mputl(fileData, "deleteNamedVariable.c"); + +ilib_verbose(0); +files = ['deleteNamedVariable.c']; +ilib_build('libdeleteNamedVariable', ['deleteNamedVariable', 'sci_deleteNamedVariable'], files, []); +exec loader.sce; + +function test() + assert_checkequal(exists("a"), 1); + assert_checkequal(a, 1); + a = 2; + assert_checkequal(a, 2); + assert_checktrue(deleteNamedVariable("a")); + assert_checkequal(exists("a"), 1); + assert_checkequal(a, 1); +endfunction + +a = 1; +test(); +assert_checkequal(a, 1); +deleteNamedVariable("a"); +assert_checkequal(exists("a"), 0); + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/double_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/double_reading_api.xml new file mode 100755 index 000000000..1d6e1c50f --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/double_reading_api.xml @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Double_management_reading_API" xml:lang="en"> + <refnamediv> + <refname>Double reading (Scilab gateway)</refname> + <refpurpose> + How to read matrices of double in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, double* _pdblReal)</synopsis> + <synopsis>SciErr readNamedComplexMatrixOfDouble(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return address of real data array (size: _iCols * _iRows). + For "Named" function, _pdblReal must be allocated before calling function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + Return address of imaginary data array (size: _iCols * _iRows). + For "Named" function, _pdblImg must be allocated before calling function. + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how matrix of doubles can be handled through the Scilab API.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/double_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/double_reading_api.tst--> + <!--Lib_name: double_reading--> + <!--Func_list: read_double--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_double(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + //first variable info : real matrix of double + int iType = 0; + int iRows = 0; + int iCols = 0; + int iComplex = 0; + int *piAddr = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + /************************ + * First variable * + ************************/ + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //check type + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr || iType != sci_matrix) + { + printError(&sciErr, 0); + return 0; + } + + //get complexity + iComplex = isVarComplex(pvApiCtx, piAddr); + + //check complexity + if(iComplex) + { + //get size and data from Scilab memory + sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + //get size and data from Scilab memory + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with data + //if variable is complex, switch real part and imaginary part otherwise multiply by -1 + if(iComplex) + { + sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblImg, pdblReal); + } + else + { + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = pdblReal[i] * -1; + } + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = [ 0 1 2 3; .. + 4 5 6 7; .. + 8 9 10 11]; +b = [ 23*%i, 1+22*%i, 2+21*%i, 3+20*%i, 4+19*%i, 5+18*%i; .. + 6+17*%i, 7+16*%i, 8+15*%i, 9+14*%i, 10+13*%i, 11+12*%i; .. + 12+11*%i, 13+10*%i, 14+9*%i, 15+8*%i, 16+7*%i, 17+6*%i; .. + 18+5*%i, 19+4*%i, 20+3*%i, 21+2*%i, 22+1*%i, 23]; + +a2 = read_double(a); +b2 = read_double(b); + +if or(a2 <> a * -1) then error("failed"), end +if or(b2 <> (imag(b) + real(b) * %i)) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/double_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/double_writing_api.xml new file mode 100755 index 000000000..0c58636ac --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/double_writing_api.xml @@ -0,0 +1,299 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Double_management_writing_API" xml:lang="en"> + <refnamediv> + <refname>Double writing (Scilab gateway)</refname> + <refpurpose> + How to write matrices of doubles in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + Create from existing data. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const double* _pdblReal, double* _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const double* _pdblReal)</synopsis> + <synopsis>SciErr createNamedComplexMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Numbers of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of real data array (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of imaginary data array (size: _iCols * _iRows). + This argument does not exist with createMatrixOfDouble and createNamedMatrixOfDouble. + </para> + <para> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr allocMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal)</synopsis> + <synopsis>SciErr allocComplexMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg)</synopsis> + <synopsis>SciErr allocComplexZMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal, doublecomplex** _pdblData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Numbers of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Returns address of real data array (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Returns address of imaginary data array (size: _iCols * _iRows). + This argument does not exist with allocMatrixOfDouble. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblData</term> + <listitem> + <para> + Returns address of doublecomplex data array (size: _iCols * _iRows). + This argument exists only in allocComplexZMatrixOfDouble. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/double_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/double_writing_api.tst--> + <!--Lib_name: double_writing--> + <!--Func_list: write_double--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int write_double(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j; + //first variable info : real matrix of double 3 x 4 + int iRows1 = 3; + int iCols1 = 4; + double* pdblReal1 = NULL; + //second variable info : complex matrix of double 4 x 6 + int iRows2 = 4; + int iCols2 = 6; + double* pdblReal2 = NULL; + double* pdblImg2 = NULL; + + /************************ + * First variable * + ************************/ + + //alloc array of data in OS memory + pdblReal1 = (double*)malloc(sizeof(double) * iRows1 * iCols1); + //fill array with incremental values + //[ 0 1 2 3 + // 4 5 6 7 + // 8 9 10 11] + for(i = 0 ; i < iRows1 ; i++) + { + for(j = 0 ; j < iCols1 ; j++) + { + pdblReal1[i + iRows1 * j] = i * iCols1 + j; + } + } + + //can be written in a single loop + //for(i = 0 ; i < iRows1 * iCols1; i++) + //{ + // pdblReal1[i] = i; + //} + //create a variable from a existing data array + + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows1, iCols1, pdblReal1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //after creation, we can free memory. + free(pdblReal1); + + + /************************* + * Second variable * + *************************/ + + //reserve space in scilab memory and fill it + sciErr = allocComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRows2, iCols2, &pdblReal2, &pdblImg2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //fill array with incremental values for real part and decremental for imaginary part + //[ 23i 1+22i 2+21i 3+20i 4+19i 5+18i + // 6+17i 7+16i 8+15i 9+14i 10+13i 11+12i + // 12+11i 13+10i 14+9i 15+8i 16+7i 17+6i + // 18+5i 19+4i 20+3i 21+2i 22+1i 23 ] + for(i = 0 ; i < iRows2 ; i++) + { + for(j = 0 ; j < iCols2 ; j++) + { + pdblReal2[i + iRows2 * j] = i * iCols2 + j; + pdblImg2 [i + iRows2 * j] = (iRows2 * iCols2 - 1) - (i * iCols2 + j); + } + } + + //can be written in a single loop + //for(i = 0 ; i < iRows2 * iCols2; i++) + //{ + // pdblReal2[i] = i; + // pdblImg2 [i] = (iRows2 * iCols2 - 1) - i; + //} + // /!\ DO NOT FREE MEMORY, in this case, it's the Scilab memory + //assign allocated variables to Lhs position + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a_ref = [ 0 1 2 3; .. + 4 5 6 7; .. + 8 9 10 11]; +b_ref = [ 23*%i, 1+22*%i, 2+21*%i, 3+20*%i, 4+19*%i, 5+18*%i; .. + 6+17*%i, 7+16*%i, 8+15*%i, 9+14*%i, 10+13*%i, 11+12*%i; .. + 12+11*%i, 13+10*%i, 14+9*%i, 15+8*%i, 16+7*%i, 17+6*%i; .. + 18+5*%i, 19+4*%i, 20+3*%i, 21+2*%i, 22+1*%i, 23]; +[a,b] = write_double(); +if or(a <> a_ref) then error("failed");end +if or(b <> b_ref) then error("failed");end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/getNbInputArgument.xml b/modules/api_scilab/help/en_US/low_level_functions/getNbInputArgument.xml new file mode 100755 index 000000000..9c4c84c88 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/getNbInputArgument.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getNbInputArgument" xml:lang="en"> + <refnamediv> + <refname>getNbInputArgument (Scilab gateway)</refname> + <refpurpose>A C gateway function which provides the number of input + arguments present in the calling Scilab function + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int* nb_params = getNbInputArgument(void* _pvCtx)</synopsis> + <synopsis>int nb_params = nbInputArgument(void* _pvCtx)</synopsis> + <synopsis>int nb_params = Rhs</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_params</term> + <listitem> + <para>the pointer on the number of input arguments present in the calling Scilab + function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>A C gateway function which provides the number of input arguments + present in the calling Scilab function. You must include api_scilab.h to + benefit from this function. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>In this example, the C interface function can take several input + arguments and prints in the Scilab console the integer corresponding to + the number of input arguments detected in the calling Scilab + function. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" + +int sci_myrhs(char * fname) +{ + sciprint("The number of input parameters is %d\n", *getNbInputArgument()); + + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="getNbOutputArgument">getNbOutputArgument</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/getNbOutputArgument.xml b/modules/api_scilab/help/en_US/low_level_functions/getNbOutputArgument.xml new file mode 100755 index 000000000..244840a8a --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/getNbOutputArgument.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getNbOutputArgument" xml:lang="en"> + <refnamediv> + <refname>getNbOutputArgument (Scilab gateway)</refname> + <refpurpose> + A C gateway function which provides the number of output + arguments present in the calling Scilab function + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int* nb_params = getNbOutputArgument(void* _pvCtx)</synopsis> + <synopsis>int nb_params = nbOutputArgument(void* _pvCtx)</synopsis> + <synopsis>int nb_params = Lhs</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_params</term> + <listitem> + <para> + the pointer on the number of output arguments present in the calling Scilab + function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + getNbOutputArgument provides a C gateway function which provides the number of + output arguments present in the calling Scilab function. You must include + api_scilab.h to benefit from this function. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para> + In this example, the C gateway function can take several output + arguments and prints in the Scilab console the integer corresponding to + the number of output arguments detected in the calling Scilab + function. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" + +int sci_mylhs(char * fname) +{ + sciprint("The number of output arguments is %d\n", *getNbOutputArgument()); + + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="getNbInputArgument">getNbInputArgument</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/handle_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/handle_reading_api.xml new file mode 100755 index 000000000..2cfd0f3da --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/handle_reading_api.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="handle_reading_API" xml:lang="en"> + <refnamediv> + <refname>Handle reading (Scilab gateway)</refname> + <refpurpose> + How to read matrix of handle. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfHandle(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, long long** _pllHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pllHandle</term> + <listitem> + <para> + Return address of data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to read matrix of handle.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_handle_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_handle_api.tst--> + <!--Lib_name: read_write_handle--> + <!--Func_list: read_write_handle--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int read_write_handle(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + //first variable info : real matrix of double + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + long long* pllHandle = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1,1); + CheckOutputArgument(pvApiCtx, 1,1); + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //get size and data from Scilab memory + sciErr = getMatrixOfHandle(pvApiCtx, piAddr, &iRows, &iCols, &pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"> + <![CDATA[ +f1 = scf(1); +f2 = scf(2); +a_ref = [f1, f2]; +b = read_write_handle(a_ref); + +if or(b <> a_ref) then error("failed"), end + ]]> + </programlisting> + </refsection> + <title>History</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>This function added in Scilab 5.5.0</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/handle_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/handle_writing_api.xml new file mode 100755 index 000000000..5a0a91099 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/handle_writing_api.xml @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="handle_writing_API" xml:lang="en"> + <refnamediv> + <refname>Handle writing (Scilab gateway)</refname> + <refpurpose> + How to write matrices of handle. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfHandle(void* _pvCtx, int _iVar, int _iRows, int _iCols, const long long* _pllHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pllHandle</term> + <listitem> + <para> + Return address of data array (size: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr allocMatrixOfHandle(void* _pvCtx, int _iVar, int _iRows, int _iCols, long long** _pllHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Numbers of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pllHandle</term> + <listitem> + <para> + Returns address of real data array (size: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to write matrix of handle.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_handle_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_handle_api.tst--> + <!--Lib_name: read_write_handle--> + <!--Func_list: read_write_handle--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int read_write_handle(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + //first variable info : real matrix of double + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + long long* pllHandle = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1,1); + CheckOutputArgument(pvApiCtx, 1,1); + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //get size and data from Scilab memory + sciErr = getMatrixOfHandle(pvApiCtx, piAddr, &iRows, &iCols, &pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"> + <![CDATA[ +f1 = scf(1); +f2 = scf(2); +a_ref = [f1, f2]; +b = read_write_handle(a_ref); + +if or(b <> a_ref) then error("failed"), end + ]]> + </programlisting> + </refsection> + <title>History</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>This function added in Scilab 5.5.0</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/int_getmatrixofintegerprecision_api.xml b/modules/api_scilab/help/en_US/low_level_functions/int_getmatrixofintegerprecision_api.xml new file mode 100755 index 000000000..d41fb0a46 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/int_getmatrixofintegerprecision_api.xml @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="int_getmatrixofintegerprecision_API" xml:lang="en"> + <refnamediv> + <refname>Integer Precision (Scilab gateway)</refname> + <refpurpose> + How to get precision of an integer matrix. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>SciErr getMatrixOfIntegerPrecision(void* _pvCtx, int* _piAddress, int* _piPrecision)</synopsis> + <synopsis>SciErr getNamedMatrixOfIntegerPrecision(void* _pvCtx, const char* _pstName, int* _piPrecision)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piPrecision</term> + <listitem> + <para> + Return precision of an integer variable. If value is greater then 10 then the variable is unsigned. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to get precision of an integer matrix.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); + +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + + //1 for true, 0 for false + iBool = sciErr.iErr == 0 ? 1 : 0; + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("Variable %d information:\n", _iVar); + + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + + sciprint("\tType: "); + if(iType == sci_ints) + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + else + { + sciprint("Not manage by this function\n"); + return sciErr; + } + + return sciErr; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/integer_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/integer_reading_api.xml new file mode 100755 index 000000000..ffa7bb996 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/integer_reading_api.xml @@ -0,0 +1,413 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Integer_management_reading_API" xml:lang="en"> + <refnamediv> + <refname>Integer reading (Scilab gateway)</refname> + <refpurpose> + How to read matrices of integer in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr getMatrixOfInteger8(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, char** _pcData8)</synopsis> + <synopsis>SciErr getMatrixOfInteger16(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, short** _psData16)</synopsis> + <synopsis>SciErr getMatrixOfInteger32(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piData32)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr getMatrixOfUnsignedInteger8(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned char** _pucData8)</synopsis> + <synopsis>SciErr getMatrixOfUnsignedInteger16(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned short** _pusData16)</synopsis> + <synopsis>SciErr getMatrixOfUnsignedInteger32(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned int** _puiData32)</synopsis> + <para>Named variable profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr readNamedMatrixOfInteger8(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, char* _pcData8)</synopsis> + <synopsis>SciErr readNamedMatrixOfInteger16(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, short* _psData16)</synopsis> + <synopsis>SciErr readNamedMatrixOfInteger32(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piData32)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr readNamedMatrixOfUnsignedInteger8(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned char* _pucData8)</synopsis> + <synopsis>SciErr readNamedMatrixOfUnsignedInteger16(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned short* _pusData16)</synopsis> + <synopsis>SciErr readNamedMatrixOfUnsignedInteger32(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned int* _puiData32)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _pucData8, _psData16, _pusData16, _piData32, _puiData32</term> + <listitem> + <para> + Returns address of array ( size: _piRows * _piCols). + For "Named" function, _pcData must be allocated before calling function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how matrices of integer can be handled through the Scilab API.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/integer_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/integer_reading_api.tst--> + <!--Lib_name: integer_reading--> + <!--Func_list: read_integer--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn); + +int read_integer(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + //output variable info + int iRows8 = 0; + int iCols8 = 0; + int iRows16 = 0; + int iCols16 = 0; + int iRows32 = 0; + int iCols32 = 0; + int iRowsu8 = 0; + int iColsu8 = 0; + int iRowsu16 = 0; + int iColsu16 = 0; + int iRowsu32 = 0; + int iColsu32 = 0; + int iPrec = 0; + int* piAddr8 = NULL; + int* piAddr16 = NULL; + int* piAddr32 = NULL; + int* piAddru8 = NULL; + int* piAddru16 = NULL; + int* piAddru32 = NULL; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + char* pcDataOut = NULL; + short* psDataOut = NULL; + int* piDataOut = NULL; + unsigned char* pucDataOut = NULL; + unsigned short* pusDataOut = NULL; + unsigned int* puiDataOut = NULL; + + //check input/output arguments count + CheckInputArgument(pvApiCtx, 6, 6); + CheckOutputArgument(pvApiCtx, 6, 6); + + //get varialbe address + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr8); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddru8); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr16); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddru16); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr32); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddru32); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr8, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT8) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru8, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT8) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr16, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT16) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru16, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT16) + { + printError(&sciErr, 0); + return 0; + } + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr32, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT32) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru32, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT32) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger8(pvApiCtx, piAddr8, &iRows8, &iCols8, &pcData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddru8, &iRowsu8, &iColsu8, &pucData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger16(pvApiCtx, piAddr16, &iRows16, &iCols16, &psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddru16, &iRowsu16, &iColsu16, &pusData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger32(pvApiCtx, piAddr32, &iRows32, &iCols32, &piData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddru32, &iRowsu32, &iColsu32, &puiData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc and fill new variable + pcDataOut = (char*)create_output(2, 1, iRows8, iCols8, (void*)pcData); + pucDataOut = (unsigned char*)create_output(4, 1, iRowsu8, iColsu8, (void*)pucData); + psDataOut = (short*)create_output(8, 2, iRows16, iCols16, (void*)psData); + pusDataOut = (unsigned short*)create_output(16, 2, iRowsu16, iColsu16, (void*)pusData); + piDataOut = (int*)create_output(32, 4, iRows32, iCols32, (void*)piData); + puiDataOut = (unsigned int*)create_output(64, 4, iRowsu32, iColsu32, (void*)puiData); + + //create new variable + sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows8, iCols8, pcDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRowsu8, iColsu8, pucDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 3, iRows16, iCols16, psDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 4, iRowsu16, iColsu16, pusDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 5, iRows32, iCols32, piDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 6, iRowsu32, iColsu32, puiDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3; + AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4; + AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5; + AssignOutputVariable(pvApiCtx, 6) = nbInputArgument(pvApiCtx) + 6; + return 0; +} + +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn) +{ + int i = 0; + void* pvDataOut = (void*)malloc(_iSize * _iRows * _iCols); + for(i = 0 ; i < _iRows * _iCols ; i++) + { + int iVal = 0; + memcpy(&iVal, (char*)_pvDataIn + i * _iSize, _iSize); + iVal *= _iCoeff; + memcpy((char*)pvDataOut + i * _iSize, &iVal, _iSize); + } + return pvDataOut; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a8 = int8([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); + +au8 = uint8([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); + +a16 = int16([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); + +au16 = uint16([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); + +a32 = int32([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); + +au32 = uint32([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); + +[c8, cu8, c16, cu16, c32, cu32] = read_integer(a8, au8, a16, au16, a32, au32); + +if or(c8 <> a8 * 2) then error("failed"), end +if or(cu8 <> au8 * 4) then error("failed"), end +if or(c16 <> a16 * 8) then error("failed"), end +if or(cu16 <> au16 * 16) then error("failed"), end +if or(c32 <> a32 * 32) then error("failed"), end +if or(cu32 <> au32 * 64) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/integer_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/integer_writing_api.xml new file mode 100755 index 000000000..4d2b55642 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/integer_writing_api.xml @@ -0,0 +1,484 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Integer_management_writing_API" xml:lang="en"> + <refnamediv> + <refname>Integer writing (Scilab gateway)</refname> + <refpurpose> + How to write matrices of integers in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + Create from existing data. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr createMatrixOfInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, const char* _pcData8)</synopsis> + <synopsis>SciErr createMatrixOfInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, const short* _psData16)</synopsis> + <synopsis>SciErr createMatrixOfInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piData32)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr createMatrixOfUnsignedInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned char* _pucData8)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned short* _pusData16)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned int* _puiData32)</synopsis> + <para>Named variable profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr createNamedMatrixOfInteger8(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const char* _pcData8)</synopsis> + <synopsis>SciErr createNamedMatrixOfInteger16(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const short* _psData16)</synopsis> + <synopsis>SciErr createNamedMatrixOfInteger32(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piData32)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr createNamedMatrixOfUnsignedInteger8(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned char* _pucData8)</synopsis> + <synopsis>SciErr createNamedMatrixOfUnsignedInteger16(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned short* _pusData16)</synopsis> + <synopsis>SciErr createNamedMatrixOfUnsignedInteger32(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned int* _puiData32)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Numbers of columns of the new variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term> + <listitem> + <para> + Address of data array (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <para>Signed integer :</para> + <synopsis>SciErr allocMatrixOfInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, char** _pcData8)</synopsis> + <synopsis>SciErr allocMatrixOfInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, short** _psData16)</synopsis> + <synopsis>SciErr allocMatrixOfInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piData32)</synopsis> + <para>Unsigned integer :</para> + <synopsis>SciErr allocMatrixOfUnsignedInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned char** _pucData8)</synopsis> + <synopsis>SciErr allocMatrixOfUnsignedInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned short** _pusData16)</synopsis> + <synopsis>SciErr allocMatrixOfUnsignedInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned int** _puiData32)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Numbers of columns of the new variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term> + <listitem> + <para> + Returns address of data array (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how matrix of integers can be handled through the Scilab API.</para> + <para>Two types of functions can be used to write in the memory of Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/integer_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/integer_writing_api.tst--> + <!--Lib_name: integer_writing--> + <!--Func_list: read_integer--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn); + +int read_integer(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + //output variable info + int iRows8 = 0; + int iCols8 = 0; + int iRows16 = 0; + int iCols16 = 0; + int iRows32 = 0; + int iCols32 = 0; + int iRowsu8 = 0; + int iColsu8 = 0; + int iRowsu16 = 0; + int iColsu16 = 0; + int iRowsu32 = 0; + int iColsu32 = 0; + int iPrec = 0; + int* piAddr8 = NULL; + int* piAddr16 = NULL; + int* piAddr32 = NULL; + int* piAddru8 = NULL; + int* piAddru16 = NULL; + int* piAddru32 = NULL; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + char* pcDataOut = NULL; + short* psDataOut = NULL; + int* piDataOut = NULL; + unsigned char* pucDataOut = NULL; + unsigned short* pusDataOut = NULL; + unsigned int* puiDataOut = NULL; + + //check input/output arguments count + CheckInputArgument(pvApiCtx, 6, 6); + CheckOutputArgument(pvApiCtx, 6, 6); + + //get varialbe address + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr8); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddru8); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr16); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddru16); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr32); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddru32); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr8, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT8) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru8, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT8) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr16, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT16) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru16, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT16) + { + printError(&sciErr, 0); + return 0; + } + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr32, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT32) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru32, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT32) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger8(pvApiCtx, piAddr8, &iRows8, &iCols8, &pcData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddru8, &iRowsu8, &iColsu8, &pucData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger16(pvApiCtx, piAddr16, &iRows16, &iCols16, &psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddru16, &iRowsu16, &iColsu16, &pusData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger32(pvApiCtx, piAddr32, &iRows32, &iCols32, &piData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddru32, &iRowsu32, &iColsu32, &puiData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc and fill new variable + pcDataOut = (char*)create_output(2, 1, iRows8, iCols8, (void*)pcData); + pucDataOut = (unsigned char*)create_output(4, 1, iRowsu8, iColsu8, (void*)pucData); + psDataOut = (short*)create_output(8, 2, iRows16, iCols16, (void*)psData); + pusDataOut = (unsigned short*)create_output(16, 2, iRowsu16, iColsu16, (void*)pusData); + piDataOut = (int*)create_output(32, 4, iRows32, iCols32, (void*)piData); + puiDataOut = (unsigned int*)create_output(64, 4, iRowsu32, iColsu32, (void*)puiData); + + //create new variable + sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows8, iCols8, pcDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRowsu8, iColsu8, pucDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 3, iRows16, iCols16, psDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 4, iRowsu16, iColsu16, pusDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 5, iRows32, iCols32, piDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 6, iRowsu32, iColsu32, puiDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3; + AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4; + AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5; + AssignOutputVariable(pvApiCtx, 6) = nbInputArgument(pvApiCtx) + 6; + return 0; +} + +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn) +{ + int i = 0; + void* pvDataOut = (void*)malloc(_iSize * _iRows * _iCols); + for(i = 0 ; i < _iRows * _iCols ; i++) + { + int iVal = 0; + memcpy(&iVal, (char*)_pvDataIn + i * _iSize, _iSize); + iVal *= _iCoeff; + memcpy((char*)pvDataOut + i * _iSize, &iVal, _iSize); + } + return pvDataOut; +} +]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a8 = int8([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); + +au8 = uint8([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); + +a16 = int16([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); + +au16 = uint16([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); + +a32 = int32([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); + +au32 = uint32([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); + +[c8, cu8, c16, cu16, c32, cu32] = read_integer(a8, au8, a16, au16, a32, au32); + +if or(c8 <> a8 * 2) then error("failed"), end +if or(cu8 <> au8 * 4) then error("failed"), end +if or(c16 <> a16 * 8) then error("failed"), end +if or(cu16 <> au16 * 16) then error("failed"), end +if or(c32 <> a32 * 32) then error("failed"), end +if or(cu32 <> au32 * 64) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/nbInputArgument.xml b/modules/api_scilab/help/en_US/low_level_functions/nbInputArgument.xml new file mode 100755 index 000000000..68f77dd84 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/nbInputArgument.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="nbInputArgument" xml:lang="en"> + <refnamediv> + <refname>nbInputArgument (Scilab gateway)</refname> + <refpurpose>A C gateway function which provides the number of input + arguments present in the calling Scilab function + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int nb_params = nbInputArgument(void* _pvCtx)</synopsis> + <synopsis>int nb_params = Rhs</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_params</term> + <listitem> + <para>the number of input arguments present in the calling Scilab + function + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>A C gateway function which provides the number of input arguments + present in the calling Scilab function. You must include api_scilab.h to + benefit from this function. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para>In this example, the C interface function can take several input + arguments and prints in the Scilab console the integer corresponding to + the number of input arguments detected in the calling Scilab + function. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" + +int sci_myrhs(char * fname) +{ + sciprint("The number of input parameters is %d\n", nbInputArgument); + + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="getNbInputArgument">getNbInputArgument</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/pointer_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/pointer_reading_api.xml new file mode 100755 index 000000000..a29ef5f0c --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/pointer_reading_api.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Pointer_reading_API" xml:lang="en"> + <refnamediv> + <refname>Pointer reading (Scilab gateway)</refname> + <refpurpose> + How to read pointer in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getPointer(void* _pvCtx, int* _piAddress, void** _pvPtr)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readNamedPointer(void* _pvCtx, const char* _pstName, void** _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + Return address of pointer. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how pointer can be handled through the Scilab API.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/pointer_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/pointer_reading_api.tst--> + <!--Lib_name: pointer_reading--> + <!--Func_list: read_pointer--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int read_pointer(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + + CheckInputArgument(pvApiCtx, 0, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + if(nbInputArgument(pvApiCtx) == 0) + {//create mode + double* pdblData = (double*)malloc(sizeof(double) * 2 * 2); + pdblData[0] = 1; + pdblData[1] = 3; + pdblData[2] = 2; + pdblData[3] = 4; + sciErr = createPointer(pvApiCtx, nbInputArgument(pvApiCtx) + 1, (void*)pdblData); + } + else if(nbInputArgument(pvApiCtx) == 1) + {//read mode + int iType = 0; + int* piAddr = NULL; + void* pvPtr = NULL; + double* pdblData = NULL; + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getPointer(pvApiCtx, piAddr, &pvPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblData = (double*)pvPtr; + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 2, 2, pdblData); + } + else + { + return 0; + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +b_ref = [1,2;3,4]; +a = read_pointer(); +b = read_pointer(a); +if or(b <> b_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/pointer_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/pointer_writing_api.xml new file mode 100755 index 000000000..35cb78b4b --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/pointer_writing_api.xml @@ -0,0 +1,194 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Pointer_writing_API" xml:lang="en"> + <refnamediv> + <refname>Pointer writing (Scilab gateway)</refname> + <refpurpose> + How to write pointer in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + Create from existing data. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createPointer(void* _pvCtx, int _iVar, void* _pvPtr)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedPointer(void* _pvCtx, const char* _pstName, void** _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + Address of pointer. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <synopsis>SciErr allocPointer(void* _pvCtx, int _iVar, void** _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + Return address of pointer. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how pointer can be handled through the Scilab API.</para> + <para>Two types of functions can be used to write in the memory of Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/pointer_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/pointer_reading_api.tst--> + <!--Lib_name: pointer_reading--> + <!--Func_list: read_pointer--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int read_pointer(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + + CheckInputArgument(pvApiCtx, 0, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + if(nbInputArgument(pvApiCtx) == 0) + {//create mode + double* pdblData = (double*)malloc(sizeof(double) * 2 * 2); + pdblData[0] = 1; + pdblData[1] = 3; + pdblData[2] = 2; + pdblData[3] = 4; + sciErr = createPointer(pvApiCtx, nbInputArgument(pvApiCtx) + 1, (void*)pdblData); + } + else if(nbInputArgument(pvApiCtx) == 1) + {//read mode + int iType = 0; + int* piAddr = NULL; + void* pvPtr = NULL; + double* pdblData = NULL; + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getPointer(pvApiCtx, piAddr, &pvPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblData = (double*)pvPtr; + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 2, 2, pdblData); + } + else + { + return 0; + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +b_ref = [1,2;3,4]; +a = read_pointer(); +b = read_pointer(a); +if or(b <> b_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/poly_getpolyvariablename_api.xml b/modules/api_scilab/help/en_US/low_level_functions/poly_getpolyvariablename_api.xml new file mode 100755 index 000000000..58df38546 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/poly_getpolyvariablename_api.xml @@ -0,0 +1,258 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="poly_getpolyvariablename_API" xml:lang="en"> + <refnamediv> + <refname>Polynomial Symbolic Variable (Scilab gateway)</refname> + <refpurpose> + How to get the symbolic variable name. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstVarName</term> + <listitem> + <para> + Return the symbolic varaible name + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piVarNameLen</term> + <listitem> + <para> + Return the length of _pstVarName + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to get the symbolic variable name.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/poly_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/poly_reading_api.tst--> + <!--Lib_name: poly_reading--> + <!--Func_list: read_poly--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_poly(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j; + //variable info + int iRows = 0; + int iCols = 0; + int iVarLen = 0; + int* piAddr = NULL; + int* piNbCoef = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + char* pstVarname = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(isVarComplex(pvApiCtx, piAddr) == FALSE) + { + //Error + return 0; + } + + //get variable name length + sciErr = getPolyVariableName(pvApiCtx, piAddr, NULL, &iVarLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc buff to receive variable name + pstVarname = (char*)malloc(sizeof(char) * (iVarLen + 1));//1 for null termination + + //get variable name + sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarname, &iVarLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //First call: retrieve dimmension + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc array of coefficient + piNbCoef = (int*)malloc(sizeof(int) * iRows * iCols); + + //Second call: retrieve coefficient + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc arrays of data + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + } + + //Third call: retrieve data + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with Data + //Invert polynomials in the matrix and invert coefficients + for(i = 0 ; i < (iRows * iCols) / 2 ; i++) + { + int iPos1 = iRows * iCols - 1 - i; + double* pdblSave = NULL; + int iNbCoefSave = 0; + //switch array of coefficient + pdblSave = pdblReal[i]; + pdblReal[i] = pdblReal[iPos1]; + pdblReal[iPos1] = pdblSave; + pdblSave = pdblImg[i]; + pdblImg[i] = pdblImg[iPos1]; + pdblImg[iPos1] = pdblSave; + //switch number of coefficient + iNbCoefSave = piNbCoef[i]; + piNbCoef[i] = piNbCoef[iPos1]; + piNbCoef[iPos1] = iNbCoefSave; + } + + //switch coefficient + for(i = 0 ; i < iRows * iCols ; i++) + { + for(j = 0 ; j < piNbCoef[i] /2 ; j++) + { + int iPos2 = piNbCoef[i] - 1 - j; + double dblVal = pdblReal[i][j]; + pdblReal[i][j] = pdblReal[i][iPos2]; + pdblReal[i][iPos2] = dblVal; + dblVal = pdblImg[i][j]; + pdblImg[i][j] = pdblImg[i][iPos2]; + pdblImg[i][iPos2] = dblVal; + } + } + + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarname, iRows, iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //free OS memory + free(pstVarname); + free(piNbCoef); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +coeff1 = [ .. +29*%i,22*%i,16*%i,11*%i,7*%i,30,23,17,12,8,-31*%i,-24*%i,-18*%i,-13*%i,-9*%i,32,25,19,14,10,-33*%i,-26*%i,-20*%i,-15*%i,0,34,27,21,0,0,0,-28*%i,0,0,0,36-35*%i,0,0,0,0; .. +4*%i,2*%i,%i,22,16,5,-3,0,-23*%i,-17*%i,-6*%i,0,0,24,18,0,0,0,-25*%i,-19*%i,0,0,0,26,20,0,0,0,-27*%i,-21*%i,0,0,0,28,0,0,0,0,0,0; .. +11,7,4,2,1,-12*%i,-8*%i,-5*%i,3*%i,0,13,9,6,0,0,-14*%i,-10*%i,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; + +x = poly(0, "x"); +p1 = 1; +p2 = 2 * x + 3 * %i; +p3 = 4 * x**2 - 5 * %i * x + 6; +p4 = 7 * x**3 - 8 * %i * x**2 + 9 * x - 10 * %i; +p5 = 11 * x**4 - 12 * %i * x**3 + 13 * x**2 - 14 * %i * x + 15; +p6 = 16 * x**5 - 17 * %i * x**4 + 18 * x**3 - 19 * %i * x**2 + 20 * x - 21 * %i; +p7 = 22 * x**6 - 23 * %i * x**5 + 24 * x**4 - 25 * %i * x**3 + 26 * x**2 - 27 * %i * x + 28; +p8 = %i; +p9 = 2 * %i * x - 3; +p10 = 4 * %i * x**2 + 5 * x - 6 * %i; +p11 = 7 * %i * x**3 + 8 * x**2 - 9 * %i * x + 10; +p12 = 11 * %i * x**4 + 12 * x**3 - 13 * %i * x**2 + 14 * x - 15 * %i; +p13 = 16 * %i * x**5 + 17 * x**4 - 18 * %i * x**3 + 19 * x**2 - 20 * %i * x + 21; +p14 = 22 * %i * x**6 + 23 * x**5 - 24 * %i * x**4 + 25 * x**3 - 26 * %i * x**2 + 27 * x - 28 * %i; +p15 = 29 * %i * x**7 + 30 * x**6 - 31 * %i * x**5 + 32 * x**4 - 33 * %i * x**3 + 34 * x**2 - 35 * %i + 36; +p = [p1, p2, p3, p4, p5 ; p6, p7, p8, p9 ,p10 ; p11, p12, p13, p14, p15]; + +p1 = read_poly(p); +coeff2 = coeff(p1); +if or(coeff2 <> coeff1) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/poly_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/poly_reading_api.xml new file mode 100755 index 000000000..3a839c434 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/poly_reading_api.xml @@ -0,0 +1,294 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Polynomial_management_reading_API" xml:lang="en"> + <refnamediv> + <refname>Polynomial reading (Scilab gateway)</refname> + <refpurpose> + How to read matrices of polynomials in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>SciErr readNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + Return number of coefficient for each polynomial. (must be allocated) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of array of double* with imaginary part of coefficient (size: _iCols * _iRows, must be allocated) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of array of double* with imaginary part of coefficient (size: _iCols * _iRows, must be allocated) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how matrix of polynomials can be handled through the Scilab API.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/poly_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/poly_reading_api.tst--> + <!--Lib_name: poly_reading--> + <!--Func_list: read_poly--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_poly(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j; + //variable info + int iRows = 0; + int iCols = 0; + int iVarLen = 0; + int* piAddr = NULL; + int* piNbCoef = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + char* pstVarname = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(isVarComplex(pvApiCtx, piAddr) == FALSE) + { + //Error + return 0; + } + + //get variable name length + sciErr = getPolyVariableName(pvApiCtx, piAddr, NULL, &iVarLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc buff to receive variable name + pstVarname = (char*)malloc(sizeof(char) * (iVarLen + 1));//1 for null termination + + //get variable name + sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarname, &iVarLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //First call: retrieve dimmension + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc array of coefficient + piNbCoef = (int*)malloc(sizeof(int) * iRows * iCols); + + //Second call: retrieve coefficient + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc arrays of data + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + } + + //Third call: retrieve data + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with Data + //Invert polynomials in the matrix and invert coefficients + for(i = 0 ; i < (iRows * iCols) / 2 ; i++) + { + int iPos1 = iRows * iCols - 1 - i; + double* pdblSave = NULL; + int iNbCoefSave = 0; + //switch array of coefficient + pdblSave = pdblReal[i]; + pdblReal[i] = pdblReal[iPos1]; + pdblReal[iPos1] = pdblSave; + pdblSave = pdblImg[i]; + pdblImg[i] = pdblImg[iPos1]; + pdblImg[iPos1] = pdblSave; + //switch number of coefficient + iNbCoefSave = piNbCoef[i]; + piNbCoef[i] = piNbCoef[iPos1]; + piNbCoef[iPos1] = iNbCoefSave; + } + + //switch coefficient + for(i = 0 ; i < iRows * iCols ; i++) + { + for(j = 0 ; j < piNbCoef[i] /2 ; j++) + { + int iPos2 = piNbCoef[i] - 1 - j; + double dblVal = pdblReal[i][j]; + pdblReal[i][j] = pdblReal[i][iPos2]; + pdblReal[i][iPos2] = dblVal; + dblVal = pdblImg[i][j]; + pdblImg[i][j] = pdblImg[i][iPos2]; + pdblImg[i][iPos2] = dblVal; + } + } + + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarname, iRows, iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //free OS memory + free(pstVarname); + free(piNbCoef); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +coeff1 = [ .. +29*%i,22*%i,16*%i,11*%i,7*%i,30,23,17,12,8,-31*%i,-24*%i,-18*%i,-13*%i,-9*%i,32,25,19,14,10,-33*%i,-26*%i,-20*%i,-15*%i,0,34,27,21,0,0,0,-28*%i,0,0,0,36-35*%i,0,0,0,0; .. +4*%i,2*%i,%i,22,16,5,-3,0,-23*%i,-17*%i,-6*%i,0,0,24,18,0,0,0,-25*%i,-19*%i,0,0,0,26,20,0,0,0,-27*%i,-21*%i,0,0,0,28,0,0,0,0,0,0; .. +11,7,4,2,1,-12*%i,-8*%i,-5*%i,3*%i,0,13,9,6,0,0,-14*%i,-10*%i,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + +x = poly(0, "x"); +p1 = 1; +p2 = 2 * x + 3 * %i; +p3 = 4 * x**2 - 5 * %i * x + 6; +p4 = 7 * x**3 - 8 * %i * x**2 + 9 * x - 10 * %i; +p5 = 11 * x**4 - 12 * %i * x**3 + 13 * x**2 - 14 * %i * x + 15; +p6 = 16 * x**5 - 17 * %i * x**4 + 18 * x**3 - 19 * %i * x**2 + 20 * x - 21 * %i; +p7 = 22 * x**6 - 23 * %i * x**5 + 24 * x**4 - 25 * %i * x**3 + 26 * x**2 - 27 * %i * x + 28; +p8 = %i; +p9 = 2 * %i * x - 3; +p10 = 4 * %i * x**2 + 5 * x - 6 * %i; +p11 = 7 * %i * x**3 + 8 * x**2 - 9 * %i * x + 10; +p12 = 11 * %i * x**4 + 12 * x**3 - 13 * %i * x**2 + 14 * x - 15 * %i; +p13 = 16 * %i * x**5 + 17 * x**4 - 18 * %i * x**3 + 19 * x**2 - 20 * %i * x + 21; +p14 = 22 * %i * x**6 + 23 * x**5 - 24 * %i * x**4 + 25 * x**3 - 26 * %i * x**2 + 27 * x - 28 * %i; +p15 = 29 * %i * x**7 + 30 * x**6 - 31 * %i * x**5 + 32 * x**4 - 33 * %i * x**3 + 34 * x**2 - 35 * %i + 36; +p = [p1, p2, p3, p4, p5 ; p6, p7, p8, p9 ,p10 ; p11, p12, p13, p14, p15]; + +p1 = read_poly(p); +coeff2 = coeff(p1); +if or(coeff2 <> coeff1) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/poly_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/poly_writing_api.xml new file mode 100755 index 000000000..f3118009b --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/poly_writing_api.xml @@ -0,0 +1,176 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Polynomial_management_writing_API" xml:lang="en"> + <refnamediv> + <refname>Polynomial writing (Scilab gateway)</refname> + <refpurpose> + How to write matrices of polynomials in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal)</synopsis> + <synopsis>SciErr createNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstVarName</term> + <listitem> + <para> + Variable name in polynomials (Scilab5: 4 characters max) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Numbers of columns of the new variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + Number of coefficient for each polynomial. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of array of double* with real part of coefficient (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of array of double* with imaginary part of coefficient (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how matrix of polynomials can be handled through the Scilab API.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/poly_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/poly_writing_api.tst--> + <!--Lib_name: poly_writing--> + <!--Func_list: write_poly--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int write_poly(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + //output variable info : polinomial matrix 2 x 4 + //[ x + 2 x^2 - 4x + 5 4x^3 - 14x^2 + 18 ; + // 2x^3 - 12x^2 + 64 1 8x^5 + 32x^3] + int iRows = 2; + int iCols = 3; + //varname "x" + char pstVarName[2] = {"x"}; + //coeficient array + int piNbCoef[6] = {2,4,3,1,4,6}; + //data array + double *pdblReal[6] = {0}; + double pdblPoly0[2] = {2,1}; + double pdblPoly1[4] = {64,0,-12,2}; + double pdblPoly2[3] = {5,-4,1}; + double pdblPoly3[1] = {1}; + double pdblPoly4[4] = {18,0,-14,4}; + double pdblPoly5[6] = {0,0,0,32,0,8}; + pdblReal[0] = pdblPoly0; + pdblReal[1] = pdblPoly1; + pdblReal[2] = pdblPoly2; + pdblReal[3] = pdblPoly3; + pdblReal[4] = pdblPoly4; + pdblReal[5] = pdblPoly5; + + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +p_ref = [2 5 18 1 -4 0 0 1 -14 0 0 4 0 0 0 0 0 0;64 1 0 0 0 0 -12 0 0 2 0 32 0 0 0 0 0 8]; +l = list(); +a = write_poly(); +p = coeff(a); +if or(p <> p_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/sparse_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/sparse_reading_api.xml new file mode 100755 index 000000000..4aa7b718e --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/sparse_reading_api.xml @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Sparse_management_reading_API" xml:lang="en"> + <refnamediv> + <refname>Sparse matrix reading (Scilab gateway)</refname> + <refpurpose> + How to read sparse matrices in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr readNamedSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal)</synopsis> + <synopsis>SciErr readNamedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + Return number of non zero value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Return number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Return column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return address of real data array (size: _iCols * _iRows) + For "Named" function, _pdblReal must be allocated before calling function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Return address of imaginary data array (size: _iCols * _iRows) + For "Named" function, _pdblImg must be allocated before calling function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how sparse matrix can be handled through the Scilab API.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/sparse_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/sparse_reading_api.tst--> + <!--Lib_name: sparse_reading--> + <!--Func_list: read_sparse--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_sparse(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j,k; + int* piAddr = NULL; + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(isVarComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal); + } + + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("Sparse %d item(s)\n", iNbItem); + k = 0; + + for(i = 0 ; i < iRows ; i++) + { + for(j = 0 ; j < piNbItemRow[i] ; j++) + { + sciprint("(%d,%d) = %f", i+1, piColPos[k], pdblReal[k]); + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint(" %+fi", pdblImg[k]); + } + + sciprint("\n"); + k++; + } + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +sp=sparse([1,2;4,5;3,10],[1 + 2*%i,2 - 3*%i,-3 + 4*%i]); +read_sparse(sp); + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/sparse_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/sparse_writing_api.xml new file mode 100755 index 000000000..b3d6fc20e --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/sparse_writing_api.xml @@ -0,0 +1,267 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Sparse_management_writing_API" xml:lang="en"> + <refnamediv> + <refname>Sparse writing (Scilab gateway)</refname> + <refpurpose> + How to write sparse matrix in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + Create from existing data. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal)</synopsis> + <synopsis>SciErr createNamedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + Number of non zero itmes in the sparse. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of real data array (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of imaginary data array (size: _iNbItem). + </para> + <para> + This argument does not exist with createSparseMatrix and createNamedSparseMatrix. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Write directly in Scilab memory. + </refsection> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr allocSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + <synopsis>SciErr allocComplexSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Number of columns of the new variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + Number of non zero itmes in the sparse. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Return address of number of item in each rows (size: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Return address of column position for each item (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Address of real data array (size: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Address of imaginary data array (size: _iNbItem). + </para> + <para> + This argument does not exist with allocSparseMatrix. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how to add sparse matrix.</para> + <para>Two types of functions can be used to write in the memory of Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/sparse_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/sparse_writing_api.tst--> + <!--Lib_name: sparse_writing--> + <!--Func_list: write_sparse--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int write_sparse(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int iNbItem = 4; + + sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 3, 10, iNbItem, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +sp_ref = sparse([1,8;2,4;2,7;3,2],[1+4*%i,2+3*%i,3+2*%i,4+%i], [3,10]); +sp = write_sparse(); +if or(sp <> sp_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/string_reading_api.xml b/modules/api_scilab/help/en_US/low_level_functions/string_reading_api.xml new file mode 100755 index 000000000..21095ca72 --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/string_reading_api.xml @@ -0,0 +1,235 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="String_management_reading_API" xml:lang="en"> + <refnamediv> + <refname>String reading (Scilab gateway)</refname> + <refpurpose> + How to read matrices of strings in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr getMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings)</synopsis> + <synopsis>SciErr getMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piLength, wchar_t** _pwstStrings)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedMatrixOfString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, char** _pstStrings)</synopsis> + <synopsis>SciErr createNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, wchar_t** _pwstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piLength</term> + <listitem> + <para> + Address of array of strings length (must be allocated size: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + Address of array of char* (must be allocated size: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstStrings</term> + <listitem> + <para> + Address of array of wchar_t* (must be allocated size: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how matrix of strings can be handled through the Scilab API.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/string_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/string_reading_api.tst--> + <!--Lib_name: string_reading--> + <!--Func_list: read_string--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_string(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j; + int iLen = 0; + //variable info + int iRows = 0; + int iCols = 0; + int* piAddr = NULL; + int* piLen = NULL; + char** pstData = NULL; + //output variable + int iRowsOut = 1; + int iColsOut = 1; + char* pstOut = NULL; + //check input and output arguments + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + //get variable address + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //first call to retrieve dimensions + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + //second call to retrieve length of each string + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + //third call to retrieve data + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //computer length of all strings + for(i = 0 ; i < iRows * iCols ; i++) + { + iLen += piLen[i]; + } + + //alloc output variable + pstOut = (char*)malloc(sizeof(char) * (iLen + iRows * iCols)); + //initialize string to 0x00 + memset(pstOut, 0x00, sizeof(char) * (iLen + iRows * iCols)); + + //concat input strings in output string + for(i = 0 ; i < iRows ; i++) + { + for(j = 0 ; j < iCols ; j++) + { + int iCurLen = strlen(pstOut); + if(iCurLen) + { + strcat(pstOut, " "); + } + strcpy(pstOut + strlen(pstOut), pstData[j * iRows + i]); + } + } + + //create new variable + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRowsOut, iColsOut, &pstOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //free memory + free(piLen); + + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pstData[i]); + } + + free(pstData); + free(pstOut); + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a_ref = ["may the puffin be with you"]; +a = ["may", "the", "puffin"; "be","with","you"]; +b = read_string(a); +if a_ref <> b then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/low_level_functions/string_writing_api.xml b/modules/api_scilab/help/en_US/low_level_functions/string_writing_api.xml new file mode 100755 index 000000000..6c826185c --- /dev/null +++ b/modules/api_scilab/help/en_US/low_level_functions/string_writing_api.xml @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="String_management_writing_API" xml:lang="en"> + <refnamediv> + <refname>String writing (Scilab gateway)</refname> + <refpurpose> + How to write matrices of string in a gateway. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <para>Input argument profile:</para> + <synopsis>SciErr createMatrixOfString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const char* const* _pstStrings)</synopsis> + <synopsis>SciErr createMatrixOfWideString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const wchar_t* const* _pwstStrings)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedMatrixOfString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const char* const* _pstStrings)</synopsis> + <synopsis>SciErr createNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const wchar_t* const* _pwstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Number of rows of the new variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Numbers of columns of the new variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + Address of array of char* (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + Error structure where is stored errors messages history and first error number. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This help describes how matrix of strings can be handled through the Scilab API.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/string_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/string_writing_api.tst--> + <!--Lib_name: string_writing--> + <!--Func_list: write_string--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int write_string(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + //variable info : matrix of string 2 x 3 + int iRows = 2; + int iCols = 3; + char** pstData = NULL; + //data to put in the new variable + char string11[] = "may"; + char string21[] = "be"; + char string12[] = "the"; + char string22[] = "with"; + char string13[] = "puffin"; + char string23[] = "you"; + //alloc new array + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + //copy data address to the "main" array + pstData[0] = string11; + pstData[1] = string21; + pstData[2] = string12; + pstData[3] = string22; + pstData[4] = string13; + pstData[5] = string23; + + //create the variable + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //free container + free(pstData); + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a_ref = "may the puffin be with you "; +b = []; +a = write_string(); +for i=1:size(a,"r") + for j=1:size(a,"c") + b = b + a(i,j); + b = b + " "; + end +end +if b <> a_ref then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/optionals/getOptionals.xml b/modules/api_scilab/help/en_US/optionals/getOptionals.xml new file mode 100755 index 000000000..cf92704a9 --- /dev/null +++ b/modules/api_scilab/help/en_US/optionals/getOptionals.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getOptionals" xml:lang="en"> + <refnamediv> + <refname>get optional argument (Scilab gateway)</refname> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getOptionals(void* _pvCtx, char* fname, rhs_opts opts[])</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>fname</term> + <listitem> + <para> + Name of the calling function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>opts</term> + <listitem> + <para>structure array of optional argument</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + A C gateway functions which use optional arguments. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para> + In this example, the C interface function can take several optional + arguments and prints theirs dimensions if exists. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" +#include "sciprint.h" +#include "sciprint.h" + +int sci_use_optional(char * fname) +{ + SciErr sciErr; + + char* pstName = NULL; + int iAge = 0; + int iDL = 0; + + static rhs_opts opts[] = + { + { -1, "age", -1, 0, 0, NULL}, + { -1, "drivinglicense", -1, 0, 0, NULL}, + { -1, "name", -1, 0, 0, NULL}, + { -1, NULL, -1, 0, 0, NULL} + }; + + int nopt = NumOpt(); + + CheckInputArgument(pvApiCtx, 0, nopt); + CheckOutputArgument(pvApiCtx, 0, 1); + + if (getOptionals(pvApiCtx, fname, opts) == 0) + { + //Error + return 1; + } + + if (opts[0].iPos != -1) + {//age + double dblAge = 0; + getScalarDouble(pvApiCtx, opts[0].piAddr, &dblAge); + iAge = (int)dblAge; + } + else + { + iAge = 77; + } + + if (opts[1].iPos != -1) + {//drivinglicense + getScalarBoolean(pvApiCtx, opts[1].piAddr, &iDL); + } + else + { + iDL = 0; + } + + if (opts[2].iPos != -1) + {//Name + getAllocatedSingleString(pvApiCtx, opts[2].piAddr, &pstName); + } + else + { + pstName = strdup("John Doe"); + } + + + + + sciprint("Read information: \n"); + sciprint("\tName: \t\t\t%s\n", pstName); + sciprint("\tAge: \t\t\t%d\n", iAge); + sciprint("\tDriving licence: \t%s\n", iDL ? "Yes" : "No"); + //no return value + AssignOutputVariable(pvApiCtx, 0) = 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"> + <![CDATA[ +use_optional(); +use_optional(name = "M. Puffin"); +use_optional(age = 25, name = "M. Puffin"); +use_optional(drivinglicense = %t, age = 25, name = "M. Puffin"); + ]]> + </programlisting> + </refsection> + <title>History</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>This function added in Scilab 5.5.0</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/A_isPolyType.xml b/modules/api_scilab/help/en_US/polynomial/A_isPolyType.xml new file mode 100755 index 000000000..802331456 --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/A_isPolyType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isPolyType" xml:lang="en"> + <refnamediv> + <refname>isPolyType</refname> + <refpurpose> + Check if it is a polynomial variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isPolyType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedPolyType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a polynomial type, otherwise 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/B_getAllocatedSinglePoly.xml b/modules/api_scilab/help/en_US/polynomial/B_getAllocatedSinglePoly.xml new file mode 100755 index 000000000..04fb25981 --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/B_getAllocatedSinglePoly.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedSinglePoly" xml:lang="en"> + <refnamediv> + <refname>getAllocatedSinglePoly</refname> + <refpurpose> + Get single polynomial variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedSinglePoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>int getAllocatedNamedSinglePoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + Returns number of coefficient. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return array of double. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/C_getAllocatedSingleComplexPoly.xml b/modules/api_scilab/help/en_US/polynomial/C_getAllocatedSingleComplexPoly.xml new file mode 100755 index 000000000..0ec34dbc1 --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/C_getAllocatedSingleComplexPoly.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedSingleComplexPoly" xml:lang="en"> + <refnamediv> + <refname>getAllocatedSinglePoly</refname> + <refpurpose> + Get single complex polynomial variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedSingleComplexPoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + <synopsis>int getAllocatedNamedSingleComplexPoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + Returns number of coefficient. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return array of real part. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Return array of imaginary part. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/D_getAllocatedMatrixOfPoly.xml b/modules/api_scilab/help/en_US/polynomial/D_getAllocatedMatrixOfPoly.xml new file mode 100755 index 000000000..0130cdfb0 --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/D_getAllocatedMatrixOfPoly.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedMatrixOfPoly" xml:lang="en"> + <refnamediv> + <refname>getAllocatedMatrixOfPoly</refname> + <refpurpose> + Get matrix of polynomial variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal)</synopsis> + <synopsis>int getAllocatedNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + Return number of coefficient for each polynomialial. (must be allocated) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return array of coefficients. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/E_getAllocatedMatrixOfComplexPoly.xml b/modules/api_scilab/help/en_US/polynomial/E_getAllocatedMatrixOfComplexPoly.xml new file mode 100755 index 000000000..7abf1ede6 --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/E_getAllocatedMatrixOfComplexPoly.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedMatrixOfComplexPoly" xml:lang="en"> + <refnamediv> + <refname>getAllocatedMatrixOfComplexPoly</refname> + <refpurpose> + Get matrix of complex polynomial variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedMatrixOfComplexPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg)</synopsis> + <synopsis>int getAllocatedNamedMatrixOfComplexPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + Return number of coefficient for each polynomialial. (must be allocated) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return array of real part coefficients. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Return array of real part coefficients. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/F_freeAllocatedSinglePoly.xml b/modules/api_scilab/help/en_US/polynomial/F_freeAllocatedSinglePoly.xml new file mode 100755 index 000000000..6e3a809b9 --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/F_freeAllocatedSinglePoly.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedSinglePoly" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedSinglePoly</refname> + <refpurpose> + Free memory allocated by getAllocatedSinglePoly function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void freeAllocatedSinglePoly(double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Pointer "_pdblReal" allocated by getAllocatedSinglePoly. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/G_freeAllocatedSingleComplexPoly.xml b/modules/api_scilab/help/en_US/polynomial/G_freeAllocatedSingleComplexPoly.xml new file mode 100755 index 000000000..58bbba39e --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/G_freeAllocatedSingleComplexPoly.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedSingleComplexPoly" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedSingleComplexPoly</refname> + <refpurpose> + Free memory allocated by getAllocatedSingleComplexPoly function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void freeAllocatedSingleComplexPoly(double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Pointer "_pdblReal" allocated by getAllocatedSingleComplexPoly. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Pointer "_pdblImg" allocated by getAllocatedSingleComplexPoly. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/H_freeAllocatedMatrixOfPoly.xml b/modules/api_scilab/help/en_US/polynomial/H_freeAllocatedMatrixOfPoly.xml new file mode 100755 index 000000000..490d34032 --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/H_freeAllocatedMatrixOfPoly.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedMatrixOfPoly" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedSinglePoly</refname> + <refpurpose> + Free memory allocated by getAllocatedSinglePoly function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void freeAllocatedSinglePoly(double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Pointer "_pdblReal" allocated by getAllocatedSinglePoly. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/I_freeAllocatedMatrixOfComplexPoly.xml b/modules/api_scilab/help/en_US/polynomial/I_freeAllocatedMatrixOfComplexPoly.xml new file mode 100755 index 000000000..507d5b57d --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/I_freeAllocatedMatrixOfComplexPoly.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedMatrixOfComplexPoly" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedSinglePoly</refname> + <refpurpose> + Free memory allocated by getAllocatedSinglePoly function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void freeAllocatedSinglePoly(double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Pointer "_pdblReal" allocated by getAllocatedSinglePoly. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/polynomial/J_polyExample.xml b/modules/api_scilab/help/en_US/polynomial/J_polyExample.xml new file mode 100755 index 000000000..fab13b82c --- /dev/null +++ b/modules/api_scilab/help/en_US/polynomial/J_polyExample.xml @@ -0,0 +1,176 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="polyExample" xml:lang="en"> + <refnamediv> + <refname>polynomial example</refname> + <refpurpose> + Polynom use case. + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>This example shows how to get a polynomial variable and return it to Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/polyExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/polyExample.tst--> + <!--Lib_name: polyExample--> + <!--Func_list: polyExample--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +int polyExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(isPolyType(pvApiCtx, piAddr)) + { + char pstVarName[64]; + int iLen = 0; + + sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarName, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + if(isScalar(pvApiCtx, piAddr)) + { + int iNbCoef = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedSingleComplexPoly(pvApiCtx, piAddr, &iNbCoef, &pdblReal, &pdblImg); + if(iRet) + { + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + return iRet; + } + + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal, &pdblImg); + if(sciErr.iErr) + { + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + } + else + { + iRet = getAllocatedSinglePoly(pvApiCtx, piAddr, &iNbCoef, &pdblReal); + if(iRet) + { + freeAllocatedSinglePoly(pdblReal); + return iRet; + } + + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal); + if(sciErr.iErr) + { + freeAllocatedSinglePoly(pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedSinglePoly(pdblReal); + } + } + else + { + int iRows = 0; + int iCols = 0; + int* piNbCoef = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + if(isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedMatrixOfComplexPoly(pvApiCtx, piAddr, &iRows, &iCols, &piNbCoef, &pdblReal, &pdblImg); + if(iRet) + { + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + return iRet; + } + + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + } + else + { + iRet = getAllocatedMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, &piNbCoef, &pdblReal); + if(iRet) + { + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + return iRet; + } + + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal); + if(sciErr.iErr) + { + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + } + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = %s; +b = (2 + 3*%i) * %s; +c = [a, 2*a, 3*a;4*a, 5*a, 6*a]; +d = [c + c * %i]; +if polyExample(a) <> a then pause, end +if polyExample(b) <> b then pause, end +if polyExample(c) <> c then pause, end +if polyExample(d) <> d then pause, end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/sparse/A_isSparseType.xml b/modules/api_scilab/help/en_US/sparse/A_isSparseType.xml new file mode 100755 index 000000000..a88825c8a --- /dev/null +++ b/modules/api_scilab/help/en_US/sparse/A_isSparseType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isSparseType" xml:lang="en"> + <refnamediv> + <refname>isSparseType</refname> + <refpurpose> + Check if it is a sparse variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isSparseType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedSparseType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a sparse type, otherwise 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/sparse/B_getAllocatedSparseMatrix.xml b/modules/api_scilab/help/en_US/sparse/B_getAllocatedSparseMatrix.xml new file mode 100755 index 000000000..965f28d69 --- /dev/null +++ b/modules/api_scilab/help/en_US/sparse/B_getAllocatedSparseMatrix.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedSparseMatrix" xml:lang="en"> + <refnamediv> + <refname>getAllocatedSparseMatrix</refname> + <refpurpose> + Get sparse matrix variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + <synopsis>int getNamedAllocatedSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + Return number of non zero value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Return number of item in each rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Return column position for each item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return address of real data array. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/sparse/C_getAllocatedComplexSparseMatrix.xml b/modules/api_scilab/help/en_US/sparse/C_getAllocatedComplexSparseMatrix.xml new file mode 100755 index 000000000..903d38f6d --- /dev/null +++ b/modules/api_scilab/help/en_US/sparse/C_getAllocatedComplexSparseMatrix.xml @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedComplexSparseMatrix" xml:lang="en"> + <refnamediv> + <refname>getAllocatedComplexSparseMatrix</refname> + <refpurpose> + Get complex sparse matrix variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedComplexSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + <synopsis>int getNamedAllocatedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + Return number of non zero value. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + Return number of item in each rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Return column position for each item. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Return address of real data array. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Return address of imaginary data array (size: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/sparse/D_freeAllocatedSparseMatrix.xml b/modules/api_scilab/help/en_US/sparse/D_freeAllocatedSparseMatrix.xml new file mode 100755 index 000000000..6f32f7eff --- /dev/null +++ b/modules/api_scilab/help/en_US/sparse/D_freeAllocatedSparseMatrix.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedSparseMatrix" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedSparseMatrix</refname> + <refpurpose> + Free memory allocated by getAllocatedSparseMatrix function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void freeAllocatedSparseMatrix(int* _piNbItemRows, int* _piColPos, double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_piNbItemRows</term> + <listitem> + <para> + Pointer "_piNbItemRows" allocated by getAllocatedSparseMatrix. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Pointer "_piColPos" allocated by getAllocatedSparseMatrix. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Pointer "_pdblReal" allocated by getAllocatedSparseMatrix. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/sparse/E_freeAllocatedComplexSparseMatrix.xml b/modules/api_scilab/help/en_US/sparse/E_freeAllocatedComplexSparseMatrix.xml new file mode 100755 index 000000000..0ecb96619 --- /dev/null +++ b/modules/api_scilab/help/en_US/sparse/E_freeAllocatedComplexSparseMatrix.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedComplexSparseMatrix" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedComplexSparseMatrix</refname> + <refpurpose> + Free memory allocated by getAllocatedComplexSparseMatrix function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void freeAllocatedComplexSparseMatrix(int* _piNbItemRows, int* _piColPos, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_piNbItemRows</term> + <listitem> + <para> + Pointer "_piNbItemRows" allocated by getAllocatedComplexSparseMatrix. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + Pointer "_piColPos" allocated by getAllocatedComplexSparseMatrix. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + Pointer "_pdblReal" allocated by getAllocatedComplexSparseMatrix. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + Pointer "_pdblImg" allocated by getAllocatedComplexSparseMatrix. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/sparse/F_sparseExample.xml b/modules/api_scilab/help/en_US/sparse/F_sparseExample.xml new file mode 100755 index 000000000..f66643172 --- /dev/null +++ b/modules/api_scilab/help/en_US/sparse/F_sparseExample.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="sparseExample" xml:lang="en"> + <refnamediv> + <refname>sparse example</refname> + <refpurpose> + Sparse use case. + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>This example shows how to get a sparse variable and return it to Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/sparseExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/sparseExample.tst--> + <!--Lib_name: sparseExample--> + <!--Func_list: sparseExample--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int sparseExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(isSparseType(pvApiCtx, piAddr)) + { + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if(isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedComplexSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + if(iRet) + { + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + return iRet; + } + + sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg); + if(sciErr.iErr) + { + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + } + else + { + iRet = getAllocatedSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal); + if(iRet) + { + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + return iRet; + } + + sciErr = createSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal); + if(sciErr.iErr) + { + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = sparse([1,1;2,2;3,3], [1, 2, 3]); +b = sparse([1,1;2,2;3,3], [1 + 2 * %i, 3 , -4 * %i]); +if sparseExample(a) <> a then pause;end +if sparseExample(b) <> b then pause;end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/string/A_isStringType.xml b/modules/api_scilab/help/en_US/string/A_isStringType.xml new file mode 100755 index 000000000..edd8f03c4 --- /dev/null +++ b/modules/api_scilab/help/en_US/string/A_isStringType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isStringType" xml:lang="en"> + <refnamediv> + <refname>isStringType</refname> + <refpurpose> + Check if it is a string variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int isStringType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedStringType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>1 if variable is a string type, otherwise 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/string/B_getAllocatedSingleString.xml b/modules/api_scilab/help/en_US/string/B_getAllocatedSingleString.xml new file mode 100755 index 000000000..526edaf0a --- /dev/null +++ b/modules/api_scilab/help/en_US/string/B_getAllocatedSingleString.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedSingleString" xml:lang="en"> + <refnamediv> + <refname>getAllocatedSingleString</refname> + <refpurpose> + Get single string variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedSingleString(void* _pvCtx, int* _piAddress, char** _pstData)</synopsis> + <synopsis>int getAllocatedNamedSingleString(void* _pvCtx, const char* _pstName, char** _pstData)</synopsis> + <synopsis>int getAllocatedSingleWideString(void* _pvCtx, int* _piAddress, wchar_t** _pwstData)</synopsis> + <synopsis>int getAllocatedNamedSingleWideString(void* _pvCtx, const char* _pstName, wchar_t** _pwstData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstData</term> + <listitem> + <para> + Return string address. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstData</term> + <listitem> + <para> + Return wide string address. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/string/C_getAllocatedMatrixOfString.xml b/modules/api_scilab/help/en_US/string/C_getAllocatedMatrixOfString.xml new file mode 100755 index 000000000..522d7b141 --- /dev/null +++ b/modules/api_scilab/help/en_US/string/C_getAllocatedMatrixOfString.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedMatrixOfString" xml:lang="en"> + <refnamediv> + <refname>getAllocatedMatrixOfString</refname> + <refpurpose> + Get matrix of string variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, char*** _pstData)</synopsis> + <synopsis>int getAllocatedNamedMatrixOfString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, char*** _pstData)</synopsis> + <synopsis>int getAllocatedMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, wchar_t*** _pwstData)</synopsis> + <synopsis>int getAllocatedNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, wchar_t*** _pwstData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Address of the Scilab variable. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + Return number of rows. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + Return number of columns. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstData</term> + <listitem> + <para> + Return array of string + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstData</term> + <listitem> + <para> + Return array of wide string. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/string/D_createSingleString.xml b/modules/api_scilab/help/en_US/string/D_createSingleString.xml new file mode 100755 index 000000000..e763f5392 --- /dev/null +++ b/modules/api_scilab/help/en_US/string/D_createSingleString.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createSingleString" xml:lang="en"> + <refnamediv> + <refname>createSingleString</refname> + <refpurpose> + create a single string variable. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int createSingleString(void* _pvCtx, int _iVar, const char* _pstStrings)</synopsis> + <synopsis>int createNamedSingleString(void* _pvCtx, const char* _pstName, const char* _pstStrings)</synopsis> + <synopsis>int createSingleString(void* _pvCtx, int _iVar, const char* _pstStrings)</synopsis> + <synopsis>int createNamedSingleWideString(void* _pvCtx, const char* _pstName, const wchar_t* _pwstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + Position in the Scilab memory where you want to put the variable + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Name of the variable for "named" functions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + Address of string. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstStrings</term> + <listitem> + <para> + Address of wide string. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Return value</title> + <para>if successful 0, otherwise print error(s) message(s) in the Scilab console and returns first error number.</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/string/E_freeAllocatedSingleString.xml b/modules/api_scilab/help/en_US/string/E_freeAllocatedSingleString.xml new file mode 100755 index 000000000..7980f4df9 --- /dev/null +++ b/modules/api_scilab/help/en_US/string/E_freeAllocatedSingleString.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedSingleString" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedSingleString</refname> + <refpurpose> + Free memory allocated by getAllocatedSinglePoly function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>void freeAllocatedSingleString(char* _pstData)</synopsis> + <synopsis xml:id="freeAllocatedSingleWideString">void freeAllocatedSingleWideString(wchar_t* _pwstData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pstData</term> + <listitem> + <para> + Pointer "_pstData" allocated by getAllocatedSingleString. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstData</term> + <listitem> + <para> + Pointer "_pwstData" allocated by getAllocatedSingleWideString. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/string/F_freeAllocatedMatrixOfString.xml b/modules/api_scilab/help/en_US/string/F_freeAllocatedMatrixOfString.xml new file mode 100755 index 000000000..c9cd0e9e3 --- /dev/null +++ b/modules/api_scilab/help/en_US/string/F_freeAllocatedMatrixOfString.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedMatrixOfString" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedMatrixOfString</refname> + <refpurpose> + Free memory allocated by getAllocatedMatrixOfString function. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis> + void freeAllocatedMatrixOfString(int _iRows, int _iCols, char** _pstData) + void freeAllocatedMatrixOfWideString(int _iRows, int _iCols, wchar_t** _pwstData) + </synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + Value "_piRows" returns by freeAllocatedMatrixOfString. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + Value "_piCols" returns by freeAllocatedMatrixOfString. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstData</term> + <listitem> + <para> + Pointer "_pstData" allocated by freeAllocatedMatrixOfString. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstData</term> + <listitem> + <para> + Pointer "_pwstData" allocated by freeAllocatedWideMatrixOfString. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/en_US/string/G_stringExample.xml b/modules/api_scilab/help/en_US/string/G_stringExample.xml new file mode 100755 index 000000000..8644eaa65 --- /dev/null +++ b/modules/api_scilab/help/en_US/string/G_stringExample.xml @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="stringExample" xml:lang="en"> + <refnamediv> + <refname>string example</refname> + <refpurpose> + String use case. + </refpurpose> + </refnamediv> + <refsection> + <title>Description</title> + <para>This example shows how to get a string variable and return it to Scilab.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/stringExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/stringExample.tst--> + <!--Lib_name: stringExample--> + <!--Func_list: stringExample--> + <title>Gateway Source</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int stringExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(isStringType(pvApiCtx, piAddr)) + { + if(isScalar(pvApiCtx, piAddr)) + { + char* pstData = NULL; + + iRet = getAllocatedSingleString(pvApiCtx, piAddr, &pstData); + if(iRet) + { + freeAllocatedSingleString(pstData); + return iRet; + } + + iRet = createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstData); + if(iRet) + { + freeAllocatedSingleString(pstData); + return iRet; + } + + freeAllocatedSingleString(pstData); + } + else + { + int iRows = 0; + int iCols = 0; + char** pstData = NULL; + + iRet = getAllocatedMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, &pstData); + if(iRet) + { + freeAllocatedMatrixOfString(iRows, iCols, pstData); + return iRet; + } + + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pstData); + if(sciErr.iErr) + { + freeAllocatedMatrixOfString(iRows, iCols, pstData); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedMatrixOfString(iRows, iCols, pstData); + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab test script</title> + <programlisting role="code_scilab"><![CDATA[ +a = "Scilab"; +b = ["New","Scilab";"API","functions"]; +if stringExample(a) <> a then pause, end +if stringExample(b) <> b then pause, end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/fr_FR/addchapter.sce b/modules/api_scilab/help/fr_FR/addchapter.sce new file mode 100755 index 000000000..f162007c8 --- /dev/null +++ b/modules/api_scilab/help/fr_FR/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// 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 + +add_help_chapter("API Scilab",SCI+"/modules/api_scilab/help/fr_FR",%T); + diff --git a/modules/api_scilab/help/ja_JP/addchapter.sce b/modules/api_scilab/help/ja_JP/addchapter.sce new file mode 100755 index 000000000..317535578 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// 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 + +add_help_chapter("API Scilab",SCI+"/modules/api_scilab/help/ja_JP",%T); + diff --git a/modules/api_scilab/help/ja_JP/api_scilab.xml b/modules/api_scilab/help/ja_JP/api_scilab.xml new file mode 100755 index 000000000..5c949564b --- /dev/null +++ b/modules/api_scilab/help/ja_JP/api_scilab.xml @@ -0,0 +1,295 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="api_scilab" scilab:needs-examples="no" xml:lang="ja"> + <refnamediv> + <refname>api_scilab</refname> + <refpurpose> + api_scilab はScilabメモリにデータを読み書きするための + Scilabインターフェイスです + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>Scilab 5.2.0以降, Scilab は統一した文書化された簡易な + APIを提供しています. + </para> + <para>このAPIはScilabメモリにデータを読み書きするための + 関数を提供します. + </para> + <para>このAPIには以下のような多くの優れた点があります:</para> + <itemizedlist> + <listitem> + <para>全てのScilabデータ型を管理</para> + </listitem> + <listitem> + <para>全データ型を統一的に処理</para> + </listitem> + <listitem> + <para>エラー管理</para> + </listitem> + <listitem> + <para>完全に文書化されている</para> + </listitem> + <listitem> + <para>ユニットテストで完全にテストされている</para> + </listitem> + <listitem> + <para> + 直接または名前を指定した変数アクセス + (<link linkend="call_scilab">call_scilab API</link>参照). + </para> + </listitem> + <listitem> + <para> + Scilabの将来のバージョンで保守される + </para> + </listitem> + </itemizedlist> + <para>通常, このAPIはScilabの機能を拡張するために使用されますが, + 他のコンテキストで使用することもできます + </para> + <itemizedlist> + <listitem> + <para>ライブラリまたはC/C++関数: + 多くのライブラリがフリー/オープンソースまたはプロプライエタリ市場で + 開発されています. + このライブラリはScilabのような高レベル言語に読み込んで使用することができます. + API Scilabはこのようなライブラリへのインターフェイス機能を提供します. + </para> + </listitem> + <listitem> + <para> + サードパーティソフトウエアから計算エンジンとしてScilabを使用すること + も可能です. + この機能は, + C/C++コードから使用する際には + <link linkend="call_scilab">call_scilab</link>, + Javaから使用する際には + <link linkend="javasci">javasci</link>と呼ばれます. + 変数へのアクセスはその名前(変数名)で行われます. + </para> + </listitem> + </itemizedlist> + <para> + 古いAPI (stackX.h)は Scilab 6.0以降使用できなくなることに注意 + してください. + </para> + </refsection> + <refsection> + <title>履歴</title> + <revhistory> + <revision> + <revnumber>5.4.0</revnumber> + <revdescription> + スタック関数/マクロを代替するための関数/マクロを追加 + <itemizedlist> + <listitem>nbInputArgument + <para> + <literal>Rhs</literal>を代替 + </para> + </listitem> + <listitem>nbOutputArgument + <para> + <literal>Lhs</literal>を代替 + </para> + </listitem> + <listitem>AssignOutputVariable + <para> + <literal>LhsVar</literal>を代替 + </para> + </listitem> + <listitem>ReturnArguments + <para> + <literal>PutLhsVar</literal>を代替 + </para> + </listitem> + <listitem>CheckInputArgument + <para> + <literal>CheckRhs</literal>を代替 + </para> + </listitem> + <listitem>CheckOutputArgument + <para> + <literal>CheckLhs</literal>を代替 + </para> + </listitem> + </itemizedlist> + <para> + リストのデータ型を調べる以下の関数を追加します: + <literal>isListType</literal>, <literal>isNamedListType</literal>, <literal>isTListType</literal>, <literal>isNamedTListType</literal>, <literal>isMListType</literal>, + <literal>isNamedMListType</literal> + </para> + </revdescription> + </revision> + </revhistory> + </refsection> + <refsection> + <title>参照 - API_Scilab</title> + <simplelist type="inline"> + <member> + <link linkend="boolean_reading_API">論理値を読み込むAPI</link>, + </member> + <member> + <link linkend="boolean_writing_API">論理値を書き込むAPI</link>, + </member> + <member> + <link linkend="bsparse_reading_API">論理値の疎行列を読み込むAPI</link>, + </member> + <member> + <link linkend="bsparse_writing_API">論理値の疎行列を書き込むAPI</link>, + </member> + <member> + <link linkend="Common_getvaraddr_API">getvaraddr 共通API</link>, + </member> + <member> + <link linkend="Common_getvardimension_API">getvardimension 共通API</link>, + </member> + <member> + <link linkend="Common_getvartype_API">getvartype 共通API</link>, + </member> + <member> + <link linkend="Common_iscomplex_API">iscomplex 共通API</link>, + </member> + <member> + <link linkend="Common_isvarmatrixtype_API">isvarmatrixtype 共通API</link>, + </member> + <member> + <link linkend="Double_management_reading_API">double管理読み込みAPI</link>, + </member> + <member> + <link linkend="Double_management_writing_API">double管理書き込みAPI</link>, + </member> + <member> + <link linkend="Integer_management_reading_API">整数管理読み込みAPI</link>, + </member> + <member> + <link linkend="Integer_management_writing_API">整数管理書き込みAPI</link>, + </member> + <member> + <link linkend="int_getmatrixofintegerprecision_API">getmatrixofintegerprecision API</link>, + </member> + <member> + <link linkend="Pointer_reading_API">ポインタ読み込みAPI</link>, + </member> + <member> + <link linkend="Pointer_writing_API">ポインタ書き込みAPI</link>, + </member> + <member> + <link linkend="poly_getpolyvariablename_API">多項式getpolyvariablename API</link>, + </member> + <member> + <link linkend="Polynomial_management_reading_API">多項式管理読み込みAPI</link>, + </member> + <member> + <link linkend="Polynomial_management_writing_API">多項式管理書き込みAPI</link>, + </member> + <member> + <link linkend="Sparse_management_reading_API">疎行列管理読み込みAPI</link>, + </member> + <member> + <link linkend="Sparse_management_writing_API">疎行列管理書き込みAPI</link>, + </member> + <member> + <link linkend="String_management_reading_API">文字列管理読み込みAPI</link>, + </member> + <member> + <link linkend="String_management_writing_API">文字列管理書き込みAPI</link> + </member> + </simplelist> + </refsection> + <refsection> + <title>参照 - API_Scilab リスト管理</title> + <simplelist type="inline"> + <member> + <link linkend="list_boolean_reading_API">論理値リストを読み込むAPI</link> + </member> + <member> + <link linkend="list_boolean_writing_API">論理値リストを書き込むAPI</link> + </member> + <member> + <link linkend="list_bsparse_reading_API">論理値疎リストを読み込むAPI</link> + </member> + <member> + <link linkend="list_bsparse_writing_API">論理値疎リストを書き込むAPI</link> + </member> + <member> + <link linkend="list_createlist_API">list_createlist API</link> + </member> + <member> + <link linkend="list_double_reading_API">doubleリストを読み込むAPI</link> + </member> + <member> + <link linkend="list_double_writing_API">doubleリストを書き込むAPI</link> + </member> + <member> + <link linkend="list_getlistitemaddress_API">getlistitemaddressリスト API</link> + </member> + <member> + <link linkend="list_getlistitemnumber_API">getlistitemnumberリスト API</link> + </member> + <member> + <link linkend="list_integer_reading_API">整数リストを読み込むAPI</link> + </member> + <member> + <link linkend="list_integer_writing_API">整数リストを書き込むAPI</link> + </member> + <member> + <link linkend="list_pointer_reading_API">ポインタリストを読み込むAPI</link> + </member> + <member> + <link linkend="list_pointer_writing_API">ポインタリストを書き込むAPI</link> + </member> + <member> + <link linkend="list_poly_reading_API">多項式リストを読み込むAPI</link> + </member> + <member> + <link linkend="list_poly_writing_API">多項式リストを書き込むAPI</link> + </member> + <member> + <link linkend="list_sparse_reading_API">疎行列リストを読み込むAPI</link> + </member> + <member> + <link linkend="list_sparse_writing_API">疎行列リストを書き込むAPI</link> + </member> + <member> + <link linkend="list_string_reading_API">文字列リストを読み込むAPI</link> + </member> + <member> + <link linkend="list_string_writing_API">文字列リストを書き込むAPI</link> + </member> + </simplelist> + </refsection> + <refsection> + <title>参照 - call_scilab</title> + <simplelist type="inline"> + <member> + <link linkend="call_scilab">Call_Scilab</link> + </member> + <member> + <link linkend="compile_and_run_call_scilab">call_scilabでコンパイル/実行する</link> + </member> + <member> + <link linkend="DoubleManagement_callscilab">行列の管理</link> + </member> + <member> + <link linkend="BooleanManagement_callscilab">論理値の管理</link> + </member> + <member> + <link linkend="ComplexManagement_callscilab">複素数の管理</link> + </member> + <member> + <link linkend="StringManagement_callscilab">文字列の管理</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/boolean/A_isBooleanType.xml b/modules/api_scilab/help/ja_JP/boolean/A_isBooleanType.xml new file mode 100755 index 000000000..7bb15440b --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean/A_isBooleanType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isBooleanType" xml:lang="ja"> + <refnamediv> + <refname>isBooleanType</refname> + <refpurpose> + 論理値変数かどうか調べる + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isBooleanType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedBooleanType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h で提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数が論理値型の場合は1, それ以外の場合は0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/boolean/B_getScalarBoolean.xml b/modules/api_scilab/help/ja_JP/boolean/B_getScalarBoolean.xml new file mode 100755 index 000000000..3b8f17841 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean/B_getScalarBoolean.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarBoolean" xml:lang="ja"> + <refnamediv> + <refname>getScalarBoolean</refname> + <refpurpose> + ゲートウェイ引数からスカラー論理値データを読み込む + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getScalarBoolean(void* _pvCtx, int* _piAddress, int* _piBool)</synopsis> + <synopsis>int getNamedScalarBoolean(void* _pvCtx, const char* _pstName, int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + 返される論理値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/boolean/C_createScalarBoolean.xml b/modules/api_scilab/help/ja_JP/boolean/C_createScalarBoolean.xml new file mode 100755 index 000000000..93b6b777a --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean/C_createScalarBoolean.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarBoolean" xml:lang="ja"> + <refnamediv> + <refname>createScalarBoolean</refname> + <refpurpose> + Scilabメモリにスカラー論理値変数を作成する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int createScalarBoolean(void* _pvCtx, int _iVar, int _iBool)</synopsis> + <synopsis>int createNamedScalarBoolean(void* _pvCtx, const char* _pstName, int _iBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iBool</term> + <listitem> + <para> + 論理値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/boolean/D_booleanExample.xml b/modules/api_scilab/help/ja_JP/boolean/D_booleanExample.xml new file mode 100755 index 000000000..9d6e59939 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean/D_booleanExample.xml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="booleanExample" xml:lang="ja"> + <refnamediv> + <refname>論理値の例</refname> + <refpurpose> + 論理値の使用例. + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>この例は論理値を取得し, + Scilabに返す手順を示します. + </para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/booleanExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/booleanExample.tst--> + <!--Lib_name: booleanExample--> + <!--Func_list: booleanExample--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int booleanExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isBooleanType(pvApiCtx, piAddr)) + { + if(isScalar(pvApiCtx, piAddr)) + { + int iBool = 0; + iRet = getScalarBoolean(pvApiCtx, piAddr, &iBool); + if(iRet) + { + return 0; + } + iRet = createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iBool); + if(iRet) + { + return 0; + } + } + else + { + int iRows = 0; + int iCols = 0; + int *piBool = NULL; + sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = %t; +b = %f; +c = [a,b;b,a;a,b;b,a]; +d = c'; +booleanExample(a) == a +booleanExample(b) == b +booleanExample(c) == c +booleanExample(d) == d + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/boolean_sparse/A_isBooleanSparseType.xml b/modules/api_scilab/help/ja_JP/boolean_sparse/A_isBooleanSparseType.xml new file mode 100755 index 000000000..816d8899c --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean_sparse/A_isBooleanSparseType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isBooleanSparseType" xml:lang="en"> + <refnamediv> + <refname>isBooleanSparseType</refname> + <refpurpose> + 疎論理値変数かどうかを確認する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isBooleanSparseType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedBooleanSparseType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h で提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数が疎論理値型の場合は1, それ以外の場合は0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/boolean_sparse/B_getAllocatedBooleanSparseMatrix.xml b/modules/api_scilab/help/ja_JP/boolean_sparse/B_getAllocatedBooleanSparseMatrix.xml new file mode 100755 index 000000000..f01390f7a --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean_sparse/B_getAllocatedBooleanSparseMatrix.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedBooleanSparseMatrix" xml:lang="ja"> + <refnamediv> + <refname>getAllocatedBooleanSparseMatrix</refname> + <refpurpose> + 疎行列の属性を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getAllocatedBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + <synopsis>int getNamedAllocatedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + %f でない値の数を返す. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 各行のアイテム数を返す (大きさ: *_piRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 各アイテムの列位置を返す (大きさ: *_piNbItem). + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/boolean_sparse/CHAPTER b/modules/api_scilab/help/ja_JP/boolean_sparse/CHAPTER new file mode 100755 index 000000000..548447144 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean_sparse/CHAPTER @@ -0,0 +1 @@ +title = Boolean Sparse
\ No newline at end of file diff --git a/modules/api_scilab/help/ja_JP/boolean_sparse/C_freeAllocatedBooleanSparse.xml b/modules/api_scilab/help/ja_JP/boolean_sparse/C_freeAllocatedBooleanSparse.xml new file mode 100755 index 000000000..1a3e0b14a --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean_sparse/C_freeAllocatedBooleanSparse.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedBooleanSparse" xml:lang="ja"> + <refnamediv> + <refname>freeAllocatedBooleanSparse</refname> + <refpurpose> + getAllocatedBooleanSparseMatrix 関数で確保されたメモリを開放する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void freeAllocatedBooleanSparse(int* _piNbItemRow, int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + getAllocatedBooleanSparseMatrixで確保された"_piNbItemRow"ポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + getAllocatedBooleanSparseMatrixで確保された"_piColPos"ポインタ. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/boolean_sparse/D_booleanSparseExample.xml b/modules/api_scilab/help/ja_JP/boolean_sparse/D_booleanSparseExample.xml new file mode 100755 index 000000000..81f653b69 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/boolean_sparse/D_booleanSparseExample.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="booleanSparseExample" xml:lang="ja"> + <refnamediv> + <refname>疎論理値の例</refname> + <refpurpose> + 疎論理値の使用例 + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>この例は疎論理値変数を取得し,Scilabに戻す手順を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/booleanSparseExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/booleanSparseExample.tst--> + <!--Lib_name: booleanSparseExample--> + <!--Func_list: booleanSparseExample--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int booleanSparseExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isBooleanSparseType(pvApiCtx, piAddr)) + { + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + iRet = getAllocatedBooleanSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos); + if(iRet) + { + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + return iRet; + } + sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos); + if(sciErr.iErr) + { + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + printError(&sciErr, 0); + return sciErr.iErr; + } + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +bsp = sparse([1,1;2,2;3,3],[%t,%t,%t]); +or(booleanSparseExample(bsp) == bsp) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/capi/CHAPTER b/modules/api_scilab/help/ja_JP/capi/CHAPTER new file mode 100755 index 000000000..42e18dc5e --- /dev/null +++ b/modules/api_scilab/help/ja_JP/capi/CHAPTER @@ -0,0 +1 @@ +title = Scilab Gateway API diff --git a/modules/api_scilab/help/ja_JP/capi/Scierror.xml b/modules/api_scilab/help/ja_JP/capi/Scierror.xml new file mode 100755 index 000000000..5a3dd2816 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/capi/Scierror.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Scierror" xml:lang="ja"> + <refnamediv> + <refname>Scierror</refname> + <refpurpose>エラーメッセージをユーザーに表示するCゲートウェイ関数 + (printf関数と同じプロファイル)で, + エラーレベルを示す整数値を返す + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void Scierror(error_level,format,value_1,..,value_n)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>error_level</term> + <listitem> + <para>エラーレベルを示す整数値</para> + </listitem> + </varlistentry> + <varlistentry> + <term>format</term> + <listitem> + <para>char* 文字列. + 変換指示を含むリテラル文字を結合した文字列を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>value_i</term> + <listitem> + <para> + フォーマットパラメータに基づき変換した + データを指定する. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>returns</term> + <listitem> + <para> + 処理が成功した場合, + この関数は出力した文字数(文字列の終端に + 使用される末尾の '\0' を含まない)を返します. + </para> + <para>エラーが発生した場合, 負の値を返します.</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + Scierror はエラーメッセージをユーザに表示するためのC ゲートウェイ関数 + (printf関数と同じプロファイル)で,エラーレベルを表す整数値を返します. + この関数を使用するには Scierror.h を読み込む必要があります. + このヘッダは output_stream モジュールで提供されています + (このディレクトリはデフォルトで読み込まれます). + </para> + </refsection> + <refsection> + <title>例</title> + <para>この例は, Cゲートウェイ関数はエラーメッセージを出力し, + エラーレベル133を返します. + </para> + <programlisting role="example"><![CDATA[ +#include <stack-c.h> +#include <Scierror.h> +int sci_myscierror(char * fname) +{ + Scierror(133,"An error has occurred: %d\n", 1); + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="printf_conversion">printf_conversion</link> + </member> + <member> + <link linkend="mprintf">mprintf</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/capi/sci_types.xml b/modules/api_scilab/help/ja_JP/capi/sci_types.xml new file mode 100755 index 000000000..b1fee3722 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/capi/sci_types.xml @@ -0,0 +1,193 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="sci_types" xml:lang="ja"> + <refnamediv> + <refname>sci_types</refname> + <refpurpose> + 変数で利用可能な型を定義するC enum + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para> + 変数で利用可能な型を定義する C enum. + この関数を使用する際には, stack-c.h を読み込む必要があります. + </para> + <para>利用可能な型のリストを以下に示します:</para> + <itemizedlist> + <listitem> + <para> + 1 - <emphasis>sci_matrix</emphasis>: doubleの行列 + </para> + </listitem> + <listitem> + <para> + 2 - <emphasis>sci_poly</emphasis>: 多項式行列 + </para> + </listitem> + <listitem> + <para> + 4 - <emphasis>sci_boolean</emphasis>: 論理値行列 + </para> + </listitem> + <listitem> + <para> + 5 - <emphasis>sci_sparse</emphasis>: 疎行列 + </para> + </listitem> + <listitem> + <para> + 6 - <emphasis>sci_boolean_sparse</emphasis>: 論理値疎行列 + </para> + </listitem> + <listitem> + <para> + 7 - <emphasis>sci_matlab_sparse</emphasis>: matlab疎行列 + </para> + </listitem> + <listitem> + <para> + 8 - <emphasis>sci_ints</emphasis>: 整数行列 + </para> + </listitem> + <listitem> + <para> + 9 - <emphasis>sci_handles</emphasis>: グラフィックハンドル + </para> + </listitem> + <listitem> + <para> + 10 - <emphasis>sci_strings</emphasis>: 文字列行列 + </para> + </listitem> + <listitem> + <para> + 11 - <emphasis>sci_u_function</emphasis>: 未コンパイルのScilab関数 + </para> + </listitem> + <listitem> + <para> + 13 - <emphasis>sci_c_function</emphasis>: コンパイル済みのScilab関数 + </para> + </listitem> + <listitem> + <para> + 14 - <emphasis>sci_lib</emphasis>: Scilab関数のライブラリ + </para> + </listitem> + <listitem> + <para> + 15 - <emphasis>sci_list</emphasis>: a Scilab list + </para> + </listitem> + <listitem> + <para> + 16 - <emphasis>sci_tlist</emphasis>: Scilab tlist + </para> + </listitem> + <listitem> + <para> + 17 - <emphasis>sci_mlist</emphasis>: Scilab mlist + </para> + </listitem> + <listitem> + <para> + 128 - <emphasis>sci_pointer (Scilab 5.2以前はsci_lufact_pointer)</emphasis>: ポインタ + </para> + </listitem> + </itemizedlist> + <para>整数またはenum型は + 変数の型を確認する際に使用出来ます. + enum型の値には明示的な意味があるため,enum型の使用が推奨されます. + </para> + </refsection> + <refsection> + <title>例</title> + <para>この例では, Cゲートウェイ関数は1つの引数をとります. + switch case構造により, パラメータとして送信した変数の型を表示します. + </para> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" +int sci_mysci_typesrhs(char * fname, unsigned long fname_len) +{ + int iType = 0; + int* piAddr = NULL; + SciErr sciErr; + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + switch(iType) + { + case sci_matrix: + sciprint("A matrix of doubles\n"); + break; + case sci_poly: + sciprint("A matrix of polynomials\n"); + break; + case sci_boolean: + sciprint("A matrix of booleans\n"); + break; + case sci_sparse: + sciprint("A sparse matrix of doubles\n"); + break; + case sci_boolean_sparse: + sciprint("A sparse matrix of booleans\n"); + break; + case sci_matlab_sparse: + sciprint("A sparse matlab matrix\n"); + break; + case sci_ints: + sciprint("A matrix of integers\n"); + break; + case sci_handles: + sciprint("A graphic handle\n"); + break; + case sci_strings: + sciprint("A matrix of strings\n"); + break; + case sci_u_function: + sciprint("An uncompiled Scilab function\n"); + break; + case sci_c_function: + sciprint("A compiled Scilab function\n"); + break; + case sci_lib: + sciprint("A library of Scilab functions\n"); + break; + case sci_list: + sciprint("A Scilab list\n"); + break; + case sci_tlist: + sciprint("A Scilab tlist\n"); + break; + case sci_mlist: + sciprint("A Scilab mlist\n"); + break; + case sci_pointer: + sciprint("A pointer\n"); + break; + default: + sciprint("Unknown type !\n"); // Should never happen + } + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/capi/sciprint.xml b/modules/api_scilab/help/ja_JP/capi/sciprint.xml new file mode 100755 index 000000000..c6a85c932 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/capi/sciprint.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="sciprint" xml:lang="ja"> + <refnamediv> + <refname>sciprint</refname> + <refpurpose>ユーザに標準メッセージを出力するCゲートウェイ関数 + (C printf関数と同じプロファイル) + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void sciprint(format,value_1,..,value_n)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>format</term> + <listitem> + <para>char* 文字列. + 変換を指定するリテラル文字からなる文字列を指定します. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>value_i</term> + <listitem> + <para> + フォーマットパラメータ(%s, %d, ...)に基づき変換するデータを + 指定します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + このCゲートウェイ関数はScilabユーザにメッセージを表示する機能を提供します. + 基本的に,この関数は,C言語のprintf関数をエミュレートします. + この関数を利用するには sciprint.h を読み込む必要があります. + このヘッダは output_stream モジュールで提供されます + (このディレクトリはデフォルトで読み込まれます). + </para> + <para> + エラーを発生させたい場合, 関数 Scierrorの方がより適当です. + </para> + </refsection> + <refsection> + <title>例</title> + <para>この例では, C ゲートウェイ関数は + sciprint関数の使用方法を表す + 複数のメッセージをScilabコンソールに出力します. + </para> + <programlisting role="example"><![CDATA[ +#include <stack-c.h> +#include <sciprint.h> +int sci_mysciprint(char * fname) +{ + sciprint("printing an integer: %d\n", 1); + sciprint("printing a double: %f\n", 2.1); + sciprint("printing a string: %s\n", "test"); + return 0; +} + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="printf_conversion">printf_conversion</link> + </member> + <member> + <link linkend="mprintf">mprintf</link> + </member> + <member> + <link linkend="Scierror">Scierror</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/double/A_isDoubleType.xml b/modules/api_scilab/help/ja_JP/double/A_isDoubleType.xml new file mode 100755 index 000000000..1d0928acb --- /dev/null +++ b/modules/api_scilab/help/ja_JP/double/A_isDoubleType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isDoubleType" xml:lang="ja"> + <refnamediv> + <refname>isDoubleType</refname> + <refpurpose> + double変数かどうかを調べる. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isDoubleType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedDoubleType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h で提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数が論理値型の場合は1, それ以外の場合は0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/double/B_getScalarDouble.xml b/modules/api_scilab/help/ja_JP/double/B_getScalarDouble.xml new file mode 100755 index 000000000..d48154a42 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/double/B_getScalarDouble.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarDouble" xml:lang="ja"> + <refnamediv> + <refname>getScalarDouble</refname> + <refpurpose> + スカラーdouble変数を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getScalarDouble(void* _pvCtx, int* _piAddress, double* _pdblReal)</synopsis> + <synopsis>int getNamedScalarDouble(void* _pvCtx, const char* _pstName, double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + double値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/double/C_getScalarComplexDouble.xml b/modules/api_scilab/help/ja_JP/double/C_getScalarComplexDouble.xml new file mode 100755 index 000000000..038c275f7 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/double/C_getScalarComplexDouble.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarComplexDouble" xml:lang="ja"> + <refnamediv> + <refname>getScalarComplexDouble</refname> + <refpurpose> + スカラー複素数double変数を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getScalarComplexDouble(void* _pvCtx, int* _piAddress, double* _pdblReal, double* _pdblImg)</synopsis> + <synopsis>int getNamedScalarComplexDouble(void* _pvCtx, const char* _pstName, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 実部の値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 虚部の値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/double/D_createScalarDouble.xml b/modules/api_scilab/help/ja_JP/double/D_createScalarDouble.xml new file mode 100755 index 000000000..111a77562 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/double/D_createScalarDouble.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarDouble" xml:lang="ja"> + <refnamediv> + <refname>createScalarDouble</refname> + <refpurpose> + スカラーdoubleをScilabメモリに作成. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int createScalarDouble(void* _pvCtx, int _iVar, double _dblReal)</synopsis> + <synopsis>int createNamedScalarDouble(void* _pvCtx, const char* _pstName, double _dblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dblReal</term> + <listitem> + <para> + doubleの値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/double/E_createScalarComplexDouble.xml b/modules/api_scilab/help/ja_JP/double/E_createScalarComplexDouble.xml new file mode 100755 index 000000000..dd8a40101 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/double/E_createScalarComplexDouble.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarComplexDouble" xml:lang="ja"> + <refnamediv> + <refname>createScalarComplexDouble</refname> + <refpurpose> + スカラー複素数doubleをScilabメモリに作成. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int createScalarComplexDouble(void* _pvCtx, int _iVar, double _dblReal, double _dblImg)</synopsis> + <synopsis>int createNamedScalarComplexDouble(void* _pvCtx, const char* _pstName, double _dblReal, double _dblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dblReal</term> + <listitem> + <para> + 実部の値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dblImg</term> + <listitem> + <para> + 虚部の値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/double/F_doubleExample.xml b/modules/api_scilab/help/ja_JP/double/F_doubleExample.xml new file mode 100755 index 000000000..16fab4c4b --- /dev/null +++ b/modules/api_scilab/help/ja_JP/double/F_doubleExample.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="doubleExample" xml:lang="ja"> + <refnamediv> + <refname>doubleの例</refname> + <refpurpose> + doubleの使用例. + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>この例はdouble変数を取得し,Scilabに戻す手順を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/doubleExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/doubleExample.tst--> + <!--Lib_name: doubleExample--> + <!--Func_list: doubleExample--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int doubleExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if(iRet) + { + return iRet; + } + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if(isDoubleType(pvApiCtx, piAddr)) + { + if(isScalar(pvApiCtx, piAddr)) + { + double dblReal = 0; + double dblImg = 0; + if(isVarComplex(pvApiCtx, piAddr)) + { + iRet = getScalarComplexDouble(pvApiCtx, piAddr, &dblReal, &dblImg); + if(iRet) + { + return iRet; + } + iRet = createScalarComplexDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblReal, dblImg); + if(iRet) + { + return iRet; + } + } + else + { + iRet = getScalarDouble(pvApiCtx, piAddr, &dblReal); + if(iRet) + { + return iRet; + } + iRet = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblReal); + if(iRet) + { + return iRet; + } + } + } + else + { + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(isVarComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = 1; +b = %i; +c = [1,2,3;4,5,6]; +d = c(1:$) + c($:-1:1) * %i; +doubleExample(a) == a +doubleExample(b) == b +doubleExample(c) == c +doubleExample(d) == d + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/getting_started.xml b/modules/api_scilab/help/ja_JP/getting_started.xml new file mode 100755 index 000000000..0a3b0f596 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/getting_started.xml @@ -0,0 +1,446 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2012 - Scilab Enterprises - Sylvestre LEDRU +* +* 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 +* +--> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="api_scilab_getting_started" xml:lang="ja"> + <refnamediv> + <refname>API_Scilab入門</refname> + <refpurpose> + C, C++ またはfortranコードを新しい関数としてScilabエンジンに読み込む方法 + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para> + <link linkend="api_scilab">api_scilabプレゼンテーション</link> + で説明されたように, + ScilabはC, C++またはFortranコード(ソースまたはライブラリ)で言語を + 拡張するためのAPIを提供します. + </para> + <para> + Scilabエンジンとアプリケーションコードの間のリンクは + <literal>gateway</literal>と呼ばれます. + </para> + <para> + 多くの場合, 処理は常に同じで,以下のようになります: + <orderedlist> + <listitem> + <para> + ユーザに指定された(入力及び出力)引数の数を調べます. + </para> + <para> + 例えば,関数<literal>foo(x)</literal>が <literal>foo()</literal> または <literal>foo(2,3)</literal>のようにコールされ, ユーザが答を得ます. + </para> + <para> + 詳細: <link linkend="CheckInputArgument">CheckInputArgument</link> および <link linkend="CheckOutputArgument">CheckOutputArgument</link> + </para> + </listitem> + <listitem> + <para>入力引数の管理</para> + <para> + 複数の処理を行います: + <orderedlist inheritnum="inherit"> + <listitem> + <para>入力引数Xの変数アドレスを取得します</para> + <para> + 関数 + <literal> + SciErr <link linkend="Common_getvaraddr_API">getVarAddressFromPosition</link>(void* context, int positionOfTheVariable, int** address) + </literal> + </para> + </listitem> + <listitem> + <para>変数の型を調べます: doubleの行列 (複素数または複素数以外), 文字列 + , 等 + </para> + <para> + <literal> + SciErr <link linkend="Common_getvartype_API">getVarType</link>(void* context, int* positionOfTheVariable, int* Type) + </literal> + </para> + <para> + 他の関数も提供されています: + <itemizedlist> + <listitem> + <para> + <literal>int isBooleanType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isBooleanSparseType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isDoubleType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isIntegerType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isPointerType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isPolyType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isSparseType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isStringType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isListType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isTListType(void* context, int* address)</literal> + </para> + </listitem> + <listitem> + <para> + <literal>int isMListType(void* context, int* address)</literal> + </para> + </listitem> + </itemizedlist> + </para> + </listitem> + <listitem> + <para> + 関連する場合, 入力引数かどうかを確認します. + </para> + <para> + <literal> + int <link linkend="Common_iscomplex_API">isVarComplex</link>(void* context, int* address) + </literal> + </para> + </listitem> + <listitem> + <para> + 整数を処理する場合,さらに整数の精度も確認します + </para> + <para> + <literal> + SciErr <link linkend="int_getmatrixofintegerprecision_API">getMatrixOfIntegerPrecision</link>(void* context, int* address, int* precision) + </literal> + </para> + </listitem> + <listitem> + <para>変数の大きさを確認します: 正方行列, スカラー, 等</para> + <para> + 大きさに関する情報を取得する際にも + 実際のデータを取得する際に使用するものと同じ関数を使用します. + 例えば, double の行列の場合 関数コール + <literal> + SciErr <link linkend="Double_management_reading_API">getMatrixOfDouble</link>(void* context, int* address, int* nbRows, int* nbCols, double** theActualData) + </literal> + により行列の次元を取得できます. + </para> + <para>ほぼ全てのScilabデータ型にはこのような処理を行うための + 同様なC関数があります. + </para> + </listitem> + <listitem> + <para> + その他, 特定の値かどうかを調べたり, 最初と2番目の入力引数の間の整合性を + 確認したりすること等も可能です. + </para> + </listitem> + <listitem> + <para>データ変換 (オプション).</para> + <para> + 使用するコードまたはライブラリによっては, + いくつかの変換をデータに適用することができます. + 古典的な例は行列の記録を列形式から線形式に変換するものです. + </para> + <para> + 通常,このようにすると性能が低下することに注意してください. + </para> + </listitem> + </orderedlist> + </para> + </listitem> + <listitem> + <para>アプリケーションコード</para> + <para> + 確認とデータ取得を行った後,実際の主コードをコールできます. + 実際の情報処理(処理, データ変換, 等)をここで実行します. + </para> + <para> + これは, + <literal>src/c</literal>, <literal>src/cpp</literal> または + <literal>src/fortran</literal>に保存,構築した + サードパーティのコードにより行いますが, + ライブラリ形式とすることも可能です. + あらゆるライブラリをScilabにリンクすることができます. + </para> + </listitem> + <listitem> + <para>Scilabエンジンの出力引数を作成する</para> + <para>通常,アプリケーションコードの実行後, + 何らかのデータをScilabインタプリタから戻します. + </para> + <para> + 例えば, doubleの行列をScilabエンジンに保存する場合,C関数 + <literal> + SciErr <link linkend="Double_management_writing_API">createMatrixOfDouble</link>(void* context, int position, int nbRows, int nbCols, const double* matrixOfDouble) + </literal> + をコールします. + </para> + <para> + 通常,位置は + <literal>nbInputArgument(pvApiCtx) + X</literal>により取得できます. + <literal>X</literal> が返す出力引数の位置となります. + 例えば, 関数プロファイル + <literal>[a, b, c] = foo();</literal> + <literal>nbInputArgument(pvApiCtx) + 3</literal> は + 変数<literal>c</literal>となります. + </para> + <para> + 作成できる次元はゲートウェイの制約を受けることに注意してください. + </para> + <para> + ほぼ全てのScilabデータ型はこのような処理を行う同様なC関数を有します. + </para> + </listitem> + <listitem> + <para>Scilabエンジンに出力引数を返す</para> + <para>以下, タスク4で, 作成した変数を返します.</para> + <para> + <literal>a</literal>を返す + 前の例 <literal>[a, b, c] = foo();</literal>の場合, + 以下の宣言を行います: <literal>AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;</literal> + </para> + <para> + Scilabエンジンに新しい変数をコミットするには, + 関数 + <link linkend="ReturnArguments">ReturnArguments(pvApiCtx)</link> をコールします. + </para> + </listitem> + </orderedlist> + </para> + <para> + ほぼ全てのAPI_Scilab関数がエラーに関する多くの情報を含む + SciErrと呼ばれるC構造体を返すことに注意してください. + </para> + <para> + デフォルトでは, Scilab数値はC言語の<literal>double</literal>型に保存されます. + </para> + <para> + 習慣的に, + ゲートウェイは,<literal>sci_gateway/c/</literal> (または <literal>/cpp/</literal>) + に保存され,<literal>sci_functionName.c</literal>という名前が付けられます. + </para> + <para> + <literal>pvApiCtx</literal> は,グローバルコンテキスト変数です. + これは,バージョン5系では使用されていませんが, Scilab バージョン 6で導入される + マルチスレッド機能を管理するために導入されています. + </para> + </refsection> + <refsection> + <title>実用的な例</title> + <para>以下のScilab関数を例として示します:</para> + <para> + <literal>[c,d] = foo(a,b)</literal> + </para> + <para> + <literal>a</literal>はdouble行列,<literal>a</literal>と同じ大きさの + <literal>b</literal>は論理値行列, + foo は<literal>a</literal>の各要素に2を乗じて, + <literal>c</literal>として返します. + また,bを要素毎に逆の論理値に変換して返します. + </para> + <para> + Scilabバイナリに含まれるツールボックススケルトンでサンプルを取得できます. + パスは + <literal>contrib/toolbox_skeleton/sci_gateway/c/sci_foo.c</literal>です. + </para> + <para>詳細な説明は以下の例のCコメント形式で提供されています. + </para> + <programlisting role="code_gateway"> + <![CDATA[ +// 完全なソースはtoolboxスケルトンのsci_gateway/c/ ディレクトリにあります + +// 標準ヘッダ +#include "api_scilab.h" +#include "BOOL.h" +// 関数宣言 +int sci_foo(char *fname, unsigned long fname_len) +{ + // エラー管理変数 + SciErr sciErr; + ////////// 変数宣言 ////////// + int m1 = 0, n1 = 0; + int *piAddressVarOne = NULL; + double *matrixOfDouble = NULL; + double *newMatrixOfDouble = NULL; + int m2 = 0, n2 = 0; + int *piAddressVarTwo = NULL; + int *matrixOfBoolean = NULL; + int *newMatrixOfBoolean = NULL; + int i = 0; + ////////// 入力/出力引数の数を調べる ////////// + /* --> [c, d] = foo(a, b) */ + /* 入力引数が2のみであることを調べる */ + /* 出力引数が2のみであることを調べる */ + CheckInputArgument(pvApiCtx, 2, 2) ; + CheckOutputArgument(pvApiCtx, 2, 2) ; + ////////// 最初の入力引数 (double) を管理 ////////// + /* 入力アドレスを取得 */ + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + /* 最初の入力引数が実数行列(複素数でない)であることを調べる */ + if ( !isDoubleType(pvApiCtx, piAddressVarOne) || isVarComplex(pvApiCtx, piAddressVarOne) ) + { + Scierror(999, "%s: Wrong type for input argument #%d: A real matrix expected.\n", fname, 1); + return 0; + } + /* 行列を取得 */ + sciErr = getMatrixOfDouble(pvApiCtx, piAddressVarOne, &m1, &n1, &matrixOfDouble); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + ////////// 2番目の入力引数を管理 (論理値) ////////// + /* 入力アドレスを取得 */ + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if ( !isBooleanType(pvApiCtx, piAddressVarTwo) ) + { + Scierror(999, "%s: Wrong type for input argument #%d: A boolean matrix expected.\n", fname, 2); + return 0; + } + /* 行列を取得 */ + sciErr = getMatrixOfBoolean(pvApiCtx, piAddressVarTwo, &m2, &n2, &matrixOfBoolean); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + ////////// 2つの入力引数の相関を確認 ////////// + if ((m1 != m2) || (n1 != n2)) + { + Scierror(999, "%s: Wrong size for input arguments: Same size expected.\n", fname, 1); + return 0; + } + newMatrixOfDouble = (double*)malloc(sizeof(double) * m1 * n1); + ////////// アプリケーションコード ////////// + // ライブラリへのコールで置換することができます + for (i = 0; i < m1 * n1; i++) + { + /* 行列の各要素を2倍します */ + newMatrixOfDouble[i] = matrixOfDouble[i] * 2; + } + newMatrixOfBoolean = (int*)malloc(sizeof(BOOL) * m2 * n2); + for (i = 0; i < m2 * n2; i++) + { + /* 行列の各要素について, 値を反転する */ + newMatrixOfBoolean[i] = ((matrixOfBoolean[i] == TRUE) ? FALSE : TRUE); + } + ////////// 出力引数を作成 ////////// + /* 関数の戻り値として行列を作成 */ + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, m1, n1, newMatrixOfDouble); + free(newMatrixOfDouble); // データをScilabメモリにコピー + if (sciErr.iErr) + { + free(newMatrixOfBoolean); // エラーの際,完全にクリンナップします + printError(&sciErr, 0); + return 0; + } + /* 関数の戻り値として行列を作成 */ + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 2, m2, n2, newMatrixOfBoolean); + free(newMatrixOfBoolean); // データをScilabメモリにコピー + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + ////////// 出力引数をScilabエンジンに戻す ////////// + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + return 0; +} + ]]> + </programlisting> + <para> + このコードを構築,Scilabにロードする際,Scilabの動的リンク機能を使用します. + この組み込み処理はScilabに委任するため,以下のコードはマルチプラットフォーム対応です. + <programlisting role="scilab"> + <![CDATA[ + files=["sci_foo.c"]; + // TODO: WTF ? + WITHOUT_AUTO_PUTLHSVAR = %t; + ilib_build('build_lib',['foo','sci_foo'],files,[]); + exec loader.sce + [c, d] = foo([2,%pi], [%t, %f]) + ]]> + </programlisting> + </para> + <para> + 種々の確認が行われます: + <programlisting role="no-scilab-exec"> + <![CDATA[ +-->[c, d] = foo(2, 2) + !--error 999 +foo: Wrong type for input argument #2: A boolean matrix expected. + ]]> + </programlisting> + <programlisting role="no-scilab-exec"> + <![CDATA[ +-->[c, d] = foo([2,2], %t) + !--error 999 +foo: Wrong size for input arguments: Same size expected. + ]]> + </programlisting> + <programlisting role="no-scilab-exec"> + <![CDATA[ +-->[a,b]=foo(2+%i,%t) + !--error 999 +foo: Wrong type for input argument #1: A real matrix expected. + ]]> + </programlisting> + <programlisting role="no-scilab-exec"> + <![CDATA[ +-->[c, d] = foo([2,%pi], [%t, %f]) + d = + + F T + c = + + 4. 6.2831853 + ]]> + </programlisting> + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/handle/A_isHandleType.xml b/modules/api_scilab/help/ja_JP/handle/A_isHandleType.xml new file mode 100755 index 000000000..2df2b3797 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/handle/A_isHandleType.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isHandleType" xml:lang="ja"> + <refnamediv> + <refname>isHandleType</refname> + <refpurpose> + ハンドル変数かどうかを調べる. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isHandleType(void* _pvCtx, int* _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数がハンドル型の場合は1, それ以外は 0</para> + </refsection> + <title>履歴</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>この関数はScilab 5.5.0で追加されました</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/handle/B_getScalarHandle.xml b/modules/api_scilab/help/ja_JP/handle/B_getScalarHandle.xml new file mode 100755 index 000000000..cd116c04d --- /dev/null +++ b/modules/api_scilab/help/ja_JP/handle/B_getScalarHandle.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarHandle" xml:lang="ja"> + <refnamediv> + <refname>getScalarHandle</refname> + <refpurpose> + ゲートウェイ引数からスカラーハンドルデータを読み込む. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getScalarHandle(void* _pvCtx, int* _piAddress, long long* _pllHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pllHandle</term> + <listitem> + <para> + 返されるハンドル値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを出力し, + 最初のエラー番号を返します. + </para> + </refsection> + <title>履歴</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>この関数はScilab 5.5.0で追加されました</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/handle/C_createScalarHandle.xml b/modules/api_scilab/help/ja_JP/handle/C_createScalarHandle.xml new file mode 100755 index 000000000..0ac88ac7a --- /dev/null +++ b/modules/api_scilab/help/ja_JP/handle/C_createScalarHandle.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarHandle" xml:lang="ja"> + <refnamediv> + <refname>createScalarHandle</refname> + <refpurpose> + Scilabメモリにスカラーハンドル変数を作成. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int createScalarHandle(void* _pvCtx, int _iVar, long long _llHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_llHandle</term> + <listitem> + <para> + ハンドルの値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを出力し, + 最初のエラー番号を返します. + </para> + </refsection> + <title>履歴</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>この関数はScilab 5.5.0で追加されました</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/handle/D_handleExample.xml b/modules/api_scilab/help/ja_JP/handle/D_handleExample.xml new file mode 100755 index 000000000..4544c241e --- /dev/null +++ b/modules/api_scilab/help/ja_JP/handle/D_handleExample.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="handleExample" xml:lang="ja"> + <refnamediv> + <refname>ハンドルの例</refname> + <refpurpose> + ハンドルの使用例. + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>この例はハンドル変数を取得し,Scilabに返す方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/handleExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/handleExample.tst--> + <!--Lib_name: handleExample--> + <!--Func_list: handleExample--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int handleExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isHandleType(pvApiCtx, piAddr)) + { + if(isScalar(pvApiCtx, piAddr)) + { + long long llHandle = 0; + iRet = getScalarHandle(pvApiCtx, piAddr, &llHandle); + if(iRet) + { + return 0; + } + iRet = createScalarHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, llHandle); + if(iRet) + { + return 0; + } + } + else + { + int iRows = 0; + int iCols = 0; + long long *pllHandle = NULL; + sciErr = getMatrixOfHandle(pvApiCtx, piAddr, &iRows, &iCols, &pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = %t; +b = %f; +c = [a,b;b,a;a,b;b,a]; +d = c'; +handleExample(a) == a +handleExample(b) == b +handleExample(c) == c +handleExample(d) == d + ]]></programlisting> + </refsection> + <title>履歴</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>この関数はScilab 5.5.0で追加されました</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/hypermat/A_isHypermatType.xml b/modules/api_scilab/help/ja_JP/hypermat/A_isHypermatType.xml new file mode 100755 index 000000000..b12547e6b --- /dev/null +++ b/modules/api_scilab/help/ja_JP/hypermat/A_isHypermatType.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isHypermatType" xml:lang="ja"> + <refnamediv> + <refname>isHypermatType</refname> + <refpurpose> + ハイパー行列変数かどうかを調べる. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isHypermatType(void* _pvCtx, int* _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数がdouble型の場合は1, それ以外は0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/hypermat/B_getHypermatOfDouble.xml b/modules/api_scilab/help/ja_JP/hypermat/B_getHypermatOfDouble.xml new file mode 100755 index 000000000..e62ef9a47 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/hypermat/B_getHypermatOfDouble.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfDouble" xml:lang="ja"> + <refnamediv> + <refname>getHypermatOfDouble</refname> + <refpurpose> + double変数のハイパー行列を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab 変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dims</term> + <listitem> + <para> + ハイパー行列の次元 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_ndims</term> + <listitem> + <para> + 次元の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + double値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>SciErr構造体, フィールド iErr は + エラー番号を保持します (エラーがない場合は 0). + </para> + </refsection> + <refsection> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int hypermatExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if (isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if (iRet) + { + return iRet; + } + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if (isHypermatType(pvApiCtx, piAddr)) + { + int * dims = NULL; + int ndims; + double* pdblReal = NULL; + double* pdblImg = NULL; + if (isHypermatComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createComplexHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal, pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + else + { + sciErr = getHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + return 0; +}]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = hypermat([1 2 3], ones(1,6)); +b = a + %i*hypermat([1 2 3], 1:6); +hypermatExample(a) == a +hypermatExample(b) == b + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/hypermat/C_getHypermatOfInt.xml b/modules/api_scilab/help/ja_JP/hypermat/C_getHypermatOfInt.xml new file mode 100755 index 000000000..902eba265 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/hypermat/C_getHypermatOfInt.xml @@ -0,0 +1,249 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfInt" xml:lang="ja"> + <refnamediv> + <refname>getHypermatOfInt</refname> + <refpurpose> + 整数変数のハイパー行列を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>SciErr getHypermatOfInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char* _pcData)</synopsis> + <synopsis>SciErr getHypermatOfUnsignedInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char* _pucData)</synopsis> + <synopsis>SciErr getHypermatOfInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short* _psData)</synopsis> + <synopsis>SciErr getHypermatOfUnsignedInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short* _pusData)</synopsis> + <synopsis>SciErr getHypermatOfInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piData)</synopsis> + <synopsis>SciErr getHypermatOfUnsignedInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int* _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_dims</term> + <listitem> + <para> + ハイパー行列の次元. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_ndims</term> + <listitem> + <para> + 次元の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_p*Data</term> + <listitem> + <para> + データ. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>SciErr構造体, フィールド iErr は + エラー番号を保持します (エラーがない場合は 0). + </para> + </refsection> + <refsection> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" +int hypermatIntExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if (isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if (iRet) + { + return iRet; + } + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if (isHypermatType(pvApiCtx, piAddr)) + { + int * dims = NULL; + int ndims; + void * data = NULL; + int htype = 0; + int precision; + sciErr = getHypermatType(pvApiCtx, piAddr, &htype); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + if (htype == sci_ints) + { + sciErr = getHypermatOfIntegerPrecision(pvApiCtx, piAddr, &precision); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + switch (precision) + { + case SCI_INT8: + sciErr = getHypermatOfInteger8(pvApiCtx, piAddr, &dims, &ndims, (char*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createHypermatOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const char*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT8: + sciErr = getHypermatOfUnsignedInteger8(pvApiCtx, piAddr, &dims, &ndims, (unsigned char*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createHypermatOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned char*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_INT16: + sciErr = getHypermatOfInteger16(pvApiCtx, piAddr, &dims, &ndims, (short*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createHypermatOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const short*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT16: + sciErr = getHypermatOfUnsignedInteger16(pvApiCtx, piAddr, &dims, &ndims, (unsigned short*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createHypermatOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned short*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_INT32: + sciErr = getHypermatOfInteger32(pvApiCtx, piAddr, &dims, &ndims, (int*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createHypermatOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const int*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT32: + sciErr = getHypermatOfUnsignedInteger32(pvApiCtx, piAddr, &dims, &ndims, (unsigned int*)&data); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createHypermatOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned int*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + } + } + else + { + Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname, 1); + return 1; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + return 0; +}]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = hypermat([1 2 3], int8(1:6)); +b = hypermat([1 2 3], uint8(1:6)); +c = hypermat([1 2 3], int16(1:6)); +d = hypermat([1 2 3], uint16(1:6)); +e = hypermat([1 2 3], int32(1:6)); +f = hypermat([1 2 3], uint32(1:6)); +hypermatExampleInt(a) == a +hypermatExampleInt(b) == b +hypermatExampleInt(c) == c +hypermatExampleInt(d) == d +hypermatExampleInt(e) == e +hypermatExampleInt(f) == f + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/integer/A_isIntegerType.xml b/modules/api_scilab/help/ja_JP/integer/A_isIntegerType.xml new file mode 100755 index 000000000..c6565b613 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/integer/A_isIntegerType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isIntegerType" xml:lang="ja"> + <refnamediv> + <refname>isIntegerType</refname> + <refpurpose> + 整数変数かどうか調べる. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isIntegerType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedIntegerType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h で提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数が整数型の場合は1, それ以外の場合は0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/integer/B_getScalarInteger.xml b/modules/api_scilab/help/ja_JP/integer/B_getScalarInteger.xml new file mode 100755 index 000000000..fa3d012f2 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/integer/B_getScalarInteger.xml @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getScalarInteger8" xml:lang="en"> + <refnamediv> + <refname>getScalarInteger8</refname> + <refpurpose> + スカラー整数変数を取得する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getScalarInteger8(void* _pvCtx, int* _piAddress, char* _pcData)</synopsis> + <synopsis>int getNamedScalarInteger8(void* _pvCtx, const char* _pstName, char* _pcData)</synopsis> + <synopsis>int getScalarInteger16(void* _pvCtx, int* _piAddress, short* _psData)</synopsis> + <synopsis>int getNamedScalarInteger16(void* _pvCtx, const char* _pstName, short* _psData)</synopsis> + <synopsis>int getScalarInteger32(void* _pvCtx, int* _piAddress, int* _piData)</synopsis> + <synopsis>int getNamedScalarInteger32(void* _pvCtx, const char* _pstName, int* _piData)</synopsis> + <synopsis>int getScalarUnsignedInteger8(void* _pvCtx, int* _piAddress, unsigned char* _pucData)</synopsis> + <synopsis>int getNamedScalarUnsignedInteger8(void* _pvCtx, const char* _pstName, unsigned char* _pucData)</synopsis> + <synopsis>int getScalarUnsignedInteger16(void* _pvCtx, int* _piAddress, unsigned short* _pusData)</synopsis> + <synopsis>int getNamedScalarUnsignedInteger16(void* _pvCtx, const char* _pstName, unsigned short* _pusData)</synopsis> + <synopsis>int getScalarUnsignedInteger32(void* _pvCtx, int* _piAddress, unsigned int* _puiData)</synopsis> + <synopsis>int getNamedScalarUnsignedInteger32(void* _pvCtx, const char* _pstName, unsigned int* _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_cData</term> + <listitem> + <para> + 8ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_sData</term> + <listitem> + <para> + 16ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iData</term> + <listitem> + <para> + 32ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_ucData</term> + <listitem> + <para> + 符号無し8ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_usData</term> + <listitem> + <para> + 符号無し16ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_uiData</term> + <listitem> + <para> + 符号無し32ビット整数値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/integer/C_createScalarInteger.xml b/modules/api_scilab/help/ja_JP/integer/C_createScalarInteger.xml new file mode 100755 index 000000000..e7048ba3a --- /dev/null +++ b/modules/api_scilab/help/ja_JP/integer/C_createScalarInteger.xml @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createScalarInteger8" xml:lang="ja"> + <refnamediv> + <refname>createScalarInteger8</refname> + <refpurpose> + スカラー整数変数を作成する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int createScalarInteger8(void* _pvCtx, int _iVar, char cData)</synopsis> + <synopsis>int createNamedScalarInteger8(void* _pvCtx, const char* _pstName, char _cData)</synopsis> + <synopsis>int createScalarInteger16(void* _pvCtx, int _iVar, short sData)</synopsis> + <synopsis>int createNamedScalarInteger16(void* _pvCtx, const char* _pstName, short _sData)</synopsis> + <synopsis>int createScalarInteger32(void* _pvCtx, int _iVar, int iData)</synopsis> + <synopsis>int createNamedScalarInteger32(void* _pvCtx, const char* _pstName, int _iData)</synopsis> + <synopsis>int createScalarUnsignedInteger8(void* _pvCtx, int _iVar, unsigned char ucData)</synopsis> + <synopsis>int createNamedScalarUnsignedInteger8(void* _pvCtx, const char* _pstName, unsigned char _ucData)</synopsis> + <synopsis>int createScalarUnsignedInteger16(void* _pvCtx, int _iVar, unsigned short usData)</synopsis> + <synopsis>int createNamedScalarUnsignedInteger16(void* _pvCtx, const char* _pstName, unsigned short _usData)</synopsis> + <synopsis>int createScalarUnsignedInteger32(void* _pvCtx, int _iVar, unsigned int uiData)</synopsis> + <synopsis>int createNamedScalarUnsignedInteger32(void* _pvCtx, const char* _pstName, unsigned int _uiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_cData</term> + <listitem> + <para> + 8ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_sData</term> + <listitem> + <para> + 16ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iData</term> + <listitem> + <para> + 32ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_ucData</term> + <listitem> + <para> + 符号無し8ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_usData</term> + <listitem> + <para> + 符号無し16ビット整数値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_uiData</term> + <listitem> + <para> + 符号無し32ビット整数値. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/integer/D_integerExample.xml b/modules/api_scilab/help/ja_JP/integer/D_integerExample.xml new file mode 100755 index 000000000..5ac2adc92 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/integer/D_integerExample.xml @@ -0,0 +1,305 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="integerExample" xml:lang="ja"> + <refnamediv> + <refname>整数の例</refname> + <refpurpose> + 整数の使用例. + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>この例は整数変数を取得し,Scilabに返す方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/integerExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/integerExample.tst--> + <!--Lib_name: integerExample--> + <!--Func_list: integerExample--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int integerExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + int iPrec = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isIntegerType(pvApiCtx, piAddr)) + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + switch(iPrec) + { + case SCI_INT8 : + if(isScalar(pvApiCtx, piAddr)) + { + char cData = 0; + iRet = getScalarInteger8(pvApiCtx, piAddr, &cData); + if(iRet) + { + return iRet; + } + iRet = createScalarInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, cData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + sciErr = getMatrixOfInteger8(pvApiCtx, piAddr, &iRows, &iCols, &pcData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pcData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + case SCI_INT16 : + if(isScalar(pvApiCtx, piAddr)) + { + short sData = 0; + iRet = getScalarInteger16(pvApiCtx, piAddr, &sData); + if(iRet) + { + return iRet; + } + iRet = createScalarInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, sData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + short* psData = NULL; + sciErr = getMatrixOfInteger16(pvApiCtx, piAddr, &iRows, &iCols, &psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + case SCI_INT32 : + if(isScalar(pvApiCtx, piAddr)) + { + int iData = 0; + iRet = getScalarInteger32(pvApiCtx, piAddr, &iData); + if(iRet) + { + return iRet; + } + iRet = createScalarInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + int* piData = NULL; + sciErr = getMatrixOfInteger32(pvApiCtx, piAddr, &iRows, &iCols, &piData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; +#ifdef __SCILAB_INT64__ + case SCI_INT64 : +#endif + case SCI_UINT8 : + if(isScalar(pvApiCtx, piAddr)) + { + unsigned char ucData = 0; + iRet = getScalarUnsignedInteger8(pvApiCtx, piAddr, &ucData); + if(iRet) + { + return iRet; + } + iRet = createScalarUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, ucData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + unsigned char* pucData = NULL; + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddr, &iRows, &iCols, &pucData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pucData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + case SCI_UINT16 : + if(isScalar(pvApiCtx, piAddr)) + { + unsigned short usData = 0; + iRet = getScalarUnsignedInteger16(pvApiCtx, piAddr, &usData); + if(iRet) + { + return iRet; + } + iRet = createScalarUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, usData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + unsigned short* pusData = NULL; + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddr, &iRows, &iCols, &pusData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pusData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; + case SCI_UINT32 : + if(isScalar(pvApiCtx, piAddr)) + { + unsigned int uiData = 0; + iRet = getScalarUnsignedInteger32(pvApiCtx, piAddr, &uiData); + if(iRet) + { + return iRet; + } + iRet = createScalarUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, uiData); + if(iRet) + { + return iRet; + } + } + else + { + int iRows = 0; + int iCols = 0; + unsigned int* puiData = NULL; + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddr, &iRows, &iCols, &puiData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, puiData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + break; +#ifdef __SCILAB_INT64__ + case SCI_UINT64 : +#endif + default : + break; + } + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +i8_1 = int8(1); +i8_2 = int8([1,2,3;4,5,6]); +ui8_1 = uint8(1); +ui8_2 = uint8([1,2,3;4,5,6]); +i16_1 = int16(1); +i16_2 = int16([1,2,3;4,5,6]); +ui16_1 = uint16(1); +ui16_2 = uint16([1,2,3;4,5,6]); +i32_1 = int32(1); +i32_2 = int32([1,2,3;4,5,6]); +ui32_1 = uint32(1); +ui32_2 = uint32([1,2,3;4,5,6]); +if integerExample(i8_1) <> i8_1 then pause;end +if integerExample(i8_2) <> i8_2 then pause;end +if integerExample(ui8_1) <> ui8_1 then pause;end +if integerExample(ui8_2) <> ui8_2 then pause;end +if integerExample(i16_1) <> i16_1 then pause;end +if integerExample(i16_2) <> i16_2 then pause;end +if integerExample(ui16_1) <> ui16_1 then pause;end +if integerExample(ui16_2) <> ui16_2 then pause;end +if integerExample(i8_1) <> i16_1 then pause;end +if integerExample(i8_2) <> i16_2 then pause;end +if integerExample(ui8_1) <> ui16_1 then pause;end +if integerExample(ui8_2) <> ui16_2 then pause;end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/CHAPTER b/modules/api_scilab/help/ja_JP/list_management/CHAPTER new file mode 100755 index 000000000..4e72a7af1 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/CHAPTER @@ -0,0 +1 @@ +title = List manipulation diff --git a/modules/api_scilab/help/ja_JP/list_management/isListType.xml b/modules/api_scilab/help/ja_JP/list_management/isListType.xml new file mode 100755 index 000000000..8ed85f891 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/isListType.xml @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isListType" xml:lang="ja"> + <refnamediv> + <refname>isListType, isTListType, isMListType</refname> + <refpurpose> + list, mlist, tlist 変数かどうかを調べる. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isListType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedListType(void* _pvCtx, const char* _pstName)</synopsis> + <synopsis>int isTListType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedTListType(void* _pvCtx, const char* _pstName)</synopsis> + <synopsis>int isMListType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedMListType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数がlist型の場合に1, それ以外は 0</para> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +fileData = [ +'#include <api_scilab.h>' +'#include <Scierror.h>' +'#include <MALLOC.h>' +'/* ========================================================================== */' +'int sci_getListType(char *fname)' +'{' +' int* piAddr = NULL;' +' char pstRet[64];' +'' +' getVarAddressFromPosition(pvApiCtx, 1, &piAddr);' +'' +' if(isStringType(pvApiCtx, piAddr))' +' {//named check' +' char* pstVar = NULL;' +' getAllocatedSingleString(pvApiCtx, piAddr, &pstVar);' +'' +' if(isNamedListType(pvApiCtx, pstVar))' +' {' +' sprintf(pstRet, ""%s"", ""isNamedList"");' +' }' +' else if(isNamedTListType(pvApiCtx, pstVar))' +' {' +' sprintf(pstRet, ""%s"", ""isNamedTList"");' +' }' +' else if(isNamedMListType(pvApiCtx, pstVar))' +' {' +' sprintf(pstRet, ""%s"", ""isNamedMList"");' +' }' +' else' +' {' +' sprintf(pstRet, ""%s"", ""unmanaged named type"");' +' }' +' FREE(pstVar);' +' }' +' else' +' {' +' if(isListType(pvApiCtx, piAddr))' +' {' +' sprintf(pstRet, ""%s"", ""isList"");' +' }' +' else if(isTListType(pvApiCtx, piAddr))' +' {' +' sprintf(pstRet, ""%s"", ""isTList"");' +' }' +' else if(isMListType(pvApiCtx, piAddr))' +' {' +' sprintf(pstRet, ""%s"", ""isMList"");' +' }' +' else' +' {' +' sprintf(pstRet, ""%s"", ""unmanaged type"");' +' }' +' }' +' createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstRet);' +' AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;' +' return 0;' +'}' +] +currentPath = pwd(); +mkdir(TMPDIR + "/getListType"); +cd(TMPDIR + "/getListType"); +mputl(fileData, "getListType.c"); +ilib_verbose(0); +files = ['getListType.c']; +ilib_build('libgetListType', ['getListType', 'sci_getListType'], files, []); +exec loader.sce; +a = list(); +b = tlist("test"); +c = mlist("test"); +d = 1; +assert_checkequal(getListType(a), "isList"); +assert_checkequal(getListType(b), "isTList"); +assert_checkequal(getListType(c), "isMList"); +assert_checkequal(getListType(d), "unmanaged type"); +assert_checkequal(getListType("a"), "isNamedList"); +assert_checkequal(getListType("b"), "isNamedTList"); +assert_checkequal(getListType("c"), "isNamedMList"); +assert_checkequal(getListType("d"), "unmanaged named type"); +//unload lib +[bOK, ilib] = c_link('libgetListType'); +if bOK then + ulink(ilib); +end +cd(currentPath); +]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_boolean_reading_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_boolean_reading_api.xml new file mode 100755 index 000000000..5a1817cfc --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_boolean_reading_api.xml @@ -0,0 +1,660 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_boolean_reading_API" xml:lang="ja"> + <refnamediv> + <refname>論理値の読み込み (Scilabゲートウェイ)</refname> + <refpurpose> + 論理値行列をリストに読み込む手順. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfBooleanInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int** _piBool)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規アイテムの親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規アイテムの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + 返されるデータ配列のアドレス (大きさ : _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号を保存するエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリストに論理値行列を読み込む手順を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + if(iPrec > 10) + { + sciprint("Unsigned "); + } + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_boolean_writing_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_boolean_writing_api.xml new file mode 100755 index 000000000..04c48b5c7 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_boolean_writing_api.xml @@ -0,0 +1,316 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_boolean_writing_API" xml:lang="ja"> + <refnamediv> + <refname>論理値を書き込む (Scilabゲートウェイ)</refname> + <refpurpose> + リスト上に論理値行列を追加する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + 既存のデータから作成. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piBool)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規アイテムの親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リスト中の新規アイテムの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + データ配列のアドレス (大きさ: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号を保存するエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込む. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr allocMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規アイテムの親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リスト中の新規アイテムの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + データ配列のアドレスを返す (大きさ: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号を保存するエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中に論理値行列を追加する手順を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_bsparse_reading_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_bsparse_reading_api.xml new file mode 100755 index 000000000..dd69b5b71 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_bsparse_reading_api.xml @@ -0,0 +1,676 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_bsparse_reading_API" xml:lang="ja"> + <refnamediv> + <refname>疎論理値の読み込み (Scilabゲートウェイ)</refname> + <refpurpose> + 疎論理値をリストに読み込む手順. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getBooleanSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readBooleanSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規アイテムの親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規アイテムの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + 非ゼロ値の数を返す. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 各行のアイテムの数を返す (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 書くアイテムの列の位置を返す (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号を保存するエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリストに疎論理値を読み込む手順を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + if(iPrec > 10) + { + sciprint("Unsigned "); + } + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_bsparse_writing_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_bsparse_writing_api.xml new file mode 100755 index 000000000..88458ac1e --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_bsparse_writing_api.xml @@ -0,0 +1,252 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_bsparse_writing_API" xml:lang="ja"> + <refnamediv> + <refname>疎論理値を書き込む (Scilabゲートウェイ)</refname> + <refpurpose> + 疎論理値をリストに追加する手順. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createBooleanSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createBooleanSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 保存する変数のScilabメモリにおける位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規アイテムの親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規アイテムの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + 疎行列における非ゼロアイテムの数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 各行におけるアイテムの数 (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 各アイテムの列の位置 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号を保存するエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリストにdouble疎行列を追加する手順を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_createlist_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_createlist_api.xml new file mode 100755 index 000000000..d7f34170b --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_createlist_api.xml @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_createlist_API" xml:lang="ja"> + <refnamediv> + <refname>リストを作成する (Scilab ゲートウェイ)</refname> + <refpurpose> + Scilabメモリにリストを作成する手順. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress)</synopsis> + <synopsis>SciErr createMList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress)</synopsis> + <synopsis>SciErr createTList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createNamedList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress)</synopsis> + <synopsis>SciErr createNamedTList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress)</synopsis> + <synopsis>SciErr createNamedMList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 保存する変数のScilabメモリにおける位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + リスト上のアイテム数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + リストのアドレスを返す. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号を保存するエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中のリストのアドレスを取得する手順を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_double_reading_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_double_reading_api.xml new file mode 100755 index 000000000..34e65b2ae --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_double_reading_api.xml @@ -0,0 +1,670 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_double_reading_API" xml:lang="ja"> + <refnamediv> + <refname>doubleの読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中のdoubleの行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double* _pdblReal)</synopsis> + <synopsis>SciErr readComplexMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返されるデータ配列(大きさ: _iRows * _iCols)の実部のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 返されるデータ配列(大きさ: _iRows * _iCols)の虚部のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中のdoubleの行列を読み込む方法を記述します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + if(iPrec > 10) + { + sciprint("Unsigned "); + } + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_double_writing_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_double_writing_api.xml new file mode 100755 index 000000000..0ed44cfaa --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_double_writing_api.xml @@ -0,0 +1,336 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_double_writing_API" xml:lang="ja"> + <refnamediv> + <refname>double書き込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中にdoubleの行列を追加する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + 既存のデータから作成. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を代入したいScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + データ配列(大きさ: _iCols * _iRows)の実部のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + データ配列(大きさ: _iCols * _iRows)の虚部のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込む. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr allocMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, double** _pdblReal)</synopsis> + <synopsis>SciErr allocComplexMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を代入したいScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返されるデータ配列の実部のアドレス (大きさ: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 返されるデータ配列の虚部のアドレス (大きさ: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中にdoubleの行列を追加する方法を記述します.</para> + <para>Scilabのメモリに書き込む際には2種類の関数を使用できます.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_getlistitemaddress_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_getlistitemaddress_api.xml new file mode 100755 index 000000000..91ec0fc10 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_getlistitemaddress_api.xml @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_getlistitemaddress_API" xml:lang="ja"> + <refnamediv> + <refname>子要素を取得 (Scilab ゲートウェイ)</refname> + <refpurpose> + 子要素のアドレスを取得する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>SciErr getListItemAddress(void* _pvCtx, int* _piAddress, int _iItemNum, int** _piItemAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + リストのアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemNum</term> + <listitem> + <para> + 要素番号. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piItemAddress</term> + <listitem> + <para> + 要素が返されるアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは子要素のアドレスを取得する方法を記述します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_list_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_list_api.tst--> + <!--Lib_name: common_list--> + <!--Func_list: common_list--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int get_list_info(int* _piAddress); +void insert_indent(void); +static int iLocalTab = 0; +int common_list(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_list_info(piAddr); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_list_info(int* _piAddress) +{ + SciErr sciErr; + int i = 0; + int iRet = 0; + int iItem = 0; + //get list item number, failed if variable is not a kind of list + sciErr = getListItemNumber(pvApiCtx, _piAddress, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + sciprint("This variable is not a list"); + return 0; + } + sciprint("List (%d items) -> address : 0x%08X) : \n", iItem, _piAddress); + for(i = 0 ; i < iItem ; i++) + { + int iType = 0; + int* piAddrChild = NULL; + sciErr = getListItemAddress(pvApiCtx, _piAddress, i + 1, &piAddrChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarType(pvApiCtx, piAddrChild, &iType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(iType == sci_list || iType == sci_tlist || iType == sci_mlist) + { + insert_indent(); + sciprint("Child %d -> ", i + 1); + iLocalTab++; + iRet = get_list_info(piAddrChild); + iLocalTab--; + if(iRet) + { + return 1; + } + } + else + { + insert_indent(); + sciprint("Child %d -> address : 0x%08X\n", i + 1, piAddrChild); + } + } + return 0; +} +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iLocalTab ; i++) + { + sciprint("\t"); + } +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l5 = list(l1,l2,l3); +l4 = list(l5, list(l5,l5)); +l6 = uint16([1000,2000,3000]); +l = list(l1,l2,l3,l6,l4,l5); +common_list(l) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_getlistitemnumber_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_getlistitemnumber_api.xml new file mode 100755 index 000000000..57f8017d8 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_getlistitemnumber_api.xml @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_getlistitemnumber_API" xml:lang="ja"> + <refnamediv> + <refname>要素数 (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト(list, mlist, tlist)中の要素数を取得する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>SciErr getListItemNumber(void* _pvCtx, int* _piAddress, int* _piNbItem)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + リストのアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + 返される要素数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト(list, mlist, tlist)中の要素数を取得する方法を説明します. + </para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_list_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_list_api.tst--> + <!--Lib_name: common_list--> + <!--Func_list: common_list--> + <title>ゲートウェイソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int get_list_info(int* _piAddress); +void insert_indent(void); +static int iLocalTab = 0; +int common_list(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_list_info(piAddr); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_list_info(int* _piAddress) +{ + SciErr sciErr; + int i = 0; + int iRet = 0; + int iItem = 0; + //get list item number, failed if variable is not a kind of list + sciErr = getListItemNumber(pvApiCtx, _piAddress, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + sciprint("This variable is not a list"); + return 0; + } + sciprint("List (%d items) -> address : 0x%08X) : \n", iItem, _piAddress); + for(i = 0 ; i < iItem ; i++) + { + int iType = 0; + int* piAddrChild = NULL; + sciErr = getListItemAddress(pvApiCtx, _piAddress, i + 1, &piAddrChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarType(pvApiCtx, piAddrChild, &iType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(iType == sci_list || iType == sci_tlist || iType == sci_mlist) + { + insert_indent(); + sciprint("Child %d -> ", i + 1); + iLocalTab++; + iRet = get_list_info(piAddrChild); + iLocalTab--; + if(iRet) + { + return 1; + } + } + else + { + insert_indent(); + sciprint("Child %d -> address : 0x%08X\n", i + 1, piAddrChild); + } + } + return 0; +} +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iLocalTab ; i++) + { + sciprint("\t"); + } +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l5 = list(l1,l2,l3); +l4 = list(l5, list(l5,l5)); +l6 = uint16([1000,2000,3000]); +l = list(l1,l2,l3,l6,l4,l5); +common_list(l) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_integer_reading_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_integer_reading_api.xml new file mode 100755 index 000000000..be6ebead7 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_integer_reading_api.xml @@ -0,0 +1,674 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_integer_reading_API" xml:lang="ja"> + <refnamediv> + <refname>整数の読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中の整数行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr getMatrixOfInteger8InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, char** _pcData)</synopsis> + <synopsis>SciErr getMatrixOfInteger16InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, short** _psData)</synopsis> + <synopsis>SciErr getMatrixOfInteger32InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int** _piData)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr getMatrixOfUnsignedInteger8InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned char** _pucData)</synopsis> + <synopsis>SciErr getMatrixOfUnsignedInteger16InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned short** _pusData)</synopsis> + <synopsis>SciErr getMatrixOfUnsignedInteger32InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned int** _puiData)</synopsis> + <para>名前指定変数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr readMatrixOfIntger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, char* _pcData)</synopsis> + <synopsis>SciErr readMatrixOfIntger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, short* _psData)</synopsis> + <synopsis>SciErr readMatrixOfIntger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piData)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr readMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned char* _pucData)</synopsis> + <synopsis>SciErr readMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned short* _pusData)</synopsis> + <synopsis>SciErr readMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned int* _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData, _pucData, _psData, _pusData, _piData, _puiData</term> + <listitem> + <para> + 返されるデータ配列 (大きさ: _iRows * _iCols)のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中の整数行列を読み込む方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>ゲートウェイソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + if(iPrec > 10) + { + sciprint("Unsigned "); + } + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + if(sciErr.iErr) +< { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_integer_writing_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_integer_writing_api.xml new file mode 100755 index 000000000..06581a27b --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_integer_writing_api.xml @@ -0,0 +1,338 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_integer_writing_API" xml:lang="ja"> + <refnamediv> + <refname>整数を書き込む (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中に整数の行列を追加する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + 既存のデータから作成. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr createMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData)</synopsis> + <synopsis>SciErr createMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData)</synopsis> + <synopsis>SciErr createMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr createMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData)</synopsis> + <para>名前指定変数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr createMatrixOfInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData)</synopsis> + <synopsis>SciErr createMatrixOfInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData)</synopsis> + <synopsis>SciErr createMatrixOfInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr createMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 代入する変数のScilabメモリ上の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term> + <listitem> + <para> + データ配列(大きさ: _iCols * _iRows)のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込む. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr allocMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, char** _pcData)</synopsis> + <synopsis>SciErr allocMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, short** _psData)</synopsis> + <synopsis>SciErr allocMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piData)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr allocMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned char** _pucData)</synopsis> + <synopsis>SciErr allocMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned short** _pusData)</synopsis> + <synopsis>SciErr allocMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned int** _puiData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 代入する変数のScilabメモリ上の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term> + <listitem> + <para> + データ配列(大きさ: _iCols * _iRows)のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中に整数の行列を追加する方法を説明します.</para> + <para>Scilabメモリに書き込む際には2種類の関数を使用できます.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_pointer_reading_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_pointer_reading_api.xml new file mode 100755 index 000000000..386e81dab --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_pointer_reading_api.xml @@ -0,0 +1,652 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_pointer_reading_API" xml:lang="ja"> + <refnamediv> + <refname>ポインタの読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中のポインタを読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getPointerInList(void* _pvCtx, int* _piParent, int _iItemPos, void** _pvPtr)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readPointerInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, void** _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 代入する変数のScilabメモリ上の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + 返されるデータのポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中のポインタを読み込む方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + if(iPrec > 10) + { + sciprint("Unsigned "); + } + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_pointer_writing_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_pointer_writing_api.xml new file mode 100755 index 000000000..24f060eae --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_pointer_writing_api.xml @@ -0,0 +1,220 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_pointer_writing_API" xml:lang="ja"> + <refnamediv> + <refname>ポインタ書き込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中にポインタを追加する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createPointerInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, void* _pvPtr)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createPointerInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, void* _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 代入する変数のScilabメモリ上の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + ポインタのアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中にポインタを追加する方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_poly_reading_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_poly_reading_api.xml new file mode 100755 index 000000000..8f454938d --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_poly_reading_api.xml @@ -0,0 +1,678 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_poly_reading_API" xml:lang="ja"> + <refnamediv> + <refname>多項式の読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中に多項式の行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>SciErr readComplexMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + 返される各多項式の係数の数. (メモリ確保が必要) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 係数の実部を保持する double* 配列のアドレス. (大きさ: _iCols * _iRows, メモリ確保が必要) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 係数の虚部を保持する double* 配列のアドレス. (大きさ: _iCols * _iRows, メモリ確保が必要) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中に多項式の行列を読み込む方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + if(iPrec > 10) + { + sciprint("Unsigned "); + } + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_poly_writing_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_poly_writing_api.xml new file mode 100755 index 000000000..62718435d --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_poly_writing_api.xml @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_poly_writing_API" xml:lang="ja"> + <refnamediv> + <refname>多項式の書き込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中に多項式の行列を追加する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 代入する変数のScilabメモリ上の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstVarName</term> + <listitem> + <para> + 多項式の変数名 (Scilab5: 最大4文字). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + 各多項式の係数の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 係数の実部を保持する double* 配列のアドレス. (大きさ: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 係数の虚部を保持する double* 配列のアドレス. (大きさ: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中に多項式を追加する方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_sparse_reading_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_sparse_reading_api.xml new file mode 100755 index 000000000..ba87b55cb --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_sparse_reading_api.xml @@ -0,0 +1,694 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_sparse_reading_API" xml:lang="ja"> + <refnamediv> + <refname>疎行列の読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中の疎行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal)</synopsis> + <synopsis>SciErr readComplexSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + 返される非ゼロ値の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 返される各行の要素数 (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 返される各要素の列の位置 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返されるデータ実部の配列 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 返されるデータ虚部の配列 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中に疎行列を読み込む方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + if(iPrec > 10) + { + sciprint("Unsigned "); + } + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_sparse_writing_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_sparse_writing_api.xml new file mode 100755 index 000000000..48e5cb648 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_sparse_writing_api.xml @@ -0,0 +1,273 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_sparse_writing_API" xml:lang="ja"> + <refnamediv> + <refname>疎行列の書き込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中に疎行列を書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + 既存のデータから作成. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を代入するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + 疎行列における非ゼロ要素の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 各行における要素数 (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 各要素に関する列方向の位置 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 実部データ配列のアドレス (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 虚部データ配列のアドレス (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中に疎行列を追加する方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_string_reading_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_string_reading_api.xml new file mode 100755 index 000000000..6cd886b78 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_string_reading_api.xml @@ -0,0 +1,668 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_string_reading_API" xml:lang="ja"> + <refnamediv> + <refname>文字列の読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中に文字列の行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfStringInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readMatrixOfStringInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piLength</term> + <listitem> + <para> + 文字列の長さの配列のアドレス (メモリ確保が必要, 大きさ: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + char *の配列のアドレス (メモリ確保が必要, 大きさ: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中の文字列の行列を読み込む方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_read_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_read_api.tst--> + <!--Lib_name: common_read--> + <!--Func_list: common_read--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for(i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int common_read(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + get_info(1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + sciErr = getVarType(pvApiCtx, _piAddr, &iType); + switch(iType) + { + case sci_matrix : + iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} +int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("(%d)\n", iItem); + for(i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + iTab++; + iRet = get_info(_iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} +int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(_iItemPos == 0) + {//not in list + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + if(_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(_iItemPos == 0) + {//Not in list + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if(isVarComplex(pvApiCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + switch(iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + if(iPrec > 10) + { + sciprint("Unsigned "); + } + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + if(_iItemPos == 0) + {//Not in list + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + if(_iItemPos == 0) + { + sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/list_management/list_string_writing_api.xml b/modules/api_scilab/help/ja_JP/list_management/list_string_writing_api.xml new file mode 100755 index 000000000..4716a2769 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/list_management/list_string_writing_api.xml @@ -0,0 +1,236 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="list_string_writing_API" xml:lang="ja"> + <refnamediv> + <refname>文字列の書き込み (Scilab ゲートウェイ)</refname> + <refpurpose> + リスト中に文字列の行列を追加する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数のプロファイル:</para> + <synopsis>SciErr createMatrixOfStringInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings)</synopsis> + <para>名前指定変数のプロファイル:</para> + <synopsis>SciErr createMatrixOfStringInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を代入するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piParent</term> + <listitem> + <para> + 新規要素の親のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iItemPos</term> + <listitem> + <para> + リストにおける新規要素の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + char* の配列のアドレス(大きさ: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリスト中に文字列の行列を追加する方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst--> + <!--Lib_name: list_createlist--> + <!--Func_list: list_createlist--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int list_createlist(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1,3,5,2,4,6}; + double pdblData2[] = {6,4,2,5,3,1}; + char *pstData[] = {"may","be","the","with","puffin","you"}; + short psData[] = {1,4,2,5,3,6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = {-2,-1}; + double pdblPoly3[] = {1,2,3}; + double pdblPoly4[] = {-4,-3,-2,-1}; + double pdblPoly5[] = {1,2,3,4,5}; + double pdblPoly6[] = {-6,-5,-4,-3,-2,-1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1,3,5,2,4,6}; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int piBool[] = {1,0,1,0,1,0,1,0,1}; + double* pdblDataPtr = NULL; + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then error("failed"), end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then error("failed"), end + if size(l(i)) <> dim_ref(i) then error("failed"), end +end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/AssignOutputVariable.xml b/modules/api_scilab/help/ja_JP/low_level_functions/AssignOutputVariable.xml new file mode 100755 index 000000000..8c177f604 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/AssignOutputVariable.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="AssignOutputVariable" xml:lang="ja"> + <refnamediv> + <refname>AssignOutputVariable</refname> + <refpurpose> + Cゲートウェイ内で作成され, Scilab に出力変数として返されるパラメータを指定するCゲートウェイ関数. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼出し手順</title> + <synopsis>AssignOutputVariable(pvApiCtx, RankPos) = RankVar;</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>RankPos</term> + <listitem> + <para>出力引数のランクを与える整数</para> + </listitem> + </varlistentry> + <varlistentry> + <term>RankVar</term> + <listitem> + <para> + Cゲートウェイ内で生成され, Scilab出力引数として返されるパラメータのランク + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + Cゲートウェイ内で作成され, Scilab に出力変数として返されるパラメータを指定するCゲートウェイ関数. + </para> + </refsection> + <refsection> + <title>例</title> + <para>この例はdoubleの行列を入力として取り, 以下を返します:</para> + <itemizedlist> + <listitem> + <para>ライン数 (最初の出力引数)</para> + </listitem> + <listitem> + <para>行数 (2番目の出力引数)</para> + </listitem> + </itemizedlist> + <para> + 整数を処理するScilab中間パラメータを作成しますが, + 使用したり,出力引数として返したりしません. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +int sci_mysizedouble(char * fname, unsigned long fname_len) +{ + SciErr sciErr; + int m_in_row; + int n_in_col; + int* piAddr = NULL; + double* pdblData = NULL; + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + /* 次元を取得 */ + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &m_in_row, &n_in_col, &pdblData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &m_in_row); // m_in_rowパラメータは引数として送信される行列のライン数を処理します + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 1, &m_in_row); // 同じ値を保存しますが,使用したり,Scilabに返したりしません. + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 3, 1, 1, &n_in_col); // n_in_colパラメータは引数として送信される行列の列数を処理します. + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; // パラメータ "nbInputArgument(pvApiCtx) + 1" を出力引数として設定 + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 3; // パラメータ "nbInputArgument(pvApiCtx) + 3" を出力引数として設定 + ReturnArguments(pvApiCtx); + return 0; +} + ]]> + </programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/CHAPTER b/modules/api_scilab/help/ja_JP/low_level_functions/CHAPTER new file mode 100755 index 000000000..aaf2bd287 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/CHAPTER @@ -0,0 +1 @@ +title = Low level functions diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/CallOverloadFunction.xml b/modules/api_scilab/help/ja_JP/low_level_functions/CallOverloadFunction.xml new file mode 100755 index 000000000..e2de8776d --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/CallOverloadFunction.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CallOverloadFunction" xml:lang="ja"> + <refnamediv> + <refname>CallOverloadFunction</refname> + <refpurpose> + オーバーロードされた関数またはマクロをコールする際に使用するCゲートウェイ関数 + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>CallOverloadFunction(_iVar)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>iVar</term> + <listitem> + <para> + オーバーロードされた関数/マクロの名前を作成する際に使用される + 入力引数を指定します + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + オーバーロードされた関数またはマクロをコールすする際に使用するCゲートウェイ関数 + </para> + </refsection> + <refsection> + <title>例</title> + <para>この例は以下の大きさを返します:</para> + <itemizedlist> + <listitem> + <para>入力引数の大きさを返します</para> + </listitem> + <listitem> + <para>入力引数が文字列の場合, 長さを返します</para> + </listitem> + </itemizedlist> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.tst--> + <!--Lib_name: calloverloadfunction--> + <!--Func_list: callOverload--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +int callOverload(char *fname,unsigned long fname_len) +{ + CheckRhs(1, 1); + CheckLhs(0, 1); + CallOverloadFunction(1); + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +function x = %c_getSize(a) + x = lenght(a); +endfunction +function x = %s_getSize(a) + x = size(a); +endfunction +a = [1,2,3,4]; +a_ref = [2,2]; +assert_checkequal(getSize(a) == a_ref); +b = ["May","the","puffin";"be","with","you"]; +b_ref = [3,3,6;2,4,3]; +assert_checkequal(getSize(b) == b_ref); + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/CheckInputArgument.xml b/modules/api_scilab/help/ja_JP/low_level_functions/CheckInputArgument.xml new file mode 100755 index 000000000..152cf99eb --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/CheckInputArgument.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CheckInputArgument" xml:lang="ja"> + <refnamediv> + <refname>CheckInputArgument</refname> + <refpurpose> + Scilab関数コール時の入力引数の数を確認するC関数. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>CheckInputArgument(void* pvCtx, int iMin, int iMax)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>pvApiCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>iMin</term> + <listitem> + <para> + Scilab関数コール時に必要な入力引数の最小値 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>iMax</term> + <listitem> + <para> + Scilab関数コール時に必要な入力引数の最大値 + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + Scilab関数コール時の入力引数を確認するC関数. + この関数を使用するには api_scilab.h をインクルードする必要があります. + </para> + <para> + 引数の数が_iMin および _iMax の間でない場合, + Cインターフェイスを終了(<literal>return 0;</literal>)し, + Scilabコンソールにエラーが返されます. + </para> + <para> + <literal>CheckInputArgument</literal> は <literal> + return + 0; + </literal> + をゲートウェイ関数内で行うため, + メモリリークを避けるために + この関数をメモリ確保処理の前にコールすることが必要です. + </para> + <para> + この関数は廃止予定の <literal>CheckRhs</literal> 関数 + を置き換えるものです. + </para> + </refsection> + <refsection> + <title>例</title> + <para> + この例では, Cゲートウェイ関数は + 入力引数の数が 2と3の間であることを確認します. + </para> + <programlisting role="example"><![CDATA[ +#include <api_scilab.h> +int sci_mycheckrhs(char * fname) +{ + CheckInputArgument(pvApiCtx, 2, 3); + // 入力引数を読み込む + // 何らかの処理を行う + // 出力引数を返す + return 0; +} + ]]></programlisting> + <para>ここで, このインターフェイスをテストするために関数を実行します:</para> + <programlisting role="example"><![CDATA[ +mycheckrhs(A,B); // OK, 入力引数2個 +mycheckrhs(A,B,C); // OK, 入力引数3個 +mycheckrhs(A); // エラー, 入力引数1個 +mycheckrhs(A,B,C,D); // エラー, 入力引数4個]]></programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="CheckOutputArgument">CheckOutputArgument</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/CheckOutputArgument.xml b/modules/api_scilab/help/ja_JP/low_level_functions/CheckOutputArgument.xml new file mode 100755 index 000000000..460154743 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/CheckOutputArgument.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CheckOutputArgument" xml:lang="ja"> + <refnamediv> + <refname>CheckOutputArgument</refname> + <refpurpose> + Scilab関数コール時の出力引数の数を確認するC関数. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>CheckOutputArgument(void* _pvCtx, int iMin, int iMax)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>pvApiCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>iMin</term> + <listitem> + <para> + Scilab関数コール時に必要な出力引数の最小値 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>iMax</term> + <listitem> + <para> + Scilab関数コール時に必要な出力引数の最大値 + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + Scilab関数コール時の出力引数を確認するC関数. + この関数を使用するには api_scilab.h をインクルードする必要があります. + </para> + <para> + 引数の数が_iMin および _iMax の間でない場合, + Cインターフェイスを終了(<literal>return 0;</literal>)し, + Scilabコンソールにエラーが返されます. + </para> + <para> + <literal>CheckOutputArgument</literal> は <literal> + return + 0; + </literal> + をゲートウェイ関数内で行うため, + メモリリークを避けるために + この関数をメモリ確保処理の前にコールすることが必要です. + </para> + <para> + この関数は廃止予定の <literal>CheckLhs</literal> 関数 + を置き換えるものです. + </para> + </refsection> + <refsection> + <title>例</title> + <para> + この例では, Cゲートウェイ関数は + 出力引数の数が 2と3の間であることを確認します. + </para> + <programlisting role="example"><![CDATA[ +#include <api_scilab.h> +int sci_mychecklhs(char * fname) +{ + CheckOutputArgument(pvApiCtx, 2, 3); + // 入力引数を読み込む + // 何らかの処理を行う + // 出力引数を返す + return 0; +} + ]]></programlisting> + <para>ここで, このインターフェイスをテストするために関数を実行します:</para> + <programlisting role="example"><![CDATA[ +[A,B] = mychecklhs(); // OK, 出力引数2個 +[A,B,C] = mychecklhs(); // OK, 出力引数3個 +[A] = mychecklhs(); // エラー, 出力引数1個 +[A,B,C,D] = mychecklhs(); // エラー, 出力引数4個]]></programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="CheckInputArgument">CheckInputArgument</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/ReturnArguments.xml b/modules/api_scilab/help/ja_JP/low_level_functions/ReturnArguments.xml new file mode 100755 index 000000000..602d9ce95 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/ReturnArguments.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="ReturnArguments" xml:lang="ja"> + <refnamediv> + <refname>ReturnArguments</refname> + <refpurpose> + 種々の変数を返すCゲートウェイ関数. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>ReturnArguments(pvApiCtx);</synopsis> + </refsynopsisdiv> + <refsection> + <title>説明</title> + <para> + ReturnArguments(pvApiCtx) は, + AssignOutputVariable(pvApiCtx, X)により宣言された + 種々の変数を返します. + </para> + </refsection> + <refsection> + <title>例</title> + <para>この例はdoubleの行列を入力とし,以下を返します:</para> + <itemizedlist> + <listitem> + <para>行数 (最初の出力引数)</para> + </listitem> + <listitem> + <para>列数 (2番目の出力引数)</para> + </listitem> + </itemizedlist> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +int sci_mysizedouble(char * fname, unsigned long fname_len) +{ + SciErr sciErr; + int m_in_row; + int n_in_col; + int* piAddr = NULL; + double* pdblData = NULL; + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + /* 次元を取得 */ + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &m_in_row, &n_in_col, &pdblData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &m_in_row); // m_in_rowパラメータは引数として渡された行列のライン数を保持します + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 1, &m_in_row); // 同じ値を保持しますが, 使用されず,Scilabに値も返されません + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 3, 1, 1, &n_in_col); // n_in_colパラメータは引数として渡された行列の列数を保持します + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; // パラメータ "nbInputArgument(pvApiCtx) + 1" を出力引数として設定します + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 3; // パラメータ "nbInputArgument(pvApiCtx) + 3" を出力引数として設定します + ReturnArguments(pvApiCtx); + return 0; +} + ]]> + </programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/boolean_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/boolean_reading_api.xml new file mode 100755 index 000000000..0f13c2957 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/boolean_reading_api.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="boolean_reading_API" xml:lang="ja"> + <refnamediv> + <refname>論理値の読み込み (Scilabゲートウェイ)</refname> + <refpurpose> + 論理値の行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfBoolean(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piBool)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 変数の行数を返す. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 変数の列数を返す. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + データ配列のアドレスを返す (大きさ: _iRows * _iCols). + "名前指定"関数の場合, _piBool は関数をコールする前に + メモリを確保しておく必要があります. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは論理値の行列を読み込む方法を説明します. + </para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_boolean_api.tst--> + <!--Lib_name: read_write_boolean--> + <!--Func_list: read_write_boolean--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_write_boolean(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + // 最初の変数の情報 : doubleの実数行列 + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int* piBool = NULL; + // 入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1,1); + CheckOutputArgument(pvApiCtx, 1,1); + // 最初の引数の変数アドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // Scilabメモリから大きさとデータを取得 + sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // データ処理を行う + for(i = 0 ; i < iRows * iCols ; i++) + { + piBool[i] = piBool[i] == 0 ? 1 : 0; + } + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = [%t, %f, %t ; %f, %t, %f ; %t, %f, %t]; +a_ref = [%f, %t, %f ; %t, %f, %t ; %f, %t, %f]; +b = read_write_boolean(a); +if or(b <> a_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/boolean_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/boolean_writing_api.xml new file mode 100755 index 000000000..a84c307f2 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/boolean_writing_api.xml @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="boolean_writing_API" xml:lang="ja"> + <refnamediv> + <refname>論理値の書き込み (Scilabゲートウェイ)</refname> + <refpurpose> + 論理値の行列を書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piBool)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を配置するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + 返されるデータ配列のアドレス (大きさ: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で, + エラーメッセージ履歴と最初のエラー番号を + 格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込む. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr allocMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piBool)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を書き込むScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piBool</term> + <listitem> + <para> + 返される実数データ配列のアドレス (大きさ: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で, + エラーメッセージ履歴と最初のエラー番号を + 格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは論理値の行列を書き込む方法を説明します</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_boolean_api.tst--> + <!--Lib_name: read_write_boolean--> + <!--Func_list: read_write_boolean--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_write_boolean(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + // 最初の変数の情報 : doubleの実数行列 + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int* piBool = NULL; + // 入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1,1); + CheckOutputArgument(pvApiCtx, 1,1); + // 最初の入力引数の変数アドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // Scilabメモリから大きさとデータを取得 + sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // データ処理を行う + for(i = 0 ; i < iRows * iCols ; i++) + { + piBool[i] = piBool[i] == 0 ? 1 : 0; + } + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = [%t, %f, %t ; %f, %t, %f ; %t, %f, %t]; +a_ref = [%f, %t, %f ; %t, %f, %t ; %f, %t, %f]; +b = read_write_boolean(a); +if or(b <> a_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/bsparse_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/bsparse_reading_api.xml new file mode 100755 index 000000000..833de66a9 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/bsparse_reading_api.xml @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="bsparse_reading_API" xml:lang="ja"> + <refnamediv> + <refname>論理値疎行列の読み込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイで論理値の疎行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 変数の行の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 変数の列の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + 返される非ゼロ値の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 返される各行の要素の数 (大きさ: _iRows). + "名前指定" 関数の場合, 関数コールの前に _piNbItemRow のメモリを確保する必要があります. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 返される各要素の列の位置 (大きさ: _iNbItem). + "名前指定"関数の場合, 関数コール前に _piColPos のメモリを確保する必要があります. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を保持します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは論理値の疎行列を読み込む方法を説明します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst--> + <!--Lib_name: read_write_bsparse--> + <!--Func_list: read_write_bsparse--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_write_bsparse(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i = 0; + int j = 0; + int k = 0; + // 最初の変数の情報 : doubleの実数行列 + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + int iCol = 0; + int iNewCol = 0; + int iNewItem = 0; + int* piNewRow = NULL; + int* piNewCol = NULL; + // 入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + // 最初の入力引数の変数アドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // Scilabメモリから大きさとデータを取得 + sciErr = getBooleanSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // データで何か処理を行う + // %T -> %F および %F -> %T の変換を行う + iNewItem = (iRows * iCols) - iNbItem; + piNewRow = (int*)MALLOC(sizeof(int) * iRows); + piNewCol = (int*)MALLOC(sizeof(int) * iNewItem); + for(i = 0 ; i < iRows ; i++) + { + piNewRow[i] = iCols - piNbItemRow[i]; + for(j = 0 ; j < iCols ; j++) + { + int iFind = 0; + for(k = 0 ; k < piNbItemRow[i] ; k++) + { + if(piColPos[iCol + k] == (j + 1)) + { + iFind = 1; + break; + } + } + if(iFind == 0) + { + piNewCol[iNewCol++] = (j + 1); + } + } + iCol += piNbItemRow[i]; + } + sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNewItem, piNewRow, piNewCol); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = sparse([%t, %f, %t ; %f, %t, %f ; %t, %f, %t]); +a_ref = sparse([%f, %t, %f ; %t, %f, %t ; %f, %t, %f]); +b = read_write_bsparse(a); +if or(b <> a_ref) then error("failed");end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/bsparse_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/bsparse_writing_api.xml new file mode 100755 index 000000000..265fff92a --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/bsparse_writing_api.xml @@ -0,0 +1,274 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="bsparse_writing_API" xml:lang="ja"> + <refnamediv> + <refname>論理値の疎行列の書き込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイで論理値の疎行列を追加する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新しい変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新しい変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + 疎行列における非ゼロ要素の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 各行の要素数 (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 各要素の列方向位置 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を保持します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込みます. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr allocBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + 疎行列の非ゼロ要素の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 各行の要素数 (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 各要素の列方向位置 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を保持します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはリストに論理値疎行列を追加する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst--> + <!--Lib_name: read_write_bsparse--> + <!--Func_list: read_write_bsparse--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_write_bsparse(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i = 0; + int j = 0; + int k = 0; + // 最初の変数の情報 : doubleの実数行列 + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + int iCol = 0; + int iNewCol = 0; + int iNewItem = 0; + int* piNewRow = NULL; + int* piNewCol = NULL; + // 入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + // 最初の入力引数の変数アドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // Scilabメモリから大きさとデータを取得 + sciErr = getBooleanSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // データで何か処理を行う + // %T -> %F および %F -> %T の変換を行う + iNewItem = (iRows * iCols) - iNbItem; + piNewRow = (int*)MALLOC(sizeof(int) * iRows); + piNewCol = (int*)MALLOC(sizeof(int) * iNewItem); + for(i = 0 ; i < iRows ; i++) + { + piNewRow[i] = iCols - piNbItemRow[i]; + for(j = 0 ; j < iCols ; j++) + { + int iFind = 0; + for(k = 0 ; k < piNbItemRow[i] ; k++) + { + if(piColPos[iCol + k] == (j + 1)) + { + iFind = 1; + break; + } + } + if(iFind == 0) + { + piNewCol[iNewCol++] = (j + 1); + } + } + iCol += piNbItemRow[i]; + } + sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNewItem, piNewRow, piNewCol); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = sparse([%t, %f, %t ; %f, %t, %f ; %t, %f, %t]); +a_ref = sparse([%f, %t, %f ; %t, %f, %t ; %f, %t, %f]); +b = read_write_bsparse(a); +if or(b <> a_ref) then error("failed");end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/check_matrix_dimension.xml b/modules/api_scilab/help/ja_JP/low_level_functions/check_matrix_dimension.xml new file mode 100755 index 000000000..524b9cefe --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/check_matrix_dimension.xml @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="check_matrix_dimension" xml:lang="ja"> + <refnamediv> + <refname>変数の次元を確認 (Scilabゲートウェイ)</refname> + <refpurpose>変数の次元を調べる C ゲートウェイ関数.</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int checkVarDimension(void* _pvCtx, int* _piAddress, int _iRows, int _iCols)</synopsis> + <synopsis>int isRowVector(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isColumnVector(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isVector(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isScalar(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isSquareMatrix(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isEmptyMatrix(void* _pvCtx, int* _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para>予定する行数</para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para>予定する列数</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + 変数の次元を調べるCゲートウェイ関数. + </para> + </refsection> + <refsection> + <title>例</title> + <para> + この例では, Cインターフェイス関数は複数の入力引数をとり, + 入力の次元と複数のテスト結果を出力します. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" +int check_matrix_dimension(char * fname) +{ + SciErr sciErr; + int* piAddr = NULL; + int iRows = 0; + int iCols = 0; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + if(checkVarDimension(pvApiCtx, piAddr, iCols, iRows)) + { + sciprint("checkVarDimension returns false\n"); + } + else + { + sciprint("checkVarDimension returns true\n"); + } + if(isRowVector(pvApiCtx, piAddr)) + { + sciprint("isRowVector\n"); + } + if(isColumnVector(pvApiCtx, piAddr)) + { + sciprint("isColumnVector\n"); + } + if(isVector(pvApiCtx, piAddr)) + { + sciprint("isVector\n"); + } + if(isScalar(pvApiCtx, piAddr)) + { + sciprint("isScalar\n"); + } + if(isSquareMatrix(pvApiCtx, piAddr)) + { + sciprint("isSquareMatrix\n"); + } + if(isEmptyMatrix(pvApiCtx, piAddr)) + { + sciprint("isEmptyMatrix\n"); + } + //no return value + AssignOutputVariable(pvApiCtx, 0) = 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"> + <![CDATA[ +check_matrix_dimension([1,2,3;4,5,6]); +check_matrix_dimension([1,2,3]); +check_matrix_dimension([1;2;3]); +check_matrix_dimension([1]); +check_matrix_dimension([1,2;3,4]); +check_matrix_dimension([]); + ]]> + </programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/common_getvaraddr_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/common_getvaraddr_api.xml new file mode 100755 index 000000000..49a81afc4 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/common_getvaraddr_api.xml @@ -0,0 +1,226 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_getvaraddr_API" xml:lang="ja"> + <refnamediv> + <refname>変数リファレンス (Scilabゲートウェイ)</refname> + <refpurpose> + 引数のアドレスまたはゲートウェイの変数を取得する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getVarAddressFromPosition(void* _pvCtx, int _iVar, int** _piAddress)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr getVarAddressFromName(void* _pvCtx, const char* _pstName, int** _piAddress)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 関数コール時の引数の位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Scilab変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のリターンアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を保持します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>この関数はゲートウェイの引数のアドレスを取得します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + // trueの場合に1,それ以外は 0 + iBool = sciErr.iErr == 0 ? 1 : 0; + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("Variable %d information:\n", _iVar); + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d", iItem); + } + return sciErr; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/common_getvardimension_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/common_getvardimension_api.xml new file mode 100755 index 000000000..9efdb0000 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/common_getvardimension_api.xml @@ -0,0 +1,234 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_getvardimension_API" xml:lang="ja"> + <refnamediv> + <refname>変数の次元 (Scilabゲートウェイ)</refname> + <refpurpose> + 引数または行列に保存された変数の次元を取得する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getVarDimension(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr getNamedVarDimension(void* _pvCtx, const char *_pstName, int* _piRows, int* _piCols)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Scilab変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を保持します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはゲートウェイ内で変数の次元を取得する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + // trueの場合に1,それ以外は 0 + iBool = sciErr.iErr == 0 ? 1 : 0; + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("Variable %d information:\n", _iVar); + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d", iItem); + } + return sciErr; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/common_getvartype_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/common_getvartype_api.xml new file mode 100755 index 000000000..ba79f48f8 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/common_getvartype_api.xml @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_getvartype_API" xml:lang="ja"> + <refnamediv> + <refname>変数の型 (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイ内で引数または変数の型を取得する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getVarType(void* _pvCtx, int* _piAddress, int* _piType)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr getNamedVarType(void* _pvCtx, const char* _pstName, int* _piType)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数のアドレス + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Scilab変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piType</term> + <listitem> + <para> + 変数のScilab型 (sci_matrix, sci_strings, sci_ints, ...). + </para> + <para> + 異なる型のリストがenumとして + <link linkend="sci_types">sci_types.h</link>に定義されている + ことに注意してください. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を保持します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはゲートウェイ内で変数のScilab型を取得する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>Gateway Source</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + // trueの場合に1,それ以外は 0 + iBool = sciErr.iErr == 0 ? 1 : 0; + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("Variable %d information:\n", _iVar); + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d", iItem); + } + return sciErr; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="sci_types">sci_types</link> + </member> + <member> + <link linkend="isPolyType">isPolyType</link> + </member> + <member> + <link linkend="isBooleanType">isBooleanType</link> + </member> + <member> + <link linkend="isListType">isListType</link> + </member> + <member> + <link linkend="isDoubleType">isDoubleType</link> + </member> + <member> + <link linkend="isIntegerType">isIntegerType</link> + </member> + <member> + <link linkend="isSparseType">isSparseType</link> + </member> + <member> + <link linkend="isBooleanSparseType">isBooleanSparseType</link> + </member> + <member> + <link linkend="isStringType">isStringType</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/common_iscomplex_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/common_iscomplex_api.xml new file mode 100755 index 000000000..aeed69b2b --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/common_iscomplex_api.xml @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_iscomplex_API" xml:lang="ja"> + <refnamediv> + <refname>複素数変数 (Scilabゲートウェイ)</refname> + <refpurpose> + 引数または変数が複素数かどうかを取得する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>int isVarComplex(void* _pvCtx, int* _piAddress)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>int isNamedVarComplex(void* _pvCtx, const char *_pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数のアドレス + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + Scilab変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>戻り値</term> + <listitem> + <para> + 変数が実数の場合に0, 複素数の場合に1. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは変数が複素数であるかを調べる方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + // trueの場合1,それ以外は 0 + iBool = sciErr.iErr == 0 ? 1 : 0; + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("Variable %d information:\n", _iVar); + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d", iItem); + } + return sciErr; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/common_isvarmatrixtype_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/common_isvarmatrixtype_api.xml new file mode 100755 index 000000000..1b2cf3a80 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/common_isvarmatrixtype_api.xml @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Common_isvarmatrixtype_API" xml:lang="ja"> + <refnamediv> + <refname>行列型 (Scilab ゲートウェイ)</refname> + <refpurpose> + 引数または変数が行列として保存されているかを調べる方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>int isVarMatrixType(void* _pvCtx, int* _piAddress)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>int isNamedVarMatrixType(void* _pvCtx, const char *_pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数のアドレス + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>戻り値</term> + <listitem> + <para> + 行列として保存されている場合は 1, それ以外は 0. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは変数が行列として保存されているかを調べる方法を示します.</para> + <para>いくつかのケース(例: リスト)では, 変数は標準的なScilab行列に保存されません. + この関数は両方のケースを処理すつ手段を提供します. + </para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + // trueの場合に1,それ以外は 0 + iBool = sciErr.iErr == 0 ? 1 : 0; + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("Variable %d information:\n", _iVar); + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d", iItem); + } + return sciErr; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/deleteNamedVariable.xml b/modules/api_scilab/help/ja_JP/low_level_functions/deleteNamedVariable.xml new file mode 100755 index 000000000..f6d3d2ebe --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/deleteNamedVariable.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="deleteNamedVariable" xml:lang="ja"> + <refnamediv> + <refname>deleteNamedVariable</refname> + <refpurpose> + 名前で指定した変数を削除する際に使用されるCゲートウェイ関数 + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int deleteNamedVariable(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + 変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + 名前で指定した変数を削除する際に使用されるCゲートウェイ関数 + </para> + </refsection> + <refsection> + <title>例</title> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +fileData = ['#include ""api_scilab.h""' +'#include ""MALLOC.h""' +'' +'int sci_deleteNamedVariable(char *fname, unsigned long fname_len)' +'{' +' SciErr sciErr;' +' int iRet = 0;' +' int* piAddr = NULL;' +' char* pstVarName = NULL;' +'' +' CheckRhs(1,1);' +' CheckLhs(1,1);' +'' +' sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);' +' if(sciErr.iErr)' +' {' +' printError(&sciErr, 0);' +' return 1;' +' }' +'' +' if(getAllocatedSingleString(pvApiCtx, piAddr, &pstVarName))' +' {' +' //error' +' return 1;' +' }' +'' +' if(isNamedVarExist(pvApiCtx, pstVarName))' +' {' +' iRet = deleteNamedVariable(pvApiCtx, pstVarName);' +' }' +'' +' createScalarBoolean(pvApiCtx, Rhs + 1, iRet);' +' AssignOutputVariable(pvApiCtx, 1) = Rhs + 1;' +' return 0;' +'}']; +currentPath = pwd(); +mkdir(TMPDIR + "/deleteNamedVariable"); +cd(TMPDIR + "/deleteNamedVariable"); +mputl(fileData, "deleteNamedVariable.c"); +ilib_verbose(0); +files = ['deleteNamedVariable.c']; +ilib_build('libdeleteNamedVariable', ['deleteNamedVariable', 'sci_deleteNamedVariable'], files, []); +exec loader.sce; +function test() + assert_checkequal(exists("a"), 1); + assert_checkequal(a, 1); + a = 2; + assert_checkequal(a, 2); + assert_checktrue(deleteNamedVariable("a")); + assert_checkequal(exists("a"), 1); + assert_checkequal(a, 1); +endfunction +a = 1; +test(); +assert_checkequal(a, 1); +deleteNamedVariable("a"); +assert_checkequal(exists("a"), 0); + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/double_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/double_reading_api.xml new file mode 100755 index 000000000..d10a126d9 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/double_reading_api.xml @@ -0,0 +1,200 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Double_management_reading_API" xml:lang="ja"> + <refnamediv> + <refname>doubleの読み込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイ内でdoubleの行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, double* _pdblReal)</synopsis> + <synopsis>SciErr readNamedComplexMatrixOfDouble(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義される "pvApiCtx" を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返される実数データ配列のアドレス (大きさ: _iCols * _iRows). + "名前指定" 関数の場合, _pdblReal は関数コール前にメモリを確保しておく必要があります. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + Return address of imaginary data array (size: _iCols * _iRows). + For "Named" function, _pdblImg must be allocated before calling function. + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を保持します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはdoubleの行列をScilab APIにより処理する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/double_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/double_reading_api.tst--> + <!--Lib_name: double_reading--> + <!--Func_list: read_double--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_double(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + // 最初の変数の情報 : doubleの実数行列 + int iType = 0; + int iRows = 0; + int iCols = 0; + int iComplex = 0; + int *piAddr = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + // 入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + /************************ + * 最初の変数 * + ************************/ + // 最初の引数の変数アドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 型を確認 + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr || iType != sci_matrix) + { + printError(&sciErr, 0); + return 0; + } + // 複素数かどうかを取得 + iComplex = isVarComplex(pvApiCtx, piAddr); + // 複素数かどうかを確認 + if(iComplex) + { + // Scilabメモリから大きさとデータを取得 + sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + // Scilabメモリから大きさとデータを取得 + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // データを用いて処理を行う + // 変数が複素数の場合,実部と虚部を交換し,それ以外は-1を乗じる + if(iComplex) + { + sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblImg, pdblReal); + } + else + { + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = pdblReal[i] * -1; + } + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = [ 0 1 2 3; .. + 4 5 6 7; .. + 8 9 10 11]; +b = [ 23*%i, 1+22*%i, 2+21*%i, 3+20*%i, 4+19*%i, 5+18*%i; .. + 6+17*%i, 7+16*%i, 8+15*%i, 9+14*%i, 10+13*%i, 11+12*%i; .. + 12+11*%i, 13+10*%i, 14+9*%i, 15+8*%i, 16+7*%i, 17+6*%i; .. + 18+5*%i, 19+4*%i, 20+3*%i, 21+2*%i, 22+1*%i, 23]; +a2 = read_double(a); +b2 = read_double(b); +if or(a2 <> a * -1) then error("failed"), end +if or(b2 <> (imag(b) + real(b) * %i)) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/double_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/double_writing_api.xml new file mode 100755 index 000000000..0c016a5c3 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/double_writing_api.xml @@ -0,0 +1,291 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Double_management_writing_API" xml:lang="ja"> + <refnamediv> + <refname>doubleの書き込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイでdoubleの行列を書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + 既存のデータから作成. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const double* _pdblReal, double* _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const double* _pdblReal)</synopsis> + <synopsis>SciErr createNamedComplexMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 実数データ配列のアドレス (大きさ: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 虚部データ配列のアドレス (大きさ: _iCols * _iRows). + この引数は createMatrixOfDouble および createNamedMatrixOfDouble では + 存在しません. + </para> + <para> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で, + エラーメッセージ履歴と最初のエラー番号を + 格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込む. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr allocMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal)</synopsis> + <synopsis>SciErr allocComplexMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg)</synopsis> + <synopsis>SciErr allocComplexZMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal, doublecomplex** _pdblData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 実部データ配列のアドレスを返す (大きさ: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 虚部データ配列のアドレスを返す (大きさ: _iCols * _iRows). + この引数は allocMatrixOfDoubleには存在しません. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblData</term> + <listitem> + <para> + doublecomplexデータ配列のアドレスを返します (大きさ: _iCols * _iRows). + この引数は allocComplexZMatrixOfDoubleにのみ存在します. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/double_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/double_writing_api.tst--> + <!--Lib_name: double_writing--> + <!--Func_list: write_double--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int write_double(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j; + // 最初の変数の情報 : 3 x 4 doubleの実数行列 + int iRows1 = 3; + int iCols1 = 4; + double* pdblReal1 = NULL; + // 2番目の変数の情報 : double 4 x 6 doubleの複素数行列 + int iRows2 = 4; + int iCols2 = 6; + double* pdblReal2 = NULL; + double* pdblImg2 = NULL; + /************************ + * 最初の変数 * + ************************/ + // OSメモリにデータ配列を確保 + pdblReal1 = (double*)malloc(sizeof(double) * iRows1 * iCols1); + // 増加する値を配列に代入 + //[ 0 1 2 3 + // 4 5 6 7 + // 8 9 10 11] + for(i = 0 ; i < iRows1 ; i++) + { + for(j = 0 ; j < iCols1 ; j++) + { + pdblReal1[i + iRows1 * j] = i * iCols1 + j; + } + } + // 1回のループで書くことも可能 + //for(i = 0 ; i < iRows1 * iCols1; i++) + //{ + // pdblReal1[i] = i; + //} + // 既存のデータ配列から変数を作成 + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows1, iCols1, pdblReal1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 作成後, メモリを解放できます. + free(pdblReal1); + /************************* + * 2番目の変数 * + *************************/ + // scilabメモリの空間を予約し,代入 + sciErr = allocComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRows2, iCols2, &pdblReal2, &pdblImg2); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 増加する値を実部, 減少する値を虚部に代入 + //[ 23i 1+22i 2+21i 3+20i 4+19i 5+18i + // 6+17i 7+16i 8+15i 9+14i 10+13i 11+12i + // 12+11i 13+10i 14+9i 15+8i 16+7i 17+6i + // 18+5i 19+4i 20+3i 21+2i 22+1i 23 ] + for(i = 0 ; i < iRows2 ; i++) + { + for(j = 0 ; j < iCols2 ; j++) + { + pdblReal2[i + iRows2 * j] = i * iCols2 + j; + pdblImg2 [i + iRows2 * j] = (iRows2 * iCols2 - 1) - (i * iCols2 + j); + } + } + // 1回のループで書き込むことも可能 + //for(i = 0 ; i < iRows2 * iCols2; i++) + //{ + // pdblReal2[i] = i; + // pdblImg2 [i] = (iRows2 * iCols2 - 1) - i; + //} + // /!\ この場合はScilabメモリなのでメモリを解放しないこと + // 確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a_ref = [ 0 1 2 3; .. + 4 5 6 7; .. + 8 9 10 11]; +b_ref = [ 23*%i, 1+22*%i, 2+21*%i, 3+20*%i, 4+19*%i, 5+18*%i; .. + 6+17*%i, 7+16*%i, 8+15*%i, 9+14*%i, 10+13*%i, 11+12*%i; .. + 12+11*%i, 13+10*%i, 14+9*%i, 15+8*%i, 16+7*%i, 17+6*%i; .. + 18+5*%i, 19+4*%i, 20+3*%i, 21+2*%i, 22+1*%i, 23]; +[a,b] = write_double(); +if or(a <> a_ref) then error("failed");end +if or(b <> b_ref) then error("failed");end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/getNbInputArgument.xml b/modules/api_scilab/help/ja_JP/low_level_functions/getNbInputArgument.xml new file mode 100755 index 000000000..89ddb51d0 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/getNbInputArgument.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getNbInputArgument" xml:lang="ja"> + <refnamediv> + <refname>getNbInputArgument (Scilabゲートウェイ)</refname> + <refpurpose> + Scilab関数コール時に入力引数の数を調べるCゲートウェイ関数 + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>nb_params = getNbInputArgument(void* _pvCtx)</synopsis> + <synopsis>nb_params = nbInputArgument</synopsis> + <synopsis>nb_params = Rhs</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_params</term> + <listitem> + <para> + Scilab関数コール時の入力引数の数 + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + Scilab関数コール時に指定された入力引数の数を調べるCゲートウェイ関数. + この関数を使用する場合は api_scilab.h をインクルードする必要があります. + </para> + </refsection> + <refsection> + <title>例</title> + <para> + この例では,Cインターフェイス関数は複数の入力引数をとり, + ScilabコンソールにScilab関数コール時に検出された入力引数の数に + 対応する整数を出力します. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" +int sci_myrhs(char * fname) +{ + sciprint("The number of input parameters is %d\n", getNbInputArgument); + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="getNbOutputArgument">getNbOutputArgument</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/getNbOutputArgument.xml b/modules/api_scilab/help/ja_JP/low_level_functions/getNbOutputArgument.xml new file mode 100755 index 000000000..07929175f --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/getNbOutputArgument.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getNbOutputArgument" xml:lang="ja"> + <refnamediv> + <refname>getNbOutputArgument (Scilabゲートウェイ)</refname> + <refpurpose> + Scilab関数コール時に出力引数の数を調べるCゲートウェイ関数 + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>nb_params = getNbOutputArgument(void* _pvCtx)</synopsis> + <synopsis>nb_params = nbOutputArgument</synopsis> + <synopsis>nb_params = Lhs</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_params</term> + <listitem> + <para> + Scilab関数コール時の出力引数の数 + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + getNbOutputArgumentはScilab関数コール時に指定された出力引数の数を調べる + Cゲートウェイ関数です. + この関数を使用する場合は api_scilab.h をインクルードする必要があります. + </para> + </refsection> + <refsection> + <title>例</title> + <para> + この例では,Cインターフェイス関数は複数の出力引数をとり, + ScilabコンソールにScilab関数コール時に検出された出力引数の数に + 対応する整数を出力します. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" +int sci_mylhs(char * fname) +{ + sciprint("The number of output arguments is %d\n", getNbOutputArgument()); + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="getNbInputArgument">getNbInputArgument</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/handle_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/handle_reading_api.xml new file mode 100755 index 000000000..ad7107ef2 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/handle_reading_api.xml @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="handle_reading_API" xml:lang="ja"> + <refnamediv> + <refname>ハンドルの読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + ハンドルの行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfHandle(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, long long** _pllHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pllHandle</term> + <listitem> + <para> + 返されるデータ取得のアドレス (大きさ: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはハンドルの行列を読み込む方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_handle_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_handle_api.tst--> + <!--Lib_name: read_write_handle--> + <!--Func_list: read_write_handle--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int read_write_handle(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + //最初の変数の情報 : double実数行列 + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + long long* pllHandle = NULL; + //入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1,1); + CheckOutputArgument(pvApiCtx, 1,1); + //最初の入力引数の変数アドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // Scilabメモリから大きさとデータを取得 + sciErr = getMatrixOfHandle(pvApiCtx, piAddr, &iRows, &iCols, &pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"> + <![CDATA[ +f1 = scf(1); +f2 = scf(2); +a_ref = [f1, f2]; +b = read_write_handle(a_ref); +if or(b <> a_ref) then error("failed"), end + ]]> + </programlisting> + </refsection> + <title>履歴</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>この関数はScilab 5.5.0で追加されました</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/handle_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/handle_writing_api.xml new file mode 100755 index 000000000..166ec9a01 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/handle_writing_api.xml @@ -0,0 +1,209 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="handle_writing_API" xml:lang="ja"> + <refnamediv> + <refname>ハンドルの書き込み (Scilab ゲートウェイ)</refname> + <refpurpose> + ハンドルの行列を書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createMatrixOfHandle(void* _pvCtx, int _iVar, int _iRows, int _iCols, const long long* _pllHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pllHandle</term> + <listitem> + <para> + 返されるデータ配列のアドレス (大きさ: _iRows * _iCols). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込み. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr allocMatrixOfHandle(void* _pvCtx, int _iVar, int _iRows, int _iCols, long long** _pllHandle)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pllHandle</term> + <listitem> + <para> + 実数データ配列のアドレスを返す (大きさ: _iCols * _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはハンドルの行列を書き込む方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/read_write_handle_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/read_write_handle_api.tst--> + <!--Lib_name: read_write_handle--> + <!--Func_list: read_write_handle--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int read_write_handle(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + //最初の変数の情報 : double実数行列 + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + long long* pllHandle = NULL; + //入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1,1); + CheckOutputArgument(pvApiCtx, 1,1); + //最初の入力引数の変数アドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // Scilabメモリから大きさとデータを取得 + sciErr = getMatrixOfHandle(pvApiCtx, piAddr, &iRows, &iCols, &pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pllHandle); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"> + <![CDATA[ +f1 = scf(1); +f2 = scf(2); +a_ref = [f1, f2]; +b = read_write_handle(a_ref); +if or(b <> a_ref) then error("failed"), end + ]]> + </programlisting> + </refsection> + <title>履歴</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>この関数は Scilab 5.5.0で追加されました</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/int_getmatrixofintegerprecision_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/int_getmatrixofintegerprecision_api.xml new file mode 100755 index 000000000..69db0fbb4 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/int_getmatrixofintegerprecision_api.xml @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="int_getmatrixofintegerprecision_API" xml:lang="ja"> + <refnamediv> + <refname>整数の精度 (Scilabゲートウェイ)</refname> + <refpurpose> + 整数行列の精度を取得する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>SciErr getMatrixOfIntegerPrecision(void* _pvCtx, int* _piAddress, int* _piPrecision)</synopsis> + <synopsis>SciErr getNamedMatrixOfIntegerPrecision(void* _pvCtx, const char* _pstName, int* _piPrecision)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piPrecision</term> + <listitem> + <para> + 返される整数変数の精度. ( SCI_INT8, SCI_UINT8, SCI_INT16, ... ) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは整数行列の精度を取得する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/common_function_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/common_function.tst--> + <!--Lib_name: common_function--> + <!--Func_list: common_function--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +SciErr printf_info(int _iVar); +int common_function(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + for(i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(i + 1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + // trueの場合は1, それ以外は 0 + iBool = sciErr.iErr == 0 ? 1 : 0; + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} +SciErr printf_info(int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("Variable %d information:\n", _iVar); + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("\tType: "); + switch(iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec); + if(sciErr.iErr) + { + return sciErr; + } + if(iPrec > 10) + { + pstSign = pstUnsigned; + } + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + sciprint("\tDimensions: "); + if(isVarMatrixType(pvApiCtx, piAddr)) + { + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem); + if(sciErr.iErr) + { + return sciErr; + } + sciprint("%d", iItem); + } + return sciErr; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/integer_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/integer_reading_api.xml new file mode 100755 index 000000000..da191d8a2 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/integer_reading_api.xml @@ -0,0 +1,378 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Integer_management_reading_API" xml:lang="ja"> + <refnamediv> + <refname>整数の読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + ゲートウェイ内で整数の行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr getMatrixOfInteger8(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, char** _pcData8)</synopsis> + <synopsis>SciErr getMatrixOfInteger16(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, short** _psData16)</synopsis> + <synopsis>SciErr getMatrixOfInteger32(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piData32)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr getMatrixOfUnsignedInteger8(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned char** _pucData8)</synopsis> + <synopsis>SciErr getMatrixOfUnsignedInteger16(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned short** _pusData16)</synopsis> + <synopsis>SciErr getMatrixOfUnsignedInteger32(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned int** _puiData32)</synopsis> + <para>名前指定変数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr readNamedMatrixOfInteger8(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, char* _pcData8)</synopsis> + <synopsis>SciErr readNamedMatrixOfInteger16(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, short* _psData16)</synopsis> + <synopsis>SciErr readNamedMatrixOfInteger32(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piData32)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr readNamedMatrixOfUnsignedInteger8(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned char* _pucData8)</synopsis> + <synopsis>SciErr readNamedMatrixOfUnsignedInteger16(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned short* _pusData16)</synopsis> + <synopsis>SciErr readNamedMatrixOfUnsignedInteger32(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned int* _puiData32)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _pucData8, _psData16, _pusData16, _piData32, _puiData32</term> + <listitem> + <para> + 返される配列のアドレス ( 大きさ: _piRows * _piCols). + "名前指定" 関数の場合, _pcData は関数コール前にメモリを確保しておく必要があります. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはScilab APIにより整数の行列を処理する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/integer_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/integer_reading_api.tst--> + <!--Lib_name: integer_reading--> + <!--Func_list: read_integer--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn); +int read_integer(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + // 出力変数の情報 + int iRows8 = 0; + int iCols8 = 0; + int iRows16 = 0; + int iCols16 = 0; + int iRows32 = 0; + int iCols32 = 0; + int iRowsu8 = 0; + int iColsu8 = 0; + int iRowsu16 = 0; + int iColsu16 = 0; + int iRowsu32 = 0; + int iColsu32 = 0; + int iPrec = 0; + int* piAddr8 = NULL; + int* piAddr16 = NULL; + int* piAddr32 = NULL; + int* piAddru8 = NULL; + int* piAddru16 = NULL; + int* piAddru32 = NULL; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + char* pcDataOut = NULL; + short* psDataOut = NULL; + int* piDataOut = NULL; + unsigned char* pucDataOut = NULL; + unsigned short* pusDataOut = NULL; + unsigned int* puiDataOut = NULL; + // 入力/出力引数の数を確認 + CheckInputArgument(pvApiCtx, 6, 6); + CheckOutputArgument(pvApiCtx, 6, 6); + // 変数のアドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr8); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddru8); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr16); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddru16); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr32); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddru32); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr8, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT8) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru8, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT8) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr16, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT16) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru16, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT16) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr32, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT32) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru32, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT32) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfInteger8(pvApiCtx, piAddr8, &iRows8, &iCols8, &pcData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddru8, &iRowsu8, &iColsu8, &pucData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfInteger16(pvApiCtx, piAddr16, &iRows16, &iCols16, &psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddru16, &iRowsu16, &iColsu16, &pusData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfInteger32(pvApiCtx, piAddr32, &iRows32, &iCols32, &piData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddru32, &iRowsu32, &iColsu32, &puiData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数のメモリを確保し,代入 + pcDataOut = (char*)create_output(2, 1, iRows8, iCols8, (void*)pcData); + pucDataOut = (unsigned char*)create_output(4, 1, iRowsu8, iColsu8, (void*)pucData); + psDataOut = (short*)create_output(8, 2, iRows16, iCols16, (void*)psData); + pusDataOut = (unsigned short*)create_output(16, 2, iRowsu16, iColsu16, (void*)pusData); + piDataOut = (int*)create_output(32, 4, iRows32, iCols32, (void*)piData); + puiDataOut = (unsigned int*)create_output(64, 4, iRowsu32, iColsu32, (void*)puiData); + // 新規変数を作成 + sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows8, iCols8, pcDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRowsu8, iColsu8, pucDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 3, iRows16, iCols16, psDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 4, iRowsu16, iColsu16, pusDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 5, iRows32, iCols32, piDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 6, iRowsu32, iColsu32, puiDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3; + AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4; + AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5; + AssignOutputVariable(pvApiCtx, 6) = nbInputArgument(pvApiCtx) + 6; + return 0; +} +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn) +{ + int i = 0; + void* pvDataOut = (void*)malloc(_iSize * _iRows * _iCols); + for(i = 0 ; i < _iRows * _iCols ; i++) + { + int iVal = 0; + memcpy(&iVal, (char*)_pvDataIn + i * _iSize, _iSize); + iVal *= _iCoeff; + memcpy((char*)pvDataOut + i * _iSize, &iVal, _iSize); + } + return pvDataOut; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a8 = int8([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au8 = uint8([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a16 = int16([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au16 = uint16([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a32 = int32([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au32 = uint32([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +[c8, cu8, c16, cu16, c32, cu32] = read_integer(a8, au8, a16, au16, a32, au32); +if or(c8 <> a8 * 2) then error("failed"), end +if or(cu8 <> au8 * 4) then error("failed"), end +if or(c16 <> a16 * 8) then error("failed"), end +if or(cu16 <> au16 * 16) then error("failed"), end +if or(c32 <> a32 * 32) then error("failed"), end +if or(cu32 <> au32 * 64) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/integer_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/integer_writing_api.xml new file mode 100755 index 000000000..bec150c97 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/integer_writing_api.xml @@ -0,0 +1,449 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Integer_management_writing_API" xml:lang="ja"> + <refnamediv> + <refname>整数の書き込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイで整数の行列を書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + 既存のデータから作成. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr createMatrixOfInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, const char* _pcData8)</synopsis> + <synopsis>SciErr createMatrixOfInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, const short* _psData16)</synopsis> + <synopsis>SciErr createMatrixOfInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piData32)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr createMatrixOfUnsignedInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned char* _pucData8)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned short* _pusData16)</synopsis> + <synopsis>SciErr createMatrixOfUnsignedInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned int* _puiData32)</synopsis> + <para>名前指定変数プロファイル:</para> + <para>符号あり変数 :</para> + <synopsis>SciErr createNamedMatrixOfInteger8(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const char* _pcData8)</synopsis> + <synopsis>SciErr createNamedMatrixOfInteger16(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const short* _psData16)</synopsis> + <synopsis>SciErr createNamedMatrixOfInteger32(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piData32)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr createNamedMatrixOfUnsignedInteger8(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned char* _pucData8)</synopsis> + <synopsis>SciErr createNamedMatrixOfUnsignedInteger16(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned short* _pusData16)</synopsis> + <synopsis>SciErr createNamedMatrixOfUnsignedInteger32(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned int* _puiData32)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term> + <listitem> + <para> + データ配列のアドレス (大きさ: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込み. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <para>符号あり整数 :</para> + <synopsis>SciErr allocMatrixOfInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, char** _pcData8)</synopsis> + <synopsis>SciErr allocMatrixOfInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, short** _psData16)</synopsis> + <synopsis>SciErr allocMatrixOfInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piData32)</synopsis> + <para>符号無し整数 :</para> + <synopsis>SciErr allocMatrixOfUnsignedInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned char** _pucData8)</synopsis> + <synopsis>SciErr allocMatrixOfUnsignedInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned short** _pusData16)</synopsis> + <synopsis>SciErr allocMatrixOfUnsignedInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned int** _puiData32)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term> + <listitem> + <para> + 返されるデータ配列のアドレス (大きさ: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはScilab APIにより整数の行列を処理する方法を示します.</para> + <para>Scilabのメモリに書き込む際には, 2種類の関数を使用できます.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/integer_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/integer_writing_api.tst--> + <!--Lib_name: integer_writing--> + <!--Func_list: read_integer--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn); +int read_integer(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + // 出力変数の情報 + int iRows8 = 0; + int iCols8 = 0; + int iRows16 = 0; + int iCols16 = 0; + int iRows32 = 0; + int iCols32 = 0; + int iRowsu8 = 0; + int iColsu8 = 0; + int iRowsu16 = 0; + int iColsu16 = 0; + int iRowsu32 = 0; + int iColsu32 = 0; + int iPrec = 0; + int* piAddr8 = NULL; + int* piAddr16 = NULL; + int* piAddr32 = NULL; + int* piAddru8 = NULL; + int* piAddru16 = NULL; + int* piAddru32 = NULL; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + char* pcDataOut = NULL; + short* psDataOut = NULL; + int* piDataOut = NULL; + unsigned char* pucDataOut = NULL; + unsigned short* pusDataOut = NULL; + unsigned int* puiDataOut = NULL; + // 入力/出力引数の数を確認 + CheckInputArgument(pvApiCtx, 6, 6); + CheckOutputArgument(pvApiCtx, 6, 6); + // 変数のアドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr8); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddru8); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr16); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddru16); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr32); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddru32); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr8, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT8) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru8, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT8) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr16, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT16) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru16, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT16) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr32, &iPrec); + if(sciErr.iErr || iPrec != SCI_INT32) + { + printError(&sciErr, 0); + return 0; + } + // 変数の精度を確認 + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru32, &iPrec); + if(sciErr.iErr || iPrec != SCI_UINT32) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfInteger8(pvApiCtx, piAddr8, &iRows8, &iCols8, &pcData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddru8, &iRowsu8, &iColsu8, &pucData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfInteger16(pvApiCtx, piAddr16, &iRows16, &iCols16, &psData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddru16, &iRowsu16, &iColsu16, &pusData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfInteger32(pvApiCtx, piAddr32, &iRows32, &iCols32, &piData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 次元とデータを取得 + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddru32, &iRowsu32, &iColsu32, &puiData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を確保して代入 + pcDataOut = (char*)create_output(2, 1, iRows8, iCols8, (void*)pcData); + pucDataOut = (unsigned char*)create_output(4, 1, iRowsu8, iColsu8, (void*)pucData); + psDataOut = (short*)create_output(8, 2, iRows16, iCols16, (void*)psData); + pusDataOut = (unsigned short*)create_output(16, 2, iRowsu16, iColsu16, (void*)pusData); + piDataOut = (int*)create_output(32, 4, iRows32, iCols32, (void*)piData); + puiDataOut = (unsigned int*)create_output(64, 4, iRowsu32, iColsu32, (void*)puiData); + // 新規変数を作成 + sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows8, iCols8, pcDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRowsu8, iColsu8, pucDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 3, iRows16, iCols16, psDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 4, iRowsu16, iColsu16, pusDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 5, iRows32, iCols32, piDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 新規変数を作成 + sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 6, iRowsu32, iColsu32, puiDataOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // 確保した変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3; + AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4; + AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5; + AssignOutputVariable(pvApiCtx, 6) = nbInputArgument(pvApiCtx) + 6; + return 0; +} +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn) +{ + int i = 0; + void* pvDataOut = (void*)malloc(_iSize * _iRows * _iCols); + for(i = 0 ; i < _iRows * _iCols ; i++) + { + int iVal = 0; + memcpy(&iVal, (char*)_pvDataIn + i * _iSize, _iSize); + iVal *= _iCoeff; + memcpy((char*)pvDataOut + i * _iSize, &iVal, _iSize); + } + return pvDataOut; +} +]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a8 = int8([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au8 = uint8([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a16 = int16([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au16 = uint16([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a32 = int32([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au32 = uint32([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +[c8, cu8, c16, cu16, c32, cu32] = read_integer(a8, au8, a16, au16, a32, au32); +if or(c8 <> a8 * 2) then error("failed"), end +if or(cu8 <> au8 * 4) then error("failed"), end +if or(c16 <> a16 * 8) then error("failed"), end +if or(cu16 <> au16 * 16) then error("failed"), end +if or(c32 <> a32 * 32) then error("failed"), end +if or(cu32 <> au32 * 64) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/nbInputArgument.xml b/modules/api_scilab/help/ja_JP/low_level_functions/nbInputArgument.xml new file mode 100755 index 000000000..a065af336 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/nbInputArgument.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="nbInputArgument" xml:lang="ja"> + <refnamediv> + <refname>nbInputArgument (Scilab ゲートウェイ)</refname> + <refpurpose> + Scilab関数コール時の入力引数の数を取得するCゲートウェイ関数 + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int nb_params = nbInputArgument(void* _pvCtx)</synopsis> + <synopsis>int nb_params = Rhs</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, + api_scilab.hにより提供された"pvApiCtx"を指定 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_params</term> + <listitem> + <para> + Scilab関数コール時の入力引数の数 + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + Scilab関数コール時の入力引数の数を取得するCゲートウェイ関数. + この関数を使用するにはapi_scilab.hをインクルードしておく + 必要があります. + </para> + </refsection> + <refsection> + <title>例</title> + <para> + この例では,Cインターフェイス関数は + 複数の入力をとり,Scilab関数コール時に検出された + 入力引数の数に対応する整数をScilabコンソールに出力します. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" +int sci_myrhs(char * fname) +{ + sciprint("The number of input parameters is %d\n", nbInputArgument); + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection role="see also"> + <title>参照</title> + <simplelist type="inline"> + <member> + <link linkend="getNbInputArgument">getNbInputArgument</link> + </member> + <member> + <link linkend="sciprint">sciprint</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/pointer_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/pointer_reading_api.xml new file mode 100755 index 000000000..1bfaed38e --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/pointer_reading_api.xml @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Pointer_reading_API" xml:lang="ja"> + <refnamediv> + <refname>ポインタの読み込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイでポインタを読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getPointer(void* _pvCtx, int* _piAddress, void** _pvPtr)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readNamedPointer(void* _pvCtx, const char* _pstName, void** _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + 返されるポインタのアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはScilab APIによりポインタを処理する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/pointer_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/pointer_reading_api.tst--> + <!--Lib_name: pointer_reading--> + <!--Func_list: read_pointer--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int read_pointer(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + CheckInputArgument(pvApiCtx, 0, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + if(nbInputArgument(pvApiCtx) == 0) + {// モードを作成 + double* pdblData = (double*)malloc(sizeof(double) * 2 * 2); + pdblData[0] = 1; + pdblData[1] = 3; + pdblData[2] = 2; + pdblData[3] = 4; + sciErr = createPointer(pvApiCtx, nbInputArgument(pvApiCtx) + 1, (void*)pdblData); + } + else if(nbInputArgument(pvApiCtx) == 1) + {// モードを読み込み + int iType = 0; + int* piAddr = NULL; + void* pvPtr = NULL; + double* pdblData = NULL; + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getPointer(pvApiCtx, piAddr, &pvPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblData = (double*)pvPtr; + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 2, 2, pdblData); + } + else + { + return 0; + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +b_ref = [1,2;3,4]; +a = read_pointer(); +b = read_pointer(a); +if or(b <> b_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/pointer_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/pointer_writing_api.xml new file mode 100755 index 000000000..324a3e89c --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/pointer_writing_api.xml @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Pointer_writing_API" xml:lang="ja"> + <refnamediv> + <refname>ポインタの書き込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイでポインタを書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + 既存のデータから作成. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createPointer(void* _pvCtx, int _iVar, void* _pvPtr)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createNamedPointer(void* _pvCtx, const char* _pstName, void** _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + ポインタのアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込み. + </refsection> + <title>呼び出し手順</title> + <synopsis>SciErr allocPointer(void* _pvCtx, int _iVar, void** _pvPtr)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pvPtr</term> + <listitem> + <para> + 返されるポインタのアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはScilab APIによりポインタを処理する方法を示します.</para> + <para>Scilabメモリに書き込む際には, 2種類の関数を使用できます.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/pointer_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/pointer_reading_api.tst--> + <!--Lib_name: pointer_reading--> + <!--Func_list: read_pointer--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"> + <![CDATA[ +#include "api_scilab.h" +int read_pointer(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + CheckInputArgument(pvApiCtx, 0, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + if(nbInputArgument(pvApiCtx) == 0) + {//モードを作成 + double* pdblData = (double*)malloc(sizeof(double) * 2 * 2); + pdblData[0] = 1; + pdblData[1] = 3; + pdblData[2] = 2; + pdblData[3] = 4; + sciErr = createPointer(pvApiCtx, nbInputArgument(pvApiCtx) + 1, (void*)pdblData); + } + else if(nbInputArgument(pvApiCtx) == 1) + {//モードを読み込み + int iType = 0; + int* piAddr = NULL; + void* pvPtr = NULL; + double* pdblData = NULL; + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getPointer(pvApiCtx, piAddr, &pvPtr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblData = (double*)pvPtr; + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 2, 2, pdblData); + } + else + { + return 0; + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +b_ref = [1,2;3,4]; +a = read_pointer(); +b = read_pointer(a); +if or(b <> b_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/poly_getpolyvariablename_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/poly_getpolyvariablename_api.xml new file mode 100755 index 000000000..cb5d54c40 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/poly_getpolyvariablename_api.xml @@ -0,0 +1,240 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="poly_getpolyvariablename_API" xml:lang="ja"> + <refnamediv> + <refname>多項式の記号変数 (Scilabゲートウェイ)</refname> + <refpurpose> + 記号変数名を取得する方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstVarName</term> + <listitem> + <para> + 返される記号変数名 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piVarNameLen</term> + <listitem> + <para> + 返される _pstVarNameの長さ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは記号変数名を取得する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/poly_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/poly_reading_api.tst--> + <!--Lib_name: poly_reading--> + <!--Func_list: read_poly--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_poly(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j; + //変数の情報 + int iRows = 0; + int iCols = 0; + int iVarLen = 0; + int* piAddr = NULL; + int* piNbCoef = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + char* pstVarname = NULL; + //入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isVarComplex(pvApiCtx, piAddr) == FALSE) + { + //Error + return 0; + } + //変数名の長さを取得 + sciErr = getPolyVariableName(pvApiCtx, piAddr, NULL, &iVarLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //変数名を得るバッファを確保 + pstVarname = (char*)malloc(sizeof(char) * (iVarLen + 1));//ヌル終端用に1 + //変数名を取得 + sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarname, &iVarLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //最初のコール: 次元を取得 + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //係数の配列を確保 + piNbCoef = (int*)malloc(sizeof(int) * iRows * iCols); + //2回目のコール: 係数を取得 + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //データ配列を確保 + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + } + //3回目のコール: データを取得 + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //何らかのデータ処理 + //行列の多項式を反転し 係数を反転 + for(i = 0 ; i < (iRows * iCols) / 2 ; i++) + { + int iPos1 = iRows * iCols - 1 - i; + double* pdblSave = NULL; + int iNbCoefSave = 0; + //switch array of coefficient + pdblSave = pdblReal[i]; + pdblReal[i] = pdblReal[iPos1]; + pdblReal[iPos1] = pdblSave; + pdblSave = pdblImg[i]; + pdblImg[i] = pdblImg[iPos1]; + pdblImg[iPos1] = pdblSave; + //switch number of coefficient + iNbCoefSave = piNbCoef[i]; + piNbCoef[i] = piNbCoef[iPos1]; + piNbCoef[iPos1] = iNbCoefSave; + } + //係数を切り替え + for(i = 0 ; i < iRows * iCols ; i++) + { + for(j = 0 ; j < piNbCoef[i] /2 ; j++) + { + int iPos2 = piNbCoef[i] - 1 - j; + double dblVal = pdblReal[i][j]; + pdblReal[i][j] = pdblReal[i][iPos2]; + pdblReal[i][iPos2] = dblVal; + dblVal = pdblImg[i][j]; + pdblImg[i][j] = pdblImg[i][iPos2]; + pdblImg[i][iPos2] = dblVal; + } + } + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarname, iRows, iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //OSメモリを解放 + free(pstVarname); + free(piNbCoef); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +coeff1 = [ .. +29*%i,22*%i,16*%i,11*%i,7*%i,30,23,17,12,8,-31*%i,-24*%i,-18*%i,-13*%i,-9*%i,32,25,19,14,10,-33*%i,-26*%i,-20*%i,-15*%i,0,34,27,21,0,0,0,-28*%i,0,0,0,36-35*%i,0,0,0,0; .. +4*%i,2*%i,%i,22,16,5,-3,0,-23*%i,-17*%i,-6*%i,0,0,24,18,0,0,0,-25*%i,-19*%i,0,0,0,26,20,0,0,0,-27*%i,-21*%i,0,0,0,28,0,0,0,0,0,0; .. +11,7,4,2,1,-12*%i,-8*%i,-5*%i,3*%i,0,13,9,6,0,0,-14*%i,-10*%i,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; +x = poly(0, "x"); +p1 = 1; +p2 = 2 * x + 3 * %i; +p3 = 4 * x**2 - 5 * %i * x + 6; +p4 = 7 * x**3 - 8 * %i * x**2 + 9 * x - 10 * %i; +p5 = 11 * x**4 - 12 * %i * x**3 + 13 * x**2 - 14 * %i * x + 15; +p6 = 16 * x**5 - 17 * %i * x**4 + 18 * x**3 - 19 * %i * x**2 + 20 * x - 21 * %i; +p7 = 22 * x**6 - 23 * %i * x**5 + 24 * x**4 - 25 * %i * x**3 + 26 * x**2 - 27 * %i * x + 28; +p8 = %i; +p9 = 2 * %i * x - 3; +p10 = 4 * %i * x**2 + 5 * x - 6 * %i; +p11 = 7 * %i * x**3 + 8 * x**2 - 9 * %i * x + 10; +p12 = 11 * %i * x**4 + 12 * x**3 - 13 * %i * x**2 + 14 * x - 15 * %i; +p13 = 16 * %i * x**5 + 17 * x**4 - 18 * %i * x**3 + 19 * x**2 - 20 * %i * x + 21; +p14 = 22 * %i * x**6 + 23 * x**5 - 24 * %i * x**4 + 25 * x**3 - 26 * %i * x**2 + 27 * x - 28 * %i; +p15 = 29 * %i * x**7 + 30 * x**6 - 31 * %i * x**5 + 32 * x**4 - 33 * %i * x**3 + 34 * x**2 - 35 * %i + 36; +p = [p1, p2, p3, p4, p5 ; p6, p7, p8, p9 ,p10 ; p11, p12, p13, p14, p15]; +p1 = read_poly(p); +coeff2 = coeff(p1); +if or(coeff2 <> coeff1) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/poly_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/poly_reading_api.xml new file mode 100755 index 000000000..e793fb066 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/poly_reading_api.xml @@ -0,0 +1,278 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Polynomial_management_reading_API" xml:lang="ja"> + <refnamediv> + <refname>多項式の読み込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイで多項式の行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>SciErr readNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + 各多項式の係数の数を返す. (要メモリ確保) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 係数の実部を保持する double*の配列のアドレス (大きさ: _iCols * _iRows, 要メモリ確保) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 係数の虚部を保持する double*の配列のアドレス (大きさ: _iCols * _iRows, 要メモリ確保) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + このヘルプはScilab APIにより多項式の行列を処理する方法を示します. + </para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/poly_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/poly_reading_api.tst--> + <!--Lib_name: poly_reading--> + <!--Func_list: read_poly--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_poly(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j; + //変数の情報 + int iRows = 0; + int iCols = 0; + int iVarLen = 0; + int* piAddr = NULL; + int* piNbCoef = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + char* pstVarname = NULL; + //入力/出力引数を確認 + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isVarComplex(pvApiCtx, piAddr) == FALSE) + { + //エラー + return 0; + } + //変数名の長さを取得 + sciErr = getPolyVariableName(pvApiCtx, piAddr, NULL, &iVarLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //変数名を得るためのバッファを確保 + pstVarname = (char*)malloc(sizeof(char) * (iVarLen + 1));//1 for null termination + //変数名を取得 + sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarname, &iVarLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //最初のコール: 次元を取得 + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //係数の配列用メモリを確保 + piNbCoef = (int*)malloc(sizeof(int) * iRows * iCols); + //2番目のコール: 係数を取得 + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //データ配列用メモリを確保 + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + } + //3回目のコール: データを取得 + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //データで何らかの処理を行う + //行列の多項式を反転し, 係数を反転 + for(i = 0 ; i < (iRows * iCols) / 2 ; i++) + { + int iPos1 = iRows * iCols - 1 - i; + double* pdblSave = NULL; + int iNbCoefSave = 0; + //係数の配列を交換 + pdblSave = pdblReal[i]; + pdblReal[i] = pdblReal[iPos1]; + pdblReal[iPos1] = pdblSave; + pdblSave = pdblImg[i]; + pdblImg[i] = pdblImg[iPos1]; + pdblImg[iPos1] = pdblSave; + //switch number of coefficient + iNbCoefSave = piNbCoef[i]; + piNbCoef[i] = piNbCoef[iPos1]; + piNbCoef[iPos1] = iNbCoefSave; + } + //係数を交換 + for(i = 0 ; i < iRows * iCols ; i++) + { + for(j = 0 ; j < piNbCoef[i] /2 ; j++) + { + int iPos2 = piNbCoef[i] - 1 - j; + double dblVal = pdblReal[i][j]; + pdblReal[i][j] = pdblReal[i][iPos2]; + pdblReal[i][iPos2] = dblVal; + dblVal = pdblImg[i][j]; + pdblImg[i][j] = pdblImg[i][iPos2]; + pdblImg[i][iPos2] = dblVal; + } + } + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarname, iRows, iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //OSメモリを解放 + free(pstVarname); + free(piNbCoef); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + //確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +coeff1 = [ .. +29*%i,22*%i,16*%i,11*%i,7*%i,30,23,17,12,8,-31*%i,-24*%i,-18*%i,-13*%i,-9*%i,32,25,19,14,10,-33*%i,-26*%i,-20*%i,-15*%i,0,34,27,21,0,0,0,-28*%i,0,0,0,36-35*%i,0,0,0,0; .. +4*%i,2*%i,%i,22,16,5,-3,0,-23*%i,-17*%i,-6*%i,0,0,24,18,0,0,0,-25*%i,-19*%i,0,0,0,26,20,0,0,0,-27*%i,-21*%i,0,0,0,28,0,0,0,0,0,0; .. +11,7,4,2,1,-12*%i,-8*%i,-5*%i,3*%i,0,13,9,6,0,0,-14*%i,-10*%i,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] +x = poly(0, "x"); +p1 = 1; +p2 = 2 * x + 3 * %i; +p3 = 4 * x**2 - 5 * %i * x + 6; +p4 = 7 * x**3 - 8 * %i * x**2 + 9 * x - 10 * %i; +p5 = 11 * x**4 - 12 * %i * x**3 + 13 * x**2 - 14 * %i * x + 15; +p6 = 16 * x**5 - 17 * %i * x**4 + 18 * x**3 - 19 * %i * x**2 + 20 * x - 21 * %i; +p7 = 22 * x**6 - 23 * %i * x**5 + 24 * x**4 - 25 * %i * x**3 + 26 * x**2 - 27 * %i * x + 28; +p8 = %i; +p9 = 2 * %i * x - 3; +p10 = 4 * %i * x**2 + 5 * x - 6 * %i; +p11 = 7 * %i * x**3 + 8 * x**2 - 9 * %i * x + 10; +p12 = 11 * %i * x**4 + 12 * x**3 - 13 * %i * x**2 + 14 * x - 15 * %i; +p13 = 16 * %i * x**5 + 17 * x**4 - 18 * %i * x**3 + 19 * x**2 - 20 * %i * x + 21; +p14 = 22 * %i * x**6 + 23 * x**5 - 24 * %i * x**4 + 25 * x**3 - 26 * %i * x**2 + 27 * x - 28 * %i; +p15 = 29 * %i * x**7 + 30 * x**6 - 31 * %i * x**5 + 32 * x**4 - 33 * %i * x**3 + 34 * x**2 - 35 * %i + 36; +p = [p1, p2, p3, p4, p5 ; p6, p7, p8, p9 ,p10 ; p11, p12, p13, p14, p15]; +p1 = read_poly(p); +coeff2 = coeff(p1); +if or(coeff2 <> coeff1) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/poly_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/poly_writing_api.xml new file mode 100755 index 000000000..5c7d2bd0b --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/poly_writing_api.xml @@ -0,0 +1,176 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Polynomial_management_writing_API" xml:lang="ja"> + <refnamediv> + <refname>多項式の書き込み (Scilabゲートウェイ)</refname> + <refpurpose> + ゲートウェイに多項式の行列を書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal)</synopsis> + <synopsis>SciErr createComplexMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)</synopsis> + <para>Named variable profile:</para> + <synopsis>SciErr createNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal)</synopsis> + <synopsis>SciErr createNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstVarName</term> + <listitem> + <para> + 多項式の変数名 (Scilab5: 最大4文字) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + 各多項式の係数の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 係数の実部を保持する double*の配列のアドレス + (大きさ: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 係数の虚部を保持する double*の配列のアドレス + (大きさ: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはScilab APIにより多項式の行列を処理する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/poly_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/poly_writing_api.tst--> + <!--Lib_name: poly_writing--> + <!--Func_list: write_poly--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int write_poly(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + //出力変数情報 : 多項式の行列 2 x 4 + //[ x + 2 x^2 - 4x + 5 4x^3 - 14x^2 + 18 ; + // 2x^3 - 12x^2 + 64 1 8x^5 + 32x^3] + int iRows = 2; + int iCols = 3; + //varname "x" + char pstVarName[2] = {"x"}; + //係数の配列 + int piNbCoef[6] = {2,4,3,1,4,6}; + //データ配列 + double *pdblReal[6] = {0}; + double pdblPoly0[2] = {2,1}; + double pdblPoly1[4] = {64,0,-12,2}; + double pdblPoly2[3] = {5,-4,1}; + double pdblPoly3[1] = {1}; + double pdblPoly4[4] = {18,0,-14,4}; + double pdblPoly5[6] = {0,0,0,32,0,8}; + pdblReal[0] = pdblPoly0; + pdblReal[1] = pdblPoly1; + pdblReal[2] = pdblPoly2; + pdblReal[3] = pdblPoly3; + pdblReal[4] = pdblPoly4; + pdblReal[5] = pdblPoly5; + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //確保された変数を左辺に代入 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +p_ref = [2 5 18 1 -4 0 0 1 -14 0 0 4 0 0 0 0 0 0;64 1 0 0 0 0 -12 0 0 2 0 32 0 0 0 0 0 8]; +l = list(); +a = write_poly(); +p = coeff(a); +if or(p <> p_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/sparse_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/sparse_reading_api.xml new file mode 100755 index 000000000..214ca32af --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/sparse_reading_api.xml @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Sparse_management_reading_API" xml:lang="ja"> + <refnamediv> + <refname>疎行列の読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + ゲートウェイで疎行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + <synopsis>SciErr getComplexSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr readNamedSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal)</synopsis> + <synopsis>SciErr readNamedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + 返される非ゼロ値の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 返される各行の要素数 (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 返される各要素の列方向の位置 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返される実部データ配列のアドレス (大きさ: _iCols * _iRows) + "名前指定" 関数の場合, _pdblReal は + 関数コール前にメモリを確保する必要があります. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 返される虚部データ配列のアドレス (大きさ: _iCols * _iRows) + "名前指定" 関数の場合, _pdblImg は + 関数コール前にメモリを確保する必要があります. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはScilab APIにより疎行列を処理する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/sparse_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/sparse_reading_api.tst--> + <!--Lib_name: sparse_reading--> + <!--Func_list: read_sparse--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_sparse(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j,k; + int* piAddr = NULL; + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isVarComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal); + } + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciprint("Sparse %d item(s)\n", iNbItem); + k = 0; + for(i = 0 ; i < iRows ; i++) + { + for(j = 0 ; j < piNbItemRow[i] ; j++) + { + sciprint("(%d,%d) = %f", i+1, piColPos[k], pdblReal[k]); + if(isVarComplex(pvApiCtx, piAddr)) + { + sciprint(" %+fi", pdblImg[k]); + } + sciprint("\n"); + k++; + } + } + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +sp=sparse([1,2;4,5;3,10],[1 + 2*%i,2 - 3*%i,-3 + 4*%i]); +read_sparse(sp); + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/sparse_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/sparse_writing_api.xml new file mode 100755 index 000000000..f7e46a51d --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/sparse_writing_api.xml @@ -0,0 +1,265 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="Sparse_management_writing_API" xml:lang="ja"> + <refnamediv> + <refname>疎行列の書き込み (Scilab ゲートウェイ)</refname> + <refpurpose> + ゲートウェイで疎行列を書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsection> + 既存のデータから作成. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal)</synopsis> + <synopsis>SciErr createComplexSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createNamedSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal)</synopsis> + <synopsis>SciErr createNamedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + 疎行列の非ゼロ要素の要素. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 各行の要素数 (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 各要素の列方向の位置 (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 実部データ配列のアドレス (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 虚部データ配列のアドレス (大きさ: _iNbItem). + </para> + <para> + この引数は createSparseMatrix および createNamedSparseMatrixには存在しません. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsynopsisdiv> + <refsection> + Scilabメモリに直接書き込む. + </refsection> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr allocSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + <synopsis>SciErr allocComplexSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iNbItem</term> + <listitem> + <para> + 疎行列の非ゼロ要素の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 返される各行の要素数のアドレス (大きさ: _iRows). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 返される各要素の列方向のアドレス (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 実部データ配列のアドレス (大きさ: _iNbItem). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 虚部データ配列のアドレス (大きさ: _iNbItem). + </para> + <para> + この引数は allocSparseMatrixには存在しません. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプは疎行列を追加する方法を示します.</para> + <para>Scilabメモリに書き込む際には,2種類の関数を使用可能です.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/sparse_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/sparse_writing_api.tst--> + <!--Lib_name: sparse_writing--> + <!--Func_list: write_sparse--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int write_sparse(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int piNbItemRow[] = {1,2,1}; + int piColPos[] = {8,4,7,2}; + double pdblSReal[] = {1,2,3,4}; + double pdblSImg[] = {4,3,2,1}; + int iNbItem = 4; + sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 3, 10, iNbItem, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +sp_ref = sparse([1,8;2,4;2,7;3,2],[1+4*%i,2+3*%i,3+2*%i,4+%i], [3,10]); +sp = write_sparse(); +if or(sp <> sp_ref) then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/string_reading_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/string_reading_api.xml new file mode 100755 index 000000000..05a16fd87 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/string_reading_api.xml @@ -0,0 +1,221 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="String_management_reading_API" xml:lang="ja"> + <refnamediv> + <refname>文字列の読み込み (Scilab ゲートウェイ)</refname> + <refpurpose> + ゲートウェイで文字列の行列を読み込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr getMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings)</synopsis> + <synopsis>SciErr getMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piLength, wchar_t** _pwstStrings)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createNamedMatrixOfString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, char** _pstStrings)</synopsis> + <synopsis>SciErr createNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, wchar_t** _pwstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piLength</term> + <listitem> + <para> + 文字列長の配列のアドレス (要メモリ確保, 大きさ: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + char*の配列のアドレス (要メモリ確保, 大きさ: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstStrings</term> + <listitem> + <para> + wchar_t* の配列のアドレス(要メモリ確保, 大きさ: _piRows * _piCols) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはScilab APIにより文字列の行列を処理する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/string_reading_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/string_reading_api.tst--> + <!--Lib_name: string_reading--> + <!--Func_list: read_string--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int read_string(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int i,j; + int iLen = 0; + //変数の情報 + int iRows = 0; + int iCols = 0; + int* piAddr = NULL; + int* piLen = NULL; + char** pstData = NULL; + //output variable + int iRowsOut = 1; + int iColsOut = 1; + char* pstOut = NULL; + //入力/出力引数の確認 + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + //変数アドレスを取得 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //次元を取得するための最初のコール + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + //各文字列の長さを取得するための2回目のコール + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + //データ取得用の3回目のコール + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //全文字列の長さを計算 + for(i = 0 ; i < iRows * iCols ; i++) + { + iLen += piLen[i]; + } + //出力変数用のメモリを確保 + pstOut = (char*)malloc(sizeof(char) * (iLen + iRows * iCols)); + //文字列を0x00に初期化 + memset(pstOut, 0x00, sizeof(char) * (iLen + iRows * iCols)); + //入力文字列を出力文字列に結合 + for(i = 0 ; i < iRows ; i++) + { + for(j = 0 ; j < iCols ; j++) + { + int iCurLen = strlen(pstOut); + if(iCurLen) + { + strcat(pstOut, " "); + } + strcpy(pstOut + strlen(pstOut), pstData[j * iRows + i]); + } + } + //新規変数を作成 + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRowsOut, iColsOut, &pstOut); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //メモリを解放 + free(piLen); + for(i = 0 ; i < iRows * iCols ; i++) + { + free(pstData[i]); + } + free(pstData); + free(pstOut); + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilabテストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a_ref = ["may the puffin be with you"]; +a = ["may", "the", "puffin"; "be","with","you"]; +b = read_string(a); +if a_ref <> b then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/low_level_functions/string_writing_api.xml b/modules/api_scilab/help/ja_JP/low_level_functions/string_writing_api.xml new file mode 100755 index 000000000..dfeab188a --- /dev/null +++ b/modules/api_scilab/help/ja_JP/low_level_functions/string_writing_api.xml @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="String_management_writing_API" xml:lang="ja"> + <refnamediv> + <refname>文字列の書き込み (Scilab ゲートウェイ)</refname> + <refpurpose> + ゲートウェイに文字列の行列を書き込む方法. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <para>入力引数プロファイル:</para> + <synopsis>SciErr createMatrixOfString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const char* const* _pstStrings)</synopsis> + <synopsis>SciErr createMatrixOfWideString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const wchar_t* const* _pwstStrings)</synopsis> + <para>名前指定変数プロファイル:</para> + <synopsis>SciErr createNamedMatrixOfString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const char* const* _pstStrings)</synopsis> + <synopsis>SciErr createNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const wchar_t* const* _pwstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定"関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + 新規変数の行数 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + 新規変数の列数 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + char*の配列のアドレス (大きさ: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>SciErr</term> + <listitem> + <para> + エラー構造体で,エラーメッセージ履歴と最初のエラー番号を格納します. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para>このヘルプはScilab APIにより文字列の行列を処理する方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/string_writing_api.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/string_writing_api.tst--> + <!--Lib_name: string_writing--> + <!--Func_list: write_string--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int write_string(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + //情報変数 : 文字列の行列 2 x 3 + int iRows = 2; + int iCols = 3; + char** pstData = NULL; + //新規変数にデータを保存 + char string11[] = "may"; + char string21[] = "be"; + char string12[] = "the"; + char string22[] = "with"; + char string13[] = "puffin"; + char string23[] = "you"; + //新規配列用にメモリ確保 + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + //"main" 配列にデータアドレスをコピー + pstData[0] = string11; + pstData[1] = string21; + pstData[2] = string12; + pstData[3] = string22; + pstData[4] = string13; + pstData[5] = string23; + //変数を作成 + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //コンテナを解放 + free(pstData); + //確保された変数を左辺に保存 + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a_ref = "may the puffin be with you "; +b = []; +a = write_string(); +for i=1:size(a,"r") + for j=1:size(a,"c") + b = b + a(i,j); + b = b + " "; + end +end +if b <> a_ref then error("failed"), end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/optionals/getOptionals.xml b/modules/api_scilab/help/ja_JP/optionals/getOptionals.xml new file mode 100755 index 000000000..979f5c52c --- /dev/null +++ b/modules/api_scilab/help/ja_JP/optionals/getOptionals.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getOptionals" xml:lang="ja"> + <refnamediv> + <refname>オプション引数を取得 (Scilabゲートウェイ)</refname> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getOptionals(void* _pvCtx, char* fname, rhs_opts opts[])</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>fname</term> + <listitem> + <para> + コールする関数の名前. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>opts</term> + <listitem> + <para>オプション引数の構造体配列</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>説明</title> + <para> + オプション引数を使用するCゲートウェイ関数. + </para> + </refsection> + <refsection> + <title>例</title> + <para> + この例では, Cインターフェイス関数は + 複数のオプション引数をとり, + その次元を取得します. + </para> + <programlisting role="example"> + <![CDATA[ +#include "api_scilab.h" +#include "sciprint.h" +#include "sciprint.h" +#include "sciprint.h" +int sci_use_optional(char * fname) +{ + SciErr sciErr; + char* pstName = NULL; + int iAge = 0; + int iDL = 0; + static rhs_opts opts[] = + { + { -1, "age", -1, 0, 0, NULL}, + { -1, "drivinglicense", -1, 0, 0, NULL}, + { -1, "name", -1, 0, 0, NULL}, + { -1, NULL, -1, 0, 0, NULL} + }; + int nopt = NumOpt(); + CheckInputArgument(pvApiCtx, 0, nopt); + CheckOutputArgument(pvApiCtx, 0, 1); + if (getOptionals(pvApiCtx, fname, opts) == 0) + { + //Error + return 1; + } + if (opts[0].iPos != -1) + {//age + double dblAge = 0; + getScalarDouble(pvApiCtx, opts[0].piAddr, &dblAge); + iAge = (int)dblAge; + } + else + { + iAge = 77; + } + if (opts[1].iPos != -1) + {//drivinglicense + getScalarBoolean(pvApiCtx, opts[1].piAddr, &iDL); + } + else + { + iDL = 0; + } + if (opts[2].iPos != -1) + {//名前 + getAllocatedSingleString(pvApiCtx, opts[2].piAddr, &pstName); + } + else + { + pstName = strdup("John Doe"); + } + sciprint("Read information: \n"); + sciprint("\tName: \t\t\t%s\n", pstName); + sciprint("\tAge: \t\t\t%d\n", iAge); + sciprint("\tDriving licence: \t%s\n", iDL ? "Yes" : "No"); + //戻り値なし + AssignOutputVariable(pvApiCtx, 0) = 1; + return 0; +} + ]]> + </programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"> + <![CDATA[ +use_optional(); +use_optional(name = "M. Puffin"); +use_optional(age = 25, name = "M. Puffin"); +use_optional(drivinglicense = %t, age = 25, name = "M. Puffin"); + ]]> + </programlisting> + </refsection> + <title>履歴</title> + <revhistory> + <revision> + <revnumber>5.5.0</revnumber> + <revremark>この関数は Scilab 5.5.0で追加されました</revremark> + </revision> + </revhistory> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/A_isPolyType.xml b/modules/api_scilab/help/ja_JP/polynomial/A_isPolyType.xml new file mode 100755 index 000000000..7f076057c --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/A_isPolyType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isPolyType" xml:lang="ja"> + <refnamediv> + <refname>isPolyType</refname> + <refpurpose> + 多項式変数かどうかを調べる. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isPolyType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedPolyType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を代入するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数が多項式型の場合に 1, それ以外 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/B_getAllocatedSinglePoly.xml b/modules/api_scilab/help/ja_JP/polynomial/B_getAllocatedSinglePoly.xml new file mode 100755 index 000000000..6222b917e --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/B_getAllocatedSinglePoly.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedSinglePoly" xml:lang="ja"> + <refnamediv> + <refname>getAllocatedSinglePoly</refname> + <refpurpose> + 多項式変数を1つ取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getAllocatedSinglePoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal)</synopsis> + <synopsis>int getAllocatedNamedSinglePoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + 返される係数の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返されるdoubleの配列. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>成功した場合に 0, それ以外はエラーメッセージへのScilabコンソールに出力し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/C_getAllocatedSingleComplexPoly.xml b/modules/api_scilab/help/ja_JP/polynomial/C_getAllocatedSingleComplexPoly.xml new file mode 100755 index 000000000..ba5fed832 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/C_getAllocatedSingleComplexPoly.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedSingleComplexPoly" xml:lang="ja"> + <refnamediv> + <refname>getAllocatedSingleComplexPoly</refname> + <refpurpose> + 複素数多項式変数を1つ取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>int getAllocatedSingleComplexPoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + <synopsis>int getAllocatedNamedSingleComplexPoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + 返される係数の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返される実部の配列. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 返される虚部の配列. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>成功した場合に 0, それ以外はエラーメッセージへのScilabコンソールに出力し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/D_getAllocatedMatrixOfPoly.xml b/modules/api_scilab/help/ja_JP/polynomial/D_getAllocatedMatrixOfPoly.xml new file mode 100755 index 000000000..c37864e64 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/D_getAllocatedMatrixOfPoly.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedMatrixOfPoly" xml:lang="jaa"> + <refnamediv> + <refname>getAllocatedMatrixOfPoly</refname> + <refpurpose> + 多項式変数の行列を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getAllocatedMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal)</synopsis> + <synopsis>int getAllocatedNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + 返される各多項式の係数の数. (メモリ確保が必要) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返される係数の配列. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>成功した場合に 0, それ以外はエラーメッセージへのScilabコンソールに出力し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/E_getAllocatedMatrixOfComplexPoly.xml b/modules/api_scilab/help/ja_JP/polynomial/E_getAllocatedMatrixOfComplexPoly.xml new file mode 100755 index 000000000..019afc8cf --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/E_getAllocatedMatrixOfComplexPoly.xml @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedMatrixOfComplexPoly" xml:lang="ja"> + <refnamediv> + <refname>getAllocatedMatrixOfComplexPoly</refname> + <refpurpose> + 複素数多項式変数の行列を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getAllocatedMatrixOfComplexPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg)</synopsis> + <synopsis>int getAllocatedNamedMatrixOfComplexPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbCoef</term> + <listitem> + <para> + 返される各多項式の係数の数. (メモリ確保が必要) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返される係数の実部の配列. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 返される係数の虚部の配列. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>成功した場合に 0, それ以外はエラーメッセージへのScilabコンソールに出力し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/F_freeAllocatedSinglePoly.xml b/modules/api_scilab/help/ja_JP/polynomial/F_freeAllocatedSinglePoly.xml new file mode 100755 index 000000000..e6ffdf716 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/F_freeAllocatedSinglePoly.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedSinglePoly" xml:lang="ja"> + <refnamediv> + <refname>freeAllocatedSinglePoly</refname> + <refpurpose> + getAllocatedSinglePoly 関数で確保されたメモリを解放する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void freeAllocatedSinglePoly(double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + getAllocatedSinglePolyで確保された"_pdblReal"ポインタ. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/G_freeAllocatedSingleComplexPoly.xml b/modules/api_scilab/help/ja_JP/polynomial/G_freeAllocatedSingleComplexPoly.xml new file mode 100755 index 000000000..245c615f6 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/G_freeAllocatedSingleComplexPoly.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedSingleComplexPoly" xml:lang="en"> + <refnamediv> + <refname>freeAllocatedSingleComplexPoly</refname> + <refpurpose> + getAllocatedSingleComplexPoly関数で確保されたメモリを解放する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void freeAllocatedSingleComplexPoly(double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + getAllocatedSingleComplexPolyで確保された"_pdblReal"ポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + getAllocatedSingleComplexPolyで確保された"_pdblImg"ポインタ. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/H_freeAllocatedMatrixOfPoly.xml b/modules/api_scilab/help/ja_JP/polynomial/H_freeAllocatedMatrixOfPoly.xml new file mode 100755 index 000000000..f71c75f56 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/H_freeAllocatedMatrixOfPoly.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedMatrixOfPoly" xml:lang="ja"> + <refnamediv> + <refname>freeAllocatedSinglePoly</refname> + <refpurpose> + getAllocatedSinglePoly関数で確保されたメモリを解放. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void freeAllocatedSinglePoly(double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + getAllocatedSinglePolyで確保されたポインタ"_pdblReal". + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/I_freeAllocatedMatrixOfComplexPoly.xml b/modules/api_scilab/help/ja_JP/polynomial/I_freeAllocatedMatrixOfComplexPoly.xml new file mode 100755 index 000000000..8c3de19d6 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/I_freeAllocatedMatrixOfComplexPoly.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedMatrixOfComplexPoly" xml:lang="ja"> + <refnamediv> + <refname>freeAllocatedSinglePoly</refname> + <refpurpose> + getAllocatedSinglePoly関数で確保されたメモリを解放する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void freeAllocatedSinglePoly(double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + getAllocatedSinglePolyで確保された"_pdblReal"ポインタ. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/polynomial/J_polyExample.xml b/modules/api_scilab/help/ja_JP/polynomial/J_polyExample.xml new file mode 100755 index 000000000..a06a69d94 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/polynomial/J_polyExample.xml @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="polyExample" xml:lang="ja"> + <refnamediv> + <refname>多項式の例</refname> + <refpurpose> + 多項式の使用例. + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>この例は多項式変数を取得し,Scilabに返す方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/polyExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/polyExample.tst--> + <!--Lib_name: polyExample--> + <!--Func_list: polyExample--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +int polyExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isPolyType(pvApiCtx, piAddr)) + { + char pstVarName[64]; + int iLen = 0; + sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarName, &iLen); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + if(isScalar(pvApiCtx, piAddr)) + { + int iNbCoef = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedSingleComplexPoly(pvApiCtx, piAddr, &iNbCoef, &pdblReal, &pdblImg); + if(iRet) + { + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + return iRet; + } + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal, &pdblImg); + if(sciErr.iErr) + { + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + } + else + { + iRet = getAllocatedSinglePoly(pvApiCtx, piAddr, &iNbCoef, &pdblReal); + if(iRet) + { + freeAllocatedSinglePoly(pdblReal); + return iRet; + } + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal); + if(sciErr.iErr) + { + freeAllocatedSinglePoly(pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + freeAllocatedSinglePoly(pdblReal); + } + } + else + { + int iRows = 0; + int iCols = 0; + int* piNbCoef = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + if(isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedMatrixOfComplexPoly(pvApiCtx, piAddr, &iRows, &iCols, &piNbCoef, &pdblReal, &pdblImg); + if(iRet) + { + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + return iRet; + } + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg); + if(sciErr.iErr) + { + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + } + else + { + iRet = getAllocatedMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, &piNbCoef, &pdblReal); + if(iRet) + { + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + return iRet; + } + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal); + if(sciErr.iErr) + { + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + } + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = %s; +b = (2 + 3*%i) * %s; +c = [a, 2*a, 3*a;4*a, 5*a, 6*a]; +d = [c + c * %i]; +if polyExample(a) <> a then pause, end +if polyExample(b) <> b then pause, end +if polyExample(c) <> c then pause, end +if polyExample(d) <> d then pause, end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/sparse/A_isSparseType.xml b/modules/api_scilab/help/ja_JP/sparse/A_isSparseType.xml new file mode 100755 index 000000000..e0dd5a9bc --- /dev/null +++ b/modules/api_scilab/help/ja_JP/sparse/A_isSparseType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isSparseType" xml:lang="ja"> + <refnamediv> + <refname>isSparseType</refname> + <refpurpose> + 疎行列変数かどうかを調べる. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isSparseType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedSparseType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + 変数を代入するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>疎行列型の場合に 1, それ以外は 0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/sparse/B_getAllocatedSparseMatrix.xml b/modules/api_scilab/help/ja_JP/sparse/B_getAllocatedSparseMatrix.xml new file mode 100755 index 000000000..adcab4965 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/sparse/B_getAllocatedSparseMatrix.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedSparseMatrix" xml:lang="ja"> + <refnamediv> + <refname>getAllocatedSparseMatrix</refname> + <refpurpose> + 疎行列変数を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getAllocatedSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + <synopsis>int getNamedAllocatedSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + 返される非ゼロ値の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 返される各行の要素の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 返される各要素の列方向位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返される実数データ配列のアドレス. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>成功した場合に 0, それ以外の場合, Scilabコンソールにエラーメッセージを出力し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/sparse/C_getAllocatedComplexSparseMatrix.xml b/modules/api_scilab/help/ja_JP/sparse/C_getAllocatedComplexSparseMatrix.xml new file mode 100755 index 000000000..77f8e8109 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/sparse/C_getAllocatedComplexSparseMatrix.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedComplexSparseMatrix" xml:lang="ja"> + <refnamediv> + <refname>getAllocatedComplexSparseMatrix</refname> + <refpurpose> + 複素数疎行列変数を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getAllocatedComplexSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + <synopsis>int getNamedAllocatedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItem</term> + <listitem> + <para> + 返される非ゼロ値の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piNbItemRow</term> + <listitem> + <para> + 返される各行の要素の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + 返される各要素の列方向位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + 返される実部データ配列のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + 返される虚部データ配列のアドレス (大きさ: _iCols * _iRows) + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>成功した場合に 0, それ以外の場合, Scilabコンソールにエラーメッセージを出力し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/sparse/D_freeAllocatedSparseMatrix.xml b/modules/api_scilab/help/ja_JP/sparse/D_freeAllocatedSparseMatrix.xml new file mode 100755 index 000000000..3357eadc3 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/sparse/D_freeAllocatedSparseMatrix.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedSparseMatrix" xml:lang="ja"> + <refnamediv> + <refname>freeAllocatedSparseMatrix</refname> + <refpurpose> + getAllocatedSparseMatrix関数で確保されたメモリを解放. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void freeAllocatedSparseMatrix(int* _piNbItemRows, int* _piColPos, double* _pdblReal)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_piNbItemRows</term> + <listitem> + <para> + getAllocatedSparseMatrixで確保された"_piNbItemRows" ポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + getAllocatedSparseMatrixで確保された"_piColPos"ポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + getAllocatedSparseMatrixで確保された"_pdblReal". + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/sparse/E_freeAllocatedComplexSparseMatrix.xml b/modules/api_scilab/help/ja_JP/sparse/E_freeAllocatedComplexSparseMatrix.xml new file mode 100755 index 000000000..2b5c21305 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/sparse/E_freeAllocatedComplexSparseMatrix.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedComplexSparseMatrix" xml:lang="ja"> + <refnamediv> + <refname>freeAllocatedComplexSparseMatrix</refname> + <refpurpose> + getAllocatedComplexSparseMatrix関数で確保されたメモリを解放. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void freeAllocatedComplexSparseMatrix(int* _piNbItemRows, int* _piColPos, double* _pdblReal, double* _pdblImg)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_piNbItemRows</term> + <listitem> + <para> + getAllocatedComplexSparseMatrixで確保された"_piNbItemRows"ポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piColPos</term> + <listitem> + <para> + getAllocatedComplexSparseMatrixで確保された"_piColPos"ポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblReal</term> + <listitem> + <para> + getAllocatedComplexSparseMatrixで確保された"_pdblReal"ポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pdblImg</term> + <listitem> + <para> + getAllocatedComplexSparseMatrixで確保された"_pdblImg"ポインタ. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/sparse/F_sparseExample.xml b/modules/api_scilab/help/ja_JP/sparse/F_sparseExample.xml new file mode 100755 index 000000000..4fa259ca5 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/sparse/F_sparseExample.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="sparseExample" xml:lang="ja"> + <refnamediv> + <refname>疎行列の例</refname> + <refpurpose> + 疎行列の使用例. + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>この例は疎行列変数を取得し,Scilabに返す方法を示します.</para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/sparseExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/sparseExample.tst--> + <!--Lib_name: sparseExample--> + <!--Func_list: sparseExample--> + <title>ゲートウェイのソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int sparseExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isSparseType(pvApiCtx, piAddr)) + { + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + if(isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedComplexSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + if(iRet) + { + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + return iRet; + } + sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg); + if(sciErr.iErr) + { + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + } + else + { + iRet = getAllocatedSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal); + if(iRet) + { + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + return iRet; + } + sciErr = createSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal); + if(sciErr.iErr) + { + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = sparse([1,1;2,2;3,3], [1, 2, 3]); +b = sparse([1,1;2,2;3,3], [1 + 2 * %i, 3 , -4 * %i]); +if sparseExample(a) <> a then pause;end +if sparseExample(b) <> b then pause;end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/string/A_isStringType.xml b/modules/api_scilab/help/ja_JP/string/A_isStringType.xml new file mode 100755 index 000000000..b7386d484 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/string/A_isStringType.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isStringType" xml:lang="ja"> + <refnamediv> + <refname>isStringType</refname> + <refpurpose> + 文字列変数かどうかを調べる. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int isStringType(void* _pvCtx, int* _piAddress)</synopsis> + <synopsis>int isNamedStringType(void* _pvCtx, const char* _pstName)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para>変数が文字列型の場合は1,それ以外は0</para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/string/B_getAllocatedSingleString.xml b/modules/api_scilab/help/ja_JP/string/B_getAllocatedSingleString.xml new file mode 100755 index 000000000..82c2edcd6 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/string/B_getAllocatedSingleString.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedSingleString" xml:lang="ja"> + <refnamediv> + <refname>getAllocatedSingleString</refname> + <refpurpose> + 文字列変数を1つ取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getAllocatedSingleString(void* _pvCtx, int* _piAddress, char** _pstData)</synopsis> + <synopsis>int getAllocatedNamedSingleString(void* _pvCtx, const char* _pstName, char** _pstData)</synopsis> + <synopsis>int getAllocatedSingleWideString(void* _pvCtx, int* _piAddress, wchar_t** _pwstData)</synopsis> + <synopsis>int getAllocatedNamedSingleWideString(void* _pvCtx, const char* _pstName, wchar_t** _pwstData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstData</term> + <listitem> + <para> + 戻り値の文字列のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstData</term> + <listitem> + <para> + 戻り値のワイド文字列のアドレス. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/string/C_getAllocatedMatrixOfString.xml b/modules/api_scilab/help/ja_JP/string/C_getAllocatedMatrixOfString.xml new file mode 100755 index 000000000..bbdfa27ec --- /dev/null +++ b/modules/api_scilab/help/ja_JP/string/C_getAllocatedMatrixOfString.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getAllocatedMatrixOfString" xml:lang="ja"> + <refnamediv> + <refname>getAllocatedMatrixOfString</refname> + <refpurpose> + 文字列変数の行列を取得. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int getAllocatedMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, char*** _pstData)</synopsis> + <synopsis>int getAllocatedNamedMatrixOfString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, char*** _pstData)</synopsis> + <synopsis>int getAllocatedMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, wchar_t*** _pwstData)</synopsis> + <synopsis>int getAllocatedNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, wchar_t*** _pwstData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piAddress</term> + <listitem> + <para> + Scilab変数のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piRows</term> + <listitem> + <para> + 返される行の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_piCols</term> + <listitem> + <para> + 返される列の数. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstData</term> + <listitem> + <para> + 返される文字列配列. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstData</term> + <listitem> + <para> + 返されるワイド文字列配列. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/string/D_createSingleString.xml b/modules/api_scilab/help/ja_JP/string/D_createSingleString.xml new file mode 100755 index 000000000..52a9cc616 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/string/D_createSingleString.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="createSingleString" xml:lang="ja"> + <refnamediv> + <refname>createSingleString</refname> + <refpurpose> + 文字列変数を1つ作成. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>int createSingleString(void* _pvCtx, int _iVar, const char* _pstStrings)</synopsis> + <synopsis>int createNamedSingleString(void* _pvCtx, const char* _pstName, const char* _pstStrings)</synopsis> + <synopsis>int createSingleString(void* _pvCtx, int _iVar, const char* _pstStrings)</synopsis> + <synopsis>int createNamedSingleWideString(void* _pvCtx, const char* _pstName, const wchar_t* _pwstStrings)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pvCtx</term> + <listitem> + <para> + Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iVar</term> + <listitem> + <para> + 変数を保存するScilabメモリの位置. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstName</term> + <listitem> + <para> + "名前指定" 関数の場合の変数名. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstStrings</term> + <listitem> + <para> + 文字列のアドレス. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstStrings</term> + <listitem> + <para> + ワイド文字列のアドレス. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>戻り値</title> + <para> + 成功した場合は 0, それ以外はScilabコンソールにエラーメッセージを表示し, + 最初のエラー番号を返します. + </para> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/string/E_freeAllocatedSingleString.xml b/modules/api_scilab/help/ja_JP/string/E_freeAllocatedSingleString.xml new file mode 100755 index 000000000..b93b39b3d --- /dev/null +++ b/modules/api_scilab/help/ja_JP/string/E_freeAllocatedSingleString.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedSingleString" xml:lang="ja"> + <refnamediv> + <refname>freeAllocatedSingleString</refname> + <refpurpose> + getAllocatedSingleString関数で確保されたメモリを開放する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis>void freeAllocatedSingleString(char* _pstData)</synopsis> + <synopsis xml:id="freeAllocatedSingleWideString">void freeAllocatedSingleWideString(wchar_t* _pwstData)</synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_pstData</term> + <listitem> + <para> + getAllocatedSingleStringで確保された"_pstData" ポインタ. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstData</term> + <listitem> + <para> + getAllocatedSingleWideStringで確保された"_pwstData" ポインタ. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/string/F_freeAllocatedMatrixOfString.xml b/modules/api_scilab/help/ja_JP/string/F_freeAllocatedMatrixOfString.xml new file mode 100755 index 000000000..c3cc849ee --- /dev/null +++ b/modules/api_scilab/help/ja_JP/string/F_freeAllocatedMatrixOfString.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="freeAllocatedMatrixOfString" xml:lang="ja"> + <refnamediv> + <refname>freeAllocatedMatrixOfString</refname> + <refpurpose> + freeAllocatedMatrixOfString関数で確保されたメモリを開放する. + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>呼び出し手順</title> + <synopsis> + void freeAllocatedMatrixOfString(int _iRows, int _iCols, char** _pstData) + void freeAllocatedMatrixOfWideString(int _iRows, int _iCols, wchar_t** _pwstData) + </synopsis> + </refsynopsisdiv> + <refsection> + <title>引数</title> + <variablelist> + <varlistentry> + <term>_iRows</term> + <listitem> + <para> + freeAllocatedMatrixOfStringから返された"_piRows"の値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_iCols</term> + <listitem> + <para> + freeAllocatedMatrixOfStringから返された"_piCols"の値. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pstData</term> + <listitem> + <para> + freeAllocatedMatrixOfStringで確保されたポインタ"_pstData". + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>_pwstData</term> + <listitem> + <para> + freeAllocatedWideMatrixOfStringで確保されたポインタ"_pwstData". + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/ja_JP/string/G_stringExample.xml b/modules/api_scilab/help/ja_JP/string/G_stringExample.xml new file mode 100755 index 000000000..3e469c130 --- /dev/null +++ b/modules/api_scilab/help/ja_JP/string/G_stringExample.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="stringExample" xml:lang="ja"> + <refnamediv> + <refname>文字列の例</refname> + <refpurpose> + 文字列の使用例. + </refpurpose> + </refnamediv> + <refsection> + <title>説明</title> + <para>この例は文字列変数を取得し,Scilabに戻すものです + </para> + </refsection> + <refsection> + <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/stringExample.c--> + <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/stringExample.tst--> + <!--Lib_name: stringExample--> + <!--Func_list: stringExample--> + <title>ゲートウェイソース</title> + <programlisting role="code_gateway"><![CDATA[ +#include "api_scilab.h" +int stringExample(char *fname,unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(isStringType(pvApiCtx, piAddr)) + { + if(isScalar(pvApiCtx, piAddr)) + { + char* pstData = NULL; + iRet = getAllocatedSingleString(pvApiCtx, piAddr, &pstData); + if(iRet) + { + freeAllocatedSingleString(pstData); + return iRet; + } + iRet = createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstData); + if(iRet) + { + freeAllocatedSingleString(pstData); + return iRet; + } + freeAllocatedSingleString(pstData); + } + else + { + int iRows = 0; + int iCols = 0; + char** pstData = NULL; + iRet = getAllocatedMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, &pstData); + if(iRet) + { + freeAllocatedMatrixOfString(iRows, iCols, pstData); + return iRet; + } + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pstData); + if(sciErr.iErr) + { + freeAllocatedMatrixOfString(iRows, iCols, pstData); + printError(&sciErr, 0); + return sciErr.iErr; + } + freeAllocatedMatrixOfString(iRows, iCols, pstData); + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} + ]]></programlisting> + </refsection> + <refsection> + <title>Scilab テストスクリプト</title> + <programlisting role="code_scilab"><![CDATA[ +a = "Scilab"; +b = ["New","Scilab";"API","functions"]; +if stringExample(a) <> a then pause, end +if stringExample(b) <> b then pause, end + ]]></programlisting> + </refsection> +</refentry> diff --git a/modules/api_scilab/help/pt_BR/addchapter.sce b/modules/api_scilab/help/pt_BR/addchapter.sce new file mode 100755 index 000000000..8726a369b --- /dev/null +++ b/modules/api_scilab/help/pt_BR/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// 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 + +add_help_chapter("API Scilab",SCI+"/modules/api_scilab/help/en_US",%T); + diff --git a/modules/api_scilab/help/ru_RU/addchapter.sce b/modules/api_scilab/help/ru_RU/addchapter.sce new file mode 100755 index 000000000..6dbb57aaf --- /dev/null +++ b/modules/api_scilab/help/ru_RU/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// 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 + +add_help_chapter("API Scilab",SCI+"/modules/api_scilab/help/ru_RU",%T); + diff --git a/modules/api_scilab/includes/api_boolean.h b/modules/api_scilab/includes/api_boolean.h new file mode 100755 index 000000000..488859fb8 --- /dev/null +++ b/modules/api_scilab/includes/api_boolean.h @@ -0,0 +1,124 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __BOOLEAN_API__ +#define __BOOLEAN_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_boolean.h. Include api_scilab.h instead. +#endif +#ifdef __cplusplus +extern "C" { +#endif + + /** + * Get boolean variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piBool return pointer to data + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr getMatrixOfBoolean(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piBool); + + /** + * Allocate boolean variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _piBool return pointer to data + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr allocMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piBool); + + /** + * Create boolean variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piBool pointer to data + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piBool); + + /** + * Create boolean named variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piBool pointer to data + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piBool); + + /** + * Read boolean named variable + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piBool return pointer to data + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr readNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piBool); + + /*shortcut functions*/ + + /** + * Check if the variable type is boolean + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isBooleanType(void* _pvCtx, int* _piAddress); + + /** + * Check if the variable type is boolean + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedBooleanType(void* _pvCtx, const char* _pstName); + + /** + * Get scalar boolean variable data + * @param[in] _piAddress variable address + * @param[out] _piBool return boolean value + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getScalarBoolean(void* _pvCtx, int* _piAddress, int* _piBool); + + /** + * Get scalar boolean variable data + * @param[in] _pstName variable name + * @param[out] _piBool return boolean value + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getNamedScalarBoolean(void* _pvCtx, const char* _pstName, int* _piBool); + + /** + * Create scalar boolean + * @param[in] _iVar variable number + * @param[in] _iBool value + * @return if the operation succeeded (0) or not ( !0 ) + */ + int createScalarBoolean(void* _pvCtx, int _iVar, int _iBool); + + /** + * Create named scalar double + * @param[in] _pstName variable name + * @param[in] _iBool value + * @return if the operation succeeded (0) or not ( !0 ) + */ + int createNamedScalarBoolean(void* _pvCtx, const char* _pstName, int _iBool); + + +#ifdef __cplusplus +} +#endif +#endif /* __BOOLEAN_API__ */ diff --git a/modules/api_scilab/includes/api_boolean_sparse.h b/modules/api_scilab/includes/api_boolean_sparse.h new file mode 100755 index 000000000..ded3530d3 --- /dev/null +++ b/modules/api_scilab/includes/api_boolean_sparse.h @@ -0,0 +1,136 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __BOOLEAN_SPARSE_API__ +#define __BOOLEAN_SPARSE_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_boolean_sparse.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + /*******************************/ + /* boolean sparse functions */ + /*******************************/ + /** + * Get boolean sparse variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of number of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr getBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos); + + /** + * Allocate boolean sparse variable data + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[out] _piNbItemRow return array of number of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr allocBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos); + + /** + * Create boolean sparse variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow array of number of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos); + + /** + * Create named boolean sparse variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow array of number of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos); + + /** + * Read named boolean sparse variable + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of number of item for each row + * @param[out] _piColPos return array of item column position ( 1 indexed ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr readNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos); + + /* shortcut functions */ + + /** + * Check if the variable type is boolean sparse + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isBooleanSparseType(void* _pvCtx, int* _piAddress); + + /** + * Check if the variable type is boolean sparse + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedBooleanSparseType(void* _pvCtx, const char* _pstName); + + /** + * Get boolean sparse variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of number of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos); + + /** + * Get named boolean sparse variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of number of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getNamedAllocatedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos); + + /** + * Free data allocated by shortcut functions + * @param[in] _piNbItemRow array of number of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + */ + void freeAllocatedBooleanSparse(int* _piNbItemRow, int* _piColPos); + +#ifdef __cplusplus +} +#endif +#endif /* __BOOLEAN_SPARSE_API__ */ diff --git a/modules/api_scilab/includes/api_common.h b/modules/api_scilab/includes/api_common.h new file mode 100755 index 000000000..d31f05568 --- /dev/null +++ b/modules/api_scilab/includes/api_common.h @@ -0,0 +1,450 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * Copyright (C) 2009 - DIGITEO - Allan CORNET + * + * 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 + */ + +#ifndef __COMMON_API__ +#define __COMMON_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_common.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + /** + * The error management structure + * + */ + +#define MESSAGE_STACK_SIZE 5 + + typedef struct api_Err + { + int iErr; /**< The error ID */ + int iMsgCount; /**< Error level */ + char* pstMsg[MESSAGE_STACK_SIZE]; /**< The error message */ + } SciErr; + + typedef struct api_Ctx + { + char* pstName; /**< Function name */ + } StrCtx, *pStrCtx; + +#ifdef _MSC_VER +#ifndef API_SCILAB_EXPORTS + __declspec( dllimport ) StrCtx* pvApiCtx; +#else + extern StrCtx* pvApiCtx; +#endif +#else + extern StrCtx* pvApiCtx; +#endif + +#include "api_scilab.h" + /* generics functions */ + + /*Rhs*/ + int* getNbInputArgument(void* _pvCtx); +#define nbInputArgument(PVCTX) (*getNbInputArgument(PVCTX)) + +#ifdef Rhs +#undef Rhs +#endif +#define Rhs (*getNbInputArgument(pvApiCtx)) + + /*Top*/ + int* getNbArgumentOnStack(void* _pvCtx); +#define nbArgumentOnStack(PVCTX) (*getNbArgumentOnStack(PVCTX)) + +#ifdef Top +#undef Top +#endif +#define Top (*getNbArgumentOnStack(pvApiCtx)) + + /*Lhs*/ + int* getNbOutputArgument(void* _pvCtx); +#define nbOutputArgument(PVCTX) (*getNbOutputArgument(PVCTX)) +#ifdef Lhs +#undef Lhs +#endif +#define Lhs (*getNbOutputArgument(pvApiCtx)) + + /*PutLhs*/ + int* assignOutputVariable(void* _pvCtx, int _iVal); +#define AssignOutputVariable(PVCTX, x) (*assignOutputVariable(PVCTX, x)) +#ifdef LhsVar +#undef LhsVar +#endif +#define LhsVar(x) (*assignOutputVariable(pvApiCtx, x)) + + /*PutLhsVar*/ + int returnArguments(void* _pvCtx); +#define ReturnArguments(PVCTX) if (! returnArguments(PVCTX)) { return 0; } +#ifdef PutLhsVar +#undef PutLhsVar +#endif +#define PutLhsVar() if (! returnArguments(pvApiCtx)) { return 0; } + + /** + * Check input argument count + * @param[in] _iMin min value + * @param[in] _iMax : max value + * @return if _iMin >= rhs >= _iMax + */ + int checkInputArgument(void* _pvCtx, int _iMin, int _iMax); +#define CheckInputArgument(ctx, min, max) \ + if(checkInputArgument(ctx, min, max) == 0) \ + { \ + return 0; \ + } +#ifdef CheckRhs +#undef CheckRhs +#endif +#define CheckRhs(min, max) \ + if(checkInputArgument(pvApiCtx, min, max) == 0) \ + { \ + return 0; \ + } + /** + * Check input argument count + * @param[in] _iMin min value + * @return if rhs >= _iMin + */ + int checkInputArgumentAtLeast(void* _pvCtx, int _iMin); +#define CheckInputArgumentAtLeast(ctx, min) \ + if(checkInputArgumentAtLeast(ctx, min) == 0) \ + { \ + return 0; \ + } + + /** + * Check input argument count + * @param[in] _iMax : max value + * @return if rhs <= max + */ + int checkInputArgumentAtMost(void* _pvCtx, int _iMax); +#define CheckInputArgumentAtMost(ctx, max) \ + if(checkInputArgumentAtMost(ctx, max) == 0) \ + { \ + return 0; \ + } + + /** + * Check output argument count + * @param[in] _iMin min value + * @param[in] _iMax : max value + * @return if _iMin >= lhs >= _iMax + */ + int checkOutputArgument(void* _pvCtx, int _iMin, int _iMax); +#define CheckOutputArgument(ctx, min, max) \ + if(checkOutputArgument(ctx, min, max) == 0) \ + { \ + return 0; \ + } +#ifdef CheckLhs +#undef CheckLhs +#endif +#define CheckLhs(min, max) \ + if(checkOutputArgument(pvApiCtx, min, max) == 0) \ + { \ + return 0; \ + } + + /** + * Check output argument count + * @param[in] _iMin min value + * @return if lhs >= _iMin + */ + int checkOutputArgumentAtLeast(void* _pvCtx, int _iMin); +#define CheckOutputArgumentAtLeast(ctx, min) \ + if(checkOutputArgumentAtLeast(ctx, min) == 0) \ + { \ + return 0; \ + } + + /** + * Check output argument count + * @param[in] _iMax : max value + * @return if lhs <= max + */ + int checkOutputArgumentAtMost(void* _pvCtx, int _iMax); +#define CheckOutputArgumentAtMost(ctx, max) \ + if(checkOutputArgumentAtMost(ctx, max) == 0) \ + { \ + return 0; \ + } + + int callOverloadFunction(void* _pvCtx, int _iVar, char* _pstName, unsigned int _iNameLen); +#define CallOverloadFunction(x) callOverloadFunction(pvApiCtx, x, fname, strlen(fname)) +#ifdef OverLoad +#undef OverLoad +#endif +#define OverLoad(x) callOverloadFunction(pvApiCtx, x, fname, (unsigned int)strlen(fname)) + /** + * Get the memory address of a variable from the variable position + * @param[in] _iVar variable number + * @param[out] _piAddress return variable address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getVarAddressFromPosition(void* _pvCtx, int _iVar, int** _piAddress); + + /** + * Get the name of a variable from the variable position + * @param[in] _iVar variable number + * @param[out] _pstName variable name + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getVarNameFromPosition(void* _pvCtx, int _iVar, char* _pstName); + + /** + * Get the memory address of a variable from the variable name + * @param[in] _pstName variable name + * @param[out] _piAddress return variable address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getVarAddressFromName(void* _pvCtx, const char* _pstName, int** _piAddress); + + /** + * Get the variable type + * @param[in] _piAddress variable address + * @param[out] _piType return variable type ( sci_matrix, sci_strings, ... ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getVarType(void* _pvCtx, int* _piAddress, int* _piType); + + /** + * Get the variable type from the variable name + * @param[in] _pstName variable name + * @param[out] _piType return variable type ( sci_matrix, sci_strings, ... ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getNamedVarType(void* _pvCtx, const char* _pstName, int* _piType); + + /** + * Check if the variable type is complex double, complex sparse double or complex polynomial + * @param[in] _piAddress variable address + * @return if complex 1 otherwise 0 + */ + int isVarComplex(void* _pvCtx, int* _piAddress); + + /** + * Check if the named variable type is complex double, complex sparse double or complex polynomial + * @param[in] _pstName variable name + * @return if complex 1 otherwise 0 + */ + int isNamedVarComplex(void* _pvCtx, const char *_pstName); + + /** + * Get variable dimensions + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of cols + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getVarDimension(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols); + + /** + * Get named variable dimensions + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of cols + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getNamedVarDimension(void* _pvCtx, const char *_pstName, int* _piRows, int* _piCols); + + /** + * Check if a variable is a matrix form ( row x col ) + * @param[in] _piAddress variable address + * @return if matrix form type variable 1 otherwise 0 + */ + int isVarMatrixType(void* _pvCtx, int* _piAddress); + + /** + * Check if a named variable is a matrix form ( row x col ) + * @param[in] _pstName variable name + * @return if matrix form type variable 1 otherwise 0 + */ + int isNamedVarMatrixType(void* _pvCtx, const char *_pstName); + + /** + * Get process mode from input variable + * @param[in] _iPos variable position in function call + * @param[in] _piAddRef variable address + * @param[out] _piMode return process mode ( 0 -> All, 1 -> Row, 2 -> Col ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getProcessMode(void* _pvCtx, int _iPos, int* _piAddRef, int *_piMode); + + /** + * Get dimension for variable, extract value from a single value + * @param[in] _piAddress variable address ( double or int variable ) + * @param[out] _piVal return value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getDimFromVar(void* _pvCtx, int* _piAddress, int* _piVal); + + /** + * Get dimension for a named variable, extract value from a single value + * @param[in] _pstName variable name + * @param[out] _piVal return value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getDimFromNamedVar(void* _pvCtx, const char* _pstName, int* _piVal); + + /** + * Get Rhs value from variable address + * @param[in] _piAddress varaible address + * @return rhs value of the variable, if failed returns 0 + */ + int getRhsFromAddress(void* _pvCtx, int* _piAddress); + + /** + * Check if a variable is a row vector + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isRowVector(void* _pvCtx, int* _piAddress); + + /** + * Check if a variable is a column vector + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isColumnVector(void* _pvCtx, int* _piAddress); + + /** + * Check if a variable is a vector ( row or column ) + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isVector(void* _pvCtx, int* _piAddress); + + /** + * Check if a variable is a scalar + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isScalar(void* _pvCtx, int* _piAddress); + + /** + * Check if a variable is a square matrix + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isSquareMatrix(void* _pvCtx, int* _piAddress); + + /** + * Check matrix dimension + * @param[in] _piAddress variable address + * @param[in] _iRows accepted number of rows ( if -1, don't check ) + * @param[in] _iCols accepted number of columns ( if -1, don't check ) + * @return 1 for true and 0 for false + */ + int checkVarDimension(void* _pvCtx, int* _piAddress, int _iRows, int _iCols); + + /** + * Check if type of variable + * @param[in] _iVar variable position + * @return 1 for true and 0 for false + */ + int getInputArgumentType(void* _pvCtx, int _iVar); + + /** + * Check if type of variable + * @param[in] _iVar variable position + * @param[in] _iType variable type to check + * @return 1 for true and 0 for false + */ + int checkInputArgumentType(void* _pvCtx, int _iVar, int _iType); + + /** + * Check if a matrix is empty + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isEmptyMatrix(void* _pvCtx, int* _piAddress); + + /** + * Create an empty matrix + * @param[in] _iVar variable number + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createEmptyMatrix(void* _pvCtx, int _iVar); + + /** + * Create a named empty matrix + * @param[in] _pstName variable name + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedEmptyMatrix(void* _pvCtx, const char* _pstName); + + /** + * Check if a named variable exists + * @param[in] _pstName variable name + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int isNamedVarExist(void* _pvCtx, const char* _pstName); + + /** + * Check if a named variable is a row vector + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedRowVector(void* _pvCtx, const char* _pstName); + + /** + * Check if a named variable is a column vector + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedColumnVector(void* _pvCtx, const char* _pstName); + + /** + * Check if a named variable is a vector ( row or column ) + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedVector(void* _pvCtx, const char* _pstName); + + /** + * Check if a named variable is a scalar + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedScalar(void* _pvCtx, const char* _pstName); + + /** + * Check if a named variable is a square matrix + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedSquareMatrix(void* _pvCtx, const char* _pstName); + + /** + * Check if a named variable is an empty matrix + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedEmptyMatrix(void* _pvCtx, const char* _pstName); + + /** + * Delete a variable for stack + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int deleteNamedVariable(void* _pvCtx, const char* _pstName); + +#ifdef __cplusplus +} +#endif +#endif /* __COMMON_API__ */ diff --git a/modules/api_scilab/includes/api_double.h b/modules/api_scilab/includes/api_double.h new file mode 100755 index 000000000..f306d1828 --- /dev/null +++ b/modules/api_scilab/includes/api_double.h @@ -0,0 +1,325 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __DOUBLE_API__ +#define __DOUBLE_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_double.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include "doublecomplex.h" + + /*******************************/ + /* double matrix functions */ + /*******************************/ + /** + * Get double variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal); + + /** + * Get complex double variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pdblReal return pointer to real data + * @param[out] _pdblImg return pointer to imaginary data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getComplexMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg); + + /** + * Get double variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of row + * @param[out] _piCols return number of column + * @param[out] _pdblZ return pointer to Z format data ( Real1, Img1, Real2, Img2, ... ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getComplexZMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, doublecomplex** _pdblZ); + + /** + * Get double variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piReal return pointer to real data as integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfDoubleAsInteger(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piReal); + + /** + * Get double variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piReal return pointer to real data as integer + * @param[out] _piImg return pointer to imaginary data as integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getComplexMatrixOfDoubleAsInteger(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piReal, int** _piImg); + + /** + * Allocate a double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal); + + /** + * Allocate a complex double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pdblReal return pointer to real data + * @param[out] _pdblImg return pointer to imaginary data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocComplexMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg); + + /** + * Allocate a double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _piReal return pointer to integer real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfDoubleAsInteger(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piReal); + + /** + * Allocate a complex double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _piReal return pointer to integer real data + * @param[out] _piImg return pointer to integer imaginary data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocComplexMatrixOfDoubleAsInteger(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piReal, int** _piImg); + + + /** + * Allocate a doublecomplex variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pdblData return pointer to doublecomplex data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocComplexZMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const doublecomplex** _pdblData); + + /** + * Create a double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const double* _pdblReal); + + /** + * Create a complex double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblReal pointer to real data + * @param[in] _pdblImg pointer to imaginary data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg); + + /** + * Create a double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piReal pointer to integer real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfDoubleAsInteger(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piReal); + + /** + * Create a complex double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piReal pointer to integer real data + * @param[in] _piImg pointer to integer imaginary data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexMatrixOfDoubleAsInteger(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piReal, const int* _piImg); + + /** + * Create a complex double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblData pointer to Z format data ( Real1, Img1, Real2, Img2, ... ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexZMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const doublecomplex* _pdblData); + + /** + * Create a named double variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const double* _pdblReal); + + /** + * Create a named complex double variable + * @param[in] _pstName variable name + * @param[in] _iRows mumber of rows + * @param[in] _iCols number of columns + * @param[in] _pdblReal pointer to real data + * @param[in] _pdblImg pointer to imaginary data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedComplexMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg); + + /** + * Create a named complex double variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblData pointer to Z format data ( Real1, Img1, Real2, Img2, ... ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedComplexZMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const doublecomplex* _pdblData); + + /** + * Get double named variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pdblReal return real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, double* _pdblReal); + + /** + * Get double named variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pdblReal return real data + * @param[out] _pdblImg return imaginary data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedComplexMatrixOfDouble(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg); + + /*shortcut functions*/ + + + /** + * Check if the variable type is double + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isDoubleType(void* _pvCtx, int* _piAddress); + + /** + * Check if the named variable type is double + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedDoubleType(void* _pvCtx, const char* _pstName); + + /** + * Get scalar double value + * @param[in] _piAddress variable address + * @param[out] _pdblReal return real value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarDouble(void* _pvCtx, int* _piAddress, double* _pdblReal); + + /** + * Get scalar complex double value + * @param[in] _piAddress variable address + * @param[out] _pdblReal return real part + * @param[out] _pdblImg return imaginary part + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarComplexDouble(void* _pvCtx, int* _piAddress, double* _pdblReal, double* _pdblImg); + + /** + * Get scalar double value from a named variable + * @param[in] _pstName variable name + * @param[out] _pdblReal return real value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarDouble(void* _pvCtx, const char* _pstName, double* _pdblReal); + + /** + * Get scalar complex double value from a named variable + * @param[in] _pstName variable name + * @param[out] _pdblReal return real part + * @param[out] _pdblImg return imaginary part + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarComplexDouble(void* _pvCtx, const char* _pstName, double* _pdblReal, double* _pdblImg); + + /** + * Create a scalar double variable + * @param[in] _iVar variable number + * @param[in] _dblReal real value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarDouble(void* _pvCtx, int _iVar, double _dblReal); + + /** + * Create a scalar complex double variable + * @param[in] _iVar variable number + * @param[in] _dblReal real part + * @param[in] _dblImg imaginary part + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarComplexDouble(void* _pvCtx, int _iVar, double _dblReal, double _dblImg); + + /** + * Create a named scalar double variable + * @param[in] _pstName variable name + * @param[in] _dblReal real value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarDouble(void* _pvCtx, const char* _pstName, double _dblReal); + + /** + * Create a named scalar complex double variable + * @param[in] _pstName variable name + * @param[in] _dblReal real part + * @param[in] _dblImg imaginary part + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarComplexDouble(void* _pvCtx, const char* _pstName, double _dblReal, double _dblImg); + +#ifdef __cplusplus +} +#endif +#endif /* __DOUBLE_API__ */ diff --git a/modules/api_scilab/includes/api_error.h b/modules/api_scilab/includes/api_error.h new file mode 100755 index 000000000..11ae40266 --- /dev/null +++ b/modules/api_scilab/includes/api_error.h @@ -0,0 +1,242 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2009 - DIGITEO - Antoine ELIAS +* +* 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 +*/ + +#ifndef __ERROR_API__ +#define __ERROR_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_error.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + /*api list error*/ + + /*common error 1 - 99*/ +#define API_ERROR_INVALID_POINTER 1 +#define API_ERROR_INVALID_TYPE 2 +#define API_ERROR_NOT_MATRIX_TYPE 3 +#define API_ERROR_GET_PROCESSMODE 6 +#define API_ERROR_INVALID_POSITION 7 +#define API_ERROR_INVALID_COMPLEXITY 8 +#define API_ERROR_GET_DIMFROMVAR 9 +#define API_ERROR_CHECKRHS 10 +#define API_ERROR_CHECKLHS 11 + +#define API_ERROR_INVALID_NAME 50 +#define API_ERROR_NAMED_TYPE 51 +#define API_ERROR_NAMED_UNDEFINED_VAR 52 +#define API_ERROR_NAMED_VARDIM 55 +#define API_ERROR_GET_NAMED_DIMFROMVAR 59 +#define API_ERROR_IS_ROW_VECTOR 60 +#define API_ERROR_IS_COLUMN_VECTOR 61 +#define API_ERROR_IS_VECTOR 62 +#define API_ERROR_IS_SCALAR 63 +#define API_ERROR_IS_SQUARE 64 +#define API_ERROR_CHECK_VAR_DIMENSION 65 +#define API_ERROR_CREATE_EMPTY_MATRIX 66 +#define API_ERROR_CREATE_NAMED_EMPTY_MATRIX 67 +#define API_ERROR_IS_NAMED_ROW_VECTOR 68 +#define API_ERROR_IS_NAMED_COLUMN_VECTOR 69 +#define API_ERROR_IS_NAMED_SCALAR 70 +#define API_ERROR_IS_NAMED_SQUARE 71 +#define API_ERROR_CHECK_NAMED_VAR_DIMENSION 72 + + /*double errors 101 - 199*/ +#define API_ERROR_GET_DOUBLE 101 +#define API_ERROR_GET_ZDOUBLE 102 +#define API_ERROR_ALLOC_DOUBLE 103 +#define API_ERROR_ALLOC_COMPLEX_DOUBLE 104 +#define API_ERROR_CREATE_DOUBLE 105 +#define API_ERROR_CREATE_COMPLEX_DOUBLE 106 +#define API_ERROR_CREATE_ZDOUBLE 107 +#define API_ERROR_READ_NAMED_DOUBLE 108 +#define API_ERROR_GET_SCALAR_DOUBLE 109 +#define API_ERROR_CREATE_SCALAR_DOUBLE 110 +#define API_ERROR_CREATE_NAMED_SCALAR 111 +#define API_ERROR_GET_NAMED_SCALAR_DOUBLE 112 + + /*poly errors 201 - 299*/ +#define API_ERROR_GET_POLY_VARNAME 201 +#define API_ERROR_GET_POLY 202 +#define API_ERROR_CREATE_POLY 203 +#define API_ERROR_TOO_LONG_VAR 204 +#define API_ERROR_CREATE_NAMED_POLY 207 +#define API_ERROR_READ_NAMED_POLY 208 +#define API_ERROR_GET_ALLOC_SINGLE_POLY 209 +#define API_ERROR_GET_ALLOC_NAMED_SINGLE_POLY 210 +#define API_ERROR_GET_ALLOC_MATRIX_POLY 211 +#define API_ERROR_GET_ALLOC_NAMED_MATRIX_POLY 212 + + /*boolean errors 401 - 499*/ +#define API_ERROR_GET_BOOLEAN 401 +#define API_ERROR_CREATE_BOOLEAN 402 +#define API_ERROR_CREATE_NAMED_BOOLEAN 403 +#define API_ERROR_READ_BOOLEAN 404 +#define API_ERROR_CREATE_SCALAR_BOOLEAN 405 +#define API_ERROR_CREATE_NAMED_SCALAR_BOOLEAN 406 + + /*sparse errors 501 - 599*/ +#define API_ERROR_GET_SPARSE 501 +#define API_ERROR_ALLOC_SPARSE 502 +#define API_ERROR_CREATE_SPARSE 504 +#define API_ERROR_CREATE_NAMED_SPARSE 505 +#define API_ERROR_READ_NAMED_SPARSE 506 +#define API_ERROR_GET_ALLOC_SPARSE 507 +#define API_ERROR_GET_NAMED_ALLOC_SPARSE 508 + + /*boolean sparse errors 601 - 699*/ +#define API_ERROR_GET_BOOLEAN_SPARSE 601 +#define API_ERROR_ALLOC_BOOLEAN_SPARSE 602 +#define API_ERROR_FILL_BOOLEAN_SPARSE 603 +#define API_ERROR_CREATE_BOOLEAN_SPARSE 604 +#define API_ERROR_CREATE_NAMED_BOOLEAN_SPARSE 605 +#define API_ERROR_READ_NAMED_BOOLEAN_SPARSE 606 +#define API_ERROR_GET_SCALAR_BOOLEAN 607 +#define API_ERROR_GET_NAMED_SCALAR_BOOLEAN 608 +#define API_ERROR_GET_ALLOC_BOOLEAN_SPARSE 611 +#define API_ERROR_GET_NAMED_ALLOC_BOOLEAN_SPARSE 612 + + /*matlab sparse errors 701 - 799*/ + + /*ints errors 801 - 899*/ +#define API_ERROR_GET_INT 802 +#define API_ERROR_CREATE_INT 803 +#define API_ERROR_ALLOC_INT 804 +#define API_ERROR_GET_NAMED_INT_PRECISION 805 +#define API_ERROR_READ_NAMED_INT 806 +#define API_ERROR_GET_SCALAR_INTEGER 807 +#define API_ERROR_GET_NAMED_SCALAR_INTEGER 808 +#define API_ERROR_CREATE_SCALAR_INT 809 +#define API_ERROR_CREATE_NAMED_SCALAR_INT 810 + + /*handles errors 901 - 999*/ +#define API_ERROR_GET_HANDLE 902 +#define API_ERROR_CREATE_HANDLE 903 +#define API_ERROR_GET_SCALAR_HANDLE 907 +#define API_ERROR_CREATE_SCALAR_HANDLE 909 + + /*strings errors 1001 - 1099*/ +#define API_ERROR_GET_STRING 1001 +#define API_ERROR_INVALID_SUBSTRING_POINTER 1002 +#define API_ERROR_CREATE_STRING 1003 +#define API_ERROR_CREATE_NAMED_STRING 1005 +#define API_ERROR_READ_NAMED_STRING 1006 +#define API_ERROR_GET_WIDE_STRING 1007 +#define API_ERROR_CREATE_WIDE_STRING 1008 +#define API_ERROR_CREATE_NAMED_WIDE_STRING 1009 +#define API_ERROR_READ_NAMED_WIDE_STRING 1010 +#define API_ERROR_GET_ALLOC_SINGLE_STRING 1011 +#define API_ERROR_GET_ALLOC_SINGLE_WIDE_STRING 1012 +#define API_ERROR_GET_ALLOC_STRING_MATRIX 1013 +#define API_ERROR_GET_ALLOC_WIDE_STRING_MATRIX 1014 +#define API_ERROR_GET_ALLOC_NAMED_SINGLE_STRING 1015 +#define API_ERROR_GET_ALLOC_NAMED_SINGLE_WIDE_STRING 1016 +#define API_ERROR_GET_ALLOC_NAMED_STRING_MATRIX 1017 +#define API_ERROR_GET_ALLOC_NAMED_WIDE_STRING_MATRIX 1018 +#define API_ERROR_CREATE_SINGLE_STRING 1019 +#define API_ERROR_CREATE_SINGLE_WIDE_STRING 1020 +#define API_ERROR_CREATE_NAMED_SINGLE_STRING 1021 +#define API_ERROR_CREATE_NAMED_SINGLE_WIDE_STRING 1022 + + /*list errors 1501 - 1599*/ +#define API_ERROR_LIST_ITEM_NUMBER 1501 +#define API_ERROR_INVALID_LIST_TYPE 1502 +#define API_ERROR_GET_ITEM_ADDRESS 1503 +#define API_ERROR_CREATE_NAMED_LIST 1504 +#define API_ERROR_CREATE_LIST 1505 +#define API_ERROR_READ_NAMED_LIST 1506 +#define API_ERROR_GET_LIST_IN_LIST 1507 +#define API_ERROR_GET_LIST_IN_NAMED_LIST 1508 +#define API_ERROR_CREATE_LIST_IN_LIST 1509 +#define API_ERROR_CREATE_LIST_IN_NAMED_LIST 1510 +#define API_ERROR_ITEM_LIST_NUMBER 1511 +#define API_ERROR_NON_ORDERED_INSERTION 1512 +#define API_ERROR_ALLOC_IN_LIST 1513 +#define API_ERROR_CREATE_VOID_IN_LIST 1514 + /*double in list*/ +#define API_ERROR_GET_DOUBLE_IN_LIST 1520 +#define API_ERROR_ALLOC_DOUBLE_IN_LIST 1521 +#define API_ERROR_CREATE_ZDOUBLE_IN_LIST 1523 +#define API_ERROR_CREATE_DOUBLE_IN_LIST 1524 +#define API_ERROR_CREATE_ZDOUBLE_IN_NAMED_LIST 1525 +#define API_ERROR_CREATE_DOUBLE_IN_NAMED_LIST 1526 +#define API_ERROR_READ_DOUBLE_IN_NAMED_LIST 1527 + + /*string in list*/ +#define API_ERROR_GET_STRING_IN_LIST 1530 +#define API_ERROR_FILL_STRING_IN_LIST 1531 +#define API_ERROR_CREATE_STRING_IN_LIST 1532 +#define API_ERROR_CREATE_STRING_IN_NAMED_LIST 1534 +#define API_ERROR_READ_STRING_IN_NAMED_LIST 1535 + + /*boolean in list*/ +#define API_ERROR_GET_BOOLEAN_IN_LIST 1540 +#define API_ERROR_CREATE_BOOLEAN_IN_LIST 1541 +#define API_ERROR_ALLOC_BOOLEAN_IN_LIST 1542 +#define API_ERROR_FILL_BOOLEAN_IN_LIST 1543 +#define API_ERROR_CREATE_BOOLEAN_IN_NAMED_LIST 1544 +#define API_ERROR_READ_BOOLEAN_IN_NAMED_LIST 1545 + + /*poly in list*/ +#define API_ERROR_GET_POLY_IN_LIST 1550 +#define API_ERROR_CREATE_POLY_IN_LIST 1551 +#define API_ERROR_FILL_POLY_IN_LIST 1552 +#define API_ERROR_CREATE_POLY_IN_NAMED_LIST 1553 +#define API_ERROR_READ_POLY_IN_NAMED_LIST 1554 + + /*int in list*/ +#define API_ERROR_FILL_INT_IN_LIST 1560 +#define API_ERROR_ALLOC_INT_IN_LIST 1561 +#define API_ERROR_CREATE_INT_IN_LIST 1562 +#define API_ERROR_GET_INT_IN_LIST 1563 +#define API_ERROR_CREATE_INT_IN_NAMED_LIST 1564 +#define API_ERROR_READ_INT_IN_NAMED_LIST 1565 + + /*sparse in list*/ +#define API_ERROR_FILL_SPARSE_IN_LIST 1570 +#define API_ERROR_CREATE_SPARSE_IN_LIST 1571 +#define API_ERROR_CREATE_SPARSE_IN_NAMED_LIST 1572 +#define API_ERROR_GET_SPARSE_IN_LIST 1573 +#define API_ERROR_READ_SPARSE_IN_NAMED_LIST 1574 + + /*boolean sparse in list*/ +#define API_ERROR_FILL_BOOLEAN_SPARSE_IN_LIST 1580 +#define API_ERROR_CREATE_BOOLEAN_SPARSE_IN_LIST 1581 +#define API_ERROR_CREATE_BOOLEAN_SPARSE_IN_NAMED_LIST 1582 +#define API_ERROR_GET_BOOLEAN_SPARSE_IN_LIST 1583 +#define API_ERROR_READ_BOOLEAN_SPARSE_IN_NAMED_LIST 1584 + + /*pointer in list*/ +#define API_ERROR_GET_POINTER_IN_LIST 1590 +#define API_ERROR_CREATE_POINTER_IN_NAMED_LIST 1591 +#define API_ERROR_READ_POINTER_IN_NAMED_LIST 1592 +#define API_ERROR_CREATE_POINTER_IN_LIST 1593 + + /*pointer errors 12801 - 12899*/ +#define API_ERROR_GET_POINTER 12801 +#define API_ERROR_ALLOC_POINTER 12803 +#define API_ERROR_CREATE_POINTER 12804 +#define API_ERROR_CREATE_NAMED_POINTER 12805 +#define API_ERROR_READ_POINTER 12806 + + /* error functions*/ + int addStackSizeError(SciErr* _psciErr, char* _pstCaller, int iNeeded); + int addErrorMessage(SciErr* _psciErr, int _iErr, const char* _pstMsg, ...); + int printError(SciErr* _psciErr, int _iLastMsg); + char* getErrorMessage(SciErr _sciErr); + +#ifdef __cplusplus +} +#endif +#endif /* __ERROR_API__ */ diff --git a/modules/api_scilab/includes/api_handle.h b/modules/api_scilab/includes/api_handle.h new file mode 100755 index 000000000..4b6dac61c --- /dev/null +++ b/modules/api_scilab/includes/api_handle.h @@ -0,0 +1,84 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#ifndef __HANDLE_API__ +#define __HANDLE_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_handle.h. Include api_scilab.h instead. +#endif +#ifdef __cplusplus +extern "C" { +#endif + + /** + * Get handle variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pllHandle return pointer to data + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr getMatrixOfHandle(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, long long** _pllHandle); + + /** + * Allocate handle variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pllHandle return pointer to data + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr allocMatrixOfHandle(void* _pvCtx, int _iVar, int _iRows, int _iCols, long long** _pllHandle); + + /** + * Create handle variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pllHandle pointer to data + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createMatrixOfHandle(void* _pvCtx, int _iVar, int _iRows, int _iCols, long long* _pllHandle); + + /*shortcut functions*/ + + /** + * Check if the variable type is handle + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isHandleType(void* _pvCtx, int* _piAddress); + + /** + * Get scalar handle variable data + * @param[in] _piAddress variable address + * @param[out] _pllHandle return handle value + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getScalarHandle(void* _pvCtx, int* _piAddress, long long* _pllHandle); + + /** + * Create scalar handle + * @param[in] _iVar variable number + * @param[in] _llHandle value + * @return if the operation succeeded (0) or not ( !0 ) + */ + int createScalarHandle(void* _pvCtx, int _iVar, long long _llHandle); + +#ifdef __cplusplus +} +#endif +#endif /* !__HANDLE_API__ */
\ No newline at end of file diff --git a/modules/api_scilab/includes/api_hypermat.h b/modules/api_scilab/includes/api_hypermat.h new file mode 100755 index 000000000..8240f7085 --- /dev/null +++ b/modules/api_scilab/includes/api_hypermat.h @@ -0,0 +1,333 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET + * + * 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 + */ + +#ifndef __HYPERMAT_API__ +#define __HYPERMAT_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_hypermat.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include "doublecomplex.h" + + /**************************************/ + /* Hypermatrices matrix functions */ + /**************************************/ + + /** + * Check if the variable type is double + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isHypermatType(void* _pvCtx, int* _piAddress); + + /** + * Check if the variable is complex + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isHypermatComplex(void* _pvCtx, int* _piAddress); + + /** + * Get the base type + * @param[in] _piAddress variable address + * @param[out] _piType return the base type + */ + SciErr getHypermatType(void *_pvCtx, int *_piAddress, int *_piType); + + /** + * Get integer precision ( SCI_xINTx ) + * @param[in] _piAddress variable address + * @param[out] _piPrecison return integer precision ( SCI_xINTx ) + */ + SciErr getHypermatOfIntegerPrecision(void *_pvCtx, int *_piAddress, int *_piPrecision); + + /** + * Get the hypermatrix dimensions + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + */ + SciErr getHypermatDimensions(void *_pvCtx, int *_piAddress, int **_dims, int *_ndims); + + /** + * Get the hypermatrix entries address + * @param[in] _piAddress variable address + * @param[out] return _piEntriesAddress entries address + */ + SciErr getHypermatEntries(void* _pvCtx, int* _piAddress, int ** _piEntriesAddress); + + /** + * Get polynomial variable name + * @param[in] _piAddress variable address + * @param[out] _pstVarName return variable name of polynomials + * @param[out] _piVarNameLen return length of _pstVarName + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getHypermatPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return real coefficients + */ + SciErr getHypermatOfPoly(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piNbCoef, double** _pdblReal); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return real coefficients + * @param[out] _pdblImg return imaginary coefficients + */ + SciErr getComplexHypermatOfPoly(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _piLength return strings lengths + * @param[out] _pstStrings return the strings data + */ + SciErr getHypermatOfString(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piLength, char** _pstStrings); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _piLength return strings lengths + * @param[out] _pwstStrings return the strings data + */ + SciErr getHypermatOfWideString(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piLength, wchar_t** _pwstStrings); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _pdblReal return the double data + */ + SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double** _pdblReal); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _pdblReal return the real data + * @param[out] _pdblImg return the imaginary data + */ + SciErr getComplexHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double** _pdblReal, double** _pdblImg); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _pucData8 return the unsigned char data + */ + SciErr getHypermatOfUnsignedInteger8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char** _pucData8); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _pcData8 return the char data + */ + SciErr getHypermatOfInteger8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char** _pcData8); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _pusData16 return the unsigned short data + */ + SciErr getHypermatOfUnsignedInteger16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short** _pusData16); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _psData16 return the short data + */ + SciErr getHypermatOfInteger16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short** _psData16); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _puiData32 return the unsigned int data + */ + SciErr getHypermatOfUnsignedInteger32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int** _puiData32); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _piData32 return the int data + */ + SciErr getHypermatOfInteger32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int** _piData32); + + /** + * Get the hypermatrix dimensions and data + * @param[in] _piAddress variable address + * @param[out] _dims return the dimensions + * @param[out] _ndims return the number of dimensions + * @param[out] _piBool return the boolean data + */ + SciErr getHypermatOfBoolean(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int** _piBool); + + /** + * Create a polynomial hypermatrix + * @param[in] _iVar variable number + * @param[in] _pstVarName polynomial variable name + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int *_dims, int _ndims, const int* _piNbCoef, const double* const* _pdblReal); + + /** + * Create a complex polynomial hypermatrix + * @param[in] _iVar variable number + * @param[in] _pstVarName polynomial variable name + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real coefficients + * @param[in] _pdblImg pointer to imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexHypermatOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int *_dims, int _ndims, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); + + /** + * Create a double hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfDouble(void* _pvCtx, int _iVar, int *_dims, int _ndims, const double* _pdblReal); + SciErr allocHypermatOfDouble(void *_pvCtx, int _iVar, int * _dims, int _ndims, double** _pdblReal); + + /** + * Create a complex hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexHypermatOfDouble(void* _pvCtx, int _iVar, int *_dims, int _ndims, const double* _pdblReal, const double* _pdblImg); + + /** + * Create a boolean hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _piBool pointer to boolean data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfBoolean(void* _pvCtx, int _iVar, int *_dims, int _ndims, const int* _piBool); + + /** + * Create a string hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _pstStrings pointer to string data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfString(void* _pvCtx, int _iVar, int *_dims, int _ndims, const char* const* _pstStrings); + + /** + * Create a int8 hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _pcData8 pointer to char data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfInteger8(void* _pvCtx, int _iVar, int *_dims, int _ndims, const char* _pcData8); + + /** + * Create a uint8 hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _pucData8 pointer to unsigned char data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfUnsignedInteger8(void* _pvCtx, int _iVar, int *_dims, int _ndims, const unsigned char* _pucData8); + + /** + * Create a int16 hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _psData16 pointer to short data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfInteger16(void* _pvCtx, int _iVar, int *_dims, int _ndims, const short* _psData16); + + /** + * Create a uint16 hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _pusData16 pointer to unsigned short data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfUnsignedInteger16(void* _pvCtx, int _iVar, int *_dims, int _ndims, const unsigned short* _pusData16); + + /** + * Create a int32 hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _piData32 pointer to int data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfInteger32(void* _pvCtx, int _iVar, int *_dims, int _ndims, const int* _piData32); + + /** + * Create a uint32 hypermatrix + * @param[in] _iVar variable number + * @param[in] _dims the dimensions + * @param[in] _ndims the number of dimensions + * @param[in] _puiData32 pointer to unsigned int data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createHypermatOfUnsignedInteger32(void* _pvCtx, int _iVar, int *_dims, int _ndims, const unsigned int* _puiData32); + +#ifdef __cplusplus +} +#endif +#endif /* __HYPERMAT_API__ */ diff --git a/modules/api_scilab/includes/api_int.h b/modules/api_scilab/includes/api_int.h new file mode 100755 index 000000000..a0525cc10 --- /dev/null +++ b/modules/api_scilab/includes/api_int.h @@ -0,0 +1,765 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __INT_API__ +#define __INT_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_int.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + /* These values are also used in: + * modules/core/includes/sci_types.h */ +#define SCI_INT8 1 +#define SCI_INT16 2 +#define SCI_INT32 4 +#define SCI_INT64 8 + +#define SCI_UINT8 11 +#define SCI_UINT16 12 +#define SCI_UINT32 14 +#define SCI_UINT64 18 + + /********************************/ + /* integer matrix functions */ + /********************************/ + + /** + * Get integer precision ( SCI_xINTx ) + * @param[in] _piAddress variable address + * @param[out] _piPrecison return integer precision ( SCI_xINTx ) + */ + SciErr getMatrixOfIntegerPrecision(void* _pvCtx, int* _piAddress, int* _piPrecision); + + /** + * Get 8-bit integer variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pcData8 return pointer to 8-bit integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfInteger8(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, char** _pcData8); + + /** + * Get 8-bit unsigned integer variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pucData8 return pointer to 8-bit unsigned integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfUnsignedInteger8(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned char** _pucData8); + + /** + * Get 16-bit integer variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _psData16 return pointer to 16-bit integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfInteger16(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, short** _psData16); + + /** + * Get 16-bit unsigned integer variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pusData16 return pointer to 16-bit unsigned integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfUnsignedInteger16(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned short** _pusData16); + + /** + * Get 32-bit integer variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piData32 return pointer to 32-bit integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfInteger32(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piData32); + + /** + * Get 32-bit unsigned integer variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _puiData32 return pointer to 32-bit unsigned integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfUnsignedInteger32(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned int** _puiData32); + + +#ifdef __SCILAB_INT64__ + + /** + * Get 64-bit integer variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pllData64 return pointer to 64-bit integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfInteger64(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, long long** _pllData64); + + /** + * Get 64-bit unsigned integer variable + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pullData64 return pointer to 64-bit unsigned integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfUnsignedInteger64(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned long long** _pullData64); + +#endif + + /** + * Create 8-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pcData8 array of 8-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, const char* _pcData8); + + /** + * Create 8-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pucData8 array of 8-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned char* _pucData8); + + /** + * Create 16-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _psData16 array of 16-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, const short* _psData16); + + /** + * Create 16-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pusData16 array of 16-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned short* _pusData16); + + /** + * Create 32-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piData32 array of 32-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piData32); + + /** + * Create 32-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _puiData32 array of 32-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned int* _puiData32); + +#ifdef __SCILAB_INT64__ + + /** + * Create 64-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pllData64 array of 64-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger64(void* _pvCtx, int _iVar, int _iRows, int _iCols, const long long* _pllData64); + + /** + * Create 64-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pullData64 array of 64-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger64(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned long long* _pullData64); + +#endif + + /** + * Create named 8-bit integer variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pcData8 array of 8-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfInteger8(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const char* _pcData8); + + /** + * Create named 8-bit unsigned integer variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pucData8 array of 8-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfUnsignedInteger8(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned char* _pucData8); + + /** + * Create named 16-bit integer variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _psData16 array of 16-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfInteger16(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const short* _psData16); + + /** + * Create named 16-bit unsigned integer variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pusData16 array of 16-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfUnsignedInteger16(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned short* _pusData16); + + /** + * Create named 32-bit integer variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piData32 array of 32-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfInteger32(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piData32); + + /** + * Create named 32-bit unsigned integer variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _puiData32 array of 32-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfUnsignedInteger32(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned int* _puiData32); + +#ifdef __SCILAB_INT64__ + + /** + * Create named 64-bit integer variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pllData64 array of 64-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfInteger64(void* _pvCtx, cosnt char* _pstName, int _iRows, int _iCols, const long long* _pllData64); + + /** + * Create named 64-bit unsigned integer variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pullData64 array of 64-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMatrixOfUnsignedInteger64(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned long long* _pullData64); + +#endif + + /** + * Allocate 8-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pcData8 return array of 8-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, char** _pcData8); + + /** + * Allocate 8-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pucData8 return array of 8-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfUnsignedInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned char** _pucData8); + + /** + * Allocate 16-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _psData16 return array of 16-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, short** _psData16); + + /** + * Allocate 16-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pusData16 return array of 16-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfUnsignedInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned short** _pusData16); + + /** + * Allocate 32-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _piData32 return array of 32-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piData32); + + /** + * Allocate 32-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _puiData32 return array of 32-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfUnsignedInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned int** _puiData32); + +#ifdef __SCILAB_INT64__ + + /** + * Allocate 64-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pllData64 return array of 64-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfInteger64(void* _pvCtx, int _iVar, int _iRows, int _iCols, long long** _pllData64); + + /** + * Allocate 64-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pullData64 return array of 64-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfUnsignedInteger64(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned long long** _pullData64); + +#endif + + /** + * Get integer precision of a named variable ( SCI_xINTx ) + * @param[in] _pstName variable name + * @param[out] _piPrecison return integer precision ( SCI_xINTx ) + */ + SciErr getNamedMatrixOfIntegerPrecision(void* _pvCtx, const char* _pstName, int* _piPrecision); + + /** + * Read named 8-bit integer variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pcData8 return array of 8-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfInteger8(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, char* _pcData8); + + /** + * Read named 8-bit unsigned integer variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pucData8 return array of 8-bit unsigned integer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfUnsignedInteger8(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned char* _pucData8); + + /** + * Read named 16-bit integer variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _psData16 return array of 16-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfInteger16(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, short* _psData16); + + /** + * Read named 16-bit unsigned integer variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pusData16 return array of 16-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfUnsignedInteger16(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned short* _pusData16); + + /** + * Read named 32-bit integer variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piData32 return array of 32-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfInteger32(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piData32); + + /** + * Read named 32-bit unsigned integer variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _puiData32 return array of 32-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfUnsignedInteger32(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned int* _puiData32); + +#ifdef __SCILAB_INT64__ + + /** + * Read named 64-bit integer variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pllData64 return array of 64-bit integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfInteger64(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, long long* _pllData64); + + /** + * Read named 64-bit unsigned integer variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pullData64 return array of 64-bit unsigned integers + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMatrixOfUnsignedInteger64(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned long long* _pullData64); + +#endif + + /* shortcut functions */ + + /** + * Check if the type of a variable is integer + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isIntegerType(void* _pvCtx, int* _piAddress); + + /** + * Check if the type of a named variable is integer + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedIntegerType(void* _pvCtx, const char* _pstName); + + /** + * Get scalar 8-bit integer value + * @param[in] _piAddress variable address + * @param[out] _pcData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarInteger8(void* _pvCtx, int* _piAddress, char* _pcData); + + /** + * Get scalar 8-bit unsigned integer value + * @param[in] _piAddress variable address + * @param[out] _pucData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarUnsignedInteger8(void* _pvCtx, int* _piAddress, unsigned char* _pucData); + + /** + * Get scalar 16-bit integer value + * @param[in] _piAddress variable address + * @param[out] _psData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarInteger16(void* _pvCtx, int* _piAddress, short* _psData); + + /** + * Get scalar 16-bit unsigned integer value + * @param[in] _piAddress variable address + * @param[out] _pusData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarUnsignedInteger16(void* _pvCtx, int* _piAddress, unsigned short* _pusData); + + /** + * Get scalar 32-bit integer value + * @param[in] _piAddress variable address + * @param[out] _piData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarInteger32(void* _pvCtx, int* _piAddress, int* _piData); + + /** + * Get scalar 32-bit unsigned integer value + * @param[in] _piAddress variable address + * @param[out] _puiData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarUnsignedInteger32(void* _pvCtx, int* _piAddress, unsigned int* _puiData); + +#ifdef __SCILAB_INT64__ + + /** + * Get scalar 64-bit integer value + * @param[in] _piAddress variable address + * @param[out] _pllData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarInteger64(void* _pvCtx, int* _piAddress, long long* _pllData); + + /** + * Get scalar 64-bit unsigned integer value + * @param[in] _piAddress variable address + * @param[out] _pullData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getScalarUnsignedInteger64(void* _pvCtx, int* _piAddress, unsigned long long* _pullData); + +#endif + + /** + * Get named scalar 8-bit integer value + * @param[in] _pstName variable name + * @param[out] _pcData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarInteger8(void* _pvCtx, const char* _pstName, char* _pcData); + + /** + * Get named scalar 8-bit unsigned integer value + * @param[in] _pstName variable name + * @param[out] _pucData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarUnsignedInteger8(void* _pvCtx, const char* _pstName, unsigned char* _pucData); + + /** + * Get named scalar 16-bit integer value + * @param[in] _pstName variable name + * @param[out] _psData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarInteger16(void* _pvCtx, const char* _pstName, short* _psData); + + /** + * Get named scalar 16-bit unsigned integer value + * @param[in] _pstName variable name + * @param[out] _pusData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarUnsignedInteger16(void* _pvCtx, const char* _pstName, unsigned short* _pusData); + + /** + * Get named scalar 32-bit integer value + * @param[in] _pstName variable name + * @param[out] _piData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarInteger32(void* _pvCtx, const char* _pstName, int* _piData); + + /** + * Get named scalar 32-bit unsigned integer value + * @param[in] _pstName variable name + * @param[out] _puiData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarUnsignedInteger32(void* _pvCtx, const char* _pstName, unsigned int* _puiData); + +#ifdef __SCILAB_INT64__ + + /** + * Get named scalar 64-bit integer value + * @param[in] _pstName variable name + * @param[out] _pllData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarInteger64(void* _pvCtx, const char* _pstName, long long* _pllData); + + /** + * Get named scalar 64-bit unsigned integer value + * @param[in] _pstName variable name + * @param[out] _pullData return integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedScalarUnsignedInteger64(void* _pvCtx, const char* _pstName, unsigned long long* _pullData); + +#endif + + /** + * Create scalar 8-bit integer variable + * @param[in] _iVar variable number + * @param[in] _cData 8-bit integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarInteger8(void* _pvCtx, int _iVar, char _cData); + + /** + * Create scalar 8-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _ucData 8-bit unsigned integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarUnsignedInteger8(void* _pvCtx, int _iVar, unsigned char _ucData); + + /** + * Create scalar 16-bit integer variable + * @param[in] _iVar variable number + * @param[in] _sData 16-bit integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarInteger16(void* _pvCtx, int _iVar, short _sData); + + /** + * Create scalar 16-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _usData 16-bit unsigned integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarUnsignedInteger16(void* _pvCtx, int _iVar, unsigned short _usData); + + /** + * Create scalar 32-bit integer variable + * @param[in] _iVar variable number + * @param[in] _iData 32-bit integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarInteger32(void* _pvCtx, int _iVar, int _iData); + + /** + * Create scalar 32-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _uiData 32-bit unsigned integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarUnsignedInteger32(void* _pvCtx, int _iVar, unsigned int _uiData); + +#ifdef __SCILAB_INT64__ + + /** + * Create scalar 64-bit integer variable + * @param[in] _iVar variable number + * @param[in] _llData 64-bit integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarInteger64(void* _pvCtx, int _iVar, long long _llData); + + /** + * Create scalar 64-bit unsigned integer variable + * @param[in] _iVar variable number + * @param[in] _ullData 64-bit unsigned integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createScalarUnsignedInteger64(void* _pvCtx, int _iVar, unsigned long long _ullData); + +#endif + + /** + * Create named scalar 8-bit integer variable + * @param[in] _pstName variable name + * @param[in] _cData 8-bit integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarInteger8(void* _pvCtx, const char* _pstName, char _cData); + + /** + * Create named scalar 8-bit unsigned integer variable + * @param[in] _pstName variable name + * @param[in] _ucData 8-bit unsigned integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarUnsignedInteger8(void* _pvCtx, const char* _pstName, unsigned char _ucData); + + /** + * Create named scalar 16-bit integer variable + * @param[in] _pstName variable name + * @param[in] _sData 16-bit integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarInteger16(void* _pvCtx, const char* _pstName, short _sData); + + /** + * Create named scalar 16-bit unsigned integer variable + * @param[in] _pstName variable name + * @param[in] _usData 16-bit unsigned integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarUnsignedInteger16(void* _pvCtx, const char* _pstName, unsigned short _usData); + + /** + * Create named scalar 32-bit integer variable + * @param[in] _pstName variable name + * @param[in] _iData 32-bit integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarInteger32(void* _pvCtx, const char* _pstName, int _iData); + + /** + * Create named scalar 32-bit unsigned integer variable + * @param[in] _pstName variable name + * @param[in] _uiData 32-bit unsigned integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarUnsignedInteger32(void* _pvCtx, const char* _pstName, unsigned int _uiData); + +#ifdef __SCILAB_INT64__ + + /** + * Create named scalar 64-bit integer variable + * @param[in] _pstName variable name + * @param[in] _llData 64-bit integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarInteger64(void* _pvCtx, const char* _pstName, long long _llData); + + /** + * Create named scalar 64-bit unsigned integer variable + * @param[in] _pstName variable name + * @param[in] _ullData 64-bit unsigned integer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int createNamedScalarUnsignedInteger64(void* _pvCtx, const char* _pstName, unsigned long long _ullData); + +#endif + +#ifdef __cplusplus +} +#endif +#endif /* __INT_API__ */ diff --git a/modules/api_scilab/includes/api_internal_handle.h b/modules/api_scilab/includes/api_internal_handle.h new file mode 100755 index 000000000..00e6ebd29 --- /dev/null +++ b/modules/api_scilab/includes/api_internal_handle.h @@ -0,0 +1,22 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#ifndef __INTERNAL_HANDLE_API__ +#define __INTERNAL_HANDLE_API__ + +//internal functions +SciErr fillMatrixOfHandle(void* _pvCtx, int* _piAddress, int _iRows, int _iCols, long long** _pllHandle); + +#endif /* __INTERNAL_HANDLE_API__ */ diff --git a/modules/api_scilab/includes/api_list.h b/modules/api_scilab/includes/api_list.h new file mode 100755 index 000000000..b4e0f1a44 --- /dev/null +++ b/modules/api_scilab/includes/api_list.h @@ -0,0 +1,1420 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __LIST_API__ +#define __LIST_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_list.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include "doublecomplex.h" + + /**********************/ + /* list functions */ + /**********************/ + + /** + * Get the number of items in a list + * @param[in] _piAddress list address + * @param[out] _piNbItem return number of items + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getListItemNumber(void* _pvCtx, int* _piAddress, int* _piNbItem); + + /** + * Get the address of an item in a list + * @param[in] _piAddress list address + * @param[in] _iItemNum item number + * @param[out] _piItemAddress return item address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getListItemAddress(void* _pvCtx, int* _piAddress, int _iItemNum, int** _piItemAddress); + + /** + * Get a list from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the retrieved list in the parent list + * @param[out] _piAddress return list address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getListInList(void* _pvCtx, int* _piParent, int _iItemPos, int** _piAddress); + + /** + * Get a tlist from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the retrieved tlist in the parent list + * @param[out] _piAddress return tlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getTListInList(void* _pvCtx, int* _piParent, int _iItemPos, int** _piAddress); + + /** + * Get an mlist from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the retrieved mlist in the parent list + * @param[out] _piAddress return mlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMListInList(void* _pvCtx, int* _piParent, int _iItemPos, int** _piAddress); + + /** + * Get a list from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the retrieved list in the parent list + * @param[out] _piAddress return list address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int** _piAddress); + + /** + * Get a tlist from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the retrieved tlist in the parent list + * @param[out] _piAddress return tlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getTListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int** _piAddress); + + /** + * Get an mlist from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the retrieved mlist in the parent list + * @param[out] _piAddress return mlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int** _piAddress); + + /** + * Create a list + * @param[in] _iVar variable number + * @param[in] _iNbItem number of items + * @param[out] _piAddress return list address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress); + + /** + * Create a tlist + * @param[in] _iVar variable number + * @param[in] _iNbItem number of items + * @param[out] _piAddress return tlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createTList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress); + + /** + * Create an mlist + * @param[in] _iVar variable number + * @param[in] _iNbItem number of items + * @param[out] _piAddress return mlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress); + + /** + * Create a named list + * @param[in] _pstName variable name + * @param[in] _iNbItem number of items + * @param[out] _piAddress return list address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress); + + /** + * Create a named tlist + * @param[in] _pstName variable name + * @param[in] _iNbItem number of items + * @param[out] _piAddress return tlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedTList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress); + + /** + * Create a named mlist + * @param[in] _pstName variable name + * @param[in] _iNbItem number of items + * @param[out] _piAddress return mlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedMList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress); + + /** + * Read a named list + * @param[in] _pstName variable name + * @param[out] _piNbItem return number of items + * @param[out] _piAddress return list address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedList(void* _pvCtx, const char* _pstName, int* _piNbItem, int** _piAddress); + + /** + * Read a named tlist + * @param[in] _pstName variable name + * @param[out] _piNbItem return number of items + * @param[out] _piAddress return tlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedTList(void* _pvCtx, const char* _pstName, int* _piNbItem, int** _piAddress); + + /** + * Read a named mlist + * @param[in] _pstName variable name + * @param[out] _piNbItem return number of items + * @param[out] _piAddress return mlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedMList(void* _pvCtx, const char* _pstName, int* _piNbItem, int** _piAddress); + + /** + * Create a list in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the created list in the parent list + * @param[in] _iNbItem number of items in the created list + * @param[out] _piAddress return new list address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createListInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress); + + /** + * Create a tlist in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the created tlist in the parent list + * @param[in] _iNbItem number of items in the created tlist + * @param[out] _piAddress return new tlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createTListInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress); + + /** + * Create an mlist in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the created mlist in the parent list + * @param[in] _iNbItem number of items in the created mlist + * @param[out] _piAddress return new mlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMListInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress); + + /** + * Create a list in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the created list in the parent list + * @param[in] _iNbItem number of items in the created list + * @param[out] _piAddress return new list address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress); + + /** + * Create a tlist in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the created tlist in the parent list + * @param[in] _iNbItem number of items in the created tlist + * @param[out] _piAddress return new tlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createTListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress); + + /** + * Create an mlist in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the created mlist in the parent list + * @param[in] _iNbItem number of items in the created mlist + * @param[out] _piAddress return new mlist address + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress); + + /********************************* + * void and undefined functions * + *********************************/ + + /** + * Create a void item in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the created mlist in the parent list + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createVoidInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos); + + /** + * Create a undefined item in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos position of the created mlist in the parent list + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createUndefinedInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos); + + /********************* + * double functions * + *********************/ + + /** + * Get double variable data from a list item + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal); + + /** + * Get complex double variable data from a list item + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getComplexMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg); + + /** + * Allocate a double variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, double** _pdblReal); + + /** + * Allocate a complex double variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocComplexMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg); + + /** + * Create a double variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal); + + /** + * Create a complex double variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblReal pointer to real parts + * @param[in] _pdblImg pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg); + + /** + * Create a complex double variable (Z-representation) in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblData pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexZMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const doublecomplex* _pdblData); + + /** + * Create a double variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal); + + /** + * Create a complex double variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblReal pointer to real parts + * @param[in] _pdblImg pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg); + + /** + * Create a complex double variable (Z-representation) in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pdblData pointer to complex data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexZMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const doublecomplex* _pdblData); + + /** + * Read a double variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double* _pdblReal); + + /** + * Read a complex double variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readComplexMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg); + + /********************* + * strings functions * + *********************/ + + /** + * Get a string variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piLength return strings length + * @param[out] _pstStrings return array of char + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfStringInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings); + + /** + * Create a string variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pstStrings array of null-terminated strings + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfStringInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings); + + /** + * Create a string variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pstStrings array of null-terminated strings + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfStringInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings); + + /** + * Read a string variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pstStrings return array of null-terminated strings + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfStringInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings); + + /********************* + * boolean functions * + *********************/ + + /** + * Get a boolean variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piBool return pointer to boolean data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfBooleanInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int** _piBool); + + /** + * Allocate a boolean variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _piBool return pointer to boolean data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piBool); + + /** + * Create a boolean variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piBool pointer to boolean data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piBool); + + /** + * Create a boolean variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piBool pointer to boolean data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piBool); + + /** + * Read a boolean variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piBool pointer to boolean data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piBool); + + /************************* + * polynomials functions * + *************************/ + + /** + * Get a polynomial variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return pointer to real polynomials coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal); + + /** + * Get a complex polynomial variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return pointer to real polynomials coefficients + * @param[out] _pdblImg return pointer to imaginary polynomials coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getComplexMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + + /** + * Create a polynomial variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _pstVarName polynomial variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real polynomial coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal); + + /** + * Create a complex polynomial variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _pstVarName polynomial variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real polynomial coefficients + * @param[in] _pdblImg pointer to imaginary polynomial coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); + + /** + * Read a polynomial variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return pointer to real polynomial coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal); + + /** + * Read a complex polynomial variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return pointer to real polynomial coefficients + * @param[out] _pdblImg return pointer to imaginary polynomial coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readComplexMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + + /** + * Create a polynomial variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _pstVarName polynomial variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real polynomial coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal); + + /** + * Create a complex polynomial variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _pstVarName polynomial variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real polynomial coefficients + * @param[in] _pdblImg pointer to imaginary polynomial coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); + + /********************* + * integer functions * + *********************/ + + /** + * Create an 8-bit signed integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pcData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData); + + /** + * Create an 8-bit unsigned integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pucData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData); + + /** + * Create a 16-bit signed integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _psData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData); + + /** + * Create a 16-bit unsigned integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pusData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData); + + /** + * Create a 32-bit signed integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData); + + /** + * Create a 32-bit unsigned integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _puiData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData); + +#ifdef __SCILAB_INT64__ + + /** + * Create a 64-bit signed integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pllData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger64InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const long long* _pllData); + + /** + * Create a 64-bit unsigned integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pullData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger64InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned long long* _pullData); + +#endif + + /** + * Allocate an 8-bit signed integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pcData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, char** _pcData); + + /** + * Allocate an 8-bit unsigned integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pucData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned char** _pucData); + + /** + * Allocate a 16-bit signed integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _psData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, short** _psData); + + /** + * Allocate a 16-bit unsigned integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pusData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned short** _pusData); + + /** + * Allocate a 32-bit signed integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _piData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piData); + + /** + * Allocate a 32-bit unsigned integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _puiData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned int** _puiData); + +#ifdef __SCILAB_INT64__ + + /** + * Allocate a 64-bit signed integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pllData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfInteger64InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, long long** _pllData); + + /** + * Allocate a 64-bit unsigned integer variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[out] _pullData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocMatrixOfUnsignedInteger64InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned long long** _pullData); + +#endif + + /** + * Get an 8-bit signed integer variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pcData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfInteger8InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, char** _pcData); + + /** + * Get an 8-bit unsigned integer variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pucData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfUnsignedInteger8InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned char** _pucData); + + /** + * Get a 16-bit signed integer variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _psData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfInteger16InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, short** _psData); + + /** + * Get a 16-bit unsigned integer variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pusData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfUnsignedInteger16InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned short** _pusData); + + /** + * Get a 32-bit signed integer variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfInteger32InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int** _piData); + + /** + * Get a 32-bit unsigned integer variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _puiData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfUnsignedInteger32InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned int** _puiData); + +#ifdef __SCILAB_INT64__ + + /** + * Get a 64-bit signed integer variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pllData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfInteger64InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, long long** _pllData); + + /** + * Get a 64-bit unsigned integer variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pllData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getMatrixOfUnsignedInteger64InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned long long** _pullData); + +#endif + + /** + * Create an 8-bit signed integer variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pcData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData); + + /** + * Create an 8-bit unsigned integer variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pucData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData); + + /** + * Create a 16-bit signed integer variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _psData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData); + + /** + * Create a 16-bit unsigned integer variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pusData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData); + + /** + * Create a 32-bit signed integer variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData); + + /** + * Create a 32-bit unsigned integer variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _puiData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData); + +#ifdef __SCILAB_INT64__ + + /** + * Create a 64-bit signed integer variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pllData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfInteger64InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const long long* _pllData); + + /** + * Create a 64-bit unsigned integer variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pullData pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createMatrixOfUnsignedInteger64InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned long long* _pullData); +#endif + + /** + * Read an 8-bit signed integer variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pcData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfIntger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, char* _pcData); + + /** + * Read an 8-bit unsigned integer variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pucData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned char* _pucData); + + /** + * Read a 16-bit signed integer variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _psData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfIntger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, short* _psData); + + /** + * Read a 16-bit unsigned integer variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pusData return pointert to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned short* _pusData); + + /** + * Read a 32-bit signed integer variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfIntger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piData); + + /** + * Read a 32-bit unsigned integer variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _puiData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned int* _puiData); + +#ifdef __SCILAB_INT64__ + + /** + * Read a 64-bit signed integer variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows number of rows + * @param[out] _piCols number of columns + * @param[out] _pllData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfIntger64InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, long long* _pllData); + + /** + * Read a 64-bit unsigned integer variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows number of rows + * @param[out] _piCols number of columns + * @param[out] _pullData return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readMatrixOfUnsignedInteger64InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned long long* _pullData); +#endif + + /******************** + * sparse functions * + ********************/ + + /** + * Create a double sparse variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow number of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal); + + /** + * Create a complex sparse variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow number of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real parts + * @param[in] _pdblImg pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg); + + /** + * Create a double sparse variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow number of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal); + + /** + * Create a complex sparse variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow number of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real parts + * @param[in] _pdblImg pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg); + + /** + * Get a double sparse variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return number of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal); + + /** + * Get a complex sparse variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return number of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getComplexSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); + + /** + * Read a double sparse variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of item + * @param[out] _piNbItemRow return number of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal); + + /** + * Read a complex sparse variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return number of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readComplexSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg); + + + /**************************** + * boolean sparse functions * + ****************************/ + + /** + * Create a boolean sparse variable in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow number of items for each row + * @param[in] _piColPos array of column positions of "true" elements ( 1 indexed ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createBooleanSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos); + + /** + * Create a boolean sparse variable in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow number of items for each row + * @param[in] _piColPos array of column positions of "true" elements ( 1 indexed ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createBooleanSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos); + + /** + * Get a boolean sparse variable from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return number of items for each row + * @param[out] _piColPos return array of column positions of "true" elements ( 1 indexed ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getBooleanSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos); + + /** + * Read a boolean sparse variable from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow number of items for each row + * @param[out] _piColPos return array of column positions of "true" elements ( 1 indexed ) + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readBooleanSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos); + + /********************* + * pointer functions * + *********************/ + + /** + * Get a pointer from a list + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _pvPtr return pointer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getPointerInList(void* _pvCtx, int* _piParent, int _iItemPos, void** _pvPtr); + + /** + * Create a pointer in a list + * @param[in] _iVar variable number + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _pvPtr return pointer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createPointerInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, void* _pvPtr); + + /** + * Read a pointer from a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[out] _pvPtr return pointer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readPointerInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, void** _pvPtr); + + /** + * Create a pointer in a named list + * @param[in] _pstName variable name + * @param[in] _piParent pointer to the parent + * @param[in] _iItemPos item position in the parent list + * @param[in] _pvPtr pointer value + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createPointerInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, void* _pvPtr); + + /** + * Check if the variable type is list + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isListType(void* _pvCtx, int* _piAddress); + + /** + * Check if the variable type is named list + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isNamedListType(void* _pvCtx, const char* _pstName); + + /** + * Check if the variable type is tlist + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isTListType(void* _pvCtx, int* _piAddress); + + /** + * Check if the variable type is named tlist + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isNamedTListType(void* _pvCtx, const char* _pstName); + + /** + * Check if the variable type is mlist + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isMListType(void* _pvCtx, int* _piAddress); + + /** + * Check if the variable type is named mlist + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isNamedMListType(void* _pvCtx, const char* _pstName); +#ifdef __cplusplus +} +#endif +#endif /* __LIST_API__ */ + diff --git a/modules/api_scilab/includes/api_optional.h b/modules/api_scilab/includes/api_optional.h new file mode 100755 index 000000000..2fac23d04 --- /dev/null +++ b/modules/api_scilab/includes/api_optional.h @@ -0,0 +1,36 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS + * + * 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 + */ + +#ifndef __OPTIONAL_API__ +#define __OPTIONAL_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_optional.h. Include api_scilab.h instead. +#endif + +#include "stack-optional.h" + +#ifdef __cplusplus +extern "C" { +#endif + + /** + * Get optional variable + * @param[in] name of function caller + * @param[in/out] opts structure of optional arguments + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getOptionals(void* _pvCtx, char* fname, rhs_opts opts[]); + +#ifdef __cplusplus +} +#endif +#endif /* __OPTIONAL_API__ */ diff --git a/modules/api_scilab/includes/api_pointer.h b/modules/api_scilab/includes/api_pointer.h new file mode 100755 index 000000000..8b106df0d --- /dev/null +++ b/modules/api_scilab/includes/api_pointer.h @@ -0,0 +1,83 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __POINTER_API__ +#define __POINTER_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_pointer.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + + /** + * Get pointer variable + * @param[in] _piAddress variable address + * @param[out] _pvPtr return pointer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getPointer(void* _pvCtx, int* _piAddress, void** _pvPtr); + + /** + * Allocate a pointer variable + * @param[in] _iVar variable number + * @param[out] _pvPtr return pointer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocPointer(void* _pvCtx, int _iVar, void** _pvPtr); + + /** + * Create pointer variable + * @param[in] _iVar variable number + * @param[in] _pvPtr pointer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createPointer(void* _pvCtx, int _iVar, void* _pvPtr); + + /** + * Create named pointer variable + * @param[in] _pstName variable name + * @param[in] _pvPtr pointer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedPointer(void* _pvCtx, const char* _pstName, void* _pvPtr); + + /** + * Read pointer named variable + * @param[in] _pstName variable name + * @param[out] _pvPtr return pointer + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedPointer(void* _pvCtx, const char* _pstName, void** _pvPtr); + + /* shortcut functions */ + + /** + * Check if the variable is of pointer type + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isPointerType(void* _pvCtx, int* _piAddress); + + /** + * check if the named variable type of pointer type + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedPointerType(void* _pvCtx, const char* _pstName); + +#ifdef __cplusplus +} +#endif +#endif /* __POINTER_API__ */ diff --git a/modules/api_scilab/includes/api_poly.h b/modules/api_scilab/includes/api_poly.h new file mode 100755 index 000000000..cff2c1a94 --- /dev/null +++ b/modules/api_scilab/includes/api_poly.h @@ -0,0 +1,277 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __POLY_API__ +#define __POLY_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_poly.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + + /*****************************/ + /* poly matrix functions */ + /*****************************/ + + /** + * Get polynomial variable data + * @param[in] _piAddress variable address + * @param[out] _pstVarName return variable name of polynomials + * @param[out] _piVarNameLen return length of _pstVarName + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr getPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen); + + /** + * Get polynomial variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr getMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal); + + /** + * Get complex polynomial variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return real coefficients + * @param[out] _pdblImg return imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr getComplexMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + + /** + * Create a polynomial variable + * @param[in] _iVar variable number + * @param[in] _pstVarName polynomial variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr createMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal); + + /** + * Create complex polynomial variable data + * @param[in] _iVar variable number + * @param[in] _pstVarName polynomial variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real coefficients + * @param[in] _pdblImg pointer to imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr createComplexMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); + + /** + * Create polynomial named variable + * @param[in] _pstName variable name + * @param[in] _pstVarName polynomial variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr createNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal); + + /** + * Create complex polynomial named variable + * @param[in] _pstName variable name + * @param[in] _pstVarName polynomial variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real coefficients + * @param[in] _pdblImg pointer to imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr createNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); + + /** + * Get named polynomial variable + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr readNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal); + + /** + * Get named complex polynomial variable + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return real coefficients + * @param[out] _pdblImg return imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + + SciErr readNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + + /* shortcut functions */ + + /** + * Check if the variable type is polynomial + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isPolyType(void* _pvCtx, int* _piAddress); + + /** + * Check if the named variable type is polynomial + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedPolyType(void* _pvCtx, const char* _pstName); + + /** + * Get single polynomial variable data + * @param[in] _piAddress variable address + * @param[out] _piNbCoef return number of polynomial coefficients + * @param[out] _pdblReal pointer to real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedSinglePoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal); + + /** + * Get single complex polynomial variable data + * @param[in] _piAddress variable address + * @param[out] _piNbCoef return number of polynomial coefficients + * @param[out] _pdblReal pointer to real coefficients + * @param[out] _pdblImg pointer to imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedSingleComplexPoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + + /** + * Get single named polynomial variable data + * @param[in] _pstName variable name + * @param[out] _piNbCoef return number of polynomial coefficients + * @param[out] _pdblReal pointer to real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedNamedSinglePoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal); + + /** + * Get single named complex polynomial variable data + * @param[in] _pstName variable name + * @param[out] _piNbCoef return number of polynomial coefficients + * @param[out] _pdblReal pointer to real coefficients + * @param[out] _pdblImg pointer to imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedNamedSingleComplexPoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + + /** + * Get matrix of polynomial variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients + * @param[out] _pdblReal return pointer to real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal); + + /** + * Get matrix of complex polynomial variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return pointer to real coefficients + * @param[out] _pdblImg return pointer to imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedMatrixOfComplexPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg); + + /** + * Get named matrix of polynomials variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return pointer to real coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal); + + /** + * Get named matrix of complex polynomials variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbCoef return number of polynomial coefficients for each element + * @param[out] _pdblReal return pointer to real coefficients + * @param[out] _pdblImg return pointer to imaginary coefficients + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedNamedMatrixOfComplexPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg); + + /** + * Free memory allocated for a single polynomial variable ( named or not ) + * @param[in] _pdblReal pointer to real coefficients + */ + void freeAllocatedSinglePoly(double* _pdblReal); + + /** + * Free memory allocated for a single complex polynomial variable ( named or not ) + * @param[in] _pdblReal pointer to real coefficients + * @param[in] _pdblImg pointer to imaginary coefficients + */ + void freeAllocatedSingleComplexPoly(double* _pdblReal, double* _pdblImg); + + /** + * Free memory allocated for a polynomial matrix ( named or not ) + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real coefficients + */ + void freeAllocatedMatrixOfPoly(int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal); + + /** + * Free memory allocated for a complex polynomial matrix ( named or not ) + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _piNbCoef number of polynomial coefficients for each element + * @param[in] _pdblReal pointer to real coefficients + * @param[in] _pdblImg pointer to imaginary coefficients + */ + void freeAllocatedMatrixOfComplexPoly(int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + +#ifdef __cplusplus +} +#endif +#endif /* __POLY_API__ */ diff --git a/modules/api_scilab/includes/api_scilab.h b/modules/api_scilab/includes/api_scilab.h new file mode 100755 index 000000000..02ca3c0fc --- /dev/null +++ b/modules/api_scilab/includes/api_scilab.h @@ -0,0 +1,57 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + + +#ifndef __VARIABLE_API__ +#define __VARIABLE_API__ + + +/* +* 1 : First version +* 2 : Shortcut functions added +* 3 : Add some functions/macros in replacement of stack functions/macros : + - Rhs -> nbInputArgument + - Lhs -> nbOutputArgument + - LhsVar -> AssignOutputVariable + - PutLhsVar -> ReturnArguments + - CheckRhs -> CheckInputArgument + - CheckLhs -> CheckOutputArgument +*/ + +#define API_SCILAB_VERSION 3 + +#define __INTERNAL_API_SCILAB__ + +//do not include stack-c.h for external modules without __USE_DEPRECATED_STACK_FUNCTIONS__ flag +#if !defined(__SCILAB_TOOLBOX__) || defined(__USE_DEPRECATED_STACK_FUNCTIONS__) +#include "stack-c.h" +#endif + +#include "api_common.h" +#include "api_double.h" +#include "api_string.h" +#include "api_int.h" +#include "api_poly.h" +#include "api_sparse.h" +#include "api_boolean.h" +#include "api_boolean_sparse.h" +#include "api_pointer.h" +#include "api_list.h" +#include "api_error.h" +#include "api_handle.h" +#include "api_optional.h" +#include "api_hypermat.h" +#undef __INTERNAL_API_SCILAB__ + +#include "core_math.h" +#include "sci_types.h" + +#endif /* __VARIABLE_API__ */ diff --git a/modules/api_scilab/includes/api_sparse.h b/modules/api_scilab/includes/api_sparse.h new file mode 100755 index 000000000..7dc06a320 --- /dev/null +++ b/modules/api_scilab/includes/api_sparse.h @@ -0,0 +1,254 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __SPARSE_API__ +#define __SPARSE_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_sparse.h. Include api_scilab.h instead. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + + /*****************************/ + /* sparse matrix functions */ + /*****************************/ + + /** + * Get sparse variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal); + + /** + * Get complex sparse variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr getComplexSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); + + /** + * Allocate a sparse variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column position ( 1 indexed ) + * @param[out] _pdblReal return pointer to data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal); + + /** + * Allocate a complex sparse variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr allocComplexSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); + + /** + * Create a sparse double variable + * @param[in] _iVar variable number + * @param[in] _iRows nmber of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow array of numbers of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal); + + /** + * Create a complex sparse double variable + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow array of numbers of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real parts + * @param[in] _pdblImg pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createComplexSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg); + + /** + * Create a named sparse double variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow array of numbers of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal); + + /** + * Create a named complex sparse double variable + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _iNbItem number of items + * @param[in] _piNbItemRow array of number of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real parts + * @param[int] _pdblImg pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr createNamedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg); + + /** + * Read named sparse double variable + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal); + + /** + * Read a named complex sparse double variable + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of number of items for each row + * @param[out] _piColPos return array of item column position ( 1 indexed ) + * @param[out] _pdblReal pointer to real parts + * @param[out] _pdblImg pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + SciErr readNamedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg); + + /* shortcut functions */ + + /** + * Check if the variable type is sparse double + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isSparseType(void* _pvCtx, int* _piAddress); + + /** + * Check if the variable type is sparse double + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedSparseType(void* _pvCtx, const char* _pstName); + + /** + * Get sparse variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal); + + /** + * Get complex sparse variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getAllocatedComplexSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); + + /** + * Get named sparse variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column positions ( 1 indexed ) + * @param[out] _pdblReal return pointer to real data + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedAllocatedSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal); + + /** + * Get named complex sparse variable data + * @param[in] _pstName variable name + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piNbItem return number of items + * @param[out] _piNbItemRow return array of numbers of items for each row + * @param[out] _piColPos return array of item column position ( 1 indexed ) + * @param[out] _pdblReal return pointer to real parts + * @param[out] _pdblImg return pointer to imaginary parts + * @return if the operation succeeded ( 0 ) or not ( !0 ) + */ + int getNamedAllocatedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); + + + /** + * Free memory allocated for a sparse matrix (named or not) by shortcut functions + * @param[in] _piNbItemRow array of numbers of items for each row + * @param[in] _piColPos array of item column position ( 1 indexed ) + * @param[in] _pdblReal pointer to real data + */ + void freeAllocatedSparseMatrix(int* _piNbItemRows, int* _piColPos, double* _pdblReal); + + /** + * Free memory allocated for a complex sparse matrix (named or not) by shortcut functions + * @param[in] _piNbItemRow array of numbers of items for each row + * @param[in] _piColPos array of item column positions ( 1 indexed ) + * @param[in] _pdblReal pointer to real parts + * @param[in] _pdblImg pointer to imaginary parts + */ + void freeAllocatedComplexSparseMatrix(int* _piNbItemRows, int* _piColPos, double* _pdblReal, double* _pdblImg); + +#ifdef __cplusplus +} +#endif +#endif /* __SPARSE_API__ */ diff --git a/modules/api_scilab/includes/api_string.h b/modules/api_scilab/includes/api_string.h new file mode 100755 index 000000000..ee82d723a --- /dev/null +++ b/modules/api_scilab/includes/api_string.h @@ -0,0 +1,276 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * Copyright (C) 2009 - DIGITEO - Allan CORNET + * + * 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 + */ + +#ifndef __STRING_API__ +#define __STRING_API__ + +#if !defined(__INTERNAL_API_SCILAB__) +#error Do not include api_string.h. Include api_scilab.h instead. +#endif + +#include <wchar.h> + +#ifdef __cplusplus +extern "C" { +#endif + + /*******************************/ + /* string matrix functions */ + /*******************************/ + + /** + * Get strings variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piLength return strings lengths + * @param[out] _pstStrings return array of char + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr getMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings); + + /** + * Get wide strings variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _piwLength return strings length + * @param[out] _pwstStrings return array of wide char + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr getMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piwLength, wchar_t** _pwstStrings); + + /** + * Create strings variable data + * @param[in] _iVar variable number + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pstStrings array of strings ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createMatrixOfString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const char* const* _pstStrings); + + /** + * Create wide strings variable data + * @param[in] _iVar variable number + * @param[in] _iRows Number of rows + * @param[in] _iCols Number of columns + * @param[in] _pwstStrings array of strings ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createMatrixOfWideString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const wchar_t* const* _pwstStrings); + + /** + * Create strings variable data + * @param[in] _pstName variable name + * @param[in] _iRows Number of row + * @param[in] _iCols Number of column + * @param[in] _pstStrings array of strings ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createNamedMatrixOfString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const char* const* _pstStrings); + + /** + * Create wide strings variable data + * @param[in] _pstName variable name + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pwstStrings array of wide strings ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr createNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const wchar_t* const* _pwstStrings); + + /** + * Get strings variable data + * @param[in] _pstName variable name + * @param[out] _piRows number of rows + * @param[out] _piCols number of columns + * @param[out] _piLength return strings lengths + * @param[in] _pstStrings array of strings ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr readNamedMatrixOfString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings); + + /** + * Get wide strings variable data + * @param[in] _pstName variable name + * @param[out] _piRows number of rows + * @param[out] _piCols number of columns + * @param[out] _piwLength return strings length + * @param[in] _pstwStrings array of strings ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + SciErr readNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piwLength, wchar_t** _pwstStrings); + + /*shortcut functions*/ + + /** + * check if the variable type is string + * @param[in] _piAddress variable address + * @return 1 for true and 0 for false + */ + int isStringType(void* _pvCtx, int* _piAddress); + + /** + * check if the variable type is string + * @param[in] _pstName variable name + * @return 1 for true and 0 for false + */ + int isNamedStringType(void* _pvCtx, const char* _pstName); + + /** + * Get single string variable data + * @param[in] _piAddress variable address + * @param[out] _pstData return allocated string pointer ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedSingleString(void* _pvCtx, int* _piAddress, char** _pstData); + + /** + * Get single wide string variable data + * @param[in] _piAddress variable address + * @param[out] _pwstData return allocated wide string pointer ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedSingleWideString(void* _pvCtx, int* _piAddress, wchar_t** _pwstData); + + /** + * Get strings variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pstData return allocated array of string pointer ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, char*** _pstData); + + /** + * Get wide strings variable data + * @param[in] _piAddress variable address + * @param[out] _piRows return number of rows + * @param[out] _piCols return number of columns + * @param[out] _pwstData return allocated array of wide string pointer ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, wchar_t*** _pwstData); + + + /** + * Get single named string variable data + * @param[in] _pstName variable name + * @param[out] _pstData return allocated string pointer ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedNamedSingleString(void* _pvCtx, const char* _pstName, char** _pstData); + + /** + * Get single named string variable data + * @param[in] _pstName variable name + * @param[out] _pwstData return allocated string pointer ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedNamedSingleWideString(void* _pvCtx, const char* _pstName, wchar_t** _pwstData); + + /** + * Get named strings variable data + * @param[in] _pstName variable name + * @param[out] _piRows number of rows + * @param[out] _piCols number of columns + * @param[out] _pstData return allocated array of string pointer ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedNamedMatrixOfString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, char*** _pstData); + + /** + * Get named wide strings variable data + * @param[in] _pstName variable name + * @param[out] _piRows number of rows + * @param[out] _piCols number of columns + * @param[out] _pwstData return allocated array of wide string pointer ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int getAllocatedNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, wchar_t*** _pwstData); + + /** + * Create single string variable data + * @param[in] _iVar variable number + * @param[in] _pstStrings string ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int createSingleString(void* _pvCtx, int _iVar, const char* _pstStrings); + + /** + * Create single string variable data + * @param[in] _iVar variable number + * @param[in] _iLen string length to reserve space in stack + * @param[out] pointer on the new single string + * @return if the operation succeeded (0) or not ( !0 ) + */ + int allocSingleString(void* _pvCtx, int _iVar, int _iLen, const char** _pstStrings); + + /** + * Create single wide string variable data + * @param[in] _iVar variable number + * @param[in] _pwstStrings wide string ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int createSingleWideString(void* _pvCtx, int _iVar, const wchar_t* _pwstStrings); + + /** + * Create named single string variable data + * @param[in] _pstName variable name + * @param[in] _pstStrings string ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int createNamedSingleString(void* _pvCtx, const char* _pstName, const char* _pstStrings); + + /** + * Create named single wide string variable data + * @param[in] _pstName variable name + * @param[in] _pwstStrings wide string ( null terminated ) + * @return if the operation succeeded (0) or not ( !0 ) + */ + int createNamedSingleWideString(void* _pvCtx, const char* _pstName, const wchar_t* _pwstStrings); + + /** + * free data allocated by shortcut functions ( named or not ) + * @param[in] _pstData string data + */ + void freeAllocatedSingleString(char* _pstData); + + /** + * free data allocated by shortcut functions ( named or not ) + * @param[in] _pwstData wide string data + */ + void freeAllocatedSingleWideString(wchar_t* _pwstData); + + /** + * free data allocated by shortcut functions ( named or not ) + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pstData matrix of string data + */ + void freeAllocatedMatrixOfString(int _iRows, int _iCols, char** _pstData); + + /** + * free data allocated by shortcut functions ( named or not ) + * @param[in] _iRows number of rows + * @param[in] _iCols number of columns + * @param[in] _pwstData matrix of wide string data + */ + void freeAllocatedMatrixOfWideString(int _iRows, int _iCols, wchar_t** _pwstData); + +#ifdef __cplusplus +} +#endif + +#endif /* __STRING_API__ */ diff --git a/modules/api_scilab/includes/dynlib_api_scilab.h b/modules/api_scilab/includes/dynlib_api_scilab.h new file mode 100755 index 000000000..8331e5b5f --- /dev/null +++ b/modules/api_scilab/includes/dynlib_api_scilab.h @@ -0,0 +1,28 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2009 - Allan CORNET +* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __DYNLIB_API_SCILAB_H__ +#define __DYNLIB_API_SCILAB_H__ + +#ifdef _MSC_VER +#ifdef API_SCILAB_EXPORTS +#define API_SCILAB_IMPEXP __declspec(dllexport) +#else +#define API_SCILAB_IMPEXP __declspec(dllimport) +#endif +#else +#define API_SCILAB_IMPEXP +#endif + +#endif /*__DYNLIB_API_SCILAB_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/api_scilab/libsciapi_scilab.la b/modules/api_scilab/libsciapi_scilab.la new file mode 100755 index 000000000..1338950bf --- /dev/null +++ b/modules/api_scilab/libsciapi_scilab.la @@ -0,0 +1,41 @@ +# libsciapi_scilab.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libsciapi_scilab.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -lpthread -ldl -lcurses' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libsciapi_scilab. +current= +age= +revision= + +# Is this an already installed library? +installed=no + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='' diff --git a/modules/api_scilab/license.txt b/modules/api_scilab/license.txt new file mode 100755 index 000000000..171511903 --- /dev/null +++ b/modules/api_scilab/license.txt @@ -0,0 +1,9 @@ +Copyright: +Copyright (c) 2009 - DIGITEO + +License: +This module must be used under the terms of the CeCILL. +This module 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 diff --git a/modules/api_scilab/linpack_f_Import.def b/modules/api_scilab/linpack_f_Import.def new file mode 100755 index 000000000..99b3ba651 --- /dev/null +++ b/modules/api_scilab/linpack_f_Import.def @@ -0,0 +1,5 @@ +LIBRARY linpack_f.dll + + +EXPORTS +icopy_
\ No newline at end of file diff --git a/modules/api_scilab/locales/api_scilab.pot b/modules/api_scilab/locales/api_scilab.pot new file mode 100755 index 000000000..5a9b03ca8 --- /dev/null +++ b/modules/api_scilab/locales/api_scilab.pot @@ -0,0 +1,880 @@ +# Localization of the module api_scilab +# Please see in SCI/tools/localization for localization management +# Copyright (C) 2007-2008 - INRIA +# Copyright (C) 2008-2011 - DIGITEO +# Copyright (C) 2012-2014 - Scilab-Enterprises +# This file is distributed under the same license as the Scilab package. +# +msgid "" +msgstr "" +"Project-Id-Version: Scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"Last-Translator: Vincent COUVERT <vincent.couvert@scilab-enterprises.com>\n" +"Language-Team: Scilab Localization <localization@lists.scilab.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Revision-Date: 2015-03-27 13:54+0100\n" + +# File: src/cpp/api_boolean.cpp, line: 35 +# File: src/cpp/api_boolean_sparse.cpp, line: 33 +# File: src/cpp/api_boolean_sparse.cpp, line: 115 +# File: src/cpp/api_common.cpp, line: 216 +# File: src/cpp/api_common.cpp, line: 363 +# File: src/cpp/api_double.cpp, line: 112 +# File: src/cpp/api_handle.cpp, line: 33 +# File: src/cpp/api_int.cpp, line: 33 +# File: src/cpp/api_int.cpp, line: 84 +# File: src/cpp/api_pointer.cpp, line: 31 +# File: src/cpp/api_pointer.cpp, line: 59 +# File: src/cpp/api_poly.cpp, line: 41 +# File: src/cpp/api_poly.cpp, line: 97 +# File: src/cpp/api_sparse.cpp, line: 48 +# File: src/cpp/api_sparse.cpp, line: 171 +# File: src/cpp/api_string.cpp, line: 48 +# File: src/cpp/api_string.cpp, line: 97 +# File: src/cpp/api_string.cpp, line: 174 +# File: src/cpp/api_string.cpp, line: 182 +# File: src/cpp/api_string.cpp, line: 281 +#, c-format +msgid "%s: Invalid argument address" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 42 +# File: src/cpp/api_double.cpp, line: 119 +# File: src/cpp/api_handle.cpp, line: 40 +# File: src/cpp/api_int.cpp, line: 39 +# File: src/cpp/api_int.cpp, line: 707 +# File: src/cpp/api_list.cpp, line: 285 +# File: src/cpp/api_list.cpp, line: 495 +# File: src/cpp/api_list.cpp, line: 538 +# File: src/cpp/api_list.cpp, line: 572 +# File: src/cpp/api_pointer.cpp, line: 44 +# File: src/cpp/api_poly.cpp, line: 47 +# File: src/cpp/api_poly.cpp, line: 110 +# File: src/cpp/api_sparse.cpp, line: 61 +# File: src/cpp/api_string.cpp, line: 61 +# File: src/cpp/api_string.cpp, line: 294 +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 42 +msgid "boolean matrix" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 49 +# File: src/cpp/api_boolean.cpp, line: 248 +# File: src/cpp/api_boolean_sparse.cpp, line: 40 +# File: src/cpp/api_boolean_sparse.cpp, line: 47 +# File: src/cpp/api_boolean_sparse.cpp, line: 284 +# File: src/cpp/api_double.cpp, line: 56 +# File: src/cpp/api_double.cpp, line: 126 +# File: src/cpp/api_double.cpp, line: 584 +# File: src/cpp/api_handle.cpp, line: 47 +# File: src/cpp/api_handle.cpp, line: 134 +# File: src/cpp/api_int.cpp, line: 91 +# File: src/cpp/api_int.cpp, line: 97 +# File: src/cpp/api_int.cpp, line: 926 +# File: src/cpp/api_pointer.cpp, line: 38 +# File: src/cpp/api_poly.cpp, line: 104 +# File: src/cpp/api_poly.cpp, line: 123 +# File: src/cpp/api_poly.cpp, line: 407 +# File: src/cpp/api_poly.cpp, line: 422 +# File: src/cpp/api_poly.cpp, line: 490 +# File: src/cpp/api_poly.cpp, line: 500 +# File: src/cpp/api_poly.cpp, line: 523 +# File: src/cpp/api_sparse.cpp, line: 55 +# File: src/cpp/api_sparse.cpp, line: 75 +# File: src/cpp/api_sparse.cpp, line: 439 +# File: src/cpp/api_string.cpp, line: 55 +# File: src/cpp/api_string.cpp, line: 68 +# File: src/cpp/api_string.cpp, line: 288 +# File: src/cpp/api_string.cpp, line: 301 +# File: src/cpp/api_string.cpp, line: 317 +# File: src/cpp/api_string.cpp, line: 338 +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 74 +# File: src/cpp/api_boolean.cpp, line: 118 +# File: src/cpp/api_boolean.cpp, line: 126 +# File: src/cpp/api_boolean.cpp, line: 150 +# File: src/cpp/api_boolean.cpp, line: 307 +# File: src/cpp/api_boolean.cpp, line: 322 +# File: src/cpp/api_boolean_sparse.cpp, line: 83 +# File: src/cpp/api_boolean_sparse.cpp, line: 100 +# File: src/cpp/api_boolean_sparse.cpp, line: 143 +# File: src/cpp/api_boolean_sparse.cpp, line: 151 +# File: src/cpp/api_boolean_sparse.cpp, line: 179 +# File: src/cpp/api_common.cpp, line: 1227 +# File: src/cpp/api_common.cpp, line: 1243 +# File: src/cpp/api_double.cpp, line: 178 +# File: src/cpp/api_double.cpp, line: 195 +# File: src/cpp/api_double.cpp, line: 211 +# File: src/cpp/api_double.cpp, line: 227 +# File: src/cpp/api_double.cpp, line: 316 +# File: src/cpp/api_double.cpp, line: 335 +# File: src/cpp/api_double.cpp, line: 354 +# File: src/cpp/api_double.cpp, line: 373 +# File: src/cpp/api_double.cpp, line: 391 +# File: src/cpp/api_double.cpp, line: 678 +# File: src/cpp/api_double.cpp, line: 706 +# File: src/cpp/api_handle.cpp, line: 92 +# File: src/cpp/api_handle.cpp, line: 100 +# File: src/cpp/api_handle.cpp, line: 161 +# File: src/cpp/api_int.cpp, line: 118 +# File: src/cpp/api_int.cpp, line: 126 +# File: src/cpp/api_int.cpp, line: 145 +# File: src/cpp/api_int.cpp, line: 153 +# File: src/cpp/api_int.cpp, line: 172 +# File: src/cpp/api_int.cpp, line: 180 +# File: src/cpp/api_int.cpp, line: 199 +# File: src/cpp/api_int.cpp, line: 207 +# File: src/cpp/api_int.cpp, line: 226 +# File: src/cpp/api_int.cpp, line: 234 +# File: src/cpp/api_int.cpp, line: 253 +# File: src/cpp/api_int.cpp, line: 261 +# File: src/cpp/api_int.cpp, line: 281 +# File: src/cpp/api_int.cpp, line: 289 +# File: src/cpp/api_int.cpp, line: 310 +# File: src/cpp/api_int.cpp, line: 320 +# File: src/cpp/api_int.cpp, line: 340 +# File: src/cpp/api_int.cpp, line: 350 +# File: src/cpp/api_int.cpp, line: 370 +# File: src/cpp/api_int.cpp, line: 380 +# File: src/cpp/api_int.cpp, line: 401 +# File: src/cpp/api_int.cpp, line: 411 +# File: src/cpp/api_int.cpp, line: 432 +# File: src/cpp/api_int.cpp, line: 442 +# File: src/cpp/api_int.cpp, line: 462 +# File: src/cpp/api_int.cpp, line: 472 +# File: src/cpp/api_int.cpp, line: 492 +# File: src/cpp/api_int.cpp, line: 502 +# File: src/cpp/api_int.cpp, line: 523 +# File: src/cpp/api_int.cpp, line: 533 +# File: src/cpp/api_int.cpp, line: 560 +# File: src/cpp/api_int.cpp, line: 651 +# File: src/cpp/api_int.cpp, line: 1079 +# File: src/cpp/api_int.cpp, line: 1092 +# File: src/cpp/api_int.cpp, line: 1105 +# File: src/cpp/api_int.cpp, line: 1119 +# File: src/cpp/api_int.cpp, line: 1133 +# File: src/cpp/api_int.cpp, line: 1146 +# File: src/cpp/api_int.cpp, line: 1159 +# File: src/cpp/api_int.cpp, line: 1173 +# File: src/cpp/api_int.cpp, line: 1187 +# File: src/cpp/api_int.cpp, line: 1200 +# File: src/cpp/api_int.cpp, line: 1213 +# File: src/cpp/api_int.cpp, line: 1227 +# File: src/cpp/api_int.cpp, line: 1241 +# File: src/cpp/api_int.cpp, line: 1254 +# File: src/cpp/api_int.cpp, line: 1267 +# File: src/cpp/api_int.cpp, line: 1281 +# File: src/cpp/api_list.cpp, line: 431 +# File: src/cpp/api_pointer.cpp, line: 94 +# File: src/cpp/api_pointer.cpp, line: 112 +# File: src/cpp/api_poly.cpp, line: 187 +# File: src/cpp/api_poly.cpp, line: 196 +# File: src/cpp/api_poly.cpp, line: 291 +# File: src/cpp/api_sparse.cpp, line: 133 +# File: src/cpp/api_sparse.cpp, line: 154 +# File: src/cpp/api_sparse.cpp, line: 219 +# File: src/cpp/api_sparse.cpp, line: 227 +# File: src/cpp/api_sparse.cpp, line: 274 +# File: src/cpp/api_string.cpp, line: 121 +# File: src/cpp/api_string.cpp, line: 131 +# File: src/cpp/api_string.cpp, line: 213 +# File: src/cpp/api_string.cpp, line: 446 +# File: src/cpp/api_string.cpp, line: 461 +# File: src/cpp/api_string.cpp, line: 480 +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 157 +# File: src/cpp/api_boolean_sparse.cpp, line: 186 +# File: src/cpp/api_common.cpp, line: 1337 +# File: src/cpp/api_double.cpp, line: 422 +# File: src/cpp/api_double.cpp, line: 463 +# File: src/cpp/api_int.cpp, line: 658 +# File: src/cpp/api_list.cpp, line: 382 +# File: src/cpp/api_list.cpp, line: 701 +# File: src/cpp/api_list.cpp, line: 771 +# File: src/cpp/api_list.cpp, line: 837 +# File: src/cpp/api_list.cpp, line: 1070 +# File: src/cpp/api_list.cpp, line: 1125 +# File: src/cpp/api_list.cpp, line: 1354 +# File: src/cpp/api_list.cpp, line: 1552 +# File: src/cpp/api_list.cpp, line: 1794 +# File: src/cpp/api_list.cpp, line: 2116 +# File: src/cpp/api_list.cpp, line: 2396 +# File: src/cpp/api_list.cpp, line: 2664 +# File: src/cpp/api_list.cpp, line: 2908 +# File: src/cpp/api_pointer.cpp, line: 132 +# File: src/cpp/api_poly.cpp, line: 298 +# File: src/cpp/api_sparse.cpp, line: 281 +# File: src/cpp/api_string.cpp, line: 220 +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 178 +# File: src/cpp/api_boolean_sparse.cpp, line: 205 +# File: src/cpp/api_list.cpp, line: 394 +# File: src/cpp/api_pointer.cpp, line: 153 +# File: src/cpp/api_poly.cpp, line: 311 +# File: src/cpp/api_sparse.cpp, line: 304 +# File: src/cpp/api_string.cpp, line: 233 +# File: src/cpp/api_string.cpp, line: 496 +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 178 +msgid "matrix of boolean" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 205 +# File: src/cpp/api_boolean.cpp, line: 212 +# File: src/cpp/api_boolean_sparse.cpp, line: 238 +# File: src/cpp/api_common.cpp, line: 379 +# File: src/cpp/api_double.cpp, line: 524 +# File: src/cpp/api_double.cpp, line: 531 +# File: src/cpp/api_int.cpp, line: 761 +# File: src/cpp/api_int.cpp, line: 768 +# File: src/cpp/api_list.cpp, line: 489 +# File: src/cpp/api_list.cpp, line: 502 +# File: src/cpp/api_pointer.cpp, line: 179 +# File: src/cpp/api_pointer.cpp, line: 186 +# File: src/cpp/api_poly.cpp, line: 346 +# File: src/cpp/api_poly.cpp, line: 361 +# File: src/cpp/api_sparse.cpp, line: 356 +# File: src/cpp/api_sparse.cpp, line: 371 +# File: src/cpp/api_string.cpp, line: 257 +# File: src/cpp/api_string.cpp, line: 264 +# File: src/cpp/api_string.cpp, line: 510 +# File: src/cpp/api_string.cpp, line: 517 +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 255 +# File: src/cpp/api_double.cpp, line: 591 +# File: src/cpp/api_handle.cpp, line: 141 +# File: src/cpp/api_int.cpp, line: 918 +# File: src/cpp/api_poly.cpp, line: 399 +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 279 +# File: src/cpp/api_boolean_sparse.cpp, line: 304 +# File: src/cpp/api_boolean_sparse.cpp, line: 315 +# File: src/cpp/api_double.cpp, line: 642 +# File: src/cpp/api_int.cpp, line: 1066 +# File: src/cpp/api_poly.cpp, line: 459 +# File: src/cpp/api_poly.cpp, line: 546 +# File: src/cpp/api_poly.cpp, line: 556 +# File: src/cpp/api_poly.cpp, line: 579 +# File: src/cpp/api_sparse.cpp, line: 477 +# File: src/cpp/api_sparse.cpp, line: 494 +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "" + +# +# File: src/cpp/api_boolean.cpp, line: 286 +# File: src/cpp/api_double.cpp, line: 634 +# File: src/cpp/api_int.cpp, line: 1058 +# File: src/cpp/api_poly.cpp, line: 451 +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" + +# +# File: src/cpp/api_boolean_sparse.cpp, line: 205 +msgid "boolean sparse matrix" +msgstr "" + +# +# File: src/cpp/api_boolean_sparse.cpp, line: 245 +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 100 +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 104 +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 120 +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 134 +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 150 +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 154 +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 170 +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 184 +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 220 +#, c-format +msgid "%s: matrix argument expected" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 235 +# File: src/cpp/api_common.cpp, line: 242 +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 269 +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 294 +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 334 +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 386 +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 512 +# File: src/cpp/api_common.cpp, line: 559 +# File: src/cpp/api_common.cpp, line: 668 +# File: src/cpp/api_common.cpp, line: 840 +# File: src/cpp/api_common.cpp, line: 867 +# File: src/cpp/api_common.cpp, line: 899 +# File: src/cpp/api_common.cpp, line: 926 +# File: src/cpp/api_common.cpp, line: 970 +# File: src/cpp/api_common.cpp, line: 997 +# File: src/cpp/api_common.cpp, line: 1029 +# File: src/cpp/api_common.cpp, line: 1056 +# File: src/cpp/api_common.cpp, line: 1088 +# File: src/cpp/api_common.cpp, line: 1115 +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 520 +#, c-format +msgid "%s: Unable to get variable address" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 527 +# File: src/cpp/api_common.cpp, line: 639 +#, c-format +msgid "%s: Unable to get argument type" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 538 +# File: src/cpp/api_common.cpp, line: 573 +# File: src/cpp/api_common.cpp, line: 581 +# File: src/cpp/api_common.cpp, line: 655 +# File: src/cpp/api_common.cpp, line: 695 +# File: src/cpp/api_common.cpp, line: 708 +# File: src/cpp/api_common.cpp, line: 721 +# File: src/cpp/api_common.cpp, line: 734 +# File: src/cpp/api_common.cpp, line: 747 +# File: src/cpp/api_common.cpp, line: 760 +# File: src/cpp/api_string.cpp, line: 553 +# File: src/cpp/api_string.cpp, line: 563 +# File: src/cpp/api_string.cpp, line: 589 +# File: src/cpp/api_string.cpp, line: 599 +# File: src/cpp/api_string.cpp, line: 612 +# File: src/cpp/api_string.cpp, line: 623 +# File: src/cpp/api_string.cpp, line: 646 +# File: src/cpp/api_string.cpp, line: 659 +# File: src/cpp/api_string.cpp, line: 670 +# File: src/cpp/api_string.cpp, line: 700 +# File: src/cpp/api_string.cpp, line: 724 +# File: src/cpp/api_string.cpp, line: 734 +# File: src/cpp/api_string.cpp, line: 759 +# File: src/cpp/api_string.cpp, line: 769 +# File: src/cpp/api_string.cpp, line: 782 +# File: src/cpp/api_string.cpp, line: 792 +# File: src/cpp/api_string.cpp, line: 816 +# File: src/cpp/api_string.cpp, line: 833 +# File: src/cpp/api_string.cpp, line: 843 +# File: src/cpp/api_string.cpp, line: 868 +# File: src/cpp/api_string.cpp, line: 881 +# File: src/cpp/api_string.cpp, line: 933 +# File: src/cpp/api_string.cpp, line: 946 +# File: src/cpp/api_string.cpp, line: 959 +#, c-format +msgid "%s: Unable to get argument data" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 544 +# File: src/cpp/api_common.cpp, line: 565 +# File: src/cpp/api_common.cpp, line: 674 +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 590 +#, c-format +msgid "%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 621 +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 647 +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 682 +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 770 +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" + +# +# File: src/cpp/api_common.cpp, line: 785 +# File: src/cpp/api_common.cpp, line: 793 +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "" + +# +# File: src/cpp/api_double.cpp, line: 119 +msgid "double matrix" +msgstr "" + +# +# File: src/cpp/api_error.cpp, line: 45 +# File: src/cpp/api_error.cpp, line: 51 +#, c-format +msgid "stack size exceeded!\n" +msgstr "" + +# +# File: src/cpp/api_error.cpp, line: 46 +# File: src/cpp/api_error.cpp, line: 52 +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "" + +# +# File: src/cpp/api_error.cpp, line: 47 +# File: src/cpp/api_error.cpp, line: 53 +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "" + +# +# File: src/cpp/api_error.cpp, line: 48 +# File: src/cpp/api_error.cpp, line: 54 +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "" + +# +# File: src/cpp/api_error.cpp, line: 49 +# File: src/cpp/api_error.cpp, line: 55 +#, c-format +msgid "Total memory available: %d\n" +msgstr "" + +# +# File: src/cpp/api_error.cpp, line: 117 +# File: src/cpp/api_error.cpp, line: 122 +msgid "API Error:\n" +msgstr "" + +# +# File: src/cpp/api_error.cpp, line: 118 +# File: src/cpp/api_error.cpp, line: 126 +#, c-format +msgid "\tin %s\n" +msgstr "" + +# +# File: src/cpp/api_handle.cpp, line: 40 +msgid "handle matrix" +msgstr "" + +# +# File: src/cpp/api_int.cpp, line: 39 +# File: src/cpp/api_int.cpp, line: 707 +msgid "int matrix" +msgstr "" + +# +# File: src/cpp/api_int.cpp, line: 700 +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "" + +# +# File: src/cpp/api_list.cpp, line: 274 +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "" + +# +# File: src/cpp/api_list.cpp, line: 285 +msgid "list" +msgstr "" + +# +# File: src/cpp/api_list.cpp, line: 301 +# File: src/cpp/api_list.cpp, line: 307 +# File: src/cpp/api_list.cpp, line: 532 +# File: src/cpp/api_list.cpp, line: 782 +# File: src/cpp/api_list.cpp, line: 795 +# File: src/cpp/api_list.cpp, line: 848 +# File: src/cpp/api_list.cpp, line: 861 +# File: src/cpp/api_list.cpp, line: 905 +# File: src/cpp/api_list.cpp, line: 912 +# File: src/cpp/api_list.cpp, line: 937 +# File: src/cpp/api_list.cpp, line: 963 +# File: src/cpp/api_list.cpp, line: 977 +# File: src/cpp/api_list.cpp, line: 984 +# File: src/cpp/api_list.cpp, line: 1242 +# File: src/cpp/api_list.cpp, line: 1249 +# File: src/cpp/api_list.cpp, line: 1441 +# File: src/cpp/api_list.cpp, line: 1448 +# File: src/cpp/api_list.cpp, line: 1661 +# File: src/cpp/api_list.cpp, line: 2058 +# File: src/cpp/api_list.cpp, line: 2065 +# File: src/cpp/api_list.cpp, line: 2453 +# File: src/cpp/api_list.cpp, line: 2460 +# File: src/cpp/api_list.cpp, line: 2710 +# File: src/cpp/api_list.cpp, line: 2717 +# File: src/cpp/api_list.cpp, line: 2787 +# File: src/cpp/api_list.cpp, line: 2794 +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "" + +# +# File: src/cpp/api_list.cpp, line: 566 +# File: src/cpp/api_list.cpp, line: 1193 +# File: src/cpp/api_list.cpp, line: 1206 +# File: src/cpp/api_list.cpp, line: 1213 +# File: src/cpp/api_list.cpp, line: 1403 +# File: src/cpp/api_list.cpp, line: 1416 +# File: src/cpp/api_list.cpp, line: 1423 +# File: src/cpp/api_list.cpp, line: 1606 +# File: src/cpp/api_list.cpp, line: 1619 +# File: src/cpp/api_list.cpp, line: 1626 +# File: src/cpp/api_list.cpp, line: 1858 +# File: src/cpp/api_list.cpp, line: 1871 +# File: src/cpp/api_list.cpp, line: 1878 +# File: src/cpp/api_list.cpp, line: 2201 +# File: src/cpp/api_list.cpp, line: 2214 +# File: src/cpp/api_list.cpp, line: 2221 +# File: src/cpp/api_list.cpp, line: 2493 +# File: src/cpp/api_list.cpp, line: 2506 +# File: src/cpp/api_list.cpp, line: 2513 +# File: src/cpp/api_list.cpp, line: 2738 +# File: src/cpp/api_list.cpp, line: 2751 +# File: src/cpp/api_list.cpp, line: 2758 +# File: src/cpp/api_list.cpp, line: 2868 +# File: src/cpp/api_list.cpp, line: 2881 +# File: src/cpp/api_list.cpp, line: 2888 +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "" + +# +# File: src/cpp/api_list.cpp, line: 616 +# File: src/cpp/api_list.cpp, line: 623 +# File: src/cpp/api_list.cpp, line: 630 +# File: src/cpp/api_list.cpp, line: 747 +# File: src/cpp/api_list.cpp, line: 788 +# File: src/cpp/api_list.cpp, line: 854 +# File: src/cpp/api_list.cpp, line: 969 +# File: src/cpp/api_list.cpp, line: 1012 +# File: src/cpp/api_list.cpp, line: 1029 +# File: src/cpp/api_list.cpp, line: 1270 +# File: src/cpp/api_list.cpp, line: 1276 +# File: src/cpp/api_list.cpp, line: 1283 +# File: src/cpp/api_list.cpp, line: 1290 +# File: src/cpp/api_list.cpp, line: 1317 +# File: src/cpp/api_list.cpp, line: 1324 +# File: src/cpp/api_list.cpp, line: 1331 +# File: src/cpp/api_list.cpp, line: 1462 +# File: src/cpp/api_list.cpp, line: 1482 +# File: src/cpp/api_list.cpp, line: 1507 +# File: src/cpp/api_list.cpp, line: 1513 +# File: src/cpp/api_list.cpp, line: 1521 +# File: src/cpp/api_list.cpp, line: 1528 +# File: src/cpp/api_list.cpp, line: 1696 +# File: src/cpp/api_list.cpp, line: 1703 +# File: src/cpp/api_list.cpp, line: 1733 +# File: src/cpp/api_list.cpp, line: 1739 +# File: src/cpp/api_list.cpp, line: 1746 +# File: src/cpp/api_list.cpp, line: 1753 +# File: src/cpp/api_list.cpp, line: 1899 +# File: src/cpp/api_list.cpp, line: 1905 +# File: src/cpp/api_list.cpp, line: 1913 +# File: src/cpp/api_list.cpp, line: 1920 +# File: src/cpp/api_list.cpp, line: 1958 +# File: src/cpp/api_list.cpp, line: 2010 +# File: src/cpp/api_list.cpp, line: 2284 +# File: src/cpp/api_list.cpp, line: 2290 +# File: src/cpp/api_list.cpp, line: 2297 +# File: src/cpp/api_list.cpp, line: 2304 +# File: src/cpp/api_list.cpp, line: 2347 +# File: src/cpp/api_list.cpp, line: 2354 +# File: src/cpp/api_list.cpp, line: 2581 +# File: src/cpp/api_list.cpp, line: 2587 +# File: src/cpp/api_list.cpp, line: 2594 +# File: src/cpp/api_list.cpp, line: 2601 +# File: src/cpp/api_list.cpp, line: 2626 +# File: src/cpp/api_list.cpp, line: 2633 +# File: src/cpp/api_list.cpp, line: 2815 +# File: src/cpp/api_list.cpp, line: 2821 +# File: src/cpp/api_list.cpp, line: 2829 +# File: src/cpp/api_list.cpp, line: 2836 +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "" + +# +# File: src/cpp/api_list.cpp, line: 711 +# File: src/cpp/api_list.cpp, line: 1082 +# File: src/cpp/api_list.cpp, line: 1091 +# File: src/cpp/api_list.cpp, line: 1137 +# File: src/cpp/api_list.cpp, line: 1150 +# File: src/cpp/api_list.cpp, line: 1364 +# File: src/cpp/api_list.cpp, line: 1371 +# File: src/cpp/api_list.cpp, line: 1564 +# File: src/cpp/api_list.cpp, line: 1573 +# File: src/cpp/api_list.cpp, line: 1806 +# File: src/cpp/api_list.cpp, line: 1816 +# File: src/cpp/api_list.cpp, line: 2128 +# File: src/cpp/api_list.cpp, line: 2135 +# File: src/cpp/api_list.cpp, line: 2408 +# File: src/cpp/api_list.cpp, line: 2415 +# File: src/cpp/api_list.cpp, line: 2676 +# File: src/cpp/api_list.cpp, line: 2683 +# File: src/cpp/api_list.cpp, line: 2920 +# File: src/cpp/api_list.cpp, line: 2927 +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "" + +# +# File: src/cpp/api_list.cpp, line: 740 +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "" + +# +# File: src/cpp/api_list.cpp, line: 1668 +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "" + +# +# File: src/cpp/api_optional.cpp, line: 46 +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" + +# +# File: src/cpp/api_optional.cpp, line: 63 +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "" + +# +# File: src/cpp/api_optional.cpp, line: 107 +msgid "Optional argument list is empty.\n" +msgstr "" + +# +# File: src/cpp/api_optional.cpp, line: 110 +msgid "Optional arguments list: \n" +msgstr "" + +# +# File: src/cpp/api_optional.cpp, line: 116 +#, c-format +msgid "and %s.\n" +msgstr "" + +# +# File: src/cpp/api_pointer.cpp, line: 44 +# File: src/cpp/api_pointer.cpp, line: 153 +msgid "pointer" +msgstr "" + +# +# File: src/cpp/api_poly.cpp, line: 47 +# File: src/cpp/api_poly.cpp, line: 110 +msgid "polynomial matrix" +msgstr "" + +# +# File: src/cpp/api_poly.cpp, line: 116 +# File: src/cpp/api_sparse.cpp, line: 67 +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "" + +# +# File: src/cpp/api_poly.cpp, line: 227 +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" + +# +# File: src/cpp/api_poly.cpp, line: 311 +msgid "matrix of double" +msgstr "" + +# +# File: src/cpp/api_sparse.cpp, line: 61 +# File: src/cpp/api_sparse.cpp, line: 304 +msgid "sparse matrix" +msgstr "" + +# +# File: src/cpp/api_string.cpp, line: 61 +# File: src/cpp/api_string.cpp, line: 294 +msgid "string matrix" +msgstr "" + +# +# File: src/cpp/api_string.cpp, line: 233 +msgid "matrix of string" +msgstr "" + +# +# File: src/cpp/api_string.cpp, line: 360 +# File: src/cpp/api_string.cpp, line: 407 +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "" + +# +# File: src/cpp/api_string.cpp, line: 496 +msgid "matrix of wide string" +msgstr "" + +# +# File: src/cpp/api_string.cpp, line: 545 +# File: src/cpp/api_string.cpp, line: 581 +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" + +# +# File: src/cpp/api_string.cpp, line: 716 +# File: src/cpp/api_string.cpp, line: 751 +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" + +# +# File: tests/nonreg_tests/bug_9264.c, line: 50 +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "" + +# +# File: tests/nonreg_tests/bug_9264.c, line: 58 +# File: tests/nonreg_tests/bug_9264.c, line: 77 +#, c-format +msgid "%s: No more memory.\n" +msgstr "" + +# +# File: tests/nonreg_tests/bug_9707.c, line: 24 +# File: tests/nonreg_tests/bug_9707.c, line: 38 +# File: tests/nonreg_tests/bug_9707.c, line: 52 +# File: tests/nonreg_tests/bug_9707.c, line: 66 +# File: tests/nonreg_tests/bug_9707.c, line: 80 +# File: tests/nonreg_tests/bug_9708.c, line: 23 +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "" + +# +# File: tests/unit_tests/hypermatIntExample.c, line: 166 +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "" diff --git a/modules/api_scilab/locales/cs_CZ.po b/modules/api_scilab/locales/cs_CZ.po new file mode 100755 index 000000000..1e0f44308 --- /dev/null +++ b/modules/api_scilab/locales/cs_CZ.po @@ -0,0 +1,321 @@ +# Czech translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2014-09-26 09:20+0000\n" +"Last-Translator: Zbyněk Schwarz <Unknown>\n" +"Language-Team: Czech <cs@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: Neplatná adresa argumentu" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: Neplatný typ argumentu, očekáváno %s" + +msgid "boolean matrix" +msgstr "booleovská matice" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: Nelze získat argument #%d" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: Nelze vytvořit proměnnou v paměti Scilab" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "%s: Neplatný typ proměnné: %s" + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s: Nelze vytvořit %s se jménem \"%s\"" + +msgid "matrix of boolean" +msgstr "matice booleanu" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: Nelze získat proměnnou \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "%s: Špatný typ vstupního argumentu #%d: Očekáván skalár.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: Nelze získat argument \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "%s: Špatný typ vstupního argumentu \"%s\": Očekáván skalár.\n" + +msgid "boolean sparse matrix" +msgstr "booleovská řídká matice" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s: Špatný počet vstupních argumentů: Očekáváno %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "%s: Špatný počet vstupních argumentů: očekáváno %d až %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "%s: Špatný počet vstupních argumentů: očekáváno alespoň %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "%s: Špatný počet vstupních argumentů: očekáváno nejvíce %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s: Špatný počet výstupních argumentů: očekáváno %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "%s: Špatný počet výstupních argumentů: očekáváno %d až %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "%s: Špatný počet výstupních argumentů: očekáváno alespoň %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "%s: Špatný počet výstupních argumentů: očekáváno nejvíce %d.\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s: očekáván argument matice" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s: Nelze získat rozměr proměnné \"%s\"" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s: špatné volání %s! (1. argument).\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s: Nelze získat jméno argumentu #%d" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: Nelze získat adresu proměnné \"%s\"" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: Nelze získat typ proměnné \"%s\"" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s: Nelze získat rozměry argumentu" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s: Nelze získat adresu proměnné" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s: Nelze získat typ argumentu" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s: Nelze získat data argumentu" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: Špatná velikost argumentu %d: očekáváno (%d,%d).\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s: Špatný typ vstupního argumentu #%d: Očekáván řetězec nebo skalár.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s: Špatná hodnota vstupního argumentu #%d: Očekáváno '%s', nebo '%s'.\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "%s: Špatný typ argumentu %d: Očekávána reálná matice.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s: nelze získat přesnost argumentu" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s: Špatný typ vstupního argumentu #%d: Očekáván reálný nebo celočíselný " +"skalár.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s: Nelze získat rozměr z argumentu \"%s\"" + +msgid "double matrix" +msgstr "dvojitá matice" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "překročena velikost zásobníku!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "Použijte funkci stacksize pro její zvýšení.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "Využitá paměť pro proměnné: %d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "Potřebná přechodná paměť: %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Celkem dostupné paměti: %d\n" + +msgid "API Error:\n" +msgstr "Chyba API:\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\tv %s\n" + +msgid "handle matrix" +msgstr "zpracování matice" + +msgid "int matrix" +msgstr "celočíselná matice" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: Nelze získat přesnost proměnné \"%s\"" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s: Nelze získat počet položek v seznamu" + +msgid "list" +msgstr "seznam" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "%s: Nelze získat adresu položky #%d v argumentu #%d" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "%s: Nelze získat adresu položky #%d v proměnné \"%s\"" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s: Nelze vytvořit položku seznamu #%d v paměti Scilab" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "%s: Nelze vytvořit položku seznamu #%d v proměnné \"%s\"" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s: Položky musí být vloženy popořadě" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "%s: Nepovinné argumenty jméno=hodnota musí být na konci.\n" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "%s: Nerozpoznané nepovinné argumenty %s.\n" + +msgid "Optional argument list is empty.\n" +msgstr "Seznam nepovinných argumentů je prázdný.\n" + +msgid "Optional arguments list: \n" +msgstr "Seznam nepovinných argumentů: \n" + +#, c-format +msgid "and %s.\n" +msgstr "a %s.\n" + +msgid "pointer" +msgstr "ukazatel" + +msgid "polynomial matrix" +msgstr "polynomická matice" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: Špatné volání pro získání nekomplexní matice" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "%s: Formální jméno proměnné mnohočlenu nemůže překročit 4 znaky" + +msgid "matrix of double" +msgstr "matice dvojité přesnosti" + +msgid "sparse matrix" +msgstr "řídká matice" + +msgid "string matrix" +msgstr "řetězcová matice" + +msgid "matrix of string" +msgstr "matice řetězce" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "%s: Nelze převést široký řetězec #%d" + +msgid "matrix of wide string" +msgstr "matice širokého řetězce" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "%s: Špatný typ vstupního argumentu #%d: Očekáván jeden řetězec.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "%s: Špatný typ vstupního argumentu \"%s\": Očekáván jeden řetězec.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: Špatná velikost vstupního argumentu #%d.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: Není více paměti.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: neplatné jméno proměnné.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "%s: Špatný typ vstupního argumentu #%d: Očekáváno celé číslo.\n" diff --git a/modules/api_scilab/locales/de_DE.po b/modules/api_scilab/locales/de_DE.po new file mode 100755 index 000000000..7557d34ef --- /dev/null +++ b/modules/api_scilab/locales/de_DE.po @@ -0,0 +1,325 @@ +# German translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2013-10-04 11:16+0000\n" +"Last-Translator: Dennis Baudys <Unknown>\n" +"Language-Team: German <de@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: de\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: Ungültige Adresse des Arguments" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: Ungültiger Argument-Typ, %s erwartet" + +msgid "boolean matrix" +msgstr "Boolesche Matrix" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: Kann Variable nicht im Scilab-Speicher anlegen" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "" + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "" + +msgid "matrix of boolean" +msgstr "Matrix boolescher Werte" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: Kann Variable \"%s\" nicht auswerten" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "%s: Falscher Typ für Eingangsargument #%d: Skalar erwartet.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: Argument »%s« kann nicht abgerufen werden" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" + +msgid "boolean sparse matrix" +msgstr "dünnbesetzte Boolesche Matrix" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: Falsche Größe für Argument #%d: (%d,%d) erwartet.\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s: Falscher Typ für Eingabeargument #%d: String oder Skalar erwartet.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s: Falscher Wert für Eingangsargument #%d: '%s' oder '%s' erwartet.\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "%s: Falscher Typ für Argument #%d: Reelle Matrix erwartet.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s: Falscher Typ des EIngangsargumentes #%d: Reeller oder ganzzahliger " +"Skalar erwartet.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "" + +msgid "double matrix" +msgstr "" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Gesamter verfügbarer Speicher: %d\n" + +msgid "API Error:\n" +msgstr "" + +#, c-format +msgid "\tin %s\n" +msgstr "\tin %s\n" + +msgid "handle matrix" +msgstr "" + +msgid "int matrix" +msgstr "" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "" + +msgid "list" +msgstr "" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s: Listenelement #%d konnte nicht im Scilab Speicher erzeugt werden" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "" +"%s: Listenelement #%d konnte nicht in der Variable \"%s\" erzeugt werden" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "" + +msgid "Optional argument list is empty.\n" +msgstr "" + +msgid "Optional arguments list: \n" +msgstr "" + +#, c-format +msgid "and %s.\n" +msgstr "" + +msgid "pointer" +msgstr "" + +msgid "polynomial matrix" +msgstr "" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: Falscher Aufruf um eine nicht komplexe Matrix zu erhalten" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" + +msgid "matrix of double" +msgstr "" + +msgid "sparse matrix" +msgstr "Dünnbesetzte Matrix" + +msgid "string matrix" +msgstr "" + +msgid "matrix of string" +msgstr "" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "" + +msgid "matrix of wide string" +msgstr "" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" +"%s: Falscher Typ des Eingangsarguments #%d: Einzelner String erwartet.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" +"%s: Falscher Typ des Eingangsarguments \"%s\": Einzelner String erwartet.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: falsche Größe des Eingangsargumentes #%d.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: Kein weiterer Speicher verfügbar.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: Ungültiger Variablenname.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "" diff --git a/modules/api_scilab/locales/es_ES.po b/modules/api_scilab/locales/es_ES.po new file mode 100755 index 000000000..b1c79bd1f --- /dev/null +++ b/modules/api_scilab/locales/es_ES.po @@ -0,0 +1,341 @@ +# Spanish translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2013-10-04 11:16+0000\n" +"Last-Translator: Jorge Catumba <jorgerev90@gmail.com>\n" +"Language-Team: Spanish <es@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: es\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: Dirección inválida para el argumento" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: Tipo de argumento inválido, se esperaba %s" + +msgid "boolean matrix" +msgstr "matriz booleana" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: Imposible obtener el argumento #%d" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: Imposible crear la variable en la memoria de Scilab" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "" + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s: Imposible crear %s llamado \"%s\"" + +msgid "matrix of boolean" +msgstr "matriz de booleanos" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: Imposible obtener la variable \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "" +"%s: Tipo incorrecto del argumento de entrada #%d: Se esperaba un escalar.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: Imposible obtener el argumento \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" +"%s: Tipo incorrecto para el argumento \"%s\": Se esperaba un escalar.\n" + +msgid "boolean sparse matrix" +msgstr "matriz booleana dispersa" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s: Número incorrecto de argumento(s) de entrada: Se esperaban %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "" +"%s: Número incorrecto de argumento(s) de entrada: Se esperaban de %d a %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "" +"%s: Número incorrecto de argumentos de entrada: Se esperaban al menos %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "" +"%s: Número incorrecto de argumentos de entrada: Se esperaban a lo sumo%d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s: Número incorrecto de argumento(s) de salida: Se esperaban %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" +"%s: Número incorrecto de argumento(s) de salida: Se esperaban de %d a %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" +"%s: Número incorrecto de argumentos de salida: Se esperaban al menos %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" +"%s: Número incorrecto de argumentos de salida: Se esperaban a lo sumo%d.\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s: se esperaba un argumento de matriz" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s: Imposible obtener la dimensión de la variable \"%s\"" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s: ¡llamada incorrecta a %s! (primer argumento).\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s: Imposible obtener el nombre del argumento #%d" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: Imposible obtener la dirección de la variable \"%s\"" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: Imposible obtener el tipo de la variable \"%s\"" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s: Imposible obtener la dimensión del argumento" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s: Imposible obtener la dirección de la variable" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s: Imposible obtener el tipo de argumento" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s: Imposible obtener los datos del argumento" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: Tamaño incorrecto para el argumento %d: Se esperaba (%d,%d).\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s: Tipo incorrecto del argumento de entrada #%d: Se esperaba un escalar o " +"una cadena de caracteres.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s: Valor incorrecto del argumento de entrada #%d: Se esperaba '%s' o '%s'.\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "" +"%s: Tipo incorrecto para el argumento %d: Se esperaba una matriz de reales.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s: Imposible obtener la precisión del argumento" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s: Tipo incorrecto del argumento de entrada #%d: Se esperaba un escalar " +"real o un escalar entero.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s: Imposible obtener la dimensión de la variable \"%s\"" + +msgid "double matrix" +msgstr "matriz de doubles" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "se excedió el tamaño de pila!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "Use la función stacksize para aumentarlo.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "Memoria usada para variables: %d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "Memoria intermedia utilizada: %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Memoria total disponible: %d\n" + +msgid "API Error:\n" +msgstr "Error en la API:\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\ten %s\n" + +msgid "handle matrix" +msgstr "" + +msgid "int matrix" +msgstr "matriz de int (entera)" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: Imposible obtener la precisión de la variable \"%s\"" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s: Imposible obtener el número de elemento de la lista" + +msgid "list" +msgstr "lista" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "" +"%s: Imposible obtener la dirección del elemento #%d en el argumento #%d" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "" +"%s: Imposible obtener la dirección del elemento #%d en la variable \"%s\"" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "" +"%s: Imposible crear el elemento #%d de la lista en la memoria de Scilab" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "" +"%s: Imposible crear el elemento #%d de la lista en la variable \"%s\"" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s: Los elementos deben ser insertados en orden" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "" + +msgid "Optional argument list is empty.\n" +msgstr "" + +msgid "Optional arguments list: \n" +msgstr "" + +#, c-format +msgid "and %s.\n" +msgstr "" + +msgid "pointer" +msgstr "puntero" + +msgid "polynomial matrix" +msgstr "matriz de polinomios" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: Llamada incorrecta para obtener una matriz no compleja" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" +"%s: El nombre formal de una variable polinómica no puede exceder los 4 " +"caracteres" + +msgid "matrix of double" +msgstr "matriz de doubles" + +msgid "sparse matrix" +msgstr "matriz dispersa" + +msgid "string matrix" +msgstr "matriz de strings" + +msgid "matrix of string" +msgstr "matriz de strings" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "%s: No se puede convertir a una cadena extensa #%d" + +msgid "matrix of wide string" +msgstr "matriz de strings largos" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" +"%s: Tipo incorrecto del argumento de entrada #%d: Se esperaba un string.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" +"%s: Tipo incorrecto del argumento de entrada \"%s\": Se esperaba un único " +"string.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: Tamaño incorrecto para el argumento de entrada #%d.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: No hay más memoria.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: Nombre de variable inválido.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "" diff --git a/modules/api_scilab/locales/fr_FR.po b/modules/api_scilab/locales/fr_FR.po new file mode 100755 index 000000000..a3ee75668 --- /dev/null +++ b/modules/api_scilab/locales/fr_FR.po @@ -0,0 +1,340 @@ +# French translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2014-03-10 13:40+0000\n" +"Last-Translator: Julie PAUL <Unknown>\n" +"Language-Team: French <fr@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: fr\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s : Adresse d'argument invalide" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s : Type d'argument invalide, %s attendu" + +msgid "boolean matrix" +msgstr "Matrice de booléens" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s : Impossible d'obtenir l'argument n°%d" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s : Impossible de créer la variable dans la mémoire." + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "%s : Nom de variable invalide : %s" + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s : Impossible de créer %s nommé \"%s\"" + +msgid "matrix of boolean" +msgstr "Matrice de booléens" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s : Impossible d'obtenir la variable \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "" +"%s : Type erroné de l'argument d'entrée n°%d : Un scalaire attendu.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s : Impossible d'obtenir l'argument \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" +"%s : Type erroné de l'argument d'entrée \"%s\" : Un scalaire attendu.\n" + +msgid "boolean sparse matrix" +msgstr "Matrice creuse de booléens" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s : Nombre erroné d'argument(s) d'entrée : %d attendu(s).\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "%s : Nombre erroné d'argument(s) d'entrée : %d à %d attendu(s).\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "" +"%s : Nombre erroné d'argument(s) d'entrée : au moins %d attendu(s).\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "%s : Nombre erroné d'argument(s) d'entrée : au plus %d attendu(s).\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s : Nombre erroné d'argument(s) de sortie : %d attendu(s).\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "%s : Nombre erroné d'argument(s) de sortie : %d à %d attendu(s).\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" +"%s : Nombre erroné d'argument(s) de sortie : au moins %d attendu(s).\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" +"%s : Nombre erroné d'argument(s) de sortie : au plus %d attendu(s).\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s : Argument matriciel attendu" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s : Impossible d'obtenir la dimension de la variable \"%s\"" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s : Appel erroné sur %s (premier argument).\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s : Impossible d'obtenir le nom de l'argument n°%d" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s : Impossible d'obtenir l'adresse de la variable \"%s\"" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s : Impossible d'obtenir le type de la variable \"%s\"" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s : Impossible d'obtenir l'argument dimension" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s : Impossible d'obtenir l'adresse de la variable" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s : Impossible d'obtenir l'argument type" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s : Impossible d'obtenir la donnée de l'argument" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s : Dimension erronée de l'argument %d : (%d,%d) attendu.\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s : Type erroné de l'argument d'entrée n°%d : Une chaîne de caractère ou un " +"scalaire attendu.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s : Valeur erronée de l'argument d'entrée n°%d : '%s' ou '%s' attendu.\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "%s : Type erroné de l'argument %d : Une matrice réelle attendue.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s : Impossible d'obtenir l'argument precision" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s : Type erroné de l'argument d'entrée n°%d : Un scalaire réel ou entier " +"attendu.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s : Impossible d'obtenir la dimension de la variable \"%s\"" + +msgid "double matrix" +msgstr "Matrice de double" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "Taille de la pile dépassée\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "Utilisez la fonction stacksize pour l'augmenter.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "Mémoire utilisée pour les variables : %d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "Mémoire intermédiaire requise : %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Mémoire totale disponible : %d\n" + +msgid "API Error:\n" +msgstr "Erreur de l'API :\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\tdans %s\n" + +msgid "handle matrix" +msgstr "Matrice de handles graphiques" + +msgid "int matrix" +msgstr "Matrice d'entiers" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s : Impossible d'obtenir la précision de la variable \"%s\"" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s : Impossible d'obtenir le numéro de l'objet dans la liste" + +msgid "list" +msgstr "Liste" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "" +"%s : Impossible d'obtenir l'adresse de l'élément n°%d dans l'argument n°%d" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "" +"%s : Impossible d'obtenir l'adresse de l'élément n°%d dans la variable \"%s\"" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "" +"%s : Impossible de créer l'élément de la liste n°%d dans la mémoire de " +"Scilab." + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "" +"%s : Impossible de créer l'élément de la liste n°%d dans la variable \"%s\"" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s : Les éléments doivent être insérés dans l'ordre" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "%s : Le paramètre optionnel name=val doit être à la fin.\n" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "%s : Le paramètre optionnel %s n'est pas reconnu.\n" + +msgid "Optional argument list is empty.\n" +msgstr "La liste d'arguments optionnels est vide.\n" + +msgid "Optional arguments list: \n" +msgstr "Liste d'arguments optionnels : \n" + +#, c-format +msgid "and %s.\n" +msgstr "et %s.\n" + +msgid "pointer" +msgstr "Pointeur" + +msgid "polynomial matrix" +msgstr "Polynôme de matrice" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s : Appel erroné pour récupérer une matrice non complexe" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" +"%s : La variable formelle d'un polynôme ne peut pas dépasser 4 caractères" + +msgid "matrix of double" +msgstr "Matrice de double" + +msgid "sparse matrix" +msgstr "Matrice creuse" + +msgid "string matrix" +msgstr "Matrice de chaîne de caractères" + +msgid "matrix of string" +msgstr "Matrice de chaînes de caractères" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "" +"%s : Impossible de convertir l'argument d'entrée n°%d en chaîne de " +"caractères étendue." + +msgid "matrix of wide string" +msgstr "Matrice de chaîne de caractères étendue" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" +"%s : Type erroné de l'argument d'entrée n°%d : Une seule chaîne de " +"caractères attendue.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" +"%s : Type erroné de l'argument d'entrée \"%s\" : Une chaîne de caractères " +"attendue.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s : Dimension erronée de l'argument d'entrée n°%d.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s : Plus de mémoire disponible.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s : Nom de variable invalide.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "%s : Type erroné de l'argument d'entrée n°%d : Un entier attendu.\n" diff --git a/modules/api_scilab/locales/it_IT.po b/modules/api_scilab/locales/it_IT.po new file mode 100755 index 000000000..4ae51c986 --- /dev/null +++ b/modules/api_scilab/locales/it_IT.po @@ -0,0 +1,357 @@ +# Italian translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2015-02-15 20:03+0000\n" +"Last-Translator: Carml <mighty.carml@gmail.com>\n" +"Language-Team: Italian <it@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: it\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: L'indirizzo dell'argomento non è valido" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: L'argomento non è di tipo valido, era atteso %s" + +msgid "boolean matrix" +msgstr "matrice booleana" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: Impossibile ottenere l'argomento #%d" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: Impossibile creare la variabile nella memoria di Scilab" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "%s: Nome di variabile non valido: %s." + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s: Impossibile creare %s chiamato \"%s\"" + +msgid "matrix of boolean" +msgstr "matrice di valori booleani" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: Impossibile ottenere la variabile \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "" +"%s: L'argomento in ingresso #%d è di tipo sbagliato: era atteso uno " +"scalare.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: Impossibile ottenere l'argomento \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" +"%s: L'argomento in ingresso \"%s\" è di tipo sbagliato: era atteso uno " +"scalare.\n" + +msgid "boolean sparse matrix" +msgstr "matrice booleana sparsa" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "" +"%s: Il numero degli argomenti in ingresso è sbagliato: ne erano attesi %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "" +"%s: Il numero degli argomenti in ingresso è sbagliato: era atteso da %d a " +"%d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "" +"%s: Il numero degli argomenti in ingresso è sbagliato: ne erano attesi " +"almeno %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "" +"%s: Il numero degli argomenti in ingresso è sbagliato: ne erano attesi al " +"più %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "" +"%s: Il numero degli argomenti in uscita è sbagliato: ne erano attesi %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" +"%s: Il numero degli argomenti in uscita è sbagliato: era atteso da %d a %d\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" +"%s: Il numero degli argomenti in uscita è sbagliato: ne erano attesi almeno " +"%d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" +"%s: Il numero degli argomenti in uscita è sbagliato: ne erano attesi al più " +"%d.\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s: atteso un argomento della matrice" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s: Impossibile ottenere la dimensione della variabile \"%s\"" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s: chiamata sbagliata a %s! (1° argomento).\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s: Impossibile ottenere il nome dell'argomento #%d" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: Impossibile ottenere l'indirizzo della variabile \"%s\"" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: Impossibile ottenere il tipo della variabile \"%s\"" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s: Impossibile ottenere la dimensione dell'argomento" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s: Impossibile ottenere l'indirizzo della variabile" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s: Impossibile ottenere il tipo dell'argomento" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s: Impossibile ottenere i dati dell'argomento" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "" +"%s: L'argomento in ingresso %d ha una dimensione sbagliata: era attesa " +"(%d,%d).\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s: L'argomento in ingresso #%d è di tipo sbagliato: era attesa una stringa " +"o uno scalare.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s: L'argomento in ingresso #%d ha un valore sbagliato: era atteso '%s' o " +"'%s'.\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "" +"%s: L'argomento in ingresso %d è di tipo sbagliato: era attesa una matrice " +"reale.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s: Impossibile ottenere la precisione dell'argomento" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s: L'argomento in ingresso #%d è di tipo sbagliato: era atteso uno scalare " +"reale o uno scalare intero.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s: Impossibile ottenere la dimensione dalla variabile \"%s\"" + +msgid "double matrix" +msgstr "matrice di double" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "superata la dimensione dello stack!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "Usare la funzione stacksize per aumentarla.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "Memoria usata per le variabili: %d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "Memoria intermedia necessaria: %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Memoria totale disponibile: %d\n" + +msgid "API Error:\n" +msgstr "Errore nella API:\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\tin %s\n" + +msgid "handle matrix" +msgstr "matrice di handle" + +msgid "int matrix" +msgstr "matrice di interi" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: Impossibile ottenere la precisione della variabile \"%s\"" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s: Impossibile ottenere il numero degli elementi della lista" + +msgid "list" +msgstr "lista" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "" +"%s: Impossibile ottenere l'indirizzo dell'elemento #%d nell'argomento #%d" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "" +"%s: Impossibile ottenere l'indirizzo dell'elemento #%d nella variabile \"%s\"" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "" +"%s: Impossibile creare l'elemento #%d della lista nella memoria di Scilab" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "" +"%s: Impossibile creare l'elemento #%d della lista nella variabile \"%s\"" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s: Gli elementi devono essere inseriti in ordine" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" +"%s: Gli argomenti opzionali name=val devono essere messi alla fine.\n" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "%s: Gli argomenti opzionali %s non sono riconosciuti.\n" + +msgid "Optional argument list is empty.\n" +msgstr "La lista degli argomenti opzionali è vuota.\n" + +msgid "Optional arguments list: \n" +msgstr "Lista degli argomenti opzionali: \n" + +#, c-format +msgid "and %s.\n" +msgstr "e %s.\n" + +msgid "pointer" +msgstr "puntatore" + +msgid "polynomial matrix" +msgstr "matrice di polinomi" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: Chiamata sbagliata per ottenere una matrice non complessa" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" +"%s: Il nome della variabile formale di un polinomio non può eccedere 4 " +"caratteri" + +msgid "matrix of double" +msgstr "matrice di double" + +msgid "sparse matrix" +msgstr "matrice sparsa" + +msgid "string matrix" +msgstr "matrice di stringhe" + +msgid "matrix of string" +msgstr "matrice di stringhe" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "%s: Impossibile convertire %d in stringa estesa" + +msgid "matrix of wide string" +msgstr "matrice di stringhe estese" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" +"%s: L'argomento in ingresso #%d è di tipo sbagliato: era attesa una singola " +"stringa.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" +"%s: L'argomento in ingresso \"%s\" è di tipo sbagliato: era attesa una " +"singola stringa.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: L'argomento in ingresso #%d ha una dimensione sbagliata.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: Memoria esaurita.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: Nome di variabile non valido.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "" +"%s: L'argomento in ingresso #%d è di tipo sbagliato: era atteso un intero.\n" diff --git a/modules/api_scilab/locales/ja_JP.po b/modules/api_scilab/locales/ja_JP.po new file mode 100755 index 000000000..b42c930ed --- /dev/null +++ b/modules/api_scilab/locales/ja_JP.po @@ -0,0 +1,318 @@ +# Japanese translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2014-03-08 13:51+0000\n" +"Last-Translator: Rui Hirokawa <Unknown>\n" +"Language-Team: Japanese <ja@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: ja\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: 引数の位置が間違っています" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: 引数の型が間違っています, %s を指定してください" + +msgid "boolean matrix" +msgstr "論理値行列" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: 引数 #%d を取得できません" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: Scilabメモリに変数を作成できません" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "%s: 変数名が無効です: %s." + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s: %s (名称: \"%s\") を作成できません" + +msgid "matrix of boolean" +msgstr "論理値の行列" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: 変数 \"%s\"を取得できません" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "%s: 入力引数 #%d の型が間違っています: スカラーを指定してください.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: 引数 \"%s\" を取得できません" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "%s: 入力引数 \"%s\"の型が間違っています: スカラーを指定してください.\n" + +msgid "boolean sparse matrix" +msgstr "論理値疎行列" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s: 入力引数の数に誤りがあります: %d 個の引数を指定してください.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "%s: 入力引数の数が誤っています: %d から %d を指定してください.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "%s: 入力引数の数が間違っています: %d 個以上の引数を指定してください.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "%s: 入力引数の数が間違っています: %d 個以下の引数を指定してください.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s: 出力引数の数が間違っています: %d 個の引数を指定してください.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "%s: 出力引数の数が間違っています: %d から %d 個の引数を指定してください.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "%s: 出力引数の数が間違っています: %d 個以上の引数を指定してください.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "%s: 出力引数の数が間違っています: %d 個以下の引数を指定してください.\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s: 行列を引数に指定してください" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s: 変数 \"%s\" の次元を取得できません" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s: %s へのコールが間違っています (1番目の引数).\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s: 引数 #%dの名前を取得できません" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: 変数 \"%s\" の位置を取得できません" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: 変数 \"%s\"の型を取得できません" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s: 引数の次元を取得できません" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s: 変数の位置を取得できません" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s: 引数の型を取得できません" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s: 引数データを取得できません" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: 引数 %d の大きさが間違っています: 大きさを (%d,%d) としてください.\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "%s: 入力引数 #%d の型が間違っています: 文字列またはスカラーを指定してください.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "%s: 入力引数 #%d の値が間違っています: '%s' または '%s' を指定してください.\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "%s: 引数 %d の型が間違っています: 実数行列を指定してください.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s: 引数の精度を取得できません" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "%s: 入力引数 #%d の型が間違っています: 実数スカラーまたは整数スカラーを指定してください.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s: 変数\"%s\"から次元を取得できません" + +msgid "double matrix" +msgstr "double行列" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "スタックサイズが制限を超えました!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "stacksize関数によりスタック設定値を増やしてください.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "変数保持用メモリ: %d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "中間的なメモリが必要です: %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "利用可能メモリ: %d\n" + +msgid "API Error:\n" +msgstr "APIエラー\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\t%s の中に\n" + +msgid "handle matrix" +msgstr "ハンドル行列" + +msgid "int matrix" +msgstr "int行列" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: 変数 \"%s\"の精度を取得できません" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s: リストの項目数を取得できません" + +msgid "list" +msgstr "リスト" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "%s: 項目#%d の位置を引数 #%d から取得できません" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "%s: 項目#%d の位置を変数 \"%s\" から取得できません" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s: Scilabメモリにリスト項目 #%d を作成できません" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "%s: リスト項目 #%d を変数 \"%s\"に作成できません" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s: 項目は順番に挿入する必要があります" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "%s: オプションの引数 name=val は末尾に置く必要があります.\n" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "%s: 認識できないオプション引数 %s です.\n" + +msgid "Optional argument list is empty.\n" +msgstr "オプションの引数リストが空です.\n" + +msgid "Optional arguments list: \n" +msgstr "オプションの引数リスト: \n" + +#, c-format +msgid "and %s.\n" +msgstr "と %s.\n" + +msgid "pointer" +msgstr "ポインタ" + +msgid "polynomial matrix" +msgstr "多項式行列" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: 非複素行列を取得するコールに誤りがあります" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "%s: 多項式の形式変数の名前は4文字以下とする必要があります" + +msgid "matrix of double" +msgstr "doubleの行列" + +msgid "sparse matrix" +msgstr "疎行列" + +msgid "string matrix" +msgstr "文字列行列" + +msgid "matrix of string" +msgstr "文字列の行列" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "%s: ワイド文字列 #%d を変換できません" + +msgid "matrix of wide string" +msgstr "ワイド文字列の行列" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "%s: 入力引数#%dの型が間違っています: 文字列を指定してください.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "%s: 入力引数 \"%s\"の型が間違っています: 文字列を指定してください.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: 入力引数 #%d の大きさが間違っています.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: メモリ不足です.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: 変数名が無効です.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "%s: 入力引数 #%d の型が間違っています: 整数を指定してください.\n" diff --git a/modules/api_scilab/locales/pl_PL.po b/modules/api_scilab/locales/pl_PL.po new file mode 100755 index 000000000..7dba85d87 --- /dev/null +++ b/modules/api_scilab/locales/pl_PL.po @@ -0,0 +1,337 @@ +# Polish translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2013-10-04 11:16+0000\n" +"Last-Translator: Scilab.team <Unknown>\n" +"Language-Team: Polish <pl@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: Nieprawidłowy adres argumentu" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: Nieprawidłowy typ argumentu, oczekiwano %s" + +msgid "boolean matrix" +msgstr "macierz Boole'a" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: Nie można pobrać argumentu #%d" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: Nie można utworzyć zmiennej w pamięci Scilab" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "" + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s: Nie można utworzyć %s o nazwie \"%s\"" + +msgid "matrix of boolean" +msgstr "macierz wartości logicznych" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: Nie można pobrać zmiennej \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "" +"%s: Nieprawidłowy typ argumentu wejściowego #%d: oczekiwano skalara.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: Nie można pobrać argumentu \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" +"%s: Nieprawidłowy typ parametru wejściowego \"%s\": Oczekiwano skalara.\n" + +msgid "boolean sparse matrix" +msgstr "macierz rzadka zmiennych logicznych" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s: Nieprawidłowa liczba argumentów wejściowych: oczekiwano %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "" +"%s: Nieprawidłowa liczba argumentów wejściowych: oczekiwano od %d do %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "" +"%s: Nieprawidłowa liczba parametrów wejściowych: oczekiwano co najmniej %d\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "" +"%s: Nieprawidłowa liczba parametrów wejściowych: oczekiwano co najwyżej %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s: Nieprawidłowa liczba argumentów wyjściowych: oczekiwano %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" +"%s:Nieprawidłowa liczba argumentów wyjściowych: oczekiwano od %d do %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" +"%s: Nieprawidłowa liczba parametrów wyjściowych: oczekiwano co najmniej %d\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" +"%s: Nieprawidłowa liczba parametrów wyjściowych: oczekiwano co najwyżej %d.\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s: oczekiwano argumentu w postaci macierzy" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s: Nie można pobrać rozmiaru zmiennej \"%s\"" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s: złe odwołanie do %s! (pierwszy parametr).\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s: Nie można pobrać nazwy argumentu #%d" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: Nie można pobrać adresu zmiennej \"%s\"" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: Nie można pobrać typu zmiennej \"%s\"" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s: Nie można pobrać rozmiaru parametru" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s: Nie można pobrać adresu zmiennej" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s: Nie można pobrać typu argumentu" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s: Nie można pobrać danych argumentu" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: Niewłaściwy rozmiar parametru %d: oczekiwano (%d,%d).\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s: Zły typ parametru wejściowego #%d: Oczekiwano ciągu znaków lub skalara.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s: Nieprawidłowa wartość argumentu wejściowego #%d: oczekiwano '%s' lub " +"'%s' .\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "" +"%s: Nieprawidłowy typ argumentu nr %d: Oczekiwana jest macierz liczb " +"rzeczywistych.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s: Nie można pobrać dokładności parametru" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s: Nieprawidłowy typ parametru wejściowego #%d: Oczekiwano skalara " +"rzeczywistego lub całkowitego.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s: Nie można pobrać rozmiaru zmiennej \"%s\"" + +msgid "double matrix" +msgstr "macierz typu double" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "przekroczono rozmiar stosu!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "Użyj funkcji stacksize aby go zwiększyć.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "Pamięć wykorzystana dla zmiennych: %d.\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "Potrzebna pamięć pośrednia: %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Całkowita dostępna pamięć: %d\n" + +msgid "API Error:\n" +msgstr "Błąd API:\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\tw %s\n" + +msgid "handle matrix" +msgstr "" + +msgid "int matrix" +msgstr "macierz int" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: Nie można pobrać dokładności zmiennej \"%s\"" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s: Nie można pobrać numeru elementu listy" + +msgid "list" +msgstr "lista" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "%s: Nie można pobrać adresu elementu #%d w parametrze #%d" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "%s: Nie można pobrać adresu elementu #%d w zmiennej \"%s\"" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s: Nie można utworzyć elementu listy #%d w pamięci Scilab" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "%s: Nie można utworzyć elementu listy #%d w zmiennej \"%s\"" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s: Elementy muszą być wstawione w kolejności" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "" + +msgid "Optional argument list is empty.\n" +msgstr "" + +msgid "Optional arguments list: \n" +msgstr "" + +#, c-format +msgid "and %s.\n" +msgstr "" + +msgid "pointer" +msgstr "wskaźnik" + +msgid "polynomial matrix" +msgstr "macierz wielomianów" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: Nieprawidłowe wywołanie pobrania macierzy nie-zespolonej" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" +"%s: Nazwa zmiennej formalnej wielomianu nie może przekroczyć 4 znaków" + +msgid "matrix of double" +msgstr "macierz zmiennych double" + +msgid "sparse matrix" +msgstr "macierz rzadka" + +msgid "string matrix" +msgstr "macierz łańcuchów znakowych" + +msgid "matrix of string" +msgstr "macierz łańcuchów znaków" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "%s: Nie można skonwertować do wide string nr %d" + +msgid "matrix of wide string" +msgstr "macierz typu wide string" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" +"%s: Nieprawidłowy typ parametru wejściowego #%d: oczekiwano pojedynczego " +"łańcucha znaków.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" +"%s: Nieprawidłowy typ parametru wejściowego \"%s\": oczekiwano pojedynczego " +"łańcucha znaków.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: Nieprawidłowy rozmiar argumentu wejściowego nr %d.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: Brak pamięci.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: Nieprawidłowa nazwa zmiennej.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "" diff --git a/modules/api_scilab/locales/pt_BR.po b/modules/api_scilab/locales/pt_BR.po new file mode 100755 index 000000000..9649643fa --- /dev/null +++ b/modules/api_scilab/locales/pt_BR.po @@ -0,0 +1,342 @@ +# Brazilian Portuguese translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2013-10-04 11:16+0000\n" +"Last-Translator: Scilab.team <Unknown>\n" +"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: pt_BR\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: Endereço de argumento inválido" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: Tipo de argumento inválido; aceita-se %s" + +msgid "boolean matrix" +msgstr "matriz booleana" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: Impossível obter o argumento #%d" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: Impossível criar a variável na memória de Scilab" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "" + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s: Impossível criar %s chamado \"%s\"" + +msgid "matrix of boolean" +msgstr "matriz de booleano" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: Impossível obter a variável \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "" +"%s: Tipo incorreto para o argumento de entrada #%d: esperava-se um escalar.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: Impossível obter o argumento \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" +"%s: Tipo incorreto para o argumento de entrada \"%s\": esperava-se uma " +"grandeza escalar.\n" + +msgid "boolean sparse matrix" +msgstr "matriz boleana esparsa" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s: Quantidade incorreta de argumentos de entrada: esperava-se %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "" +"%s: Quantidade incorreta de argumento(s) de entrada: esperava-se de %d a " +"%d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "" +"%s: Quantidade incorreta de argumentos de entrada: esperava-se pelo menos " +"%d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "" +"%s: Quantidade incorreta de argumentos de entrada: esperava-se pelo menos " +"%d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s: Quantidade incorreta de argumentos de saída: esperava-se %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" +"%s: Quantidade incorreta de argumentos de saída: esperava-se de %d a %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "%s: Quantidade incorreta de argumentos: esperava-se pelo menos %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" +"%s: Quantidade incorreta de argumentos de saída: esperava-se pelo menos %d.\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s: o argumento não é uma matriz" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s: Impossível obter as dimensões da variável \"%s\"" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s: Chamada inválida para %s (primeiro argumento)!\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s: Impossível obter o nome do argumento #%d" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: Impossível obter o endereço da variável \"%s\"" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: Impossível obter o tipo da variável \"%s\"" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s: Impossível obter as dimensões do argumento" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s: Impossível obter o endereço da variável" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s: Impossível obter o tipo do argumento" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s: Impossível obter o conteúdo do argumento" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: Tamanho incorreto para o argumento %d: esperava-se (%d,%d).\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s: Tipo incorreto para o argumento de entrada #%d: esperava-se um texto ou " +"uma grandeza escalar.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s: Valor incorreto para o argumento de entrada #%d: esperava-se \"%s\" ou " +"\"%s\".\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "" +"%s: Tipo incorreto para o argumento %d: esperava-se uma matriz de números " +"reais.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s: Impossível obter a precisão do argumento" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s: Tipo incorreto para o argumento #%d: esperava-se um número escalar " +"inteiro ou real.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s: Impossível obter as dimensões da variável \"%s\"" + +msgid "double matrix" +msgstr "matriz de reais" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "excedeu o tamanho da pilha!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "Use a função stacksize para aumentá-la.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "Memória utilizada para variáveis: %d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "Memória intermediária necessária: %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Memória total disponível: %d\n" + +msgid "API Error:\n" +msgstr "Erro de API:\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\tem %s\n" + +msgid "handle matrix" +msgstr "" + +msgid "int matrix" +msgstr "matriz de inteiros" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: Impossível obter a precisão da variável \"%s\"" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s: Impossível obter o número do item da lista" + +msgid "list" +msgstr "lista" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "%s: Impossível obter o endereço do item #%d no argumento #%d" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "%s: Impossível obter o endereço do item #%d na variável \"%s\"" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s: Impossível criar o item #%d da lista na memória do Scilab" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "%s: Impossível criar o item #%d da lista na variável \"%s\"" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s: Os itens devem ser inseridos em ordem" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "" + +msgid "Optional argument list is empty.\n" +msgstr "" + +msgid "Optional arguments list: \n" +msgstr "" + +#, c-format +msgid "and %s.\n" +msgstr "" + +msgid "pointer" +msgstr "ponteiro" + +msgid "polynomial matrix" +msgstr "matriz polinominal" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: Erro ao obter uma matrix não complexa" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" +"%s: O nome formal de variáveis de polinômios não pode exceder 4 caracteres" + +msgid "matrix of double" +msgstr "matriz de reais" + +msgid "sparse matrix" +msgstr "matriz esparsa" + +msgid "string matrix" +msgstr "matriz de textos" + +msgid "matrix of string" +msgstr "matriz de textos" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "" + +msgid "matrix of wide string" +msgstr "matriz de textos longos" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" +"%s: Tipo incorreto para o argumento de entrada #%d: esperava-se um único " +"texto.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" +"%s: Tipo incorreto para o argumento de entrada \"%s\": esperava-se um único " +"texto.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: Tamanho incorreto para o argumento de entrada #%d.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: Memória esgotada.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: O nome da variável é inválido.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "" diff --git a/modules/api_scilab/locales/ru_RU.po b/modules/api_scilab/locales/ru_RU.po new file mode 100755 index 000000000..1e37d2296 --- /dev/null +++ b/modules/api_scilab/locales/ru_RU.po @@ -0,0 +1,330 @@ +# Russian translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2014-05-31 15:46+0000\n" +"Last-Translator: Stanislav V. Kroter <krotersv@gmail.com>\n" +"Language-Team: Russian <ru@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: ru\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: Неверный адрес параметра" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: Неверный тип параметра, ожидался %s" + +msgid "boolean matrix" +msgstr "булева матрица" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: Невозможно получить параметр №%d" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: Невозможно создать переменную в памяти Scilab" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "%s: Недопустимое имя переменной: %s." + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s: Невозможно создать %s с именем \"%s\"" + +msgid "matrix of boolean" +msgstr "булева матрица" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: Невозможно получить переменную \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "%s: Неверный тип входного параметра №%d: ожидался скаляр.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: Невозможно получить параметр \"%s\"" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "%s: Неверный тип параметра \"%s\": ожидался скаляр.\n" + +msgid "boolean sparse matrix" +msgstr "разреженная булева матрица" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s: Неверное количество входных аргументов: Ожидалось %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "%s: Неверное количество входных аргументов: Ожидалось от %d до %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "%s: Неверное количество входных аргументов: ожидалось не менее %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "" +"%s: Неверное количество входных аргументов: ожидалось не больше %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s: Неверное количество выходных аргументов: Ожидалось %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" +"%s: Неверное количество выходных аргументов: ожидалось от %d до %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" +"%s: Неверное количество выходных аргументов: ожидалось не меньше %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" +"%s: Неверное количество выходных аргументов: ожидалось не больше %d.\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s: ожидался матричный параметр" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s: Невозможно получить размерность переменной \"%s\"" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s: неправильный вызов %s! (1-й параметр).\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s: Невозможно получить имя параметра №%d" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: Невозможно получить адрес переменной \"%s\"" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: Невозможно получить тип переменной \"%s\"" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s: Невозможно получить размерность параметра" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s: Невозможно получить адрес переменной" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s: Невозможно получить тип параметра" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s: Невозможно получить данные параметра" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: Неверный размер параметра %d: ожидался размер (%d,%d).\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s: Неверный тип входного параметра №%d: ожидалась строка или скаляр.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s: Неверное значение входного параметра №%d: ожидалось «%s» или «%s».\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "" +"%s: Неверный тип параметра %d: ожидалась матрица вещественных чисел.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s: Невозможно получить точность параметра" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s: Неверный тип входного аргумента №%d: ожидался вещественный или " +"целочисленный скаляр.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s: Невозможно получить размерность из переменной \"%s\"" + +msgid "double matrix" +msgstr "матрица чисел двойной точности" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "достигнут предел размера стека!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "Используйте функцию stacksize для его увеличения.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "Занято памяти под переменные: %d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "Необходимо промежуточной памяти: %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Всего памяти доступно: %d\n" + +msgid "API Error:\n" +msgstr "Ошибка API:\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\tв %s\n" + +msgid "handle matrix" +msgstr "матрица дескрипторов" + +msgid "int matrix" +msgstr "целочисленная матрица" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: Невозможно получить точность переменной \"%s\"" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s: Невозможно получить количество элементов списка" + +msgid "list" +msgstr "список" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "%s: Невозможно получить адрес элемента №%d в параметре #%d" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "%s: Невозможно получить адрес элемента №%d в переменной \"%s\"" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s: Невозможно создать элемент списка №%d в памяти Scilab" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "%s: Невозможно создать элемент списка №%d в в переменной \"%s\"" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s: элементы должны быть вставлены в порядке" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "%s: Необязательные аргументы name=val должны быть в конце.\n" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "%s: Нераспознанные необязательные аргументы %s.\n" + +msgid "Optional argument list is empty.\n" +msgstr "Список необязательных аргументов пуст.\n" + +msgid "Optional arguments list: \n" +msgstr "Необязательные аргументы: \n" + +#, c-format +msgid "and %s.\n" +msgstr "и %s.\n" + +msgid "pointer" +msgstr "указатель" + +msgid "polynomial matrix" +msgstr "полиномиальная матрица" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: неверный вызов для получения некомплексной матрицы" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" +"%s: Формальное имя переменной многочлена не может превышать 4 символа" + +msgid "matrix of double" +msgstr "матрица чисел двойной точности" + +msgid "sparse matrix" +msgstr "разреженная матрица" + +msgid "string matrix" +msgstr "строковая матрица" + +msgid "matrix of string" +msgstr "матрица строк" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "%s: Невозможно преобразовать в широкую строку №%d" + +msgid "matrix of wide string" +msgstr "матрица длинных строк" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" +"%s: Неверный тип входного параметра #%d: ожидалась одиночная строка.\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" +"%s: Неверный тип входного параметра \"%s\": ожидалась одиночная строка.\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: Неверный размер входного параметра №%d.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: Недостаточно памяти.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: Некорректное имя переменной.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "%s: Неверный тип входного аргумента №%d: ожидалось целое число.\n" diff --git a/modules/api_scilab/locales/uk_UA.po b/modules/api_scilab/locales/uk_UA.po new file mode 100755 index 000000000..4a4cabeba --- /dev/null +++ b/modules/api_scilab/locales/uk_UA.po @@ -0,0 +1,346 @@ +# Ukrainian translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# +# Yuri Chornoivan <yurchor@gmail.com>, 2011. +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2014-03-07 19:46+0000\n" +"Last-Translator: Yuri Chornoivan <yurchor@gmail.com>\n" +"Language-Team: Ukrainian <kde-i18n-uk@kde.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: ukPlural-Forms: nplurals=1; plural=0;\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: некоректна адреса параметра" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s: некоректний тип параметра, мало бути %s" + +msgid "boolean matrix" +msgstr "матриця з булевих значень" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: не вдалося отримати аргумент №%d" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s: не вдалося створити змінну у пам’яті Scilab" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "%s: некоректна назва змінної: %s." + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s: не вдалося створити %s з назвою «%s»" + +msgid "matrix of boolean" +msgstr "матриця з булівських значень" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: не вдалося отримати змінну «%s»" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "" +"%s: помилковий тип вхідного параметра №%d: слід використовувати скалярний " +"тип.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: не вдалося отримати аргумент «%s»" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" +"\"%s: помилковий тип вхідного параметра «%s»: слід використовувати скалярний " +"тип.\n" + +msgid "boolean sparse matrix" +msgstr "розріджена матриця з булівських значень" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s: помилкова кількість вхідних параметрів: мало бути %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "" +"%s: помилкова кількість вхідних параметрів: слід використовувати від %d до " +"%d параметрів.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "" +"%s: помилкова кількість вхідних параметрів: слід вказати принаймні %d.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "" +"%s: помилкова кількість вхідних параметрів: мало бути вказано не більше %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s: помилкова кількість вихідних параметрів: мало бути %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" +"%s: помилкова кількість вихідних параметрів: мало бути від %d до %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" +"%s: помилкова кількість виведених параметрів: мало бути виведено принаймні " +"%d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" +"%s: помилкова кількість виведених параметрів: мало бути виведено не більше " +"%d.\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s: слід використовувати матричний параметр" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s: не вдалося отримати розмірність змінної «%s»" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s: помилковий виклик %s (перший параметр).\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s: не вдалося отримати назву параметра №%d" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: не вдалося отримати адресу змінної «%s»" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: не вдалося отримати тип змінної «%s»" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s: не вдалося отримати розмірність параметра" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s: не вдалося отримати адресу змінної" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s: не вдалося отримати тип параметра" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s: не вдалося отримати дані параметра" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: помилкова розмірність параметра №%d: мало бути (%d,%d).\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "" +"%s: помилковий тип вхідного параметра №%d: слід використовувати тип «string» " +"або скалярний тип.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" +"%s: Помилкове значення вхідного параметра №%d: слід використовувати «%s» або " +"«%s».\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "" +"%s: помилковий тип параметра %d: слід використовувати матрицю дійсних " +"значень.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s: не вдалося отримати точність параметра" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" +"%s: помилковий тип вхідного параметра №%d: мало бути вказано дійсний або " +"цілий тип.\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s: не вдалося отримати розмірність зі змінної «%s»" + +msgid "double matrix" +msgstr "матриця зі значень double" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "Перевищено розміри стеку!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "Скористайтеся функцією stacksize, щоб збільшити ці розміри.\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "Пам’ять, відведена під змінні: %d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "Потрібна проміжна область пам’яті: %d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "Загалом доступно пам’яті: %d\n" + +msgid "API Error:\n" +msgstr "Помилка API:\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\tу %s\n" + +msgid "handle matrix" +msgstr "матриця елемента керування" + +msgid "int matrix" +msgstr "матриця зі значень int" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: не вдалося отримати точність змінної «%s»" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s: не вдалося отримати кількість пунктів у списку" + +msgid "list" +msgstr "список" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "%s: не вдалося отримати адресу елемента №%d у аргументі №%d" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "%s: не вдалося отримати адресу елемента №%d у змінній «%s»" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s: не вдалося створити пункт списку №%d у пам’яті Scilab" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "%s: не вдалося створити пункт списку №%d у змінній «%s»" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s: елементи слід вставляти впорядковано" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" +"%s: записи додаткових параметрів у формі назва=значення слід вказувати " +"наприкінці.\n" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "%s: невідомі додаткові параметри %s.\n" + +msgid "Optional argument list is empty.\n" +msgstr "Список додаткових параметрів порожній.\n" + +msgid "Optional arguments list: \n" +msgstr "Список додаткових параметрів: \n" + +#, c-format +msgid "and %s.\n" +msgstr "і %s.\n" + +msgid "pointer" +msgstr "вказівник" + +msgid "polynomial matrix" +msgstr "поліноміальна матриця" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: помилковий виклик для отримання некомплексної матриці" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "" +"%s: формальна назва змінної полінома не може бути довшою за 4 символи" + +msgid "matrix of double" +msgstr "матриця зі значень double" + +msgid "sparse matrix" +msgstr "розріджена матриця" + +msgid "string matrix" +msgstr "рядкова матриця" + +msgid "matrix of string" +msgstr "матриця з рядків" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "%s: не вдалося перетворити довгий рядок №%d" + +msgid "matrix of wide string" +msgstr "матриця з довгих рядків" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" +"%s: помилковий тип вхідного параметра №%d: слід використовувати одинарне " +"значення типу «string».\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" +"\"%s: помилковий тип вхідного параметра «%s»: слід використовувати одинарне " +"значення типу «string».\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: помилкова розмірність вхідного параметра №%d.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: доступну пам’ять вичерпано.\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s: : некоректна назва змінної.\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "%s: помилковий тип вхідного параметра №%d: мало бути ціле число.\n" diff --git a/modules/api_scilab/locales/zh_CN.po b/modules/api_scilab/locales/zh_CN.po new file mode 100755 index 000000000..1b56d8a9d --- /dev/null +++ b/modules/api_scilab/locales/zh_CN.po @@ -0,0 +1,317 @@ +# Chinese (Simplified) translation for scilab +# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2013-10-04 11:16+0000\n" +"Last-Translator: Scilab.team <Unknown>\n" +"Language-Team: Chinese (Simplified) <zh_CN@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s:无效的的参数地址" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s无效的参数类型,应该为%s" + +msgid "boolean matrix" +msgstr "布尔型矩阵" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s无法获取第%d个参数" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s:不能在Scilab内存中创建变量" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "" + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s:无法创建名为“%s”的%s" + +msgid "matrix of boolean" +msgstr "布尔型矩阵" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s:不能获取变量“%s”" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "%s:第%d个输入参数的类型错误:应该为标量。\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s:不能获取参数“%s”" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "%s:输入参数“%s”的类型错误:应该为标量。\n" + +msgid "boolean sparse matrix" +msgstr "布尔型稀疏矩阵" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "%s:输入参数的数目错误:应该为%d。\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "%s:输入参数的数目出错:应该为%d到%d个。\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "%s:输入参数的数目错误:应该为至少%d个。\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "%s:输入参数的数目错误:应该为至多%d个。\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s:输出参数的数目错误:应该为%d个。\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "%s:输出参数的数目错误:应该为%d到%d个。\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "%s:输出参数的数目错误:应该为至少%d个。\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "%s:输出参数的数目错误:应该为至多%d个。\n" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "%s:矩阵参数除外" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s:不能获取变量“%s”的维。" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "%s:调用 %s 失败!(第一个参数)。\n" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s:不能获得第%d个参数的名称" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s:不能获得变量“%s”的地址" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s:不能获得变量“%s”的类型" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s:不能获得参数的维" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s:不能获得变量的地址" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s:无法获取参数类型" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s:无法获取参数数据" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s:参数%d的大小错误:应该为(%d,%d)。\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "%s:第%d个输入参数的类型错误:应该字符串或标量。\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "%s:第%d个输入参数的值错误:应该为‘%s’或‘%s’。\n" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "%s:参数%d的类型错误:应该是实数矩阵。\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s:无法获取参数精度" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "%s:第%d个输入参数的类型错误:应该实数标量或整数标量。\n" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s:无法获从变量\"%s\"获取维数" + +msgid "double matrix" +msgstr "双精度矩阵" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "堆栈大小超出!\n" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "使用stacksize函数增加堆栈大小。\n" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "变量已用的内存:%d\n" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "需要的中间内存:%d\n" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "可用总内存:%d\n" + +msgid "API Error:\n" +msgstr "API错误:\n" + +#, c-format +msgid "\tin %s\n" +msgstr "\t在%s中\n" + +msgid "handle matrix" +msgstr "" + +msgid "int matrix" +msgstr "整型矩阵" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s:无法获取变量“%s”的精度" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s:无法获取列表条目数" + +msgid "list" +msgstr "列表" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "%s:无法获取第%d个参数中的第%d个条目的地址" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "%s:无法获取第%d个条目的地址在变量“%s”中" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s:无法在Scilab内存中创建第%d个列表条目" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "%s:无法创建第%d个列表条目在变量“%s”中" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s:条目必须顺序插入" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "API_ERROR_GET_POLY_IN_LIST" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "" + +msgid "Optional argument list is empty.\n" +msgstr "" + +msgid "Optional arguments list: \n" +msgstr "" + +#, c-format +msgid "and %s.\n" +msgstr "" + +msgid "pointer" +msgstr "指针" + +msgid "polynomial matrix" +msgstr "多项式矩阵" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s:调用非复矩阵错误" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "%s:多项式的形式变量名不能超过4个字符" + +msgid "matrix of double" +msgstr "双精度矩阵" + +msgid "sparse matrix" +msgstr "稀疏矩阵" + +msgid "string matrix" +msgstr "字符串矩阵" + +msgid "matrix of string" +msgstr "字符串矩阵" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "%s:无法转换成宽字符#%d" + +msgid "matrix of wide string" +msgstr "宽字符串矩阵" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "%s:第%d个输入参数的类型错误:应该为单字符串(即不是字符串矩阵)。\n" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "%s:输入参数“%s”的类型错误:应该为单字符串(即不是字符串矩阵)。\n" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s:第%d个输入参数的大小错误。\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s:内存不足。\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "%s:无效的变量名。\n" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "" diff --git a/modules/api_scilab/locales/zh_TW.po b/modules/api_scilab/locales/zh_TW.po new file mode 100755 index 000000000..e73a1c394 --- /dev/null +++ b/modules/api_scilab/locales/zh_TW.po @@ -0,0 +1,318 @@ +# Chinese (Traditional) translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2013-10-04 11:16+0000\n" +"Last-Translator: Scilab.team <Unknown>\n" +"Language-Team: Chinese (Traditional) <zh_TW@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: \n" + +#, c-format +msgid "%s: Invalid argument address" +msgstr "%s: 無效的引數位址" + +#, c-format +msgid "%s: Invalid argument type, %s expected" +msgstr "%s :無效的參數形式, %s 除外" + +msgid "boolean matrix" +msgstr "布林矩陣" + +#, c-format +msgid "%s: Unable to get argument #%d" +msgstr "%s: 無法得到第 %d 參數" + +#, c-format +msgid "%s: Unable to create variable in Scilab memory" +msgstr "%s:無法在Scilab記憶體中建立變數" + +#, c-format +msgid "%s: Invalid variable name: %s." +msgstr "" + +#, c-format +msgid "%s: Unable to create %s named \"%s\"" +msgstr "%s :無法建立 %s 名為 \"%s\"" + +msgid "matrix of boolean" +msgstr "" + +#, c-format +msgid "%s: Unable to get variable \"%s\"" +msgstr "%s: 無法得到變數「 %s 」" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A scalar expected.\n" +msgstr "%s: 第 %d 個輸入參數型態錯誤: 應為純量.\n" + +#, c-format +msgid "%s: Unable to get argument \"%s\"" +msgstr "%s: 無法得到參數「 %s 」" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A scalar expected.\n" +msgstr "" + +msgid "boolean sparse matrix" +msgstr "" + +msgid "API_ERROR_READ_NAMED_BOOLEAN_SPARSE" +msgstr "" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of input argument(s): %d to %d expected.\n" +msgstr "%s: 輸入參數數目錯誤: 應在 %d ,%d 之間.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at least %d expected.\n" +msgstr "%s: 參數個數有誤: 至少要 %d 才對.\n" + +#, c-format +msgid "%s: Wrong number of input argument(s): at most %d expected.\n" +msgstr "%s: 參數個數有誤: 最多爲 %d 個.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d expected.\n" +msgstr "%s: 輸出參數數目錯誤: 應為 %d.\n" + +#, c-format +msgid "%s: Wrong number of output argument(s): %d to %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of output argument(s): at least %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong number of output argument(s): at most %d expected.\n" +msgstr "" + +#, c-format +msgid "%s: matrix argument expected" +msgstr "" + +#, c-format +msgid "%s: Unable to get dimension of variable \"%s\"" +msgstr "%s :無法得到變數\"%s\"的維度" + +#, c-format +msgid "%s: bad call to %s! (1rst argument).\n" +msgstr "" + +#, c-format +msgid "%s: Unable to get name of argument #%d" +msgstr "%s:無法得到第 %d 個參數名稱" + +#, c-format +msgid "%s: Unable to get address of variable \"%s\"" +msgstr "%s: 無法獲得變數「 %s 」的位址" + +#, c-format +msgid "%s: Unable to get type of variable \"%s\"" +msgstr "%s: 無法得到變數「 %s 」形式" + +#, c-format +msgid "%s: Unable to get argument dimension" +msgstr "%s:無法得到參數維度" + +#, c-format +msgid "%s: Unable to get variable address" +msgstr "%s :無法得到變數位址" + +#, c-format +msgid "%s: Unable to get argument type" +msgstr "%s :無法得到參數型態" + +#, c-format +msgid "%s: Unable to get argument data" +msgstr "%s:無法得到參數資料" + +#, c-format +msgid "%s: Wrong size for argument #%d: (%d,%d) expected.\n" +msgstr "%s: 參數 %d 長度錯誤: 應為 (%d,%d).\n" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A string or a scalar expected.\n" +msgstr "%s: 第 %d 的輸入參數型態錯誤: 應該是字串或是純量.\n" + +#, c-format +msgid "%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong type for argument #%d: Real matrix expected.\n" +msgstr "%s: 參數 %d 型態錯誤: 應為實數矩陣.\n" + +#, c-format +msgid "%s: Unable to get argument precision" +msgstr "%s :無法得到參數精度" + +#, c-format +msgid "" +"%s: Wrong type for input argument #%d: A real scalar or an integer scalar " +"expected.\n" +msgstr "" + +#, c-format +msgid "%s: Unable to get dimension from variable \"%s\"" +msgstr "%s :無法從變數\"%s\"得到維度型態" + +msgid "double matrix" +msgstr "" + +#, c-format +msgid "stack size exceeded!\n" +msgstr "" + +#, c-format +msgid "Use stacksize function to increase it.\n" +msgstr "" + +#, c-format +msgid "Memory used for variables: %d\n" +msgstr "" + +#, c-format +msgid "Intermediate memory needed: %d\n" +msgstr "" + +#, c-format +msgid "Total memory available: %d\n" +msgstr "" + +msgid "API Error:\n" +msgstr "" + +#, c-format +msgid "\tin %s\n" +msgstr "\t做 %s\n" + +msgid "handle matrix" +msgstr "" + +msgid "int matrix" +msgstr "" + +#, c-format +msgid "%s: Unable to get precision of variable \"%s\"" +msgstr "%s: 無法得到變數「 %s 」的精度" + +#, c-format +msgid "%s: Unable to get item number of list" +msgstr "%s:無法得到列表項目序數" + +msgid "list" +msgstr "" + +#, c-format +msgid "%s: Unable to get address of item #%d in argument #%d" +msgstr "%s:無法得到第 %d 項目的位址(在第 %d 參數中)" + +#, c-format +msgid "%s: Unable to get address of item #%d in variable \"%s\"" +msgstr "%s:無法得到第 %d 項目的位址(在變數 %s 中)" + +#, c-format +msgid "%s: Unable to create list item #%d in Scilab memory" +msgstr "%s: 無法在Scilab記憶體內建立第 %d 個列表選項" + +#, c-format +msgid "%s: Unable to create list item #%d in variable \"%s\"" +msgstr "%s:無法產生列表項目 %d 於變數 %s 中" + +#, c-format +msgid "%s: Items must be inserted in order" +msgstr "%s :項一定要加入次方" + +msgid "API_ERROR_GET_POLY_IN_LIST" +msgstr "" + +#, c-format +msgid "%s: Optional arguments name=val must be at the end.\n" +msgstr "" + +#, c-format +msgid "%s: Unrecognized optional arguments %s.\n" +msgstr "" + +msgid "Optional argument list is empty.\n" +msgstr "" + +msgid "Optional arguments list: \n" +msgstr "" + +#, c-format +msgid "and %s.\n" +msgstr "" + +msgid "pointer" +msgstr "" + +msgid "polynomial matrix" +msgstr "" + +#, c-format +msgid "%s: Bad call to get a non complex matrix" +msgstr "%s: 錯誤的呼叫複數矩陣方式" + +#, c-format +msgid "%s: Formal variable name of polynomial can't exceed 4 characters" +msgstr "%s :多項式型態變數名稱不能超過4個字元" + +msgid "matrix of double" +msgstr "" + +msgid "sparse matrix" +msgstr "" + +msgid "string matrix" +msgstr "" + +msgid "matrix of string" +msgstr "" + +#, c-format +msgid "%s: Unable to convert to wide string #%d" +msgstr "" + +msgid "matrix of wide string" +msgstr "" + +#, c-format +msgid "%s: Wrong type for input argument #%d: A single string expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong type for input argument \"%s\": A single string expected.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong size for input argument #%d.\n" +msgstr "%s: 第 %d 個輸入參數長度錯誤.\n" + +#, c-format +msgid "%s: No more memory.\n" +msgstr "%s: 記憶體空間不足。\n" + +#, c-format +msgid "%s: Invalid variable name.\n" +msgstr "" + +#, c-format +msgid "%s: Wrong type for input argument #%d: An integer expected.\n" +msgstr "" diff --git a/modules/api_scilab/macros/buildmacros.bat b/modules/api_scilab/macros/buildmacros.bat new file mode 100755 index 000000000..2cdd2abe6 --- /dev/null +++ b/modules/api_scilab/macros/buildmacros.bat @@ -0,0 +1,11 @@ +rem Scilab ( http://mwww.scilab.org/ ) - This file is part of Scilab +rem Copyright (C) 2006 - INRIA +rem +rem This file must be used under the terms of the CeCILL. +rem This source file is licensed as described in the file COPYING, which +rem you should have received as part of this distribution. The terms +rem are also available at +rem http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + + +@..\..\..\bin\scilex -nwni -ns -e exec('buildmacros.sce');quit;
\ No newline at end of file diff --git a/modules/api_scilab/macros/buildmacros.sce b/modules/api_scilab/macros/buildmacros.sce new file mode 100755 index 000000000..90d2ed8e5 --- /dev/null +++ b/modules/api_scilab/macros/buildmacros.sce @@ -0,0 +1,15 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Allan CORNET +// +// 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 + +if (isdef("genlib") == %f) then + exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce"); +end +//------------------------------------ +//genlib('api_scilablib','SCI/modules/api_scilab/macros',%f,%t); +//------------------------------------ diff --git a/modules/api_scilab/macros/cleanmacros.bat b/modules/api_scilab/macros/cleanmacros.bat new file mode 100755 index 000000000..9cf5e61e0 --- /dev/null +++ b/modules/api_scilab/macros/cleanmacros.bat @@ -0,0 +1,13 @@ +rem Scilab ( http://mwww.scilab.org/ ) - This file is part of Scilab +rem Copyright (C) 2006 - INRIA +rem +rem This file must be used under the terms of the CeCILL. +rem This source file is licensed as described in the file COPYING, which +rem you should have received as part of this distribution. The terms +rem are also available at +rem http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + + +@del *.bin 2>NUL +@del lib 2>NUL +@del names 2>NUL
\ No newline at end of file diff --git a/modules/api_scilab/src/c/DllmainApi_scilab.c b/modules/api_scilab/src/c/DllmainApi_scilab.c new file mode 100755 index 000000000..cc5ef107b --- /dev/null +++ b/modules/api_scilab/src/c/DllmainApi_scilab.c @@ -0,0 +1,36 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2009 - DIGITEO - Allan CORNET +* +* 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 +* +*/ +/*--------------------------------------------------------------------------*/ +#include <stdio.h> +#include <windows.h> +/*--------------------------------------------------------------------------*/ +#pragma comment(lib, "../../bin/libintl.lib") +#pragma comment(lib, "../../bin/blasplus.lib") +/*--------------------------------------------------------------------------*/ +int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved) +{ + + switch (reason) + { + case DLL_PROCESS_ATTACH: + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + } + return 1; +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/api_scilab/src/c/api_scilab.rc b/modules/api_scilab/src/c/api_scilab.rc new file mode 100755 index 000000000..78f9de5c0 --- /dev/null +++ b/modules/api_scilab/src/c/api_scilab.rc @@ -0,0 +1,96 @@ +// Microsoft Visual C++ generated resource script. +// + + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,5,2,0 + PRODUCTVERSION 5,5,2,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040c04b0" + BEGIN + VALUE "FileDescription", "api_scilab module" + VALUE "FileVersion", "5, 5, 2, 0" + VALUE "InternalName", "api_scilab module" + VALUE "LegalCopyright", "Copyright (C) 2017" + VALUE "OriginalFilename", "api_scilab.dll" + VALUE "ProductName", "api_scilab module" + VALUE "ProductVersion", "5, 5, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40c, 1200 + END +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/modules/api_scilab/src/cpp/.deps/.dirstamp b/modules/api_scilab/src/cpp/.deps/.dirstamp new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/.dirstamp diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_boolean.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_boolean.Plo new file mode 100755 index 000000000..4fb50d927 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_boolean.Plo @@ -0,0 +1,274 @@ +src/cpp/libsciapi_scilab_la-api_boolean.lo: src/cpp/api_boolean.cpp \ + /usr/include/stdc-predef.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + src/cpp/api_internal_boolean.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/output_stream/includes/Scierror.h \ + ../../modules/output_stream/includes/do_error_number.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h + +/usr/include/stdc-predef.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +src/cpp/api_internal_boolean.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/output_stream/includes/Scierror.h: + +../../modules/output_stream/includes/do_error_number.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_boolean_sparse.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_boolean_sparse.Plo new file mode 100755 index 000000000..4fb8c7cb0 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_boolean_sparse.Plo @@ -0,0 +1,276 @@ +src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo: \ + src/cpp/api_boolean_sparse.cpp /usr/include/stdc-predef.h \ + includes/api_scilab.h ../../modules/core/includes/stack-c.h \ + /usr/include/string.h /usr/include/features.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + includes/api_boolean_sparse.h src/cpp/api_internal_boolean_sparse.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h + +/usr/include/stdc-predef.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +includes/api_boolean_sparse.h: + +src/cpp/api_internal_boolean_sparse.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_common.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_common.Plo new file mode 100755 index 000000000..dc99c0dde --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_common.Plo @@ -0,0 +1,438 @@ +src/cpp/libsciapi_scilab_la-api_common.lo: src/cpp/api_common.cpp \ + /usr/include/stdc-predef.h /usr/include/c++/5/string \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/cpu_defines.h \ + /usr/include/c++/5/bits/stringfwd.h /usr/include/c++/5/bits/memoryfwd.h \ + /usr/include/c++/5/bits/char_traits.h \ + /usr/include/c++/5/bits/stl_algobase.h \ + /usr/include/c++/5/bits/functexcept.h \ + /usr/include/c++/5/bits/exception_defines.h \ + /usr/include/c++/5/bits/cpp_type_traits.h \ + /usr/include/c++/5/ext/type_traits.h \ + /usr/include/c++/5/ext/numeric_traits.h \ + /usr/include/c++/5/bits/stl_pair.h /usr/include/c++/5/bits/move.h \ + /usr/include/c++/5/bits/concept_check.h \ + /usr/include/c++/5/bits/stl_iterator_base_types.h \ + /usr/include/c++/5/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/5/debug/debug.h /usr/include/c++/5/bits/stl_iterator.h \ + /usr/include/c++/5/bits/ptr_traits.h \ + /usr/include/c++/5/bits/predefined_ops.h \ + /usr/include/c++/5/bits/postypes.h /usr/include/c++/5/cwchar \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h \ + /usr/include/c++/5/bits/allocator.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h \ + /usr/include/c++/5/ext/new_allocator.h /usr/include/c++/5/new \ + /usr/include/c++/5/exception \ + /usr/include/c++/5/bits/atomic_lockfree_defines.h \ + /usr/include/c++/5/bits/localefwd.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h \ + /usr/include/c++/5/clocale /usr/include/locale.h \ + /usr/include/x86_64-linux-gnu/bits/locale.h /usr/include/c++/5/iosfwd \ + /usr/include/c++/5/cctype /usr/include/ctype.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/c++/5/bits/ostream_insert.h \ + /usr/include/c++/5/bits/cxxabi_forced.h \ + /usr/include/c++/5/bits/stl_function.h \ + /usr/include/c++/5/backward/binders.h \ + /usr/include/c++/5/bits/range_access.h \ + /usr/include/c++/5/bits/basic_string.h \ + /usr/include/c++/5/ext/atomicity.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/bits/sched.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/timex.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \ + /usr/include/x86_64-linux-gnu/bits/setjmp.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/atomic_word.h \ + /usr/include/c++/5/ext/alloc_traits.h \ + /usr/include/c++/5/bits/basic_string.tcc /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h \ + /usr/include/x86_64-linux-gnu/sys/types.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + includes/api_int.h includes/api_poly.h includes/api_sparse.h \ + includes/api_boolean.h includes/api_boolean_sparse.h \ + includes/api_pointer.h includes/api_list.h includes/api_error.h \ + includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/machine.h ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/stackinfo.h \ + ../../modules/output_stream/includes/Scierror.h \ + ../../modules/output_stream/includes/do_error_number.h \ + ../../modules/output_stream/includes/sciprint.h \ + ../../modules/localization/includes/localization.h \ + /usr/include/libintl.h ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h + +/usr/include/stdc-predef.h: + +/usr/include/c++/5/string: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/cpu_defines.h: + +/usr/include/c++/5/bits/stringfwd.h: + +/usr/include/c++/5/bits/memoryfwd.h: + +/usr/include/c++/5/bits/char_traits.h: + +/usr/include/c++/5/bits/stl_algobase.h: + +/usr/include/c++/5/bits/functexcept.h: + +/usr/include/c++/5/bits/exception_defines.h: + +/usr/include/c++/5/bits/cpp_type_traits.h: + +/usr/include/c++/5/ext/type_traits.h: + +/usr/include/c++/5/ext/numeric_traits.h: + +/usr/include/c++/5/bits/stl_pair.h: + +/usr/include/c++/5/bits/move.h: + +/usr/include/c++/5/bits/concept_check.h: + +/usr/include/c++/5/bits/stl_iterator_base_types.h: + +/usr/include/c++/5/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/5/debug/debug.h: + +/usr/include/c++/5/bits/stl_iterator.h: + +/usr/include/c++/5/bits/ptr_traits.h: + +/usr/include/c++/5/bits/predefined_ops.h: + +/usr/include/c++/5/bits/postypes.h: + +/usr/include/c++/5/cwchar: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +/usr/include/c++/5/bits/allocator.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h: + +/usr/include/c++/5/ext/new_allocator.h: + +/usr/include/c++/5/new: + +/usr/include/c++/5/exception: + +/usr/include/c++/5/bits/atomic_lockfree_defines.h: + +/usr/include/c++/5/bits/localefwd.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h: + +/usr/include/c++/5/clocale: + +/usr/include/locale.h: + +/usr/include/x86_64-linux-gnu/bits/locale.h: + +/usr/include/c++/5/iosfwd: + +/usr/include/c++/5/cctype: + +/usr/include/ctype.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/c++/5/bits/ostream_insert.h: + +/usr/include/c++/5/bits/cxxabi_forced.h: + +/usr/include/c++/5/bits/stl_function.h: + +/usr/include/c++/5/backward/binders.h: + +/usr/include/c++/5/bits/range_access.h: + +/usr/include/c++/5/bits/basic_string.h: + +/usr/include/c++/5/ext/atomicity.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/bits/sched.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/timex.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/x86_64-linux-gnu/bits/setjmp.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/atomic_word.h: + +/usr/include/c++/5/ext/alloc_traits.h: + +/usr/include/c++/5/bits/basic_string.tcc: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/stackinfo.h: + +../../modules/output_stream/includes/Scierror.h: + +../../modules/output_stream/includes/do_error_number.h: + +../../modules/output_stream/includes/sciprint.h: + +../../modules/localization/includes/localization.h: + +/usr/include/libintl.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_double.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_double.Plo new file mode 100755 index 000000000..d57ca2837 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_double.Plo @@ -0,0 +1,281 @@ +src/cpp/libsciapi_scilab_la-api_double.lo: src/cpp/api_double.cpp \ + /usr/include/stdc-predef.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \ + /usr/include/x86_64-linux-gnu/bits/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/stdio2.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + src/cpp/api_internal_double.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h + +/usr/include/stdc-predef.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h: + +/usr/include/x86_64-linux-gnu/bits/stdio.h: + +/usr/include/x86_64-linux-gnu/bits/stdio2.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +src/cpp/api_internal_double.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_error.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_error.Plo new file mode 100755 index 000000000..14cf84496 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_error.Plo @@ -0,0 +1,293 @@ +src/cpp/libsciapi_scilab_la-api_error.lo: src/cpp/api_error.cpp \ + /usr/include/stdc-predef.h ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h /usr/include/stdio.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \ + /usr/include/x86_64-linux-gnu/bits/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/stdio2.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h \ + ../../modules/output_stream/includes/sciprint.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/output_stream/includes/Scierror.h \ + ../../modules/output_stream/includes/do_error_number.h \ + ../../modules/core/includes/machine.h \ + ../../modules/localization/includes/localization.h \ + /usr/include/libintl.h ../../modules/core/includes/stackinfo.h \ + ../../modules/core/includes/mode_exec.h + +/usr/include/stdc-predef.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: + +/usr/include/stdlib.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +/usr/include/stdio.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h: + +/usr/include/x86_64-linux-gnu/bits/stdio.h: + +/usr/include/x86_64-linux-gnu/bits/stdio2.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +../../modules/output_stream/includes/sciprint.h: + +../../modules/core/includes/BOOL.h: + +../../modules/output_stream/includes/Scierror.h: + +../../modules/output_stream/includes/do_error_number.h: + +../../modules/core/includes/machine.h: + +../../modules/localization/includes/localization.h: + +/usr/include/libintl.h: + +../../modules/core/includes/stackinfo.h: + +../../modules/core/includes/mode_exec.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_handle.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_handle.Plo new file mode 100755 index 000000000..1aaba56d2 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_handle.Plo @@ -0,0 +1,274 @@ +src/cpp/libsciapi_scilab_la-api_handle.lo: src/cpp/api_handle.cpp \ + /usr/include/stdc-predef.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + includes/api_internal_handle.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/output_stream/includes/Scierror.h \ + ../../modules/output_stream/includes/do_error_number.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h + +/usr/include/stdc-predef.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +includes/api_internal_handle.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/output_stream/includes/Scierror.h: + +../../modules/output_stream/includes/do_error_number.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_hypermat.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_hypermat.Plo new file mode 100755 index 000000000..9b27a2adc --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_hypermat.Plo @@ -0,0 +1,281 @@ +src/cpp/libsciapi_scilab_la-api_hypermat.lo: src/cpp/api_hypermat.cpp \ + /usr/include/stdc-predef.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \ + /usr/include/x86_64-linux-gnu/bits/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/stdio2.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + src/cpp/api_internal_double.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h + +/usr/include/stdc-predef.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h: + +/usr/include/x86_64-linux-gnu/bits/stdio.h: + +/usr/include/x86_64-linux-gnu/bits/stdio2.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +src/cpp/api_internal_double.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_int.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_int.Plo new file mode 100755 index 000000000..97e343371 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_int.Plo @@ -0,0 +1,268 @@ +src/cpp/libsciapi_scilab_la-api_int.lo: src/cpp/api_int.cpp \ + /usr/include/stdc-predef.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + src/cpp/api_internal_int.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h + +/usr/include/stdc-predef.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +src/cpp/api_internal_int.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_list.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_list.Plo new file mode 100755 index 000000000..9ea549571 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_list.Plo @@ -0,0 +1,487 @@ +src/cpp/libsciapi_scilab_la-api_list.lo: src/cpp/api_list.cpp \ + /usr/include/stdc-predef.h /usr/include/c++/5/vector \ + /usr/include/c++/5/bits/stl_algobase.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/cpu_defines.h \ + /usr/include/c++/5/bits/functexcept.h \ + /usr/include/c++/5/bits/exception_defines.h \ + /usr/include/c++/5/bits/cpp_type_traits.h \ + /usr/include/c++/5/ext/type_traits.h \ + /usr/include/c++/5/ext/numeric_traits.h \ + /usr/include/c++/5/bits/stl_pair.h /usr/include/c++/5/bits/move.h \ + /usr/include/c++/5/bits/concept_check.h \ + /usr/include/c++/5/bits/stl_iterator_base_types.h \ + /usr/include/c++/5/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/5/debug/debug.h /usr/include/c++/5/bits/stl_iterator.h \ + /usr/include/c++/5/bits/ptr_traits.h \ + /usr/include/c++/5/bits/predefined_ops.h \ + /usr/include/c++/5/bits/allocator.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h \ + /usr/include/c++/5/ext/new_allocator.h /usr/include/c++/5/new \ + /usr/include/c++/5/exception \ + /usr/include/c++/5/bits/atomic_lockfree_defines.h \ + /usr/include/c++/5/bits/memoryfwd.h \ + /usr/include/c++/5/bits/stl_construct.h \ + /usr/include/c++/5/ext/alloc_traits.h \ + /usr/include/c++/5/bits/stl_uninitialized.h \ + /usr/include/c++/5/bits/stl_vector.h \ + /usr/include/c++/5/bits/stl_bvector.h \ + /usr/include/c++/5/bits/range_access.h \ + /usr/include/c++/5/bits/vector.tcc /usr/include/c++/5/map \ + /usr/include/c++/5/bits/stl_tree.h \ + /usr/include/c++/5/bits/stl_function.h \ + /usr/include/c++/5/backward/binders.h /usr/include/c++/5/bits/stl_map.h \ + /usr/include/c++/5/bits/stl_multimap.h /usr/include/c++/5/string \ + /usr/include/c++/5/bits/stringfwd.h \ + /usr/include/c++/5/bits/char_traits.h /usr/include/c++/5/bits/postypes.h \ + /usr/include/c++/5/cwchar /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h \ + /usr/include/c++/5/bits/localefwd.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h \ + /usr/include/c++/5/clocale /usr/include/locale.h \ + /usr/include/x86_64-linux-gnu/bits/locale.h /usr/include/c++/5/iosfwd \ + /usr/include/c++/5/cctype /usr/include/ctype.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/c++/5/bits/ostream_insert.h \ + /usr/include/c++/5/bits/cxxabi_forced.h \ + /usr/include/c++/5/bits/basic_string.h \ + /usr/include/c++/5/ext/atomicity.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/bits/sched.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/timex.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \ + /usr/include/x86_64-linux-gnu/bits/setjmp.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/atomic_word.h \ + /usr/include/c++/5/bits/basic_string.tcc /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \ + /usr/include/x86_64-linux-gnu/bits/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/stdio2.h \ + ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h \ + /usr/include/x86_64-linux-gnu/sys/types.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h \ + ../../modules/core/includes/machine.h ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/sci_types.h includes/api_scilab.h \ + includes/api_common.h includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + includes/api_int.h includes/api_poly.h includes/api_sparse.h \ + includes/api_boolean.h includes/api_boolean_sparse.h \ + includes/api_pointer.h includes/api_list.h includes/api_error.h \ + includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h src/cpp/api_internal_common.h \ + src/cpp/api_internal_double.h src/cpp/api_internal_string.h \ + src/cpp/api_internal_boolean.h src/cpp/api_internal_poly.h \ + src/cpp/api_internal_int.h src/cpp/api_internal_sparse.h \ + src/cpp/api_internal_boolean_sparse.h src/cpp/api_internal_pointer.h \ + ../../modules/localization/includes/localization.h \ + /usr/include/libintl.h + +/usr/include/stdc-predef.h: + +/usr/include/c++/5/vector: + +/usr/include/c++/5/bits/stl_algobase.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/cpu_defines.h: + +/usr/include/c++/5/bits/functexcept.h: + +/usr/include/c++/5/bits/exception_defines.h: + +/usr/include/c++/5/bits/cpp_type_traits.h: + +/usr/include/c++/5/ext/type_traits.h: + +/usr/include/c++/5/ext/numeric_traits.h: + +/usr/include/c++/5/bits/stl_pair.h: + +/usr/include/c++/5/bits/move.h: + +/usr/include/c++/5/bits/concept_check.h: + +/usr/include/c++/5/bits/stl_iterator_base_types.h: + +/usr/include/c++/5/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/5/debug/debug.h: + +/usr/include/c++/5/bits/stl_iterator.h: + +/usr/include/c++/5/bits/ptr_traits.h: + +/usr/include/c++/5/bits/predefined_ops.h: + +/usr/include/c++/5/bits/allocator.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h: + +/usr/include/c++/5/ext/new_allocator.h: + +/usr/include/c++/5/new: + +/usr/include/c++/5/exception: + +/usr/include/c++/5/bits/atomic_lockfree_defines.h: + +/usr/include/c++/5/bits/memoryfwd.h: + +/usr/include/c++/5/bits/stl_construct.h: + +/usr/include/c++/5/ext/alloc_traits.h: + +/usr/include/c++/5/bits/stl_uninitialized.h: + +/usr/include/c++/5/bits/stl_vector.h: + +/usr/include/c++/5/bits/stl_bvector.h: + +/usr/include/c++/5/bits/range_access.h: + +/usr/include/c++/5/bits/vector.tcc: + +/usr/include/c++/5/map: + +/usr/include/c++/5/bits/stl_tree.h: + +/usr/include/c++/5/bits/stl_function.h: + +/usr/include/c++/5/backward/binders.h: + +/usr/include/c++/5/bits/stl_map.h: + +/usr/include/c++/5/bits/stl_multimap.h: + +/usr/include/c++/5/string: + +/usr/include/c++/5/bits/stringfwd.h: + +/usr/include/c++/5/bits/char_traits.h: + +/usr/include/c++/5/bits/postypes.h: + +/usr/include/c++/5/cwchar: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +/usr/include/c++/5/bits/localefwd.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h: + +/usr/include/c++/5/clocale: + +/usr/include/locale.h: + +/usr/include/x86_64-linux-gnu/bits/locale.h: + +/usr/include/c++/5/iosfwd: + +/usr/include/c++/5/cctype: + +/usr/include/ctype.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/c++/5/bits/ostream_insert.h: + +/usr/include/c++/5/bits/cxxabi_forced.h: + +/usr/include/c++/5/bits/basic_string.h: + +/usr/include/c++/5/ext/atomicity.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/bits/sched.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/timex.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/x86_64-linux-gnu/bits/setjmp.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/atomic_word.h: + +/usr/include/c++/5/bits/basic_string.tcc: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h: + +/usr/include/x86_64-linux-gnu/bits/stdio.h: + +/usr/include/x86_64-linux-gnu/bits/stdio2.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/sci_types.h: + +includes/api_scilab.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +src/cpp/api_internal_common.h: + +src/cpp/api_internal_double.h: + +src/cpp/api_internal_string.h: + +src/cpp/api_internal_boolean.h: + +src/cpp/api_internal_poly.h: + +src/cpp/api_internal_int.h: + +src/cpp/api_internal_sparse.h: + +src/cpp/api_internal_boolean_sparse.h: + +src/cpp/api_internal_pointer.h: + +../../modules/localization/includes/localization.h: + +/usr/include/libintl.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_optional.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_optional.Plo new file mode 100755 index 000000000..9c0ae50ba --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_optional.Plo @@ -0,0 +1,272 @@ +src/cpp/libsciapi_scilab_la-api_optional.lo: src/cpp/api_optional.cpp \ + /usr/include/stdc-predef.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/output_stream/includes/Scierror.h \ + ../../modules/output_stream/includes/do_error_number.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/output_stream/includes/sciprint.h + +/usr/include/stdc-predef.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/output_stream/includes/Scierror.h: + +../../modules/output_stream/includes/do_error_number.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: + +../../modules/output_stream/includes/sciprint.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_pointer.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_pointer.Plo new file mode 100755 index 000000000..8349ae808 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_pointer.Plo @@ -0,0 +1,271 @@ +src/cpp/libsciapi_scilab_la-api_pointer.lo: src/cpp/api_pointer.cpp \ + /usr/include/stdc-predef.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h + +/usr/include/stdc-predef.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_poly.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_poly.Plo new file mode 100755 index 000000000..fb2db970f --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_poly.Plo @@ -0,0 +1,280 @@ +src/cpp/libsciapi_scilab_la-api_poly.lo: src/cpp/api_poly.cpp \ + /usr/include/stdc-predef.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + src/cpp/api_internal_poly.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/string/includes/code2str.h \ + ../../modules/string/includes/dynlib_string.h + +/usr/include/stdc-predef.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +src/cpp/api_internal_poly.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: + +../../modules/string/includes/code2str.h: + +../../modules/string/includes/dynlib_string.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_sparse.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_sparse.Plo new file mode 100755 index 000000000..22307bd81 --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_sparse.Plo @@ -0,0 +1,274 @@ +src/cpp/libsciapi_scilab_la-api_sparse.lo: src/cpp/api_sparse.cpp \ + /usr/include/stdc-predef.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h /usr/include/string.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h includes/api_int.h \ + includes/api_poly.h includes/api_sparse.h includes/api_boolean.h \ + includes/api_boolean_sparse.h includes/api_pointer.h includes/api_list.h \ + includes/api_error.h includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + src/cpp/api_internal_sparse.h \ + ../../modules/localization/includes/localization.h \ + ../../modules/core/includes/machine.h /usr/include/libintl.h \ + ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/BOOL.h + +/usr/include/stdc-predef.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +src/cpp/api_internal_sparse.h: + +../../modules/localization/includes/localization.h: + +../../modules/core/includes/machine.h: + +/usr/include/libintl.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/BOOL.h: diff --git a/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_string.Plo b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_string.Plo new file mode 100755 index 000000000..f10002ceb --- /dev/null +++ b/modules/api_scilab/src/cpp/.deps/libsciapi_scilab_la-api_string.Plo @@ -0,0 +1,292 @@ +src/cpp/libsciapi_scilab_la-api_string.lo: src/cpp/api_string.cpp \ + /usr/include/stdc-predef.h /usr/include/string.h /usr/include/features.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/localization/includes/charEncoding.h /usr/include/wchar.h \ + /usr/include/stdio.h /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h \ + /usr/include/x86_64-linux-gnu/sys/stat.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/bits/stat.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \ + ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/BOOL.h includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h \ + /usr/include/x86_64-linux-gnu/bits/xopen_lim.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h includes/api_common.h \ + includes/api_scilab.h includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h includes/api_string.h \ + includes/api_int.h includes/api_poly.h includes/api_sparse.h \ + includes/api_boolean.h includes/api_boolean_sparse.h \ + includes/api_pointer.h includes/api_list.h includes/api_error.h \ + includes/api_handle.h includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h src/cpp/api_internal_common.h \ + src/cpp/api_internal_string.h \ + ../../modules/call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/machine.h \ + ../../modules/localization/includes/localization.h \ + /usr/include/libintl.h ../../modules/string/includes/code2str.h \ + ../../modules/string/includes/dynlib_string.h \ + ../../modules/core/includes/freeArrayOfString.h + +/usr/include/stdc-predef.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/localization/includes/charEncoding.h: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +/usr/include/x86_64-linux-gnu/sys/stat.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/bits/stat.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/BOOL.h: + +includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/x86_64-linux-gnu/bits/xopen_lim.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +includes/api_common.h: + +includes/api_scilab.h: + +includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +includes/api_string.h: + +includes/api_int.h: + +includes/api_poly.h: + +includes/api_sparse.h: + +includes/api_boolean.h: + +includes/api_boolean_sparse.h: + +includes/api_pointer.h: + +includes/api_list.h: + +includes/api_error.h: + +includes/api_handle.h: + +includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +src/cpp/api_internal_common.h: + +src/cpp/api_internal_string.h: + +../../modules/call_scilab/includes/call_scilab.h: + +../../modules/core/includes/machine.h: + +../../modules/localization/includes/localization.h: + +/usr/include/libintl.h: + +../../modules/string/includes/code2str.h: + +../../modules/string/includes/dynlib_string.h: + +../../modules/core/includes/freeArrayOfString.h: diff --git a/modules/api_scilab/src/cpp/.dirstamp b/modules/api_scilab/src/cpp/.dirstamp new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/modules/api_scilab/src/cpp/.dirstamp diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_boolean.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_boolean.o Binary files differnew file mode 100755 index 000000000..248a2b8fe --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_boolean.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_boolean_sparse.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_boolean_sparse.o Binary files differnew file mode 100755 index 000000000..ade2368e8 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_boolean_sparse.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_common.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_common.o Binary files differnew file mode 100755 index 000000000..f8a05de89 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_common.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_double.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_double.o Binary files differnew file mode 100755 index 000000000..0477626fe --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_double.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_error.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_error.o Binary files differnew file mode 100755 index 000000000..52bd48f67 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_error.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_handle.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_handle.o Binary files differnew file mode 100755 index 000000000..e0462be7a --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_handle.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_hypermat.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_hypermat.o Binary files differnew file mode 100755 index 000000000..e12e464f5 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_hypermat.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_int.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_int.o Binary files differnew file mode 100755 index 000000000..24c8507eb --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_int.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_list.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_list.o Binary files differnew file mode 100755 index 000000000..8146ca7a0 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_list.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_optional.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_optional.o Binary files differnew file mode 100755 index 000000000..fb6137cca --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_optional.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_pointer.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_pointer.o Binary files differnew file mode 100755 index 000000000..8aab87c47 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_pointer.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_poly.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_poly.o Binary files differnew file mode 100755 index 000000000..49ce8bff4 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_poly.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_sparse.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_sparse.o Binary files differnew file mode 100755 index 000000000..4b218dd44 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_sparse.o diff --git a/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_string.o b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_string.o Binary files differnew file mode 100755 index 000000000..b67a66938 --- /dev/null +++ b/modules/api_scilab/src/cpp/.libs/libsciapi_scilab_la-api_string.o diff --git a/modules/api_scilab/src/cpp/api_boolean.cpp b/modules/api_scilab/src/cpp/api_boolean.cpp new file mode 100755 index 000000000..f582e0d63 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_boolean.cpp @@ -0,0 +1,330 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2009 - DIGITEO - Antoine ELIAS +* +* 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 +* +* Please note that piece of code will be rewrited for the Scilab 6 family +* However, the API (profile of the functions in the header files) will be +* still available and supported in Scilab 6. +*/ + +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_boolean.h" +#include "localization.h" + +#include "Scierror.h" +#include "call_scilab.h" + + +/********************************/ +/* boolean matrix functions */ +/********************************/ +SciErr getMatrixOfBoolean(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piBool) +{ + SciErr sciErr = sciErrInit(); + int iType = 0; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getMatrixOfBoolean"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr || iType != sci_boolean) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getMatrixOfBoolean", _("boolean matrix")); + return sciErr; + } + + sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_BOOLEAN, _("%s: Unable to get argument #%d"), "getMatrixOfBoolean", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (_piBool) + { + *_piBool = _piAddress + 3; + } + return sciErr; +} + +SciErr allocMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piBool) +{ + SciErr sciErr = sciErrInit(); + int *piAddr = NULL; + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + + //return empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + int iMemSize = (int)(((double)(_iRows * _iCols) / 2) + 2); + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(iAddr)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + fillMatrixOfBoolean(_pvCtx, piAddr, _iRows, _iCols, _piBool); + + updateInterSCI(_iVar, '$', iAddr, sadr(iadr(iAddr) + 3)); + updateLstk(iNewPos, sadr(iadr(iAddr) + 3), (_iRows * _iCols) / (sizeof(double) / sizeof(int))); + + return sciErr; +} + +SciErr fillMatrixOfBoolean(void* _pvCtx, int* _piAddress, int _iRows, int _iCols, int** _piBool) +{ + SciErr sciErr = sciErrInit(); + _piAddress[0] = sci_boolean; + _piAddress[1] = Min(_iRows, _iRows * _iCols); + _piAddress[2] = Min(_iCols, _iRows * _iCols); + + *_piBool = _piAddress + 3; + return sciErr; +} + +SciErr createMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piBool) +{ + SciErr sciErr = sciErrInit(); + int* piBool = NULL; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + sciErr = allocMatrixOfBoolean(_pvCtx, _iVar, _iRows, _iCols, &piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfBoolean"); + return sciErr; + } + + memcpy(piBool, _piBool, sizeof(int) * _iRows * _iCols); + return sciErr; +} + +SciErr createNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piBool) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int* piBool = NULL; + int *piAddr = NULL; + + //return named empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createNamedMatrixOfDouble(_pvCtx, _pstName, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createNamedEmptyMatrix"); + } + return sciErr; + } + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createNamedMatrixOfBoolean", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + Top = Top + Nbvars + 1; + + int iMemSize = (int)(((double)(_iRows * _iCols) / 2) + 2); + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(*Lstk(Top))); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + //write matrix information + sciErr = fillMatrixOfBoolean(_pvCtx, piAddr, _iRows, _iCols, &piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_BOOLEAN, _("%s: Unable to create %s named \"%s\""), "createNamedMatrixOfBoolean", _("matrix of boolean"), _pstName); + return sciErr; + } + + //copy data in stack + memcpy(piBool, _piBool, sizeof(int) * _iRows * _iCols); + + updateLstk(Top, *Lstk(Top) + sadr(3), (_iRows * _iCols) / (sizeof(double) / sizeof(int))); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + return sciErr; +} + +SciErr readNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piBool) +{ + SciErr sciErr = sciErrInit(); + int* piAddr = NULL; + int* piBool = NULL; + + sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_BOOLEAN, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfBoolean", _pstName); + return sciErr; + } + + sciErr = getMatrixOfBoolean(_pvCtx, piAddr, _piRows, _piCols, &piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_BOOLEAN, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfBoolean", _pstName); + return sciErr; + } + + if (_piBool) + { + memcpy(_piBool, piBool, sizeof(int) **_piRows **_piCols); + } + + return sciErr; +} + +/*shortcut functions*/ + +/*--------------------------------------------------------------------------*/ +int isBooleanType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_boolean); +} +/*--------------------------------------------------------------------------*/ +int isNamedBooleanType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_boolean); +} +/*--------------------------------------------------------------------------*/ +int getScalarBoolean(void* _pvCtx, int* _piAddress, int* _piBool) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + + int* piBool = NULL; + + sciErr = getMatrixOfBoolean(_pvCtx, _piAddress, &iRows, &iCols, &piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_SCALAR_BOOLEAN, _("%s: Unable to get argument #%d"), "getScalarBoolean", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (isScalar(_pvCtx, _piAddress) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_SCALAR_BOOLEAN, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "getScalarBoolean", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (_piBool != NULL) + { + *_piBool = piBool[0]; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedScalarBoolean(void* _pvCtx, const char* _pstName, int* _piBool) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + + int iBool = 0; + + sciErr = readNamedMatrixOfBoolean(_pvCtx, _pstName, &iRows, &iCols, &iBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_SCALAR_BOOLEAN, _("%s: Unable to get argument \"%s\""), "getNamedScalarBoolean", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (isNamedScalar(_pvCtx, _pstName) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_SCALAR_BOOLEAN, _("%s: Wrong type for input argument \"%s\": A scalar expected.\n"), "getNamedScalarBoolean", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (_piBool != NULL) + { + *_piBool = iBool; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createScalarBoolean(void* _pvCtx, int _iVar, int _iBool) +{ + SciErr sciErr = sciErrInit(); + int* piBool = NULL; + + sciErr = allocMatrixOfBoolean(_pvCtx, _iVar, 1, 1, &piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_BOOLEAN, _("%s: Unable to create variable in Scilab memory"), "createScalarBoolean"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + piBool[0] = _iBool; + return 0; +} +/*--------------------------------------------------------------------------*/ +int createNamedScalarBoolean(void* _pvCtx, const char* _pstName, int _iBool) +{ + SciErr sciErr = sciErrInit(); + sciErr = createNamedMatrixOfBoolean(_pvCtx, _pstName, 1, 1, &_iBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_BOOLEAN, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarBoolean"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/api_scilab/src/cpp/api_boolean_sparse.cpp b/modules/api_scilab/src/cpp/api_boolean_sparse.cpp new file mode 100755 index 000000000..8a415f4fe --- /dev/null +++ b/modules/api_scilab/src/cpp/api_boolean_sparse.cpp @@ -0,0 +1,327 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_boolean_sparse.h" +#include "api_internal_boolean_sparse.h" +#include "localization.h" + + +#include "call_scilab.h" +#include "MALLOC.h" + +SciErr getBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos) +{ + SciErr sciErr = sciErrInit(); + int iType = 0; + + if ( _piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getBooleanSparseMatrix"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr || iType != sci_boolean_sparse) + { + addErrorMessage(&sciErr, API_ERROR_GET_BOOLEAN_SPARSE, _("%s: Unable to get argument #%d"), "getBooleanSparseMatrix", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_BOOLEAN_SPARSE, _("%s: Unable to get argument #%d"), "getBooleanSparseMatrix", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + *_piNbItem = _piAddress[4]; + + if (_piNbItemRow == NULL) + { + return sciErr; + } + *_piNbItemRow = _piAddress + 5;//4 for header + 1 for NbItem + + if (_piColPos == NULL) + { + return sciErr; + } + *_piColPos = *_piNbItemRow + *_piRows; + + return sciErr; +} + +SciErr allocBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos) +{ + SciErr sciErr = sciErrInit(); + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int iPos = 5 + _iRows + _iNbItem; + int* piAddr = NULL; + + //return empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + int iMemSize = (int)( ( (double)iPos / 2 ) + 0.5); + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(iAddr)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + sciErr = fillBooleanSparseMatrix(_pvCtx, piAddr, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_BOOLEAN_SPARSE, _("%s: Unable to create variable in Scilab memory"), "allocBooleanSparseMatrix"); + return sciErr; + } + + iPos += iAddr; + updateInterSCI(_iVar, '$', iAddr, iPos); + updateLstk(iNewPos, iPos, 0); + return sciErr; +} + +SciErr fillBooleanSparseMatrix(void* _pvCtx, int *_piAddress, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos) +{ + SciErr sciErr = sciErrInit(); + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "fillBooleanSparseMatrix"); + return sciErr; + } + + _piAddress[0] = sci_boolean_sparse; + _piAddress[1] = Min(_iRows, _iRows * _iCols); + _piAddress[2] = Min(_iCols, _iRows * _iCols); + _piAddress[3] = 0; + + _piAddress[4] = _iNbItem; + + *_piNbItemRow = _piAddress + 5;//4 for header + 1 for NbItem + *_piColPos = *_piNbItemRow + _iRows; + return sciErr; +} + +SciErr createBooleanSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos) +{ + SciErr sciErr = sciErrInit(); + int* piNbItemRow = NULL; + int* piColPos = NULL; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + sciErr = allocBooleanSparseMatrix(_pvCtx, _iVar, _iRows, _iCols, _iNbItem, &piNbItemRow, &piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_SPARSE, _("%s: Unable to create variable in Scilab memory"), "createBooleanSparseMatrix"); + return sciErr; + } + + memcpy(piNbItemRow, _piNbItemRow, _iRows * sizeof(int)); + memcpy(piColPos, _piColPos, _iNbItem * sizeof(int)); + return sciErr; +} + +SciErr createNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int iPos = 0; + + int* piAddr = NULL; + int* piNbItemRow = NULL; + int* piColPos = NULL; + + //return named empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createNamedMatrixOfDouble(_pvCtx, _pstName, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createNamedEmptyMatrix"); + } + return sciErr; + } + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createNamedBooleanSparseMatrix", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + Top = Top + Nbvars + 1; + + int iMemSize = (int)( ( (double)iPos / 2) + 0.5); + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(Top)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + sciErr = fillBooleanSparseMatrix(_pvCtx, piAddr, _iRows, _iCols, _iNbItem, &piNbItemRow, &piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_BOOLEAN_SPARSE, _("%s: Unable to create %s named \"%s\""), "createNamedBooleanSparseMatrix", _("boolean sparse matrix"), _pstName); + return sciErr; + } + + memcpy(piNbItemRow, _piNbItemRow, _iRows * sizeof(int)); + memcpy(piColPos, _piColPos, _iNbItem * sizeof(int)); + + iPos = 5;//4 for header + 1 for NbItem + iPos += _iRows + _iNbItem; + + //update "variable index" + updateLstk(Top, *Lstk(Top) + iPos, 0); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr readNamedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos) +{ + SciErr sciErr = sciErrInit(); + int* piAddr = NULL; + int* piNbItemRow = 0; + int* piColPos = 0; + + sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_BOOLEAN_SPARSE, _("%s: Unable to get variable \"%s\""), "readNamedBooleanSparseMatrix", _pstName); + return sciErr; + } + + sciErr = getBooleanSparseMatrix(_pvCtx, piAddr, _piRows, _piCols, _piNbItem, &piNbItemRow, &piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_BOOLEAN_SPARSE, _("API_ERROR_READ_NAMED_BOOLEAN_SPARSE")); + return sciErr; + } + + if (_piNbItemRow == NULL) + { + return sciErr; + } + + memcpy(_piNbItemRow, piNbItemRow, *_piRows * sizeof(int)); + + if (_piColPos == NULL) + { + return sciErr; + } + + memcpy(_piColPos, piColPos, *_piNbItem * sizeof(int)); + return sciErr; +} +/*--------------------------------------------------------------------------*/ +int isBooleanSparseType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_boolean_sparse); +} +/*--------------------------------------------------------------------------*/ +int isNamedBooleanSparseType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_boolean_sparse); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos) +{ + SciErr sciErr = sciErrInit(); + int* piNbItemRow = NULL; + int* piColPos = NULL; + + sciErr = getBooleanSparseMatrix(_pvCtx, _piAddress, _piRows, _piCols, _piNbItem, &piNbItemRow, &piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_BOOLEAN_SPARSE, _("%s: Unable to get argument #%d"), "getAllocatedBooleanSparseMatrix", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_piNbItemRow = (int*)MALLOC(sizeof(int) * *_piRows); + memcpy(*_piNbItemRow, piNbItemRow, sizeof(int) * *_piRows); + + *_piColPos = (int*)MALLOC(sizeof(int) * *_piNbItem); + memcpy(*_piColPos, piColPos, sizeof(int) * *_piNbItem); + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedAllocatedBooleanSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos) +{ + SciErr sciErr = sciErrInit(); + sciErr = readNamedBooleanSparseMatrix(_pvCtx, _pstName, _piRows, _piCols, _piNbItem, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_ALLOC_BOOLEAN_SPARSE, _("%s: Unable to get argument \"%s\""), "getNamedAllocatedBooleanSparseMatrix", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_piNbItemRow = (int*)MALLOC(sizeof(int) * *_piRows); + *_piColPos = (int*)MALLOC(sizeof(int) * *_piNbItem); + + sciErr = readNamedBooleanSparseMatrix(_pvCtx, _pstName, _piRows, _piCols, _piNbItem, *_piNbItemRow, *_piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_ALLOC_BOOLEAN_SPARSE, _("%s: Unable to get argument \"%s\""), "getNamedAllocatedBooleanSparseMatrix", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedBooleanSparse(int* _piNbItemRow, int* _piColPos) +{ + FREE(_piNbItemRow); + FREE(_piColPos); +} diff --git a/modules/api_scilab/src/cpp/api_common.cpp b/modules/api_scilab/src/cpp/api_common.cpp new file mode 100755 index 000000000..94263bef0 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_common.cpp @@ -0,0 +1,1379 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2009 - DIGITEO - Antoine ELIAS +* +* 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 +* +* Please note that piece of code will be rewrited for the Scilab 6 family +* However, the API (profile of the functions in the header files) will be +* still available and supported in Scilab 6. +*/ + +#include <string> +#include <stdlib.h> +//#include "api_stack.h" +#include "api_scilab.h" +#include "api_internal_common.h" +#include "call_scilab.h" +#include "stackinfo.h" +#include "Scierror.h" +#include "sciprint.h" +#include "localization.h" +#include "MALLOC.h" + +/*Global structure for scilab 5.x*/ +extern "C" +{ + StrCtx *pvApiCtx = NULL; +} + +/*--------------------------------------------------------------------------*/ +/* Defined in SCI/modules/core/src/fortran/cvname.f */ +extern "C" +{ + extern int C2F(cvnamel) (int *id, char *str, int *jobptr, int *str_len); + extern int C2F(cvname)(int *, char *, int *, unsigned long int); + /* *jobptr==0: Get Scilab codes from C-string */ + /* *jobptr==1: Get C-string from Scilab codes */ + + extern int C2F(stackp) (int *, int *); + extern int C2F(funs) (int *); +}; + +/*--------------------------------------------------------------------------*/ +#define idstk(x,y) (C2F(vstk).idstk+(x-1)+(y-1)*nsiz) +#define CvNameL(id,str,jobptr,str_len) C2F(cvnamel)(id,str,jobptr,str_len); + +static SciErr getinternalVarAddress(void* _pvCtx, int _iVar, int** _piAddress); + +/*--------------------------------------------------------------------------*/ +/* Replaces Rhs */ +int* getNbInputArgument(void* _pvCtx) +{ + return &C2F(com).rhs; +} + +/* Replaces Top */ +int* getNbArgumentOnStack(void* _pvCtx) +{ + return &C2F(vstk).top; +} + +/* Replaces Lhs */ +int* getNbOutputArgument(void* _pvCtx) +{ + return &C2F(com).lhs; +} + +int* assignOutputVariable(void* _pvCtx, int _iVal) +{ + return &(C2F(intersci).lhsvar[_iVal - 1]); +} + +int returnArguments(void* _pvCtx) +{ + return C2F(putlhsvar)(); +} + +int checkInputArgument(void* _pvCtx, int _iMin, int _iMax) +{ + SciErr sciErr = sciErrInit(); + + /* + * store the name in recu array, fname can be a non null terminated char array + * Get_Iname() can be used in other function to get the interface name + */ + int cx0 = 0; + C2F(cvname) (&C2F(recu).ids[(C2F(recu).pt + 1) * nsiz - nsiz], ((StrCtx *) _pvCtx)->pstName, &cx0, (unsigned long int)strlen(((StrCtx *)_pvCtx)->pstName)); + + if (_iMin <= nbInputArgument(_pvCtx) && _iMax >= nbInputArgument(_pvCtx)) + { + return 1; + } + + if (_iMax == _iMin) + { + Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), ((StrCtx *) _pvCtx)->pstName, _iMax); + } + else + { + Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), ((StrCtx *) _pvCtx)->pstName, _iMin, _iMax); + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkInputArgumentAtLeast(void* _pvCtx, int _iMin) +{ + SciErr sciErr = sciErrInit(); + + if (_iMin <= nbInputArgument(_pvCtx)) + { + return 1; + } + + Scierror(77, _("%s: Wrong number of input argument(s): at least %d expected.\n"), ((StrCtx *) _pvCtx)->pstName, _iMin); + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkInputArgumentAtMost(void* _pvCtx, int _iMax) +{ + SciErr sciErr = sciErrInit(); + + if (_iMax >= nbInputArgument(_pvCtx)) + { + return 1; + } + + Scierror(77, _("%s: Wrong number of input argument(s): at most %d expected.\n"), ((StrCtx *) _pvCtx)->pstName, _iMax); + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkOutputArgument(void* _pvCtx, int _iMin, int _iMax) +{ + SciErr sciErr = sciErrInit(); + + if (_iMin <= nbOutputArgument(_pvCtx) && _iMax >= nbOutputArgument(_pvCtx)) + { + return 1; + } + + if (_iMax == _iMin) + { + Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), ((StrCtx *) _pvCtx)->pstName, _iMax); + } + else + { + Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), ((StrCtx *) _pvCtx)->pstName, _iMin, _iMax); + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkOutputArgumentAtLeast(void* _pvCtx, int _iMin) +{ + SciErr sciErr = sciErrInit(); + + if (_iMin <= nbOutputArgument(_pvCtx)) + { + return 1; + } + + Scierror(78, _("%s: Wrong number of output argument(s): at least %d expected.\n"), ((StrCtx *) _pvCtx)->pstName, _iMin); + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkOutputArgumentAtMost(void* _pvCtx, int _iMax) +{ + SciErr sciErr = sciErrInit(); + + if (_iMax >= nbOutputArgument(_pvCtx)) + { + return 1; + } + + Scierror(78, _("%s: Wrong number of output argument(s): at most %d expected.\n"), ((StrCtx *) _pvCtx)->pstName, _iMax); + return 0; +} + +/*--------------------------------------------------------------------------*/ +int callOverloadFunction(void* _pvCtx, int _iVar, char* _pstName, unsigned int _iNameLen) +{ + int iVar = 0; + if (_iVar != 0) + { + iVar = _iVar + Top - Rhs; + } + + return C2F(overload)(&iVar, _pstName, _iNameLen); +} + +/*--------------------------------------------------------------------------*/ +SciErr getVarDimension(void *_pvCtx, int *_piAddress, int *_piRows, int *_piCols) +{ + SciErr sciErr = sciErrInit(); + + if (_piAddress != NULL && isVarMatrixType(_pvCtx, _piAddress)) + { + *_piRows = _piAddress[1]; + *_piCols = _piAddress[2]; + } + else + { + *_piRows = 0; + *_piCols = 0; + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getVarDimension"); + } + else + { + addErrorMessage(&sciErr, API_ERROR_NOT_MATRIX_TYPE, _("%s: matrix argument expected"), "getVarDimension"); + } + } + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +SciErr getNamedVarDimension(void *_pvCtx, const char *_pstName, int *_piRows, int *_piCols) +{ + SciErr sciErr = sciErrInit(); + int *piAddr = NULL; + + sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_NAMED_VARDIM, _("%s: Unable to get dimension of variable \"%s\""), "getNamedVarDimension", _pstName); + return sciErr; + } + + sciErr = getVarDimension(_pvCtx, piAddr, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_NAMED_VARDIM, _("%s: Unable to get dimension of variable \"%s\""), "getNamedVarDimension", _pstName); + return sciErr; + } + + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +SciErr getVarAddressFromPosition(void *_pvCtx, int _iVar, int **_piAddress) +{ + SciErr sciErr = getinternalVarAddress(_pvCtx, _iVar, _piAddress); + //sciprint("type : %d(%c)\n", (*_piAddress)[0], intersci_.ntypes[_iVar - 1]); + //update variable state to "read + intersci_.ntypes[_iVar - 1] = '$'; + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +static SciErr getinternalVarAddress(void *_pvCtx, int _iVar, int **_piAddress) +{ + SciErr sciErr = sciErrInit(); + int iAddr = 0; + int iValType = 0; + + /* we accept a call to getVarAddressFromPosition after a create... call */ + if (_iVar > Rhs && _iVar > Nbvars) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POSITION, _("%s: bad call to %s! (1rst argument).\n"), ((StrCtx *) _pvCtx)->pstName, + "getVarAddressFromPosition"); + return sciErr; + } + + iAddr = iadr(*Lstk(Top - Rhs + _iVar)); + iValType = *istk(iAddr); + if (iValType < 0) + { + iAddr = iadr(*istk(iAddr + 1)); + } + + *_piAddress = istk(iAddr); + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr getVarNameFromPosition(void *_pvCtx, int _iVar, char *_pstName) +{ + SciErr sciErr = sciErrInit(); + int iNameLen = 0; + int iJob1 = 1; + + CvNameL(&vstk_.idstk[(Top - Rhs + _iVar - 1) * 6], _pstName, &iJob1, &iNameLen); + if (iNameLen == 0) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Unable to get name of argument #%d"), "getVarNameFromPosition", _iVar); + return sciErr; + } + + _pstName[iNameLen] = '\0'; + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +int getNewVarAddressFromPosition(void *_pvCtx, int _iVar, int **_piAddress) +{ + int iAddr = iadr(*Lstk(_iVar)); + *_piAddress = istk(iAddr); + return 0; +} + +/*--------------------------------------------------------------------------*/ +SciErr getVarAddressFromName(void *_pvCtx, const char *_pstName, int **_piAddress) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int *piAddr = NULL; + + //get variable id from name + C2F(str2name) (_pstName, iVarID, (int)strlen(_pstName)); + + //define scope of search + Fin = -6; + Err = 0; + //search variable + C2F(stackg) (iVarID); + + //No idea :( + if (*Infstk(Fin) == 2) + { + Fin = *istk(iadr(*Lstk(Fin)) + 1 + 1); + } + + if (Err > 0 || Fin == 0) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Unable to get address of variable \"%s\""), "getVarAddressFromName", _pstName); + return sciErr; + } + + //get variable address + getNewVarAddressFromPosition(_pvCtx, Fin, &piAddr); + if (piAddr[0] < 0) + { + //get address from reference + int iStackRef = *Lstk(Fin); + int iStackAddr = iadr(iStackRef); + int iNewStackRef = iStackAddr + 1; + int iNewStackPtr = *istk(iNewStackRef); + int iNewStackAddr = iadr(iNewStackPtr); + + piAddr = istk(iNewStackAddr); + } + + *_piAddress = piAddr; + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +SciErr getVarType(void *_pvCtx, int *_piAddress, int *_piType) +{ + SciErr sciErr = sciErrInit(); + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getVarType"); + return sciErr; + } + + *_piType = _piAddress[0]; + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +SciErr getNamedVarType(void *_pvCtx, const char *_pstName, int *_piType) +{ + int *piAddr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_NAMED_UNDEFINED_VAR, _("%s: Unable to get variable \"%s\""), "getNamedVarType", _pstName); + return sciErr; + } + + sciErr = getVarType(_pvCtx, piAddr, _piType); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_NAMED_TYPE, _("%s: Unable to get type of variable \"%s\""), "getNamedVarType", _pstName); + return sciErr; + } + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +int isVarComplex(void *_pvCtx, int *_piAddress) +{ + int iType = 0; + int iComplex = 0; + + if (_piAddress == NULL) + { + return 0; + } + + getVarType(_pvCtx, _piAddress, &iType); + switch (iType) + { + case sci_matrix: + case sci_poly: + case sci_sparse: + iComplex = _piAddress[3]; + break; + default: + iComplex = 0; + } + return iComplex; +} + +/*--------------------------------------------------------------------------*/ +int isNamedVarComplex(void *_pvCtx, const char *_pstName) +{ + int *piAddr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + return 0; + } + return isVarComplex(_pvCtx, piAddr); +} + +/*--------------------------------------------------------------------------*/ +void createNamedVariable(int *_piVarID) +{ + int iOne = 1; + C2F(stackp) (_piVarID, &iOne); +} + +/*--------------------------------------------------------------------------*/ +int updateInterSCI(int _iVar, char _cType, int _iSCIAddress, int _iSCIDataAddress) +{ + intersci_.ntypes[_iVar - 1] = _cType; + intersci_.iwhere[_iVar - 1] = _iSCIAddress; + intersci_.lad[_iVar - 1] = _iSCIDataAddress; + return 0; +} + +/*--------------------------------------------------------------------------*/ +int updateLstk(int _iNewpos, int _iSCIDataAddress, int _iVarSize) +{ + *Lstk(_iNewpos + 1) = _iSCIDataAddress + _iVarSize; + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isVarMatrixType(void *_pvCtx, int *_piAddress) +{ + if (_piAddress != NULL) + { + int iType = 0; + + getVarType(_pvCtx, _piAddress, &iType); + + switch (iType) + { + case sci_matrix: + case sci_poly: + case sci_boolean: + case sci_sparse: + case sci_boolean_sparse: + case sci_matlab_sparse: + case sci_ints: + case sci_handles: + case sci_strings: + return 1; + default: + return 0; + } + } + else + { + return 0; + } + return 1; +} + +/*--------------------------------------------------------------------------*/ +int isNamedVarMatrixType(void *_pvCtx, const char *_pstName) +{ + int *piAddr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + return 0; + } + return isVarMatrixType(_pvCtx, piAddr); +} + +/*--------------------------------------------------------------------------*/ +SciErr getProcessMode(void *_pvCtx, int _iPos, int *_piAddRef, int *_piMode) +{ + int iRows1 = 0; + int iCols1 = 0; + int iRows2 = 0; + int iCols2 = 0; + int iType2 = 0; + int iMode = 0; + int *piAddr2 = NULL; + + SciErr sciErr = getVarDimension(_pvCtx, _piAddRef, &iRows1, &iCols1); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Unable to get argument dimension"), "getProcessMode"); + return sciErr; + } + + //sciprint("getProcessMode ->"); + sciErr = getinternalVarAddress(_pvCtx, _iPos, &piAddr2); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Unable to get variable address"), "getProcessMode"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, piAddr2, &iType2); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Unable to get argument type"), "getProcessMode"); + return sciErr; + } + + if (iType2 == sci_matrix && !isVarComplex(_pvCtx, piAddr2)) + { + double *pdblReal2 = NULL; + + sciErr = getMatrixOfDouble(_pvCtx, piAddr2, &iRows2, &iCols2, &pdblReal2); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Unable to get argument data"), "getProcessMode"); + return sciErr; + } + + if (iRows2 != 1 || iCols2 != 1) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Wrong size for argument #%d: (%d,%d) expected.\n"), "getProcessMode", _iPos, 1, + 1); + return sciErr; + } + + iMode = (int)pdblReal2[0]; + } + else if (iType2 == sci_strings) + { + int iLen = 0; + char *pstMode[1] = { "" }; + + sciErr = getVarDimension(_pvCtx, piAddr2, &iRows2, &iCols2); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Unable to get argument dimension"), "getProcessMode"); + return sciErr; + } + + if (iRows2 != 1 || iCols2 != 1) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Wrong size for argument #%d: (%d,%d) expected.\n"), "getProcessMode", _iPos, 1, + 1); + return sciErr; + } + + sciErr = getMatrixOfString(_pvCtx, piAddr2, &iRows2, &iCols2, &iLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Unable to get argument data"), "getProcessMode"); + return sciErr; + } + + pstMode[0] = (char *)MALLOC(sizeof(char) * (iLen + 1)); //+1 for null termination + sciErr = getMatrixOfString(_pvCtx, piAddr2, &iRows2, &iCols2, &iLen, pstMode); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Unable to get argument data"), "getProcessMode"); + return sciErr; + } + + iMode = (int)pstMode[0][0]; + FREE(pstMode[0]); + } + else + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Wrong type for input argument #%d: A string or a scalar expected.\n"), + "getProcessMode", _iPos); + return sciErr; + } + + if (iMode == ROW_LETTER || iMode == BY_ROWS) + { + *_piMode = BY_ROWS; + } + else if (iMode == COL_LETTER || iMode == BY_COLS) + { + *_piMode = BY_COLS; + } + else if (iMode == STAR_LETTER || iMode == BY_ALL) + { + *_piMode = BY_ALL; + } + else if (iMode == MTLB_LETTER || iMode == BY_MTLB) + { + *_piMode = 0; + if (iRows1 > 1) + { + *_piMode = 1; + } + else if (iCols1 > 1) + { + *_piMode = 2; + } + } + else + { + addErrorMessage(&sciErr, API_ERROR_GET_PROCESSMODE, _("%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n"), "getProcessMode", + _iPos, "'*', 'r', 'c', 'm', '0', '1', '2'", "-1"); + return sciErr; + } + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +SciErr getDimFromVar(void *_pvCtx, int *_piAddress, int *_piVal) +{ + int iType = 0; + int iRows = 0; + int iCols = 0; + double *pdblReal = NULL; + + SciErr sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument type"), "getDimFromVar"); + return sciErr; + } + + if (iType == sci_matrix) + { + if (isVarComplex(_pvCtx, _piAddress)) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Wrong type for argument #%d: Real matrix expected.\n"), "getDimFromVar", + getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + sciErr = getMatrixOfDouble(_pvCtx, _piAddress, &iRows, &iCols, &pdblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument data"), "getDimFromVar"); + return sciErr; + } + + *_piVal = (int)Max(pdblReal[0], 0); + } + else if (iType == sci_ints) + { + int iPrec = 0; + + sciErr = getVarDimension(_pvCtx, _piAddress, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument dimension"), "getDimFromVar"); + return sciErr; + } + + if (iRows != 1 || iCols != 1) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Wrong size for argument #%d: (%d,%d) expected.\n"), "getProcessMode", + getRhsFromAddress(_pvCtx, _piAddress), 1, 1); + return sciErr; + } + + sciErr = getMatrixOfIntegerPrecision(_pvCtx, _piAddress, &iPrec); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument precision"), "getDimFromVar"); + return sciErr; + } + + switch (iPrec) + { + case SCI_INT8: + { + char *pcData = NULL; + + sciErr = getMatrixOfInteger8(_pvCtx, _piAddress, &iRows, &iCols, &pcData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument data"), "getDimFromVar"); + return sciErr; + } + *_piVal = pcData[0]; + } + break; + case SCI_UINT8: + { + unsigned char *pucData = NULL; + + sciErr = getMatrixOfUnsignedInteger8(_pvCtx, _piAddress, &iRows, &iCols, &pucData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument data"), "getDimFromVar"); + return sciErr; + } + *_piVal = pucData[0]; + } + break; + case SCI_INT16: + { + short *psData = NULL; + + sciErr = getMatrixOfInteger16(_pvCtx, _piAddress, &iRows, &iCols, &psData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument data"), "getDimFromVar"); + return sciErr; + } + *_piVal = psData[0]; + } + break; + case SCI_UINT16: + { + unsigned short *pusData = NULL; + + sciErr = getMatrixOfUnsignedInteger16(_pvCtx, _piAddress, &iRows, &iCols, &pusData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument data"), "getDimFromVar"); + return sciErr; + } + *_piVal = pusData[0]; + } + break; + case SCI_INT32: + { + int *piData = NULL; + + sciErr = getMatrixOfInteger32(_pvCtx, _piAddress, &iRows, &iCols, &piData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument data"), "getDimFromVar"); + return sciErr; + } + *_piVal = piData[0]; + } + break; + case SCI_UINT32: + { + unsigned int *puiData = NULL; + + sciErr = getMatrixOfUnsignedInteger32(_pvCtx, _piAddress, &iRows, &iCols, &puiData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Unable to get argument data"), "getDimFromVar"); + return sciErr; + } + *_piVal = puiData[0]; + } + break; + } + } + else + { + addErrorMessage(&sciErr, API_ERROR_GET_DIMFROMVAR, _("%s: Wrong type for input argument #%d: A real scalar or an integer scalar expected.\n"), + "getDimFromVar", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +SciErr getDimFromNamedVar(void *_pvCtx, const char *_pstName, int *_piVal) +{ + int *piAddr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_DIMFROMVAR, _("%s: Unable to get dimension from variable \"%s\""), "getDimFromNamedVar", + _pstName); + return sciErr; + } + + sciErr = getDimFromVar(_pvCtx, piAddr, _piVal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_DIMFROMVAR, _("%s: Unable to get dimension from variable \"%s\""), "getDimFromNamedVar", + _pstName); + return sciErr; + } + + return sciErr; +} + +/*--------------------------------------------------------------------------*/ +int getRhsFromAddress(void *_pvCtx, int *_piAddress) +{ + int i = 0; + int *piAddr = NULL; + + for (i = 0; i < Rhs; i++) + { + //sciprint("getRhsFromAddress ->"); + getinternalVarAddress(_pvCtx, i + 1, &piAddr); + if (_piAddress == piAddr) + { + return i + 1; + } + } + return 0; +} + +/*short cut functions*/ + +/*--------------------------------------------------------------------------*/ +int isRowVector(void *_pvCtx, int *_piAddress) +{ + int iRows = 0; + int iCols = 0; + + if (_piAddress == NULL) + { + return 0; + } + + if (isVarMatrixType(_pvCtx, _piAddress) == 0) + { + return 0; + } + + SciErr sciErr = getVarDimension(_pvCtx, _piAddress, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_IS_ROW_VECTOR, _("%s: Unable to get argument dimension"), "isRowVector"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (iRows == 1 && iCols > 1) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isNamedRowVector(void *_pvCtx, const char *_pstName) +{ + int iRows = 0; + int iCols = 0; + + if (isNamedVarMatrixType(_pvCtx, _pstName) == 0) + { + return 0; + } + + SciErr sciErr = getNamedVarDimension(_pvCtx, _pstName, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_IS_NAMED_ROW_VECTOR, _("%s: Unable to get argument dimension"), "isNamedRowVector"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (iRows == 1 && iCols > 1) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isColumnVector(void *_pvCtx, int *_piAddress) +{ + int iRows = 0; + int iCols = 0; + + if (_piAddress == NULL) + { + return 0; + } + + if (isVarMatrixType(_pvCtx, _piAddress) == 0) + { + return 0; + } + + SciErr sciErr = getVarDimension(_pvCtx, _piAddress, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_IS_COLUMN_VECTOR, _("%s: Unable to get argument dimension"), "isColumnVector"); + printError(&sciErr, 0); + return 0; + } + + if (iCols == 1 && iRows > 1) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isNamedColumnVector(void *_pvCtx, const char *_pstName) +{ + int iRows = 0; + int iCols = 0; + + if (isNamedVarMatrixType(_pvCtx, _pstName) == 0) + { + return 0; + } + + SciErr sciErr = getNamedVarDimension(_pvCtx, _pstName, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_IS_NAMED_COLUMN_VECTOR, _("%s: Unable to get argument dimension"), "isNamedColumnVector"); + printError(&sciErr, 0); + return 0; + } + + if (iCols == 1 && iRows > 1) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isVector(void *_pvCtx, int *_piAddress) +{ + return isRowVector(_pvCtx, _piAddress) || isColumnVector(_pvCtx, _piAddress); +} + +/*--------------------------------------------------------------------------*/ +int isNamedVector(void *_pvCtx, const char *_pstName) +{ + return isNamedRowVector(_pvCtx, _pstName) || isNamedColumnVector(_pvCtx, _pstName); +} + +/*--------------------------------------------------------------------------*/ +int isScalar(void *_pvCtx, int *_piAddress) +{ + int iRows = 0; + int iCols = 0; + + if (_piAddress == NULL) + { + return 0; + } + + if (isVarMatrixType(_pvCtx, _piAddress) == 0) + { + return 0; + } + + SciErr sciErr = getVarDimension(_pvCtx, _piAddress, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_IS_SCALAR, _("%s: Unable to get argument dimension"), "isScalar"); + printError(&sciErr, 0); + return 0; + } + + if (iCols == 1 && iRows == 1) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isNamedScalar(void *_pvCtx, const char *_pstName) +{ + int iRows = 0; + int iCols = 0; + + if (isNamedVarMatrixType(_pvCtx, _pstName) == 0) + { + return 0; + } + + SciErr sciErr = getNamedVarDimension(_pvCtx, _pstName, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_IS_NAMED_SCALAR, _("%s: Unable to get argument dimension"), "isNamedScalar"); + printError(&sciErr, 0); + return 0; + } + + if (iCols == 1 && iRows == 1) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isSquareMatrix(void *_pvCtx, int *_piAddress) +{ + int iRows = 0; + int iCols = 0; + + if (_piAddress == NULL) + { + return 0; + } + + if (isVarMatrixType(_pvCtx, _piAddress) == 0) + { + return 0; + } + + SciErr sciErr = getVarDimension(_pvCtx, _piAddress, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_IS_SQUARE, _("%s: Unable to get argument dimension"), "isSquareMatrix"); + printError(&sciErr, 0); + return 0; + } + + if (iRows > 1 && iCols == iRows) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isNamedSquareMatrix(void *_pvCtx, const char *_pstName) +{ + int iRows = 0; + int iCols = 0; + + if (isNamedVarMatrixType(_pvCtx, _pstName) == 0) + { + return 0; + } + + SciErr sciErr = getNamedVarDimension(_pvCtx, _pstName, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_IS_NAMED_SQUARE, _("%s: Unable to get argument dimension"), "isNamedSquareMatrix"); + printError(&sciErr, 0); + return 0; + } + + if (iRows > 1 && iCols == iRows) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkVarDimension(void *_pvCtx, int *_piAddress, int _iRows, int _iCols) +{ + int iRows = 0; + int iCols = 0; + + if (_piAddress == NULL) + { + return 0; + } + + if (isVarMatrixType(_pvCtx, _piAddress) == 0) + { + return 0; + } + + SciErr sciErr = getVarDimension(_pvCtx, _piAddress, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CHECK_VAR_DIMENSION, _("%s: Unable to get argument dimension"), "checkVarDimension"); + printError(&sciErr, 0); + return 0; + } + + if ((_iRows == iRows || _iRows == -1) && (_iCols == iCols || _iCols == -1)) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkNamedVarDimension(void *_pvCtx, const char *_pstName, int _iRows, int _iCols) +{ + int iRows = 0; + int iCols = 0; + + if (isNamedVarMatrixType(_pvCtx, _pstName) == 0) + { + return 0; + } + + SciErr sciErr = getNamedVarDimension(_pvCtx, _pstName, &iRows, &iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CHECK_NAMED_VAR_DIMENSION, _("%s: Unable to get argument dimension"), "checkNamedVarDimension"); + printError(&sciErr, 0); + return 0; + } + + if ((_iRows == iRows || _iRows == -1) && (_iCols == iCols || _iCols == -1)) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkVarType(void *_pvCtx, int *_piAddress, int _iType) +{ + int iType = 0; + + if (_piAddress == NULL) + { + return 0; + } + + SciErr sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr) + { + return 0; + } + + if (iType == _iType) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int checkNamedVarType(void *_pvCtx, const char *_pstName, int _iType) +{ + int iType = 0; + + SciErr sciErr = getNamedVarType(_pvCtx, _pstName, &iType); + if (sciErr.iErr) + { + return 0; + } + + if (iType == _iType) + { + return 1; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int getInputArgumentType(void* _pvCtx, int _iVar) +{ + int* piAddr = NULL; + int iType = 0; + + //sciprint("getInputArgumentType ->"); + SciErr sciErr = getinternalVarAddress(_pvCtx, _iVar, &piAddr); + if (sciErr.iErr) + { + return 0; + } + + sciErr = getVarType(_pvCtx, piAddr, &iType); + if (sciErr.iErr) + { + return 0; + } + + return iType; +} + +/*--------------------------------------------------------------------------*/ +int checkInputArgumentType(void* _pvCtx, int _iVar, int _iType) +{ + return getInputArgumentType(_pvCtx, _iVar) == _iType; +} + +/*--------------------------------------------------------------------------*/ +int isEmptyMatrix(void *_pvCtx, int *_piAddress) +{ + if (checkVarType(_pvCtx, _piAddress, sci_matrix)) + { + return checkVarDimension(_pvCtx, _piAddress, 0, 0); + } + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isNamedEmptyMatrix(void *_pvCtx, const char *_pstName) +{ + if (checkNamedVarType(_pvCtx, _pstName, sci_matrix)) + { + return checkNamedVarDimension(_pvCtx, _pstName, 0, 0); + } + return 0; +} + +/*--------------------------------------------------------------------------*/ +int createEmptyMatrix(void *_pvCtx, int _iVar) +{ + double dblReal = 0; + + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int createNamedEmptyMatrix(void *_pvCtx, const char *_pstName) +{ + double dblOne = 0; + + SciErr sciErr = createNamedMatrixOfDouble(_pvCtx, _pstName, 0, 0, &dblOne); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createNamedEmptyMatrix"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int isNamedVarExist(void *_pvCtx, const char *_pstName) +{ + int iVarID[nsiz]; + int *piAddr = NULL; + int funs = C2F(com).fun; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr || piAddr == NULL) + { + Fin = -1; + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + C2F(funs)(iVarID); + if (Fin > 0) + { + Fin = 1; + C2F(com).fun = funs; + return 1; + } + + return 0; + } + + return 1; +} + +/*--------------------------------------------------------------------------*/ +int checkNamedVarFormat(void* _pvCtx, const char *_pstName) +{ +#define FORBIDDEN_CHARS " */\\.,;:^@><!=+-&|()~\n\t'\"" + + // check pointer + if (_pstName == NULL) + { + return 0; + } + + // check length _pstName =< nlgh + if ((strlen(_pstName) == 0 || strlen(_pstName) > nlgh)) + { + return 0; + } + + // forbidden characters + if (strpbrk(_pstName, FORBIDDEN_CHARS) != NULL) + { + return 0; + } + + // variable does not begin by a digit + if (isdigit(_pstName[0])) + { + return 0; + } + + // check that we have only ascii characters + for (int i = 0; i < (int)strlen(_pstName); i++) + { + if (!isascii(_pstName[i])) + { + return 0; + } + } + + // add here some others rules + + return 1; +} +/*--------------------------------------------------------------------------*/ +int deleteNamedVariable(void* _pvCtx, const char* _pstName) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iZero = 0; + int il; + int sRhs = Rhs; + int sLhs = Lhs; + int sTop = Top; + + if (isNamedVarExist(_pvCtx, _pstName) == 0) + { + return 0; + } + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createNamedComplexZMatrixOfDouble", _pstName); + return 0; + } + + //get varId from varName + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + + //create a null matrix at the Top of the stack + Top = Top + 1; + il = iadr(*Lstk(Top)); + *istk(il) = 0; + *Lstk(Top + 1) = *Lstk(Top) + 1; + Rhs = 0; + + //Replace existing value by null matrix to delete it + C2F(stackp) (iVarID, &iZero); + Rhs = sRhs; + Lhs = sLhs; + Top = sTop ; + if (C2F(iop).err > 0/* || C2F(errgst).err1 > 0*/) + { + return 0; + } + + //No Idea :x + Fin = 1; + return 1; +} +/*--------------------------------------------------------------------------*/ +SciErr sciErrInit() +{ + int i = 0 ; + SciErr sciErr; + sciErr.iErr = 0; + sciErr.iMsgCount = 0; + + for (; i < MESSAGE_STACK_SIZE ; i++) + { + sciErr.pstMsg[i] = ""; + } + + return sciErr; +} diff --git a/modules/api_scilab/src/cpp/api_double.cpp b/modules/api_scilab/src/cpp/api_double.cpp new file mode 100755 index 000000000..971bc8b58 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_double.cpp @@ -0,0 +1,713 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2009 - DIGITEO - Antoine ELIAS +* +* 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 +* +* Please note that piece of code will be rewrited for the Scilab 6 family +* However, the API (profile of the functions in the header files) will be +* still available and supported in Scilab 6. +*/ + +#include <stdio.h> +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_double.h" +#include "localization.h" + +#include "call_scilab.h" + +extern int C2F(entier)(int *n, double *d__, int *s); +extern int C2F(icopy)(int *, int *, int *, int *, int *); +/*******************************/ +/* double matrix functions */ +/*******************************/ + +static int getCommonScalarDouble(void* _pvCtx, int* _piAddress, int _iComplex, double* _pdblReal, double* _pdblImg); +static int createCommonScalarDouble(void* _pvCtx, int _iVar, int _iComplex, double _dblReal, double _dblImg); +static int createCommonNamedScalarDouble(void* _pvCtx, const char* _pstName, int _iComplex, double _dblReal, double _dblImg); +static int getCommonNamedScalarDouble(void* _pvCtx, const char* _pstName, int _iComplex, double* _pdblReal, double* _pdblImg); + + + +SciErr getMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal) +{ + return getCommonMatrixOfDouble(_pvCtx, _piAddress, '$', 0, _piRows, _piCols, _pdblReal, NULL); +} + +SciErr getComplexMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg) +{ + return getCommonMatrixOfDouble(_pvCtx, _piAddress, '$', 1, _piRows, _piCols, _pdblReal, _pdblImg); +} + +SciErr getComplexZMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, doublecomplex** _pdblZ) +{ + int iSize = 0; + double *pdblReal = NULL; + double *pdblImg = NULL; + + SciErr sciErr = getCommonMatrixOfDouble(_pvCtx, _piAddress, 'z', isVarComplex(_pvCtx, _piAddress), _piRows, _piCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ZDOUBLE, _("%s: Unable to get argument #%d"), "getComplexZMatrixOfDouble", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + iSize = *_piRows **_piCols; + SciToF77(pdblReal, iSize, iSize); + *_pdblZ = (doublecomplex*)pdblReal; + return sciErr; +} + +SciErr getMatrixOfDoubleAsInteger(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piReal) +{ + double* pdblReal = NULL; + int iSize = 0; + SciErr sciErr = getCommonMatrixOfDouble(_pvCtx, _piAddress, 'i', 0, _piRows, _piCols, &pdblReal, NULL); + if (sciErr.iErr) + { + return sciErr; + } + + iSize = *_piRows **_piCols; + *_piReal = (int*)pdblReal; + + //Warning we overwrite double by int !!!! + C2F(entier)(&iSize, pdblReal, *_piReal); + return sciErr; +} + +SciErr getComplexMatrixOfDoubleAsInteger(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piReal, int** _piImg) +{ + double* pdblReal = NULL; + double* pdblImg = NULL; + int iSize = 0; + SciErr sciErr = getCommonMatrixOfDouble(_pvCtx, _piAddress, 'i', 1, _piRows, _piCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + return sciErr; + } + + iSize = *_piRows **_piCols; + *_piReal = (int*)pdblReal; + *_piImg = (int*)pdblImg; + + //Warning we overwrite double by int !!!! + C2F(entier)(&iSize, pdblReal, *_piReal); + C2F(entier)(&iSize, pdblImg, *_piImg); + return sciErr; +} + +SciErr getCommonMatrixOfDouble(void* _pvCtx, int* _piAddress, char _cType, int _iComplex, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iType = 0; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), _iComplex ? "getComplexMatrixOfDouble" : "getMatrixOfDouble"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr || iType != sci_matrix) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), _iComplex ? "getComplexMatrixOfDouble" : "getMatrixOfDouble", _("double matrix")); + return sciErr; + } + + sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DOUBLE, _("%s: Unable to get argument #%d"), _iComplex ? "getComplexMatrixOfDouble" : "getMatrixOfDouble", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (_pdblReal != NULL) + { + *_pdblReal = (double*)(_piAddress + 4); + } + if (isVarComplex(_pvCtx, _piAddress) && _pdblImg != NULL) + { + *_pdblImg = (double*)(_piAddress + 4) + *_piRows **_piCols; + } + + if (_cType == 'i') + { + /*update to set view as integer*/ + int iRhs = getRhsFromAddress(_pvCtx, _piAddress); + int iNewPos = Top - Rhs + iRhs; + int iAddr = *Lstk(iNewPos); + int iSCIAddress = sadr(iadr(iAddr) + 4); + iSCIAddress = iadr(iSCIAddress); + updateInterSCI(iRhs, _cType, iAddr, iSCIAddress); + } + else if (_cType == 'z') + { + int iRhs = getRhsFromAddress(_pvCtx, _piAddress); + int iNewPos = Top - Rhs + iRhs; + int iAddr = *Lstk(iNewPos); + int iSCIAddress = sadr(iadr(iAddr) + 4); + + //printf("iRhs : %d\n", iRhs); + //printf("intersci_.ntypes : %c\n", intersci_.ntypes[iRhs - 1]); + //printf("intersci_.iwhere : %d\n", intersci_.iwhere[iRhs - 1]); + //printf("intersci_.lad : %d\n-----------------------\n", intersci_.lad[iRhs - 1]); + + updateInterSCI(iRhs, _cType, iAddr, iSCIAddress); + + //printf("intersci_.ntypes : %c\n", intersci_.ntypes[iRhs - 1]); + //printf("intersci_.iwhere : %d\n", intersci_.iwhere[iRhs - 1]); + //printf("intersci_.lad : %d\n\n", intersci_.lad[iRhs - 1]); + } + + return sciErr; +} + +SciErr allocMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal) +{ + double *pdblReal = NULL; + + SciErr sciErr = allocCommonMatrixOfDouble(_pvCtx, _iVar, '$', 0, _iRows, _iCols, &pdblReal, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_DOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfDouble"); + return sciErr; + } + + *_pdblReal = pdblReal; + + return sciErr; +} + +SciErr allocComplexMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg) +{ + double *pdblReal = NULL; + double *pdblImg = NULL; + + SciErr sciErr = allocCommonMatrixOfDouble(_pvCtx, _iVar, '$', 1, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_COMPLEX_DOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocComplexMatrixOfDouble"); + return sciErr; + } + + *_pdblReal = pdblReal; + *_pdblImg = pdblImg; + return sciErr; +} + +SciErr allocMatrixOfDoubleAsInteger(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piReal) +{ + double *pdblReal = NULL; + + SciErr sciErr = allocCommonMatrixOfDouble(_pvCtx, _iVar, 'i', 0, _iRows, _iCols, &pdblReal, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_DOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfDouble"); + return sciErr; + } + + *_piReal = (int*)pdblReal; + return sciErr; +} + +SciErr allocComplexMatrixOfDoubleAsInteger(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piReal, int** _piImg) +{ + double *pdblReal = NULL; + double *pdblImg = NULL; + + SciErr sciErr = allocCommonMatrixOfDouble(_pvCtx, _iVar, 'i', 1, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_COMPLEX_DOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocComplexMatrixOfDouble"); + return sciErr; + } + + *_piReal = (int*)pdblReal; + *_piImg = (int*)pdblImg; + return sciErr; +} + +SciErr allocCommonMatrixOfDouble(void* _pvCtx, int _iVar, char _cType, int _iComplex, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int* piAddr = NULL; + + int iMemSize = _iRows * _iCols * (_iComplex + 1) + 2; + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(iAddr)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + fillCommonMatrixOfDouble(_pvCtx, piAddr, _iComplex, _iRows, _iCols, _pdblReal, _pdblImg); + + int iSCIAddress = sadr(iadr(iAddr) + 4); + if (_cType == 'i') + { + iSCIAddress = iadr(iSCIAddress); + } + + updateInterSCI(_iVar, _cType, iAddr, iSCIAddress); + updateLstk(iNewPos, sadr(iadr(iAddr) + 4), _iRows * _iCols * (_iComplex + 1)); + return sciErr; +} + +SciErr allocComplexZMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const doublecomplex** _pdblData) +{ + double* pdblReal = NULL; + double* pdblImg = NULL; + + SciErr sciErr = allocComplexMatrixOfDouble(_pvCtx, _iVar, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + return sciErr; + } + + //warning convert double* to doublecomplex* + *_pdblData = (doublecomplex*)pdblReal; + + //strore storage information to putlhsvar + intersci_.ntypes[_iVar - 1] = 'z'; + return sciErr; +} + +SciErr fillCommonMatrixOfDouble(void* _pvCtx, int* _piAddress, int _iComplex, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + _piAddress[0] = sci_matrix; + _piAddress[1] = Min(_iRows, _iRows * _iCols); + _piAddress[2] = Min(_iCols, _iRows * _iCols); + _piAddress[3] = _iComplex; + + + if (_pdblReal != NULL) + { + *_pdblReal = (double*)(_piAddress + 4); + + if (_iComplex != 0 && _pdblImg != NULL) + { + *_pdblImg = *_pdblReal + _iRows * _iCols; + } + } + + return sciErr; +} + +SciErr createMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const double* _pdblReal) +{ + double *pdblReal = NULL; + + int iOne = 1; + int iSize = _iRows * _iCols; + + SciErr sciErr = allocMatrixOfDouble(_pvCtx, _iVar, _iRows, _iCols, &pdblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_DOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocComplexMatrixOfDouble"); + return sciErr; + } + + C2F(dcopy)(&iSize, const_cast<double*>(_pdblReal), &iOne, pdblReal, &iOne); + return sciErr; +} + +SciErr createComplexMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg) +{ + double *pdblReal = NULL; + double *pdblImg = NULL; + + int iOne = 1; + int iSize = _iRows * _iCols; + + SciErr sciErr = allocComplexMatrixOfDouble(_pvCtx, _iVar, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_COMPLEX_DOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocComplexMatrixOfDouble"); + return sciErr; + } + + C2F(dcopy)(&iSize, const_cast<double*>(_pdblReal), &iOne, pdblReal, &iOne); + C2F(dcopy)(&iSize, const_cast<double*>(_pdblImg), &iOne, pdblImg, &iOne); + return sciErr; +} + +SciErr createMatrixOfDoubleAsInteger(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piReal) +{ + double *pdblReal = NULL; + + int iOne = 1; + int iSize = _iRows * _iCols; + + SciErr sciErr = allocCommonMatrixOfDouble(_pvCtx, _iVar, 'i', 0, _iRows, _iCols, &pdblReal, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_COMPLEX_DOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocComplexMatrixOfDouble"); + return sciErr; + } + + C2F(icopy)(&iSize, (int*)_piReal, &iOne, (int*)pdblReal, &iOne); + return sciErr; +} + +SciErr createComplexMatrixOfDoubleAsInteger(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piReal, const int* _piImg) +{ + double *pdblReal = NULL; + double *pdblImg = NULL; + + int iOne = 1; + int iSize = _iRows * _iCols; + + SciErr sciErr = allocCommonMatrixOfDouble(_pvCtx, _iVar, 'i', 1, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_COMPLEX_DOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocComplexMatrixOfDouble"); + return sciErr; + } + + C2F(icopy)(&iSize, (int*)_piReal, &iOne, (int*)pdblReal, &iOne); + C2F(icopy)(&iSize, (int*)_piImg, &iOne, (int*)pdblImg, &iOne); + return sciErr; +} + +SciErr createComplexZMatrixOfDouble(void* _pvCtx, int _iVar, int _iRows, int _iCols, const doublecomplex* _pdblData) +{ + double *pdblReal = NULL; + double *pdblImg = NULL; + + + SciErr sciErr = allocComplexMatrixOfDouble(_pvCtx, _iVar, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_ZDOUBLE, _("%s: Unable to create variable in Scilab memory"), "allocComplexMatrixOfDouble"); + return sciErr; + } + + vGetPointerFromDoubleComplex(_pdblData, _iRows * _iCols, pdblReal, pdblImg); + return sciErr; +} + +SciErr createNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const double* _pdblReal) +{ + return createCommonNamedMatrixOfDouble(_pvCtx, _pstName, 0, _iRows, _iCols, _pdblReal, NULL); +} + +SciErr createNamedComplexMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg) +{ + return createCommonNamedMatrixOfDouble(_pvCtx, _pstName, 1, _iRows, _iCols, _pdblReal, _pdblImg); +} + +SciErr createNamedComplexZMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const doublecomplex* _pdblData) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int iSize = _iRows * _iCols; + int *piAddr = NULL; + double *pdblReal = NULL; + double *pdblImg = NULL; + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createNamedComplexZMatrixOfDouble", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + //write matrix information + fillCommonMatrixOfDouble(_pvCtx, piAddr, 1, _iRows, _iCols, &pdblReal, &pdblImg); + + vGetPointerFromDoubleComplex(_pdblData, _iRows * _iCols, pdblReal, pdblImg); + + //update "variable index" + updateLstk(Top, *Lstk(Top) + sadr(4), iSize * (2) * 2); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr createCommonNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iComplex, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int iSize = _iRows * _iCols; + int *piAddr = NULL; + double *pdblReal = NULL; + double *pdblImg = NULL; + int iOne = 1; + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonNamedMatrixOfDouble", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + Top = Top + Nbvars + 1; + + int iMemSize = _iRows * _iCols * (_iComplex + 1) + 2; + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(Top)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + //write matrix information + fillCommonMatrixOfDouble(_pvCtx, piAddr, _iComplex, _iRows, _iCols, &pdblReal, &pdblImg); + //copy data in stack + C2F(dcopy)(&iSize, const_cast<double*>(_pdblReal), &iOne, pdblReal, &iOne); + + if (_iComplex) + { + C2F(dcopy)(&iSize, const_cast<double*>(_pdblImg), &iOne, pdblImg, &iOne); + } + + //update "variable index" + updateLstk(Top, *Lstk(Top) + sadr(4), iSize * (_iComplex + 1) * 2); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr readNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, double* _pdblReal) +{ + return readCommonNamedMatrixOfDouble(_pvCtx, _pstName, 0, _piRows, _piCols, _pdblReal, NULL); +} + +SciErr readNamedComplexMatrixOfDouble(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg) +{ + return readCommonNamedMatrixOfDouble(_pvCtx, _pstName, 1, _piRows, _piCols, _pdblReal, _pdblImg); +} + +SciErr readCommonNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg) +{ + int* piAddr = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + int iSize = 0; + int iOne = 1; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_DOUBLE, _("%s: Unable to get variable \"%s\""), _iComplex ? "readNamedComplexMatrixOfDouble" : "readNamedMatrixOfDouble", _pstName); + return sciErr; + } + + sciErr = getCommonMatrixOfDouble(_pvCtx, piAddr, '$', _iComplex, _piRows, _piCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_DOUBLE, _("%s: Unable to get variable \"%s\""), _iComplex ? "readNamedComplexMatrixOfDouble" : "readNamedMatrixOfDouble", _pstName); + return sciErr; + } + + if (_pdblReal == NULL || (_iComplex && _pdblImg == NULL)) + { + return sciErr; + } + + iSize = (*_piRows) * (*_piCols); + /* dcopy source to dest */ + C2F(dcopy)(&iSize, pdblReal, &iOne, _pdblReal, &iOne); + if (_iComplex) + { + C2F(dcopy)(&iSize, pdblImg, &iOne, _pdblImg, &iOne); + } + + return sciErr; +} + +/*shortcut functions*/ + +int isDoubleType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_matrix); +} +/*--------------------------------------------------------------------------*/ +int isNamedDoubleType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_matrix); +} +/*--------------------------------------------------------------------------*/ +int getScalarDouble(void* _pvCtx, int* _piAddress, double* _pdblReal) +{ + return getCommonScalarDouble(_pvCtx, _piAddress, 0, _pdblReal, NULL); +} +/*--------------------------------------------------------------------------*/ +int getScalarComplexDouble(void* _pvCtx, int* _piAddress, double* _pdblReal, double* _pdblImg) +{ + return getCommonScalarDouble(_pvCtx, _piAddress, 1, _pdblReal, _pdblImg); +} +/*--------------------------------------------------------------------------*/ +static int getCommonScalarDouble(void* _pvCtx, int* _piAddress, int _iComplex, double* _pdblReal, double* _pdblImg) +{ + int iRows = 0; + int iCols = 0; + + double* pdblReal = NULL; + double* pdblImg = NULL; + + SciErr sciErr = getCommonMatrixOfDouble(_pvCtx, _piAddress, '$', _iComplex, &iRows, &iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_SCALAR_DOUBLE, _("%s: Unable to get argument #%d"), _iComplex ? "getScalarComplexDouble" : "getScalarDouble", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (isScalar(_pvCtx, _piAddress) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_SCALAR_DOUBLE, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), _iComplex ? "getScalarComplexDouble" : "getScalarDouble", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (_pdblReal != NULL) + { + *_pdblReal = pdblReal[0]; + } + + if (_iComplex == 1 && _pdblImg != NULL && pdblImg != NULL) + { + *_pdblImg = pdblImg[0]; + } + else if (_pdblImg != NULL) + { + *_pdblImg = 0; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedScalarDouble(void* _pvCtx, const char* _pstName, double* _pdblReal) +{ + return getCommonNamedScalarDouble(_pvCtx, _pstName, 0, _pdblReal, 0); +} +/*--------------------------------------------------------------------------*/ +int getNamedScalarComplexDouble(void* _pvCtx, const char* _pstName, double* _pdblReal, double* _pdblImg) +{ + return getCommonNamedScalarDouble(_pvCtx, _pstName, 1, _pdblReal, _pdblImg); +} +/*--------------------------------------------------------------------------*/ +static int getCommonNamedScalarDouble(void* _pvCtx, const char* _pstName, int _iComplex, double* _pdblReal, double* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + + double dblReal = 0; + double dblImg = 0; + + if (isNamedScalar(_pvCtx, _pstName) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_SCALAR_DOUBLE, _("%s: Wrong type for input argument \"%s\": A scalar expected.\n"), _iComplex ? "getNamedScalarComplexDouble" : "getNamedScalarDouble", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = readCommonNamedMatrixOfDouble(_pvCtx, _pstName, _iComplex, &iRows, &iCols, &dblReal, &dblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_SCALAR_DOUBLE, _("%s: Unable to get argument \"%s\""), _iComplex ? "getNamedScalarComplexDouble" : "getNamedScalarDouble", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (_pdblReal != NULL) + { + _pdblReal[0] = dblReal; + } + + if (_pdblImg != NULL) + { + _pdblImg[0] = dblImg; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createScalarDouble(void* _pvCtx, int _iVar, double _dblReal) +{ + return createCommonScalarDouble(_pvCtx, _iVar, 0, _dblReal, NULL); +} +/*--------------------------------------------------------------------------*/ +int createScalarComplexDouble(void* _pvCtx, int _iVar, double _dblReal, double _dblImg) +{ + return createCommonScalarDouble(_pvCtx, _iVar, 1, _dblReal, _dblImg); +} +/*--------------------------------------------------------------------------*/ +static int createCommonScalarDouble(void* _pvCtx, int _iVar, int _iComplex, double _dblReal, double _dblImg) +{ + double *pdblReal = NULL; + double *pdblImg = NULL; + + SciErr sciErr = allocCommonMatrixOfDouble(_pvCtx, _iVar, '$', _iComplex, 1, 1, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_DOUBLE, _("%s: Unable to create variable in Scilab memory"), _iComplex ? "createScalarComplexDouble" : "createScalarDouble"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + pdblReal[0] = _dblReal; + if (_iComplex) + { + pdblImg[0] = _dblImg; + } + return 0; +} +/*--------------------------------------------------------------------------*/ +int createNamedScalarDouble(void* _pvCtx, const char* _pstName, double _dblReal) +{ + return createCommonNamedScalarDouble(_pvCtx, _pstName, 0, _dblReal, 0); +} +/*--------------------------------------------------------------------------*/ +int createNamedScalarComplexDouble(void* _pvCtx, const char* _pstName, double _dblReal, double _dblImg) +{ + return createCommonNamedScalarDouble(_pvCtx, _pstName, 1, _dblReal, _dblImg); +} +/*--------------------------------------------------------------------------*/ +static int createCommonNamedScalarDouble(void* _pvCtx, const char* _pstName, int _iComplex, double _dblReal, double _dblImg) +{ + SciErr sciErr = createCommonNamedMatrixOfDouble(_pvCtx, _pstName, _iComplex, 1, 1, &_dblReal, &_dblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR, _("%s: Unable to create variable in Scilab memory"), _iComplex ? "createNamedScalarComplexDouble" : "createNamedScalarDouble"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/api_scilab/src/cpp/api_error.cpp b/modules/api_scilab/src/cpp/api_error.cpp new file mode 100755 index 000000000..c643447f2 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_error.cpp @@ -0,0 +1,141 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include "MALLOC.h" +#include <stdio.h> +#include "api_scilab.h" +#include "sciprint.h" +#include "Scierror.h" +#ifdef _MSC_VER +#include "strdup_windows.h" +#endif +#include "localization.h" +extern "C" +{ +#include "stackinfo.h" +#include "mode_exec.h" +} + +int addStackSizeError(SciErr* _psciErr, char* _pstCaller, int _iNeeded) +{ + char pstMsg1[bsiz]; + char pstMsg2[bsiz]; + char pstMsg3[bsiz]; + char pstMsg4[bsiz]; + char pstMsg5[bsiz]; + + int Memory_used_for_variables = 0; + int Total_Memory_available = 0; + + C2F(getstackinfo)(&Total_Memory_available, &Memory_used_for_variables); + +#ifdef _MSC_VER + sprintf_s(pstMsg1, bsiz, "%s\n%s", _pstCaller, _("stack size exceeded!\n")); + sprintf_s(pstMsg2, bsiz, _("Use stacksize function to increase it.\n")); + sprintf_s(pstMsg3, bsiz, _("Memory used for variables: %d\n"), Memory_used_for_variables); + sprintf_s(pstMsg4, bsiz, _("Intermediate memory needed: %d\n"), _iNeeded); + sprintf_s(pstMsg5, bsiz, _("Total memory available: %d\n"), Total_Memory_available); +#else + sprintf(pstMsg1, _("stack size exceeded!\n")); + sprintf(pstMsg2, _("Use stacksize function to increase it.\n")); + sprintf(pstMsg3, _("Memory used for variables: %d\n"), Memory_used_for_variables); + sprintf(pstMsg4, _("Intermediate memory needed: %d\n"), _iNeeded); + sprintf(pstMsg5, _("Total memory available: %d\n"), Total_Memory_available); +#endif + + strcat(pstMsg1, pstMsg2); + strcat(pstMsg1, pstMsg3); + strcat(pstMsg1, pstMsg4); + strcat(pstMsg1, pstMsg5); + + return addErrorMessage(_psciErr, 17, pstMsg1); +} + +int addErrorMessage(SciErr* _psciErr, int _iErr, const char* _pstMsg, ...) +{ + int iRet = 0; + char pstMsg[bsiz]; + va_list ap; + + va_start(ap, _pstMsg); +#if defined (vsnprintf) || defined (linux) + iRet = vsnprintf(pstMsg, bsiz - 1, _pstMsg, ap ); +#else + iRet = vsprintf(pstMsg, _pstMsg, ap ); +#endif + va_end(ap); + + if (_psciErr->iMsgCount >= MESSAGE_STACK_SIZE) + { + // no more space, shift error messages + FREE(_psciErr->pstMsg[0]); + for (int i = 1; i < MESSAGE_STACK_SIZE; i++) + { + _psciErr->pstMsg[i - 1] = _psciErr->pstMsg[i]; + } + _psciErr->pstMsg[MESSAGE_STACK_SIZE - 1] = strdup(pstMsg); + } + else + { + _psciErr->pstMsg[_psciErr->iMsgCount++] = strdup(pstMsg); + } + + _psciErr->iErr = _iErr; + return iRet; +} + +int printError(SciErr* _psciErr, int _iLastMsg) +{ + int iMode = getExecMode(); + + if (_psciErr->iErr == 0) + { + return 0; + } + + SciStoreError(_psciErr->iErr); + + if (iMode == SILENT_EXEC_MODE) + { + return 0; + } + + if (_iLastMsg) + { + sciprint(_("API Error:\n")); + sciprint(_("\tin %s\n"), _psciErr->pstMsg[0]); + } + else + { + sciprint(_("API Error:\n")); + + for (int i = _psciErr->iMsgCount - 1 ; i >= 0 ; i--) + { + sciprint(_("\tin %s\n"), _psciErr->pstMsg[i]); + } + } + return 0; +} + +char* getErrorMessage(SciErr _sciErr) +{ + if (_sciErr.iErr == 0) + { + return NULL; + } + + return _sciErr.pstMsg[0]; +} + diff --git a/modules/api_scilab/src/cpp/api_handle.cpp b/modules/api_scilab/src/cpp/api_handle.cpp new file mode 100755 index 000000000..095775ac9 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_handle.cpp @@ -0,0 +1,168 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_handle.h" +#include "localization.h" + +#include "Scierror.h" +#include "call_scilab.h" + + + +SciErr getMatrixOfHandle(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, long long** _pllHandle) +{ + SciErr sciErr = sciErrInit(); + int iType = 0; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getMatrixOfHandle"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr || iType != sci_handles) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getMatrixOfHandle", _("handle matrix")); + return sciErr; + } + + sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_HANDLE, _("%s: Unable to get argument #%d"), "getMatrixOfHandle", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (_pllHandle) + { + *_pllHandle = (long long*)(_piAddress + 4); + } + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr allocMatrixOfHandle(void* _pvCtx, int _iVar, int _iRows, int _iCols, long long** _pllHandle) +{ + SciErr sciErr = sciErrInit(); + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int* piAddr = NULL; + + int iMemSize = _iRows * _iCols + 2; + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(iAddr)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + fillMatrixOfHandle(_pvCtx, piAddr, _iRows, _iCols, _pllHandle); + + int iSCIAddress = sadr(iadr(iAddr) + 4); + updateInterSCI(_iVar, '$', iAddr, iSCIAddress); + updateLstk(iNewPos, sadr(iadr(iAddr) + 4), _iRows * _iCols); + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr createMatrixOfHandle(void* _pvCtx, int _iVar, int _iRows, int _iCols, long long* _pllHandle) +{ + long long* pllHandle = NULL; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocMatrixOfHandle(_pvCtx, _iVar, _iRows, _iCols, &pllHandle); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_HANDLE, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfHandle"); + return sciErr; + } + + memcpy(pllHandle, _pllHandle, sizeof(long long) * _iRows * _iCols); + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr fillMatrixOfHandle(void* _pvCtx, int* _piAddress, int _iRows, int _iCols, long long** _pllHandle) +{ + SciErr sciErr = sciErrInit(); + _piAddress[0] = sci_handles; + _piAddress[1] = Min(_iRows, _iRows * _iCols); + _piAddress[2] = Min(_iCols, _iRows * _iCols); + + *_pllHandle = (long long*)(_piAddress + 4); + return sciErr; +} +/*--------------------------------------------------------------------------*/ +int isHandleType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_handles); +} +/*--------------------------------------------------------------------------*/ +int getScalarHandle(void* _pvCtx, int* _piAddress, long long* _pllHandle) +{ + int iRows = 0; + int iCols = 0; + + long long* pllHandle = NULL; + + SciErr sciErr = getMatrixOfHandle(_pvCtx, _piAddress, &iRows, &iCols, &pllHandle); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_SCALAR_HANDLE, _("%s: Unable to get argument #%d"), "getScalarHandle", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (isScalar(_pvCtx, _piAddress) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_SCALAR_HANDLE, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "getScalarHandle", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (_pllHandle != NULL) + { + *_pllHandle = pllHandle[0]; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createScalarHandle(void* _pvCtx, int _iVar, long long _llHandle) +{ + long long* pllHandle = NULL; + + SciErr sciErr = allocMatrixOfHandle(_pvCtx, _iVar, 1, 1, &pllHandle); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_HANDLE, _("%s: Unable to create variable in Scilab memory"), "createScalarHandle"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + pllHandle[0] = _llHandle; + return 0; +} diff --git a/modules/api_scilab/src/cpp/api_hypermat.cpp b/modules/api_scilab/src/cpp/api_hypermat.cpp new file mode 100755 index 000000000..8cf0198b8 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_hypermat.cpp @@ -0,0 +1,735 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include <stdio.h> +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_double.h" +#include "localization.h" + +#include "call_scilab.h" + +int isHypermatType(void* _pvCtx, int* _piAddress) +{ + if (_piAddress[0] != sci_mlist || _piAddress[1] != 3) + { + // not a mlist or not containing 3 fields + return 0; + } + + if (_piAddress[6] != sci_strings || _piAddress[7] != 1 || _piAddress[8] != 3) + { + // first field is not a matrix 1x3 of strings + return 0; + } + + if (_piAddress[11] - 1 != 2 || _piAddress[14] != 17 || _piAddress[15] != 22) + { + // mlist type is not of length 2 or type is not "hm" ("hm" == [17 22]) + return 0; + } + + return 1; +} + +int isHypermatComplex(void* _pvCtx, int* _piAddress) +{ + int * _piItemAddress = NULL; + SciErr sciErr = getHypermatEntries(_pvCtx, _piAddress, &_piItemAddress); + if (sciErr.iErr) + { + return 0; + } + + return isVarComplex(_pvCtx, _piItemAddress); +} + +SciErr getHypermatType(void *_pvCtx, int *_piAddress, int *_piType) +{ + int * _piItemAddress = NULL; + SciErr sciErr = getHypermatEntries(_pvCtx, _piAddress, &_piItemAddress); + if (sciErr.iErr) + { + return sciErr; + } + + return getVarType(_pvCtx, _piItemAddress, _piType); +} + +SciErr getHypermatOfIntegerPrecision(void *_pvCtx, int *_piAddress, int *_piPrecision) +{ + int * _piItemAddress = NULL; + SciErr sciErr = getHypermatEntries(_pvCtx, _piAddress, &_piItemAddress); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfIntegerPrecision(_pvCtx, _piItemAddress, _piPrecision); +} + +SciErr getHypermatDimensions(void *_pvCtx, int *_piAddress, int **_dims, int *_ndims) +{ + int * _piItemAddress = NULL; + int _rows = 0; + + SciErr sciErr = getListItemAddress(_pvCtx, _piAddress, 2, &_piItemAddress); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfInteger32(_pvCtx, _piItemAddress, &_rows, _ndims, _dims); +} + +SciErr getHypermatEntries(void* _pvCtx, int* _piAddress, int ** _piEntriesAddress) +{ + return getListItemAddress(_pvCtx, _piAddress, 3, _piEntriesAddress); +} + +SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double** _pdblReal) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfDouble(_pvCtx, entries, &_rows, &_cols, _pdblReal); +} + +SciErr getComplexHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double** _pdblReal, double** _pdblImg) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getComplexMatrixOfDouble(_pvCtx, entries, &_rows, &_cols, _pdblReal, _pdblImg); +} + +SciErr getHypermatPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen) +{ + int * entries = NULL; + + SciErr sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getPolyVariableName(_pvCtx, entries, _pstVarName, _piVarNameLen); +} + +SciErr getHypermatOfPoly(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piNbCoef, double** _pdblReal) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfPoly(_pvCtx, entries, &_rows, &_cols, _piNbCoef, _pdblReal); +} + +SciErr getComplexHypermatOfPoly(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getComplexMatrixOfPoly(_pvCtx, entries, &_rows, &_cols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr getHypermatOfString(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piLength, char** _pstStrings) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfString(_pvCtx, entries, &_rows, &_cols, _piLength, _pstStrings); +} + +SciErr getHypermatOfWideString(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piLength, wchar_t** _pwstStrings) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfWideString(_pvCtx, entries, &_rows, &_cols, _piLength, _pwstStrings); +} + +SciErr getHypermatOfInteger8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char** _pcData8) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfInteger8(_pvCtx, entries, &_rows, &_cols, _pcData8); +} + +SciErr getHypermatOfUnsignedInteger8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char** _pucData8) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfUnsignedInteger8(_pvCtx, entries, &_rows, &_cols, _pucData8); +} + +SciErr getHypermatOfInteger16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short** _psData16) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfInteger16(_pvCtx, entries, &_rows, &_cols, _psData16); +} + +SciErr getHypermatOfUnsignedInteger16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short** _pusData16) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfUnsignedInteger16(_pvCtx, entries, &_rows, &_cols, _pusData16); +} + +SciErr getHypermatOfInteger32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int** _piData32) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfInteger32(_pvCtx, entries, &_rows, &_cols, _piData32); +} + +SciErr getHypermatOfUnsignedInteger32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int** _puiData32) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfUnsignedInteger32(_pvCtx, entries, &_rows, &_cols, _puiData32); +} + +SciErr getHypermatOfBoolean(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int** _piBool) +{ + int * entries = NULL; + int _rows = 0; + int _cols = 0; + + SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries); + if (sciErr.iErr) + { + return sciErr; + } + + return getMatrixOfBoolean(_pvCtx, entries, &_rows, &_cols, _piBool); +} + +SciErr createEmptyHypermat(void *_pvCtx, int _iVar, const int * _dims, int _ndims, int ** _piAddress) +{ + static const char * fields[3] = {"hm", "dims", "entries"}; + + SciErr sciErr = createMList(_pvCtx, _iVar, 3, _piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = createMatrixOfStringInList(_pvCtx, _iVar, *_piAddress, 1, 1, 3, fields); + if (sciErr.iErr) + { + return sciErr; + } + + sciErr = createMatrixOfInteger32InList(_pvCtx, _iVar, *_piAddress, 2, 1, _ndims, _dims); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfString(void *_pvCtx, int _iVar, int * _dims, int _ndims, const char* const* _pstStrings) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfStringInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pstStrings); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfPoly(void *_pvCtx, int _iVar, char* _pstVarName, int * _dims, int _ndims, const int* _piNbCoef, const double* const* _pdblReal) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfPolyInList(_pvCtx, _iVar, _piAddress, 3, _pstVarName, iNbElements, 1, _piNbCoef, _pdblReal); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createComplexHypermatOfPoly(void *_pvCtx, int _iVar, char* _pstVarName, int * _dims, int _ndims, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createComplexMatrixOfPolyInList(_pvCtx, _iVar, _piAddress, 3, _pstVarName, iNbElements, 1, _piNbCoef, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr allocHypermatOfDouble(void *_pvCtx, int _iVar, int * _dims, int _ndims, double** _pdblReal) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = allocMatrixOfDoubleInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pdblReal); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfDouble(void *_pvCtx, int _iVar, int * _dims, int _ndims, const double * _pdblReal) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pdblReal); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createComplexHypermatOfDouble(void *_pvCtx, int _iVar, int * _dims, int _ndims, const double * _pdblReal, const double * _pdblImg) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createComplexMatrixOfDoubleInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfBoolean(void *_pvCtx, int _iVar, int * _dims, int _ndims, const int * _piBool) +{ + int * _piAddress = NULL; + int iNbElements = 1; + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfBooleanInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _piBool); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfInteger8(void *_pvCtx, int _iVar, int * _dims, int _ndims, const char * _pcData8) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfInteger8InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pcData8); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfUnsignedInteger8(void *_pvCtx, int _iVar, int * _dims, int _ndims, const unsigned char * _pucData8) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfUnsignedInteger8InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pucData8); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfInteger16(void *_pvCtx, int _iVar, int * _dims, int _ndims, const short * _psData16) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfInteger16InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _psData16); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfUnsignedInteger16(void *_pvCtx, int _iVar, int * _dims, int _ndims, const unsigned short * _pusData16) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfUnsignedInteger16InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pusData16); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfInteger32(void *_pvCtx, int _iVar, int * _dims, int _ndims, const int * _piData32) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfInteger32InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _piData32); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} + +SciErr createHypermatOfUnsignedInteger32(void *_pvCtx, int _iVar, int * _dims, int _ndims, const unsigned int * _puiData32) +{ + int * _piAddress = NULL; + int iNbElements = 1; + + SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress); + if (sciErr.iErr) + { + return sciErr; + } + + for (int i = 0; i < _ndims; i++) + { + iNbElements *= _dims[i]; + } + + sciErr = createMatrixOfUnsignedInteger32InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _puiData32); + if (sciErr.iErr) + { + return sciErr; + } + + return sciErr; +} diff --git a/modules/api_scilab/src/cpp/api_int.cpp b/modules/api_scilab/src/cpp/api_int.cpp new file mode 100755 index 000000000..9ff5ee987 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_int.cpp @@ -0,0 +1,1289 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_int.h" +#include "localization.h" + +#include "call_scilab.h" + + +static int getCommonScalarInteger(void* _pvCtx, int* _piAddress, int _iPrec, void** _pvData); +static int getCommandNamedScalarInteger(void* _pvCtx, const char* _pstName, int _iPrec, void** _pvData); + + +SciErr getMatrixOfIntegerPrecision(void* _pvCtx, int* _piAddress, int* _piPrecision) +{ + SciErr sciErr = sciErrInit(); + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getMatrixOfIntegerPrecision"); + return sciErr; + } + + if (_piAddress[0] != sci_ints) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getMatrixOfIntegerPrecision", _("int matrix")); + return sciErr; + } + + *_piPrecision = _piAddress[3]; + return sciErr; +} + +SciErr getMatrixOfUnsignedInteger8(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned char** _pucData8) +{ + return getCommonMatrixOfInteger(_pvCtx, _piAddress, SCI_UINT8, _piRows, _piCols, (void**)_pucData8); +} + +SciErr getMatrixOfUnsignedInteger16(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned short** _pusData16) +{ + return getCommonMatrixOfInteger(_pvCtx, _piAddress, SCI_UINT16, _piRows, _piCols, (void**)_pusData16); +} + +SciErr getMatrixOfUnsignedInteger32(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, unsigned int** _puiData32) +{ + return getCommonMatrixOfInteger(_pvCtx, _piAddress, SCI_UINT32, _piRows, _piCols, (void**)_puiData32); +} + +SciErr getMatrixOfInteger8(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, char** _pcData8) +{ + return getCommonMatrixOfInteger(_pvCtx, _piAddress, SCI_INT8, _piRows, _piCols, (void**)_pcData8); +} + +SciErr getMatrixOfInteger16(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, short** _psData16) +{ + return getCommonMatrixOfInteger(_pvCtx, _piAddress, SCI_INT16, _piRows, _piCols, (void**)_psData16); +} + +SciErr getMatrixOfInteger32(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piData32) +{ + return getCommonMatrixOfInteger(_pvCtx, _piAddress, SCI_INT32, _piRows, _piCols, (void**)_piData32); +} + +SciErr getCommonMatrixOfInteger(void* _pvCtx, int* _piAddress, int _iPrecision, int* _piRows, int* _piCols, void** _piData) +{ + SciErr sciErr = sciErrInit(); + int iPrec = 0; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getMatrixOfInteger"); + return sciErr; + } + + sciErr = getMatrixOfIntegerPrecision(_pvCtx, _piAddress, &iPrec); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_INT, _("%s: Unable to get argument #%d"), "getMatrixOfInteger", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (iPrec != _iPrecision) + { + addErrorMessage(&sciErr, API_ERROR_GET_INT, _("%s: Unable to get argument #%d"), "getMatrixOfInteger", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + *_piRows = _piAddress[1]; + *_piCols = _piAddress[2]; + *_piData = (void*)(_piAddress + 4); + return sciErr; +} + +SciErr createMatrixOfUnsignedInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned char* _pucData8) +{ + unsigned char *pucData8 = NULL; + int iSize = _iRows * _iCols; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocMatrixOfUnsignedInteger8(_pvCtx, _iVar, _iRows, _iCols, &pucData8); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfUnsignedInteger8"); + return sciErr; + } + + memcpy(pucData8, _pucData8, sizeof(unsigned char) * iSize); + return sciErr; +} + +SciErr createMatrixOfUnsignedInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned short* _pusData16) +{ + unsigned short *psData16 = NULL; + int iSize = _iRows * _iCols; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocMatrixOfUnsignedInteger16(_pvCtx, _iVar, _iRows, _iCols, &psData16); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfUnsignedInteger16"); + return sciErr; + } + + memcpy(psData16, _pusData16, sizeof(unsigned short) * iSize); + return sciErr; +} + +SciErr createMatrixOfUnsignedInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, const unsigned int* _puiData32) +{ + unsigned int *piData32 = NULL; + int iSize = _iRows * _iCols; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocMatrixOfUnsignedInteger32(_pvCtx, _iVar, _iRows, _iCols, &piData32); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfUnsignedInteger32"); + return sciErr; + } + + memcpy(piData32, _puiData32, sizeof(unsigned int) * iSize); + return sciErr; +} + +SciErr createMatrixOfInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, const char* _pcData8) +{ + char *pcData8 = NULL; + int iSize = _iRows * _iCols; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocMatrixOfInteger8(_pvCtx, _iVar, _iRows, _iCols, &pcData8); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfInteger8"); + return sciErr; + } + + memcpy(pcData8, _pcData8, sizeof(char) * iSize); + return sciErr; +} + +SciErr createMatrixOfInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, const short* _psData16) +{ + short *psData16 = NULL; + int iSize = _iRows * _iCols; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocMatrixOfInteger16(_pvCtx, _iVar, _iRows, _iCols, &psData16); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfInteger16"); + return sciErr; + } + + memcpy(psData16, _psData16, sizeof(short) * iSize); + return sciErr; +} + +SciErr createMatrixOfInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piData32) +{ + int *piData32 = NULL; + int iSize = _iRows * _iCols; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocMatrixOfInteger32(_pvCtx, _iVar, _iRows, _iCols, &piData32); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfInteger32"); + return sciErr; + } + + memcpy(piData32, _piData32, sizeof(int) * iSize); + return sciErr; +} + +#ifdef __SCILAB_INT64__ +SciErr createMatrixOfInteger64(void* _pvCtx, int _iVar, int _iRows, int _iCols, const ong long* _pllData64) +{ + long long *pllData64 = NULL; + int iSize = _iRows * _iCols; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocMatrixOfInteger64(_iVar, _iRows, _iCols, &pllData64); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfInteger64"); + return sciErr; + } + + memcpy(pllData64, _pllData64, sizeof(long long) * iSize); + return sciErr; +} +#endif + +SciErr allocMatrixOfInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, char** _pcData8) +{ + int *piAddr = NULL; + char *pcData8 = NULL; + int iNewPos = Top - Rhs + _iVar; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + SciErr sciErr = allocCommonMatrixOfInteger(_pvCtx, _iVar, piAddr, SCI_INT8, _iRows, _iCols, (void**)&pcData8); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfInteger8"); + return sciErr; + } + + *_pcData8 = pcData8; + return sciErr; +} + +SciErr allocMatrixOfInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, short** _psData16) +{ + int *piAddr = NULL; + short *psData16 = NULL; + int iNewPos = Top - Rhs + _iVar; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + SciErr sciErr = allocCommonMatrixOfInteger(_pvCtx, _iVar, piAddr, SCI_INT16, _iRows, _iCols, (void**)&psData16); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfInteger16"); + return sciErr; + } + + *_psData16 = psData16; + return sciErr; +} + +SciErr allocMatrixOfInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piData32) +{ + int *piAddr = NULL; + int *piData32 = NULL; + int iNewPos = Top - Rhs + _iVar; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + SciErr sciErr = allocCommonMatrixOfInteger(_pvCtx, _iVar, piAddr, SCI_INT32, _iRows, _iCols, (void**)&piData32); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfInteger32"); + return sciErr; + } + + *_piData32 = piData32; + return sciErr; +} + +#ifdef __SCILAB_INT64__ +SciErr allocMatrixOfInteger64(void* _pvCtx, int _iVar, int _iRows, int _iCols, long long** _piData64) +{ + int *piAddr = NULL; + long long *pllData64 = NULL; + int iNewPos = Top - Rhs + _iVar; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(iNewPos, &piAddr); + + SciErr sciErr = allocCommonMatrixOfInteger(_iVar, piAddr, SCI_INT64, _iRows, _iCols, (void**)&piData32); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfInteger64"); + return sciErr; + } + + *_pllData64 = pllData64; + return sciErr; +} +#endif + +SciErr allocMatrixOfUnsignedInteger8(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned char** _pucData8) +{ + int *piAddr = NULL; + unsigned char *pucData8 = NULL; + int iNewPos = Top - Rhs + _iVar; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + SciErr sciErr = allocCommonMatrixOfInteger(_pvCtx, _iVar, piAddr, SCI_UINT8, _iRows, _iCols, (void**)&pucData8); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfUnsignedInteger8"); + return sciErr; + } + + *_pucData8 = pucData8; + return sciErr; +} + +SciErr allocMatrixOfUnsignedInteger16(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned short** _pusData16) +{ + int *piAddr = NULL; + unsigned short *pusData16 = NULL; + int iNewPos = Top - Rhs + _iVar; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + SciErr sciErr = allocCommonMatrixOfInteger(_pvCtx, _iVar, piAddr, SCI_UINT16, _iRows, _iCols, (void**)&pusData16); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfUnsignedInteger16"); + return sciErr; + } + + *_pusData16 = pusData16; + return sciErr; +} + +SciErr allocMatrixOfUnsignedInteger32(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned int** _puiData32) +{ + int *piAddr = NULL; + unsigned int *puiData32 = NULL; + int iNewPos = Top - Rhs + _iVar; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + SciErr sciErr = allocCommonMatrixOfInteger(_pvCtx, _iVar, piAddr, SCI_UINT32, _iRows, _iCols, (void**)&puiData32); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfUnsignedInteger32"); + return sciErr; + } + + *_puiData32 = puiData32; + return sciErr; +} + +#ifdef __SCILAB_INT64__ +SciErr allocMatrixOfUnsignedInteger64(void* _pvCtx, int _iVar, int _iRows, int _iCols, unsigned long long** _pullData64) +{ + int *piAddr = NULL; + unsigned long long *pullData64 = NULL; + int iNewPos = Top - Rhs + _iVar; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(iNewPos, &piAddr); + + SciErr sciErr = allocCommonMatrixOfInteger(_iVar, piAddr, SCI_UINT64, _iRows, _iCols, (void**)&puiData32); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT, _("%s: Unable to create variable in Scilab memory"), "allocMatrixOfUnsignedInteger64"); + return sciErr; + } + + *_pullData64 = pullData64; + return sciErr; +} +#endif + +SciErr allocCommonMatrixOfInteger(void* _pvCtx, int _iVar, int *_piAddress, int _iPrecision, int _iRows, int _iCols, void** pvData) +{ + SciErr sciErr = sciErrInit(); + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int iRate = (sizeof(double) / (_iPrecision % 10)); + int iSize = _iRows * _iCols; + int iDouble = iSize / iRate; + int iMod = (iSize % iRate) == 0 ? 0 : 1; + int iTotalSize = iDouble + iMod; + + //return empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + int iMemSize = iTotalSize + 2; + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(iAddr)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + fillCommonMatrixOfInteger(_pvCtx, _piAddress, _iPrecision, _iRows, _iCols, pvData); + updateInterSCI(_iVar, '$', iAddr, iAddr + 4); + updateLstk(iNewPos, iAddr + 4, iTotalSize ); + return sciErr; +} + +SciErr fillCommonMatrixOfInteger(void* _pvCtx, int* _piAddress, int _iPrecision, int _iRows, int _iCols, void** _pvData) +{ + SciErr sciErr = sciErrInit(); + + _piAddress[0] = sci_ints; + _piAddress[1] = Min(_iRows, _iRows * _iCols); + _piAddress[2] = Min(_iCols, _iRows * _iCols); + _piAddress[3] = _iPrecision; + *_pvData = (void*)(_piAddress + 4); + + return sciErr; +} + +SciErr createNamedMatrixOfUnsignedInteger8(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned char* _pucData8) +{ + return createCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_UINT8, _iRows, _iCols, _pucData8); +} + +SciErr createNamedMatrixOfUnsignedInteger16(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned short* _pusData16) +{ + return createCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_UINT16, _iRows, _iCols, _pusData16); +} + +SciErr createNamedMatrixOfUnsignedInteger32(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const unsigned int* _puiData32) +{ + return createCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_UINT32, _iRows, _iCols, _puiData32); +} + +SciErr createNamedMatrixOfInteger8(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const char* _pcData8) +{ + return createCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_INT8, _iRows, _iCols, _pcData8); +} + +SciErr createNamedMatrixOfInteger16(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const short* _psData16) +{ + return createCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_INT16, _iRows, _iCols, _psData16); +} + +SciErr createNamedMatrixOfInteger32(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piData32) +{ + return createCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_INT32, _iRows, _iCols, _piData32); +} + +#ifdef __SCILAB_INT64__ +SciErr createNamedMatrixOfInteger64(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const long long* _pllData64) +{ + return createCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_INT64, _iRows, _iCols, _piData32); +} +#endif + +SciErr createCommonNamedMatrixOfInteger(void* _pvCtx, const char* _pstName, int _iPrecision, int _iRows, int _iCols, const void* _pvData) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + void *pvData = NULL; + + int iRate = (sizeof(double) / (_iPrecision % 10)); + int iSize = _iRows * _iCols; + int iDouble = iSize / iRate; + int iMod = (iSize % iRate) == 0 ? 0 : 1; + int iTotalSize = iDouble + iMod; + + //return named empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createNamedMatrixOfDouble(_pvCtx, _pstName, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createNamedEmptyMatrix"); + } + return sciErr; + } + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonNamedMatrixOfInteger", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + Top = Top + Nbvars + 1; + + int iMemSize = iTotalSize + 2; + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(Top)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + //write matrix information + fillCommonMatrixOfInteger(_pvCtx, piAddr, _iPrecision, _iRows, _iCols, &pvData); + //copy data in stack + memcpy(pvData, _pvData, (_iPrecision % 10) * iSize); + + //update "variable index" + updateLstk(Top, *Lstk(Top) + 4, iTotalSize); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr getNamedMatrixOfIntegerPrecision(void* _pvCtx, const char* _pstName, int* _piPrecision) +{ + int* piAddr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_INT_PRECISION, _("%s: Unable to get precision of variable \"%s\""), "getNamedMatrixOfIntegerPrecision", _pstName); + return sciErr; + } + + //check variable type + if (piAddr[0] != sci_ints) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getNamedMatrixOfIntegerPrecision", _("int matrix")); + return sciErr; + } + + *_piPrecision = piAddr[3]; + return sciErr; +} + +SciErr readNamedMatrixOfUnsignedInteger8(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned char* _pucData8) +{ + return readCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_UINT8, _piRows, _piCols, _pucData8); +} + +SciErr readNamedMatrixOfUnsignedInteger16(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned short* _pusData16) +{ + return readCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_UINT16, _piRows, _piCols, _pusData16); +} + +SciErr readNamedMatrixOfUnsignedInteger32(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, unsigned int* _puiData32) +{ + return readCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_UINT32, _piRows, _piCols, _puiData32); +} + +SciErr readNamedMatrixOfInteger8(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, char* _pcData8) +{ + return readCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_INT8, _piRows, _piCols, _pcData8); +} + +SciErr readNamedMatrixOfInteger16(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, short* _psData16) +{ + return readCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_INT16, _piRows, _piCols, _psData16); +} + +SciErr readNamedMatrixOfInteger32(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piData32) +{ + return readCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_INT32, _piRows, _piCols, _piData32); +} + +#ifdef __SCILAB_INT64__ +SciErr readNamedMatrixOfInteger64(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, long long* _pllData64) +{ + return readCommonNamedMatrixOfInteger(_pvCtx, _pstName, SCI_INT64, _piRows, _piCols, _piData32); +} +#endif + +SciErr readCommonNamedMatrixOfInteger(void* _pvCtx, const char* _pstName, int _iPrecision, int* _piRows, int* _piCols, void* _pvData) +{ + int* piAddr = NULL; + int iSize = 0; + void* pvData = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_INT, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfInteger", _pstName); + return sciErr; + } + + sciErr = getCommonMatrixOfInteger(_pvCtx, piAddr, _iPrecision, _piRows, _piCols, &pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_INT, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfInteger", _pstName); + return sciErr; + } + iSize = *_piRows **_piCols; + + if (pvData == NULL || _pvData == NULL) + { + return sciErr; + } + + memcpy(_pvData, pvData, (_iPrecision % 10) * iSize); + return sciErr; +} + +/* shortcut functions */ + +int isIntegerType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_ints); +} +/*--------------------------------------------------------------------------*/ +int isNamedIntegerType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_ints); +} +/*--------------------------------------------------------------------------*/ +int getScalarInteger8(void* _pvCtx, int* _piAddress, char* _pcData) +{ + char* pcData = NULL; + + int iRet = getCommonScalarInteger(_pvCtx, _piAddress, SCI_INT8, (void**)&pcData); + if (iRet) + { + return iRet; + } + + *_pcData = pcData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +int getScalarInteger16(void* _pvCtx, int* _piAddress, short* _psData) +{ + short* psData = NULL; + + int iRet = getCommonScalarInteger(_pvCtx, _piAddress, SCI_INT16, (void**)&psData); + if (iRet) + { + return iRet; + } + + *_psData = psData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +int getScalarInteger32(void* _pvCtx, int* _piAddress, int* _piData) +{ + int* piData = NULL; + + int iRet = getCommonScalarInteger(_pvCtx, _piAddress, SCI_INT32, (void**)&piData); + if (iRet) + { + return iRet; + } + + *_piData = piData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +#ifdef __SCILAB_INT64__ +int getScalarInteger64(void* _pvCtx, int* _piAddress, long long* _pllData) +{ + long long* pllData = NULL; + + int iRet = getCommonScalarInteger(_pvCtx, _piAddress, SCI_INT64, (void**)&pllData); + if (iRet) + { + return iRet; + } + + *_pllData = pllData[0]; + return 0; +} +#endif +/*--------------------------------------------------------------------------*/ +int getScalarUnsignedInteger8(void* _pvCtx, int* _piAddress, unsigned char* _pucData) +{ + unsigned char* pucData = NULL; + + int iRet = getCommonScalarInteger(_pvCtx, _piAddress, SCI_UINT8, (void**)&pucData); + if (iRet) + { + return iRet; + } + + *_pucData = pucData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +int getScalarUnsignedInteger16(void* _pvCtx, int* _piAddress, unsigned short* _pusData) +{ + unsigned short* pusData = NULL; + + int iRet = getCommonScalarInteger(_pvCtx, _piAddress, SCI_UINT16, (void**)&pusData); + if (iRet) + { + return iRet; + } + + *_pusData = pusData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +int getScalarUnsignedInteger32(void* _pvCtx, int* _piAddress, unsigned int* _puiData) +{ + unsigned int* puiData = NULL; + + int iRet = getCommonScalarInteger(_pvCtx, _piAddress, SCI_UINT32, (void**)&puiData); + if (iRet) + { + return iRet; + } + + *_puiData = puiData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +#ifdef __SCILAB_INT64__ +int getScalarUnsignedInteger64(void* _pvCtx, int* _piAddress, unsigned long long* _pullData) +{ + unsigned long long* pullData = NULL; + + int iRet = getCommonScalarInteger(_pvCtx, _piAddress, SCI_UINT64, (void**)&pullData); + if (iRet) + { + return iRet; + } + + *_pullData = pullData[0]; + return 0; +} +#endif +/*--------------------------------------------------------------------------*/ +static int getCommonScalarInteger(void* _pvCtx, int* _piAddress, int _iPrec, void** _pvData) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + + if (isScalar(_pvCtx, _piAddress) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_SCALAR_INTEGER, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "getScalarInteger", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = getCommonMatrixOfInteger(_pvCtx, _piAddress, _iPrec, &iRows, &iCols, _pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_SCALAR_INTEGER, _("%s: Unable to get argument #%d"), "getScalarInteger", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedScalarInteger8(void* _pvCtx, const char* _pstName, char* _pcData) +{ + char* pcData = NULL; + + int iRet = getCommandNamedScalarInteger(_pvCtx, _pstName, SCI_INT8, (void**)&pcData); + if (iRet) + { + return iRet; + } + + *_pcData = pcData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedScalarInteger16(void* _pvCtx, const char* _pstName, short* _psData) +{ + short* psData = NULL; + + int iRet = getCommandNamedScalarInteger(_pvCtx, _pstName, SCI_INT16, (void**)&psData); + if (iRet) + { + return iRet; + } + + *_psData = psData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedScalarInteger32(void* _pvCtx, const char* _pstName, int* _piData) +{ + int* piData = NULL; + + int iRet = getCommandNamedScalarInteger(_pvCtx, _pstName, SCI_INT32, (void**)&piData); + if (iRet) + { + return iRet; + } + + *_piData = piData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +#ifdef __SCILAB_INT64__ +int getNamedScalarInteger64(void* _pvCtx, const char* _pstName, long long* _pllData) +{ + long long* pllData = NULL; + + int iRet = getCommandNamedScalarInteger(_pvCtx, _pstName, SCI_INT64, (void**)&pllData); + if (iRet) + { + return iRet; + } + + *_pllData = pllData[0]; + return 0; +} +#endif +/*--------------------------------------------------------------------------*/ +int getNamedScalarUnsignedInteger8(void* _pvCtx, const char* _pstName, unsigned char* _pucData) +{ + unsigned char* pucData = NULL; + + int iRet = getCommandNamedScalarInteger(_pvCtx, _pstName, SCI_UINT8, (void**)&pucData); + if (iRet) + { + return iRet; + } + + *_pucData = pucData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedScalarUnsignedInteger16(void* _pvCtx, const char* _pstName, unsigned short* _pusData) +{ + unsigned short* pusData = NULL; + + int iRet = getCommandNamedScalarInteger(_pvCtx, _pstName, SCI_UINT16, (void**)&pusData); + if (iRet) + { + return iRet; + } + + *_pusData = pusData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedScalarUnsignedInteger32(void* _pvCtx, const char* _pstName, unsigned int* _puiData) +{ + unsigned int* puiData = NULL; + + int iRet = getCommandNamedScalarInteger(_pvCtx, _pstName, SCI_UINT32, (void**)&puiData); + if (iRet) + { + return iRet; + } + + *_puiData = puiData[0]; + return 0; +} +/*--------------------------------------------------------------------------*/ +#ifdef __SCILAB_INT64__ +int getNamedScalarUnsignedInteger64(void* _pvCtx, const char* _pstName, unsigned long long* _pullData) +{ + unsigned long long* pullData = NULL; + + int iRet = getCommandNamedScalarInteger(_pvCtx, _pstName, SCI_UINT64, (void**)&pullData); + if (iRet) + { + return iRet; + } + + *_pullData = pullData[0]; + return 0; +} +#endif +/*--------------------------------------------------------------------------*/ +static int getCommandNamedScalarInteger(void* _pvCtx, const char* _pstName, int _iPrec, void** _pvData) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + + if (isNamedScalar(_pvCtx, _pstName) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_SCALAR_INTEGER, _("%s: Wrong type for input argument \"%s\": A scalar expected.\n"), "getNamedScalarInteger", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = readCommonNamedMatrixOfInteger(_pvCtx, _pstName, _iPrec, &iRows, &iCols, _pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_SCALAR_INTEGER, _("%s: Unable to get argument \"%s\""), "getNamedScalarInteger", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createScalarInteger8(void* _pvCtx, int _iVar, char _cData) +{ + SciErr sciErr = createMatrixOfInteger8(_pvCtx, _iVar, 1, 1, &_cData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createScalarInteger8"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createScalarInteger16(void* _pvCtx, int _iVar, short _sData) +{ + SciErr sciErr = createMatrixOfInteger16(_pvCtx, _iVar, 1, 1, &_sData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createScalarInteger16"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createScalarInteger32(void* _pvCtx, int _iVar, int _iData) +{ + SciErr sciErr = createMatrixOfInteger32(_pvCtx, _iVar, 1, 1, &_iData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createScalarInteger32"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +#ifdef __SCILAB_INT64__ +int createScalarInteger64(void* _pvCtx, int _iVar, long long _llData) +{ + SciErr sciErr = createMatrixOfInteger64(_pvCtx, _iVar, 1, 1, _llData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createScalarInteger64"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +#endif +/*--------------------------------------------------------------------------*/ +int createScalarUnsignedInteger8(void* _pvCtx, int _iVar, unsigned char _ucData) +{ + SciErr sciErr = createMatrixOfUnsignedInteger8(_pvCtx, _iVar, 1, 1, &_ucData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createScalarUnsignedInteger8"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createScalarUnsignedInteger16(void* _pvCtx, int _iVar, unsigned short _usData) +{ + SciErr sciErr = createMatrixOfUnsignedInteger16(_pvCtx, _iVar, 1, 1, &_usData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createScalarUnsignedInteger16"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createScalarUnsignedInteger32(void* _pvCtx, int _iVar, unsigned int _uiData) +{ + SciErr sciErr = createMatrixOfUnsignedInteger32(_pvCtx, _iVar, 1, 1, &_uiData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createScalarUnsignedInteger32"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +#ifdef __SCILAB_INT64__ +int createScalarUnsignedInteger64(void* _pvCtx, int _iVar, unsigned long long _ullData) +{ + SciErr sciErr = createMatrixOfUnsignedInteger64(_pvCtx, _iVar, 1, 1, &_ullData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createScalarUnsignedInteger64"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +#endif +/*--------------------------------------------------------------------------*/ +int createNamedScalarInteger8(void* _pvCtx, const char* _pstName, char _cData) +{ + SciErr sciErr = createNamedMatrixOfInteger8(_pvCtx, _pstName, 1, 1, &_cData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarInteger8"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createNamedScalarInteger16(void* _pvCtx, const char* _pstName, short _sData) +{ + SciErr sciErr = createNamedMatrixOfInteger16(_pvCtx, _pstName, 1, 1, &_sData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarInteger16"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createNamedScalarInteger32(void* _pvCtx, const char* _pstName, int _iData) +{ + SciErr sciErr = createNamedMatrixOfInteger32(_pvCtx, _pstName, 1, 1, &_iData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarInteger32"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +#ifdef __SCILAB_INT64__ +int createNamedScalarInteger64(void* _pvCtx, const char* _pstName, long long _llData) +{ + SciErr sciErr = createNamedMatrixOfInteger64(_pvCtx, _pstName, 1, 1, &_llData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarInteger64"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +#endif +/*--------------------------------------------------------------------------*/ +int createNamedScalarUnsignedInteger8(void* _pvCtx, const char* _pstName, unsigned char _ucData) +{ + SciErr sciErr = createNamedMatrixOfUnsignedInteger8(_pvCtx, _pstName, 1, 1, &_ucData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarUnsignedInteger8"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createNamedScalarUnsignedInteger16(void* _pvCtx, const char* _pstName, unsigned short _usData) +{ + SciErr sciErr = createNamedMatrixOfUnsignedInteger16(_pvCtx, _pstName, 1, 1, &_usData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarUnsignedInteger16"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createNamedScalarUnsignedInteger32(void* _pvCtx, const char* _pstName, unsigned int _uiData) +{ + SciErr sciErr = createNamedMatrixOfUnsignedInteger32(_pvCtx, _pstName, 1, 1, &_uiData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarUnsignedInteger32"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +#ifdef __SCILAB_INT64__ +int createNamedScalarUnsignedInteger64(void* _pvCtx, const char* _pstName, unsigned long long _ullData) +{ + SciErr sciErr = createNamedMatrixOfUnsignedInteger64(_pvCtx, _pstName, 1, 1, &_ullData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SCALAR_INT, _("%s: Unable to create variable in Scilab memory"), "createNamedScalarUnsignedInteger64"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +#endif +/*--------------------------------------------------------------------------*/ diff --git a/modules/api_scilab/src/cpp/api_internal_boolean.h b/modules/api_scilab/src/cpp/api_internal_boolean.h new file mode 100755 index 000000000..1a7e6e9d8 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_boolean.h @@ -0,0 +1,22 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#ifndef __INTERNAL_BOOLEAN_API__ +#define __INTERNAL_BOOLEAN_API__ + +//internal functions +SciErr fillMatrixOfBoolean(void* _pvCtx, int* _piAddress, int _iRows, int _iCols, int** _piBool); + +#endif /* __INTERNAL_BOOLEAN_API__ */ diff --git a/modules/api_scilab/src/cpp/api_internal_boolean_sparse.h b/modules/api_scilab/src/cpp/api_internal_boolean_sparse.h new file mode 100755 index 000000000..bb36fb1fe --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_boolean_sparse.h @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#ifndef __INTERNAL_BOOLEAN_SPARSE_API__ +#define __INTERNAL_BOOLEAN_SPARSE_API__ + +//internal functions +//internal boolean sparse functions +SciErr fillBooleanSparseMatrix(void* _pvCtx, int *_piAddress, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos); + +#endif /* __INTERNAL_BOOLEAN_SPARSE_API__ */ diff --git a/modules/api_scilab/src/cpp/api_internal_common.h b/modules/api_scilab/src/cpp/api_internal_common.h new file mode 100755 index 000000000..fc11e9b94 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_common.h @@ -0,0 +1,72 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __INTERNAL_COMMON_API__ +#define __INTERNAL_COMMON_API__ + +/** +* +* @param[in] +* @param +* @return +*/ +int getNewVarAddressFromPosition(void* _pvCtx, int _iVar, int** _piAddress); + +/** +* +* @param +*/ +void createNamedVariable(int *_piVarID); + +/** +* +* @param[in] +* @param[in] +* @param[in] +* @return +*/ +int updateLstk(int _iNewPos, int _iSCIDataAddress, int _iVarSize); + +/** +* +* @param[in] +* @param[in] +* @param[in] +* @param[in] +* @return +*/ +int updateInterSCI(int _iVar, char _cType, int _iSCIAddress, int _iSCIDataAddress); + +/** +* @param[in] _piAddress variable address +* @param[in] _iType type to check +* @return 1 for true and 0 for false +*/ +int checkVarType(void* _pvCtx, int* _piAddress, int _iType); + +/** +* @param[in] _psName variable name +* @param[in] _iType type to check +* @return 1 for true and 0 for false +*/ +int checkNamedVarType(void* _pvCtx, const char *_pstName, int _iType); + +/** +* @param[in] _psName variable name +* @return 1 for true (variable name is valid) and 0 for false +*/ +int checkNamedVarFormat(void* _pvCtx, const char *_pstName); + + +SciErr sciErrInit(); + +#endif /* __INTERNAL_COMMON_API__ */ + diff --git a/modules/api_scilab/src/cpp/api_internal_double.h b/modules/api_scilab/src/cpp/api_internal_double.h new file mode 100755 index 000000000..76e172031 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_double.h @@ -0,0 +1,22 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __INTERNAL_DOUBLE_API__ +#define __INTERNAL_DOUBLE_API__ + +//internal double functions +SciErr getCommonMatrixOfDouble(void* _pvCtx, int* _piAddress, char _cType, int _iComplex, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg); +SciErr allocCommonMatrixOfDouble(void* _pvCtx, int _iVar, char _cType, int _iComplex, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg); +SciErr fillCommonMatrixOfDouble(void* _pvCtx, int* _piAddress, int _iComplex, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg); +SciErr createCommonNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iComplex, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg); +SciErr readCommonNamedMatrixOfDouble(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg); + +#endif /* __INTERNAL_DOUBLE_API__ */ diff --git a/modules/api_scilab/src/cpp/api_internal_int.h b/modules/api_scilab/src/cpp/api_internal_int.h new file mode 100755 index 000000000..223c5ba76 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_int.h @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __INTERNAL_INT_API__ +#define __INTERNAL_INT_API__ + +//internal +SciErr getCommonMatrixOfInteger(void* _pvCtx, int* _piAddress, int _iPrecision, int* _piRows, int* _piCols, void** _piData); +SciErr allocCommonMatrixOfInteger(void* _pvCtx, int _iVar, int *_piAddress, int _iPrecision, int _iRows, int _iCols, void** piData); +SciErr fillCommonMatrixOfInteger(void* _pvCtx, int* _piAddress, int _iPrecision, int _iRows, int _iCols, void** _pdiData); +SciErr createCommonNamedMatrixOfInteger(void* _pvCtx, const char* _pstName, int _iPrecision, int _iRows, int _iCols, const void* _piData); +SciErr readCommonNamedMatrixOfInteger(void* _pvCtx, const char* _pstName, int _iPrecision, int* _piRows, int* _piCols, void* _piData); +#endif /* __INTERNAL_INT_API__ */ diff --git a/modules/api_scilab/src/cpp/api_internal_pointer.h b/modules/api_scilab/src/cpp/api_internal_pointer.h new file mode 100755 index 000000000..15c0b7e4c --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_pointer.h @@ -0,0 +1,17 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __INTERNAL_POINTER_API__ +#define __INTERNAL_POINTER_API__ + +SciErr fillPointer(void* _pvCtx, int *_piAddress, void** _pvPtr); + +#endif /* __INTERNAL_POINTER_API__ */
\ No newline at end of file diff --git a/modules/api_scilab/src/cpp/api_internal_poly.h b/modules/api_scilab/src/cpp/api_internal_poly.h new file mode 100755 index 000000000..15b3bd5f2 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_poly.h @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __INTERNAL_POLY_API__ +#define __INTERNAL_POLY_API__ + +//internal poly functions +SciErr getCommonMatrixOfPoly(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); +SciErr createCommonMatrixOfPoly(void* _pvCtx, int _iVar, int _iComplex, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); +SciErr fillCommonMatrixOfPoly(void* _pvCtx, int* _piAddress, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg, int* _piTotalLen); +SciErr createCommonNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); +SciErr readCommonNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); + +#endif /* __INTERNAL_POLY_API__ */ + diff --git a/modules/api_scilab/src/cpp/api_internal_sparse.h b/modules/api_scilab/src/cpp/api_internal_sparse.h new file mode 100755 index 000000000..cac72146c --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_sparse.h @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __INTERNAL_SPARSE_API__ +#define __INTERNAL_SPARSE_API__ + +SciErr getCommonSparseMatrix(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); +SciErr allocCommonSparseMatrix(void* _pvCtx, int _iVar, int _iComplex, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); +SciErr fillCommonSparseMatrix(void* _pvCtx, int *_piAddress, int _iComplex, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg, int* _piTotalSize); +SciErr createCommonSparseMatrix(void* _pvCtx, int _iVar, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg); +SciErr createCommonNamedSparseMatrix(void* _pvCtx, const char* _pstName, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg); +SciErr readCommonNamedSparseMatrix(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg); + + +#endif /* __INTERNAL_SPARSE_API__ */ diff --git a/modules/api_scilab/src/cpp/api_internal_string.h b/modules/api_scilab/src/cpp/api_internal_string.h new file mode 100755 index 000000000..ee59a9252 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_internal_string.h @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + */ + +#ifndef __INTERNAL_STRING_API__ +#define __INTERNAL_STRING_API__ + +//local string functions +SciErr fillMatrixOfString(void* _pvCtx, int* _piAddress, int _iRows, int _iCols, const char* const* _pstStrings, int* _piTotalLen); + +#endif /* __INTERNAL_STRING_API__ */ diff --git a/modules/api_scilab/src/cpp/api_list.cpp b/modules/api_scilab/src/cpp/api_list.cpp new file mode 100755 index 000000000..3b51ab0c5 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_list.cpp @@ -0,0 +1,3081 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2009 - DIGITEO - Antoine ELIAS +* +* 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 +* +* Please note that piece of code will be rewrited for the Scilab 6 family +* However, the API (profile of the functions in the header files) will be +* still available and supported in Scilab 6. +*/ + +#include <vector> +#include <map> +#include <string> + +#include "stdio.h" +#include "MALLOC.h" +#include "call_scilab.h" + +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_double.h" +#include "api_internal_string.h" +#include "api_internal_boolean.h" +#include "api_internal_poly.h" +#include "api_internal_int.h" +#include "api_internal_sparse.h" +#include "api_internal_boolean_sparse.h" +#include "api_internal_pointer.h" +#include "localization.h" + +//internal functions +static SciErr createCommonList(void* _pvCtx, int _iVar, int _iListType, int _iNbItem, int** _piAddress); +static SciErr createCommonListInList(void* _pvCtx, int _iVar, const char* _pstName, int* _piParent, int _iItemPos, int _iListType, int _iNbItem, int** _piAddress, int iNamed); +static SciErr createCommonNamedList(void* _pvCtx, const char* _pstName, int _iListType, int _iNbItem, int** _piAddress); +static SciErr createCommonListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iListType, int _iNbItem, int** _piAddress); +static SciErr getCommonListInList(void* _pvCtx, int* _piParent, int _iItemPos, int _iListType, int** _piAddress); +static SciErr getCommomListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iListType, int** _piAddress); +static SciErr readCommonNamedList(void* _pvCtx, const char* _pstName, int _iListType, int* _piNbItem, int** _piAddress); +static SciErr fillCommonList(void* _pvCtx, int* _piAddress, int _iListType, int _iNbItem); +static void closeList(int _iVar, int *_piEnd); +static void updateListOffset(void* _pvCtx, int _iVar, int *_piCurrentNode, int _iItemPos, int *_piEnd); +static void updateNamedListOffset(void* _pvCtx, int _iVar, const char* _pstName, int *_piCurrentNode, int _iItemPos, int *_piEnd); +static void updateCommunListOffset(void* _pvCtx, int _iVar, const char* _pstName, int *_piCurrentNode, int _iItemPos, int *_piEnd); + +static SciErr allocCommonMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iComplex, int _iRows, int _iCols, double **_pdblReal, double **_pdblImg); +static SciErr getCommonMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg); +static SciErr createCommonMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iComplex, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg); +static SciErr fillCommonMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iComplex, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg); +static SciErr createCommomMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg); +static SciErr readCommonMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg); +static SciErr allocCommonItemInList(void* _pvCtx, int* _piParent, int _iItemPos, int** _piChildAddr); +static SciErr fillMatrixOfBoolInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piBool); +static SciErr getCommonMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); +static SciErr createCommonMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); +static SciErr createCommonMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg); +static SciErr readCommonMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg); +static SciErr fillCommonMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg, int* _piTotalLen); +static SciErr fillCommonMatrixOfStringInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings, int* _piTotalLen); +static SciErr readCommonSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg); +static SciErr createCommonSparseMatrixInList(void* _pvCtx, int _iVar, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg); +static SciErr createCommonSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg); + +struct ListInfo +{ + ListInfo(int* _piAddr, int _iLast) : m_piAddr(_piAddr), m_iLast(_iLast) {}; + int* m_piAddr; + int m_iLast; +}; + +typedef std::vector<ListInfo*> VectListInfo; +typedef std::map<int, VectListInfo*> StackList; +typedef std::map<std::string, VectListInfo*> StackNamedList; +static StackList stackListPosition; +static StackNamedList stackNamedListPosition; + + +// Push a list address on the stackListPosition +static void pushListAddress(int _iRhsPos, int* _piAddr) +{ + if (stackListPosition.find(_iRhsPos) == stackListPosition.end()) + { + VectListInfo* pVect = new VectListInfo(); + pVect->push_back(new ListInfo(_piAddr, 0)); + stackListPosition[_iRhsPos] = pVect; + } + else + { + stackListPosition[_iRhsPos]->push_back(new ListInfo(_piAddr, 0)); + } +} + +static void pushNamedListAddress(std::string _stNamedList, int* _piAddr) +{ + if (stackNamedListPosition.find(_stNamedList) == stackNamedListPosition.end()) + { + VectListInfo* pVect = new VectListInfo(); + pVect->push_back(new ListInfo(_piAddr, 0)); + stackNamedListPosition[_stNamedList] = pVect; + } + else + { + stackNamedListPosition[_stNamedList]->push_back(new ListInfo(_piAddr, 0)); + } +} + +// Pop a list address from the stackListPosition +static void popListAddress(int _iRhsPos) +{ + StackList::iterator it = stackListPosition.find(_iRhsPos); + if (it != stackListPosition.end()) + { + delete it->second->back(); + it->second->pop_back(); + if (it->second->size() > 0 && it->second->back()->m_iLast == 1) + { + //close cascade + popListAddress(_iRhsPos); + } + + StackList::iterator jt = stackListPosition.find(_iRhsPos); + if (jt != stackListPosition.end() && jt->second->empty()) + { + delete jt->second; + stackListPosition.erase(jt); + //TODO : check to close list + } + } +} + +static void popNamedListAddress(std::string _stNamedList) +{ + StackNamedList::iterator it = stackNamedListPosition.find(_stNamedList); + if (it != stackNamedListPosition.end()) + { + delete it->second->back(); + it->second->pop_back(); + if (it->second->size() > 0 && it->second->back()->m_iLast == 1) + { + //close cascade + popNamedListAddress(_stNamedList); + } + + StackNamedList::iterator jt = stackNamedListPosition.find(_stNamedList); + if (jt != stackNamedListPosition.end() && jt->second->empty()) + { + int iVarID[nsiz]; + delete jt->second; + stackNamedListPosition.erase(jt); + C2F(str2name)(_stNamedList.c_str(), iVarID, (unsigned long)_stNamedList.size()); + createNamedVariable(iVarID); + } + } +} + +/*get last store address*/ +int* getLastListAddress(int _iRhsPos, int _iItemPos) +{ + StackList::iterator it = stackListPosition.find(_iRhsPos); + if (it == stackListPosition.end() || it->second->empty()) + { + return NULL; + } + + if (_iItemPos == it->second->back()->m_piAddr[1]) + { + it->second->back()->m_iLast = 1; + } + + return it->second->back()->m_piAddr; +} + +static int* getLastNamedListAddress(std::string _stNamedList, int _iItemPos) +{ + StackNamedList::iterator it = stackNamedListPosition.find(_stNamedList); + if (it == stackNamedListPosition.end() || it->second->empty()) + { + return NULL; + } + + if (_iItemPos == it->second->back()->m_piAddr[1]) + { + it->second->back()->m_iLast = 1; + } + + return it->second->back()->m_piAddr; +} + + +//get address list +static void getListAdressses(int _iRhsPos, int** _piAddresses) +{ + StackList::iterator it = stackListPosition.find(_iRhsPos); + if (it == stackListPosition.end() || it->second->empty() || _piAddresses == NULL) + { + return; + } + + VectListInfo::iterator vit; + int i = 0; + for (vit = it->second->begin() ; vit != it->second->end() ; vit++, i++) + { + _piAddresses[i] = (*vit)->m_piAddr; + } +} + +static void getNamedListAdressses(std::string _stName, int** _piAddresses) +{ + StackNamedList::iterator it = stackNamedListPosition.find(_stName); + if (it == stackNamedListPosition.end() || it->second->empty() || _piAddresses == NULL) + { + return; + } + + VectListInfo::iterator vit; + int i = 0; + for (vit = it->second->begin() ; vit != it->second->end() ; vit++, i++) + { + _piAddresses[i] = (*vit)->m_piAddr; + } +} + +//get Depth of list +static int getDepthList(int _iRhsPos) +{ + StackList::iterator it = stackListPosition.find(_iRhsPos); + if (it == stackListPosition.end() || it->second->empty()) + { + return 0; + } + return (int)it->second->size(); +} + +static int getDepthNamedList(std::string _stNamedList) +{ + StackNamedList::iterator it = stackNamedListPosition.find(_stNamedList); + if (it == stackNamedListPosition.end() || it->second->empty()) + { + return 0; + } + return (int)it->second->size(); +} + +char* getListTypeName(int _iType) +{ + switch (_iType) + { + case sci_list : + return "list"; + break; + case sci_tlist : + return "tlist"; + break; + case sci_mlist : + return "mlist"; + break; + default: + break; + } + return ""; +} + +SciErr getListItemNumber(void* _pvCtx, int* _piAddress, int* _piNbItem) +{ + int iType = 0; + + SciErr sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_LIST_ITEM_NUMBER, _("%s: Unable to get item number of list"), "getListItemNumber"); + return sciErr; + } + switch (iType) + { + case sci_list : + case sci_mlist : + case sci_tlist : + *_piNbItem = _piAddress[1]; + break; + default : + addErrorMessage(&sciErr, API_ERROR_INVALID_LIST_TYPE, _("%s: Invalid argument type, %s expected"), "getListItemNumber", _("list")); + return sciErr; + } + return sciErr; +} + +SciErr getListItemAddress(void* _pvCtx, int* _piAddress, int _iItemNum, int** _piItemAddress) +{ + int iItem = 0; + int* piOffset = NULL; + int* piItemAddress = NULL; + + //get item count + SciErr sciErr = getListItemNumber(_pvCtx, _piAddress, &iItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ITEM_ADDRESS, _("%s: Unable to get address of item #%d in argument #%d"), "getListItemAddress", _iItemNum + 1, getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (_iItemNum > iItem) + { + addErrorMessage(&sciErr, API_ERROR_GET_ITEM_ADDRESS, _("%s: Unable to get address of item #%d in argument #%d"), "getListItemAddress", _iItemNum + 1, getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + //get offset of item array + piOffset = _piAddress + 2; + if (piOffset[_iItemNum] == piOffset[_iItemNum - 1]) + { + *_piItemAddress = NULL; + } + else + { + piItemAddress = piOffset + iItem + 1 + !(iItem % 2); + *_piItemAddress = piItemAddress + (piOffset[_iItemNum - 1] - 1) * (sizeof(double) / sizeof(int)); + } + return sciErr; +} + +SciErr createList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress) +{ + return createCommonList(_pvCtx, _iVar, sci_list, _iNbItem, _piAddress); +} + +SciErr createMList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress) +{ + return createCommonList(_pvCtx, _iVar, sci_mlist, _iNbItem, _piAddress); +} + +SciErr createTList(void* _pvCtx, int _iVar, int _iNbItem, int** _piAddress) +{ + return createCommonList(_pvCtx, _iVar, sci_tlist, _iNbItem, _piAddress); +} + +SciErr createNamedList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress) +{ + return createCommonNamedList(_pvCtx, _pstName, sci_list, _iNbItem, _piAddress); +} + +SciErr createNamedTList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress) +{ + return createCommonNamedList(_pvCtx, _pstName, sci_tlist, _iNbItem, _piAddress); +} + +SciErr createNamedMList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress) +{ + return createCommonNamedList(_pvCtx, _pstName, sci_mlist, _iNbItem, _piAddress); +} + +SciErr createNamedList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress, bool useStack) +{ + + return createCommonNamedList(_pvCtx, _pstName, sci_list, _iNbItem, _piAddress); +} + +SciErr createNamedTList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress, bool useStack) +{ + return createCommonNamedList(_pvCtx, _pstName, sci_tlist, _iNbItem, _piAddress); +} + +SciErr createNamedMList(void* _pvCtx, const char* _pstName, int _iNbItem, int** _piAddress, bool useStack) +{ + return createCommonNamedList(_pvCtx, _pstName, sci_mlist, _iNbItem, _piAddress); +} + +static SciErr createCommonNamedList(void* _pvCtx, const char* _pstName, int _iListType, int _iNbItem, int** _piAddress) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + int* piEnd = NULL; + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = fillCommonList(_pvCtx, piAddr, _iListType, _iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_LIST, _("%s: Unable to create %s named \"%s\""), "createNamedList", getListTypeName(_iListType), _pstName); + return sciErr; + } + + piEnd = piAddr + 3 + _iNbItem + !(_iNbItem % 2); + closeList(Top, piEnd); + + Rhs = 0; + + if (_iNbItem != 0) + { + pushNamedListAddress(_pstName, piAddr); + } + else + { + //Add name in stack reference list + createNamedVariable(iVarID); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + *_piAddress = piAddr; + return sciErr; +} + +static SciErr createCommonList(void* _pvCtx, int _iVar, int _iListType, int _iNbItem, int** _piAddress) +{ + int *piAddr = NULL; + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + SciErr sciErr = fillCommonList(_pvCtx, piAddr, _iListType, _iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_LIST, _("%s: Unable to create variable in Scilab memory"), "createList"); + return sciErr; + } + + *_piAddress = piAddr; + updateInterSCI(_iVar, '$', iAddr, sadr(iadr(iAddr) + 2 + _iNbItem + 1 + !(_iNbItem % 2))); + closeList(iNewPos, piAddr + 2 + _iNbItem + 1 + !(_iNbItem % 2)); + + if (_iNbItem != 0) + { + pushListAddress(_iVar, piAddr); + } + + return sciErr; +} + +SciErr fillCommonList(void* _pvCtx, int* _piAddress, int _iListType, int _iNbItem) +{ + SciErr sciErr = sciErrInit(); + int* piOffset = NULL; + + _piAddress[0] = _iListType; + _piAddress[1] = _iNbItem; + + piOffset = _piAddress + 2; + piOffset[0] = 1; //always + + for (int i = 0 ; i < _iNbItem; i++) + { + //initialize item offset + piOffset[i + 1] = -1; + } + return sciErr; +} + +SciErr readNamedList(void* _pvCtx, const char* _pstName, int* _piNbItem, int** _piAddress) +{ + return readCommonNamedList(_pvCtx, _pstName, sci_list, _piNbItem, _piAddress); +} + +SciErr readNamedTList(void* _pvCtx, const char* _pstName, int* _piNbItem, int** _piAddress) +{ + return readCommonNamedList(_pvCtx, _pstName, sci_tlist, _piNbItem, _piAddress); +} + +SciErr readNamedMList(void* _pvCtx, const char* _pstName, int* _piNbItem, int** _piAddress) +{ + return readCommonNamedList(_pvCtx, _pstName, sci_mlist, _piNbItem, _piAddress); +} + +static SciErr readCommonNamedList(void* _pvCtx, const char* _pstName, int _iListType, int* _piNbItem, int** _piAddress) +{ + int* piAddr = NULL; + int iNbItem = 0; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_LIST, _("%s: Unable to get variable \"%s\""), "readNamedList", _pstName); + return sciErr; + } + + if (piAddr[0] != _iListType) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_LIST_TYPE, _("%s: Invalid argument type, %s expected"), "readNamedList", getListTypeName(_iListType)); + return sciErr; + } + + sciErr = getListItemNumber(_pvCtx, piAddr, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_LIST, _("%s: Unable to get variable \"%s\""), "readNamedList", _pstName); + return sciErr; + } + + *_piNbItem = iNbItem; + *_piAddress = piAddr; + + return sciErr; +} + +SciErr getListInList(void* _pvCtx, int* _piParent, int _iItemPos, int** _piAddress) +{ + return getCommonListInList(_pvCtx, _piParent, _iItemPos, sci_list, _piAddress); +} + +SciErr getTListInList(void* _pvCtx, int* _piParent, int _iItemPos, int** _piAddress) +{ + return getCommonListInList(_pvCtx, _piParent, _iItemPos, sci_tlist, _piAddress); +} + +SciErr getMListInList(void* _pvCtx, int* _piParent, int _iItemPos, int** _piAddress) +{ + return getCommonListInList(_pvCtx, _piParent, _iItemPos, sci_mlist, _piAddress); +} + +SciErr getCommonListInList(void* _pvCtx, int* _piParent, int _iItemPos, int _iListType, int** _piAddress) +{ + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, _piAddress); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_LIST_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getListInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + if ((*_piAddress)[0] != _iListType) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_LIST_TYPE, _("%s: Invalid argument type, %s expected"), "getListInList", getListTypeName(_iListType)); + return sciErr; + } + return sciErr; +} + +SciErr getListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int** _piAddress) +{ + return getCommomListInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, sci_list, _piAddress); +} + +SciErr getTListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int** _piAddress) +{ + return getCommomListInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, sci_tlist, _piAddress); +} + +SciErr getMListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int** _piAddress) +{ + return getCommomListInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, sci_mlist, _piAddress); +} + +SciErr getCommomListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iListType, int** _piAddress) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_LIST_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "getListInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + if (piAddr[0] != _iListType) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_LIST_TYPE, _("%s: Invalid argument type, %s expected"), "getListInNamedList", getListTypeName(_iListType)); + return sciErr; + } + + *_piAddress = piAddr; + return sciErr; +} + +SciErr createListInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress) +{ + return createCommonListInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, sci_list, _iNbItem, _piAddress, 0); +} + +SciErr createTListInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress) +{ + return createCommonListInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, sci_tlist, _iNbItem, _piAddress, 0); +} + +SciErr createMListInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress) +{ + return createCommonListInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, sci_mlist, _iNbItem, _piAddress, 0); +} + +static SciErr createCommonListInList(void* _pvCtx, int _iVar, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iListType, int _iNbItem, int** _piAddress, int iNamed) +{ + int iNewPos = Top - Rhs + _iVar; + int iNbItem = 0; + int* piChildAddr = NULL; + int* piParent = NULL; + + if (iNamed) + { + piParent = getLastNamedListAddress(_pstName, _iItemPos); + } + else + { + piParent = getLastListAddress(_iVar, _iItemPos); + } + + //Does item can be added in the list + SciErr sciErr = getListItemNumber(_pvCtx, piParent, &iNbItem); + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_LIST_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillCommonList(_pvCtx, piChildAddr, _iListType, _iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_LIST_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1); + return sciErr; + } + + *_piAddress = piChildAddr; + if (iNamed) + { + closeList(_iVar, piChildAddr + 2 + _iNbItem + 1 + !(_iNbItem % 2)); + } + else + { + closeList(iNewPos, piChildAddr + 2 + _iNbItem + 1 + !(_iNbItem % 2)); + } + + if (_iNbItem == 0) + { + //for empty list + int *piOffset = piParent + 2; + int* piEnd = piChildAddr + 4; + + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + 2; + if (iNamed) + { + updateNamedListOffset(_pvCtx, _iVar, _pstName, piParent, _iItemPos, piEnd); + } + else + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + if (_iItemPos == piParent[1]) + { + popListAddress(_iVar); + } + } + } + else + { + //not empty list + if (iNamed == 0) + { + //add new child address in stacklist + pushListAddress(_iVar, *_piAddress); + } + } + + return sciErr; +} + +SciErr createListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress) +{ + return createCommonListInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, sci_list, _iNbItem, _piAddress); +} + +SciErr createTListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress) +{ + return createCommonListInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, sci_tlist, _iNbItem, _piAddress); +} + +SciErr createMListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iNbItem, int** _piAddress) +{ + return createCommonListInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, sci_mlist, _iNbItem, _piAddress); +} + +SciErr createCommonListInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iListType, int _iNbItem, int** _piAddress) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveTop = Top; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonListInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + sciErr = createCommonListInList(_pvCtx, Top, _pstName, piParent, _iItemPos, _iListType, _iNbItem, _piAddress, 1); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_LIST_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createListInList", _iItemPos + 1, _pstName); + return sciErr; + } + + if (_iNbItem == 0 && _iItemPos == piParent[1]) + { + popNamedListAddress(_pstName); + } + + if (_iNbItem != 0) + { + //add new child address in stacklist + pushNamedListAddress(_pstName, *_piAddress); + } + + Top = iSaveTop; + return sciErr; +} + +SciErr allocCommonItemInList(void* _pvCtx, int* _piParent, int _iItemPos, int** _piChildAddr) +{ + SciErr sciErr = sciErrInit(); + int* piOffset = NULL; + + //Does previous items was already inserted + piOffset = _piParent + 2; + if (piOffset[_iItemPos - 1] == -1) + { + //Previous items wasn't inserted + addErrorMessage(&sciErr, API_ERROR_NON_ORDERED_INSERTION, _("%s: Items must be inserted in order"), "allocItemInList"); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, _piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "allocItemInList", _iItemPos + 1); + return sciErr; + } + + return sciErr; +} + +/****************************** +* Void and defined functions * +******************************/ +SciErr createVoidInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iNbItem = 0; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piOffset = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createVoidInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + //Does item can be added in the list + sciErr = getListItemNumber(_pvCtx, piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_VOID_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "createVoidInNamedList", _iItemPos + 1, getRhsFromAddress(_pvCtx, piParent)); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createVoidInNamedList", _iItemPos + 1); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_DOUBLE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "createVoidInNamedList", _iItemPos + 1, getRhsFromAddress(_pvCtx, piParent)); + return sciErr; + } + + //set type, rows, cols complex at 0 + piChildAddr[0] = 0; + piChildAddr[1] = 0; + piChildAddr[2] = 0; + piChildAddr[3] = 0; + + piOffset = piParent + 2; + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + 2; + + piEnd = piChildAddr + 4; + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr createUndefinedInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iNbItem = 0; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piOffset = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createUndefinedInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + //Does item can be added in the list + sciErr = getListItemNumber(_pvCtx, piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_VOID_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "createVoidInNamedList", _iItemPos + 1, getRhsFromAddress(_pvCtx, piParent)); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createVoidInNamedList", _iItemPos + 1); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_DOUBLE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "createVoidInNamedList", _iItemPos + 1, getRhsFromAddress(_pvCtx, piParent)); + return sciErr; + } + + //undefined size == 0, so put previous offset + piOffset = piParent + 2; + piOffset[_iItemPos] = piOffset[_iItemPos - 1]; + + piEnd = piChildAddr; + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +/********************* +* Double functions * +*********************/ + +SciErr getMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal) +{ + return getCommonMatrixOfDoubleInList(_pvCtx, _piParent, _iItemPos, 0, _piRows, _piCols, _pdblReal, NULL); +} + +SciErr getComplexMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg) +{ + return getCommonMatrixOfDoubleInList(_pvCtx, _piParent, _iItemPos, 1, _piRows, _piCols, _pdblReal, _pdblImg); +} + +static SciErr getCommonMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, double** _pdblReal, double** _pdblImg) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DOUBLE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "getComplexMatrixOfDoubleInList" : "getMatrixOfDoubleInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = getCommonMatrixOfDouble(_pvCtx, piAddr, '$', _iComplex, _piRows, _piCols, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_DOUBLE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "getComplexMatrixOfDoubleInList" : "getMatrixOfDoubleInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + return sciErr; +} + +SciErr allocMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, double** _pdblReal) +{ + return allocCommonMatrixOfDoubleInList(_pvCtx, _iVar, _piParent, _iItemPos, 0, _iRows, _iCols, _pdblReal, NULL); +} + +SciErr allocComplexMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg) +{ + return allocCommonMatrixOfDoubleInList(_pvCtx, _iVar, _piParent, _iItemPos, 1, _iRows, _iCols, _pdblReal, _pdblImg); +} + +static SciErr allocCommonMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, int _iComplex, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg) +{ + int iNewPos = Top - Rhs + _iVar; + int* piEnd = NULL; + int* piParent = getLastListAddress(_iVar, _iItemPos); + + SciErr sciErr = fillCommonMatrixOfDoubleInList(_pvCtx, _iVar, piParent, _iItemPos, _iComplex, _iRows, _iCols, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_DOUBLE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "allocComplexMatrixOfDoubleInList" : "allocMatrixOfDoubleInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, piParent)); + return sciErr; + } + + piEnd = (int*) (*_pdblReal + _iRows * _iCols * (_iComplex + 1)); + closeList(iNewPos, piEnd); + + if (_iItemPos == piParent[1]) + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + popListAddress(_iVar); + } + + return sciErr; +} + +static SciErr fillCommonMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iComplex, int _iRows, int _iCols, double** _pdblReal, double** _pdblImg) +{ + int iNbItem = 0; + int* piOffset = NULL; + int* piChildAddr = NULL; + + //Does item can be added in the list + SciErr sciErr = getListItemNumber(_pvCtx, _piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_DOUBLE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "allocComplexMatrixOfDoubleInList" : "allocMatrixOfDoubleInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexMatrixOfDoubleInList" : "createMatrixOfDoubleInList", _iItemPos + 1); + return sciErr; + } + + + sciErr = allocCommonItemInList(_pvCtx, _piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_DOUBLE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "allocComplexMatrixOfDoubleInList" : "allocMatrixOfDoubleInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = fillCommonMatrixOfDouble(_pvCtx, piChildAddr, _iComplex, _iRows, _iCols, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_DOUBLE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "allocComplexMatrixOfDoubleInList" : "allocMatrixOfDoubleInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + piOffset = _piParent + 2; + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + _iRows * _iCols * (_iComplex + 1) + 2; + + return sciErr; +} + +SciErr createMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal) +{ + return createCommonMatrixOfDoubleInList(_pvCtx, _iVar, _piParent, _iItemPos, 0, _iRows, _iCols, _pdblReal, NULL); +} + +SciErr createComplexMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg) +{ + return createCommonMatrixOfDoubleInList(_pvCtx, _iVar, _piParent, _iItemPos, 1, _iRows, _iCols, _pdblReal, _pdblImg); +} + +SciErr createComplexZMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const doublecomplex* _pdblData) +{ + double *pdblReal = NULL; + double *pdblImg = NULL; + + SciErr sciErr = allocCommonMatrixOfDoubleInList(_pvCtx, _iVar, _piParent, _iItemPos, 1, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_DOUBLE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createComplexZMatrixOfDoubleInList", _iItemPos + 1); + return sciErr; + } + + vGetPointerFromDoubleComplex(_pdblData, _iRows * _iCols, pdblReal, pdblImg); + + return sciErr; +} + +SciErr createCommonMatrixOfDoubleInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, int _iComplex, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg) +{ + double *pdblReal = NULL; + double *pdblImg = NULL; + + SciErr sciErr = allocCommonMatrixOfDoubleInList(_pvCtx, _iVar, NULL/*_piParent*/, _iItemPos, _iComplex, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_DOUBLE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexMatrixOfDoubleInList" : "createMatrixOfDoubleInList", _iItemPos + 1); + return sciErr; + } + + if (_pdblReal != NULL) + { + memcpy(pdblReal, _pdblReal, _iRows * _iCols * sizeof(double)); + } + + if (_iComplex && _pdblImg != NULL) + { + memcpy(pdblImg, _pdblImg, _iRows * _iCols * sizeof(double)); + } + return sciErr; +} + +SciErr createMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal) +{ + return createCommomMatrixOfDoubleInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 0, _iRows, _iCols, _pdblReal, NULL); +} + +SciErr createComplexMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg) +{ + return createCommomMatrixOfDoubleInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 1, _iRows, _iCols, _pdblReal, _pdblImg); +} + +SciErr createComplexZMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, const doublecomplex* _pdblData) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + double *pdblReal = NULL; + double *pdblImg = NULL; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createComplexZMatrixOfDoubleInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = fillCommonMatrixOfDoubleInList(_pvCtx, Top, piParent, _iItemPos, 1, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_ZDOUBLE_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createComplexZMatrixOfDoubleInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + vGetPointerFromDoubleComplex(_pdblData, _iRows * _iCols, pdblReal, pdblImg); + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_ZDOUBLE_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createComplexZMatrixOfDoubleInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + piEnd = piChildAddr + 4 + (_iRows * _iCols * 4);//4 -> 2*2 real + img * double + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr createCommomMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iComplex, int _iRows, int _iCols, const double* _pdblReal, const double* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + double *pdblReal = NULL; + double *pdblImg = NULL; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommomMatrixOfDoubleInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = fillCommonMatrixOfDoubleInList(_pvCtx, Top, piParent, _iItemPos, _iComplex, _iRows, _iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_DOUBLE_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), _iComplex ? "createComplexMatrixOfDoubleInNamedList" : "createMatrixOfDoubleInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + memcpy(pdblReal, _pdblReal, sizeof(double) * _iRows * _iCols); + if (_iComplex) + { + memcpy(pdblImg, _pdblImg, sizeof(double) * _iRows * _iCols); + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_DOUBLE_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), _iComplex ? "createComplexMatrixOfDoubleInNamedList" : "createMatrixOfDoubleInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + piEnd = piChildAddr + 4 + (_iRows * _iCols * 2 * (_iComplex + 1)); + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr readMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double* _pdblReal) +{ + return readCommonMatrixOfDoubleInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 0, _piRows, _piCols, _pdblReal, NULL); +} + +SciErr readComplexMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg) +{ + return readCommonMatrixOfDoubleInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 1, _piRows, _piCols, _pdblReal, _pdblImg); +} + +static SciErr readCommonMatrixOfDoubleInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, double* _pdblReal, double* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iNbItem = 0; + int* piAddr = NULL; + int* piRoot = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (_piParent == NULL) + { + sciErr = readNamedList(_pvCtx, _pstName, &iNbItem, &piRoot); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_DOUBLE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexMatrixOfDoubleInNamedList" : "readMatrixOfDoubleInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piRoot, _iItemPos, &piAddr); + } + else + { + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_DOUBLE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexMatrixOfDoubleInNamedList" : "readMatrixOfDoubleInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getCommonMatrixOfDouble(_pvCtx, piAddr, '$', _iComplex, _piRows, _piCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_DOUBLE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexMatrixOfDoubleInNamedList" : "readMatrixOfDoubleInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + if (_pdblReal == NULL || (_iComplex && _pdblImg == NULL)) + { + return sciErr; + } + + memcpy(_pdblReal, pdblReal, sizeof(double) **_piRows **_piCols); + if (_iComplex) + { + memcpy(_pdblImg, pdblImg, sizeof(double) **_piRows **_piCols); + } + return sciErr; +} + + +/********************* +* Strings functions * +*********************/ + +SciErr getMatrixOfStringInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_STRING_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getMatrixOfStringInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = getMatrixOfString(_pvCtx, piAddr, _piRows, _piCols, _piLength, _pstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_STRING_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getMatrixOfStringInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + return sciErr; +} + + +SciErr createMatrixOfStringInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings) +{ + int iNbItem = 0; + int iTotalLen = 0; + int iNewPos = Top - Rhs + _iVar; + + int* piItemAddr = NULL; + int* piEnd = NULL; + int* piParent = getLastListAddress(_iVar, _iItemPos); + + SciErr sciErr = getListItemNumber(_pvCtx, piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_STRING_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfStringInList", _iItemPos + 1); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfStringInList", _iItemPos + 1); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piParent, _iItemPos, &piItemAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_STRING_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfStringInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillCommonMatrixOfStringInList(_pvCtx, _iVar, piParent, _iItemPos, _iRows, _iCols, _pstStrings, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_STRING_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfStringInList", _iItemPos + 1); + return sciErr; + } + + piEnd = piItemAddr + iTotalLen + 5 + _iRows * _iCols + !((iTotalLen + _iRows * _iCols) % 2); + closeList(iNewPos, piEnd); + + if (_iItemPos == iNbItem) + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + popListAddress(_iVar); + } + + return sciErr; +} + +SciErr fillCommonMatrixOfStringInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings, int* _piTotalLen) +{ + SciErr sciErr = sciErrInit(); + int iNbItem = 0; + int* piAddr = NULL; + int* piOffset = NULL; + + //Does item can be added in the list + getListItemNumber(_pvCtx, _piParent, &iNbItem); + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfStringInList", _iItemPos + 1); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_STRING_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "fillMatrixOfStringInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillMatrixOfString(_pvCtx, piAddr, _iRows, _iCols, _pstStrings, _piTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_STRING_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "fillMatrixOfStringInList", _iItemPos + 1); + return sciErr; + } + + piOffset = _piParent + 2; + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + (*_piTotalLen + 5 + _iRows * _iCols + !((*_piTotalLen + _iRows * _iCols) % 2)) / 2; + + return sciErr; +} + +SciErr createMatrixOfStringInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iTotalLen = 0; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int* piItemAddr = NULL; + int* piEnd = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createMatrixOfStringInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + sciErr = getListItemAddress(_pvCtx, piParent, _iItemPos, &piItemAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_STRING_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createMatrixOfStringInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = fillCommonMatrixOfStringInList(_pvCtx, Top, piParent, _iItemPos, _iRows, _iCols, _pstStrings, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_STRING_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createMatrixOfStringInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + piEnd = piItemAddr + iTotalLen + 5 + _iRows * _iCols + !((iTotalLen + _iRows * _iCols) % 2); + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + + return sciErr; +} + +SciErr readMatrixOfStringInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings) +{ + SciErr sciErr = sciErrInit(); + int* piAddr = NULL; + int* piRoot = NULL; + int iNbItem = 0; + + if (_piParent == NULL) + { + sciErr = readNamedList(_pvCtx, _pstName, &iNbItem, &piRoot); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_STRING_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfStringInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piRoot, _iItemPos, &piAddr); + } + else + { + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_STRING_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfStringInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getMatrixOfString(_pvCtx, piAddr, _piRows, _piCols, _piLength, _pstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_STRING_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfStringInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + return sciErr; +} + +/********************* +* boolean functions * +*********************/ + +SciErr getMatrixOfBooleanInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int** _piBool) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_BOOLEAN_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getMatrixOfBooleanInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = getMatrixOfBoolean(_pvCtx, piAddr, _piRows, _piCols, _piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_BOOLEAN_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getMatrixOfBooleanInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + return sciErr; +} + +SciErr createMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, const int* _piBool) +{ + int *piBool = NULL; + + SciErr sciErr = allocMatrixOfBooleanInList(_pvCtx, _iVar, NULL/*_piParent*/, _iItemPos, _iRows, _iCols, &piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBooleanInList", _iItemPos + 1); + return sciErr; + } + + if (_piBool != NULL) + { + memcpy(piBool, _piBool, _iRows * _iCols * sizeof(int)); + } + return sciErr; +} + +SciErr allocMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, int** _piBool) +{ + int iNewPos = Top - Rhs + _iVar; + int* piEnd = NULL; + int* piParent = getLastListAddress(_iVar, _iItemPos); + + SciErr sciErr = fillMatrixOfBoolInList(_pvCtx, _iVar, piParent, _iItemPos, _iRows, _iCols, _piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "allocMatrixOfBooleanInList", _iItemPos + 1); + return sciErr; + } + + piEnd = *_piBool + _iRows * _iCols + !((_iRows * _iCols) % 2); + closeList(iNewPos, piEnd); + + if (_iItemPos == piParent[1]) + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + popListAddress(_iVar); + } + return sciErr; +} + +static SciErr fillMatrixOfBoolInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piBool) +{ + int iNbItem = 0; + int* piOffset = NULL; + int* piChildAddr = NULL; + + //Does item can be added in the list + SciErr sciErr = getListItemNumber(_pvCtx, _piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBoolInList", _iItemPos + 1); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBooleanInList", _iItemPos + 1); + return sciErr; + } + + + sciErr = allocCommonItemInList(_pvCtx, _piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBoolInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillMatrixOfBoolean(_pvCtx, piChildAddr, _iRows, _iCols, _piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBoolInList", _iItemPos + 1); + return sciErr; + } + + piOffset = _piParent + 2; + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + ((3 + _iRows * _iCols + !((_iRows * _iCols) % 2)) / 2); + + return sciErr; +} + +SciErr createMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, const int* _piBool) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + int* piBool = NULL; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createMatrixOfBooleanInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = fillMatrixOfBoolInList(_pvCtx, Top, piParent, _iItemPos, _iRows, _iCols, &piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createMatrixOfBooleanInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + memcpy(piBool, _piBool, sizeof(int) * _iRows * _iCols); + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createMatrixOfBooleanInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + piEnd = piChildAddr + 4 + (_iRows * _iCols) + ((_iRows * _iCols) % 2); + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr readMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piBool) +{ + SciErr sciErr = sciErrInit(); + int* piAddr = NULL; + int* piRoot = NULL; + int iNbItem = 0; + int* piBool = NULL; + + + if (_piParent == NULL) + { + sciErr = readNamedList(_pvCtx, _pstName, &iNbItem, &piRoot); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_BOOLEAN_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfBooleanInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piRoot, _iItemPos, &piAddr); + } + else + { + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_BOOLEAN_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfBooleanInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getMatrixOfBoolean(_pvCtx, piAddr, _piRows, _piCols, &piBool); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_BOOLEAN_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfBooleanInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + if (_piBool == NULL) + { + return sciErr; + } + + memcpy(_piBool, piBool, *_piRows **_piCols * sizeof(int)); + return sciErr; +} + + +/************************* +* polynomials functions * +*************************/ + +SciErr getMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal) +{ + return getCommonMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, 0, _piRows, _piCols, _piNbCoef, _pdblReal, NULL); +} + +SciErr getComplexMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + return getCommonMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, 1, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr getCommonMatrixOfPolyInList(void* _pvCtx, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_POLY_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "getComplexMatrixOfPolyInList" : "getMatrixOfPolyInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = getCommonMatrixOfPoly(_pvCtx, piAddr, _iComplex, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_POLY_IN_LIST, _("API_ERROR_GET_POLY_IN_LIST")); + return sciErr; + } + + return sciErr; +} + +SciErr createMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal) +{ + return createCommonMatrixOfPolyInList(_pvCtx, _iVar, _piParent, _iItemPos, _pstVarName, 0, _iRows, _iCols, _piNbCoef, _pdblReal, NULL); +} + +SciErr createComplexMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + return createCommonMatrixOfPolyInList(_pvCtx, _iVar, _piParent, _iItemPos, _pstVarName, 1, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr createCommonMatrixOfPolyInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + int* piItemAddr = NULL; + int *piEnd = NULL; + int iItemLen = 0; + int iTotalLen = 0; + int* piParent = getLastListAddress(_iVar, _iItemPos); + + SciErr sciErr = getListItemAddress(_pvCtx, piParent, _iItemPos, &piItemAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POLY_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexMatrixOfPolyInList" : "createMatrixOfPolyInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillCommonMatrixOfPolyInList(_pvCtx, _iVar, piParent, _iItemPos, _pstVarName, _iComplex, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POLY_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexMatrixOfPolyInList" : "createMatrixOfPolyInList", _iItemPos + 1); + return sciErr; + } + + iItemLen = 9 + _iRows * _iCols + (9 + _iRows * _iCols) % 2; + iItemLen += iTotalLen; + piEnd = piItemAddr + iItemLen; + if (_iItemPos == piParent[1]) + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + popListAddress(_iVar); + } + + closeList(_iVar, piEnd); + + return sciErr; +} + +static SciErr fillCommonMatrixOfPolyInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg, int* _piTotalLen) +{ + int iNbItem = 0; + int iTotalLen = 0; + int* piOffset = NULL; + int* piChildAddr = NULL; + int iItemLen = 0; + + //Does item can be added in the list + SciErr sciErr = getListItemNumber(_pvCtx, _piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_POLY_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexMatrixOfPolyInList" : "createMatrixOfPolyInList", _iItemPos + 1); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexMatrixOfPolyInList" : "createMatrixOfPolyInList", _iItemPos + 1); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, _piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_POLY_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexMatrixOfPolyInList" : "createMatrixOfPolyInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillCommonMatrixOfPoly(_pvCtx, piChildAddr, _pstVarName, _iComplex, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_POLY_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexMatrixOfPolyInList" : "createMatrixOfPolyInList", _iItemPos + 1); + return sciErr; + } + + piOffset = _piParent + 2; + + iItemLen = 9 + _iRows * _iCols + (9 + _iRows * _iCols) % 2; + iItemLen += iTotalLen; + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + ((iItemLen + 1) / 2); + + *_piTotalLen = iTotalLen; + return sciErr; +} + + +SciErr createMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal) +{ + return createCommonMatrixOfPolyInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, _pstVarName, 0, _iRows, _iCols, _piNbCoef, _pdblReal, NULL); +} + +SciErr createComplexMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + return createCommonMatrixOfPolyInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, _pstVarName, 1, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr createCommonMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + int* piEnd = NULL; + int* piChildAddr = NULL; + int iTotalLen = 0; + int iItemLen = 0; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonMatrixOfPolyInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = fillCommonMatrixOfPolyInList(_pvCtx, Top, piParent, _iItemPos, _pstVarName, _iComplex, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POLY_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), _iComplex ? "createComplexMatrixOfPolyInNamedList" : "createMatrixOfPolyInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + iItemLen = 9 + _iRows * _iCols + (9 + _iRows * _iCols) % 2; + iItemLen += iTotalLen; + + sciErr = getListItemAddress(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POLY_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), _iComplex ? "createComplexMatrixOfPolyInNamedList" : "createMatrixOfPolyInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + piEnd = piChildAddr + iItemLen; + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr readMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal) +{ + return readCommonMatrixOfPolyInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 0, _piRows, _piCols, _piNbCoef, _pdblReal, NULL); +} + +SciErr readComplexMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + return readCommonMatrixOfPolyInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 1, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr readCommonMatrixOfPolyInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int* piAddr = NULL; + int* piRoot = NULL; + int iNbItem = 0; + + if (_piParent == NULL) + { + sciErr = readNamedList(_pvCtx, _pstName, &iNbItem, &piRoot); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_POLY_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexMatrixOfPolyInNamedList" : "readMatrixOfPolyInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piRoot, _iItemPos, &piAddr); + } + else + { + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_POLY_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexMatrixOfPolyInNamedList" : "readMatrixOfPolyInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getCommonMatrixOfPoly(_pvCtx, piAddr, _iComplex, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_POLY_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexMatrixOfPolyInNamedList" : "readMatrixOfPolyInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + return sciErr; +} + +/********************** +* integers functions * +**********************/ + +static SciErr fillCommonMatrixOfIntegerInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iPrecision, int _iRows, int _iCols, void** _pvData) +{ + int iNbItem = 0; + int* piOffset = NULL; + int* piChildAddr = NULL; + + //Does item can be added in the list + SciErr sciErr = getListItemNumber(_pvCtx, _piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_INT_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfIntegerInList", _iItemPos + 1); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfIntegerInList", _iItemPos + 1); + return sciErr; + } + + + sciErr = allocCommonItemInList(_pvCtx, _piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_INT_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfIntegerInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillCommonMatrixOfInteger(_pvCtx, piChildAddr, _iPrecision, _iRows, _iCols, _pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_INT_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfIntegerInList", _iItemPos + 1); + return sciErr; + } + + piOffset = _piParent + 2; + + //integer : size in double + //1st case, 5 * 1 int8 -> (10,5) (1,1) (1,2,3,4,5,x,x,x) -> 3 : 2 + 5/8 + !!(5%8) -> 2 + 0 + 1 -> 3 + //2nd case, 5 * 1 int16 -> (10,5) (1,2) (1,2,3,4) (5,x,x,x) -> 4 : 2 + 5/4 + !!(5%4) -> 2 + 1 + 1 -> 4 + //3th case, 5 * 1 int32 -> (10,5) (1,3) (1,2) (3,4) (5,x) -> 5 : 2 + 5/2 + !!(5%2) -> 2 + 2 + 1 -> 5 + + //with 5*5 int matrix + //1st case, 5 * 5 int8 -> (10,5) (5,1) (1:25) -> 3 : 2 + 25/8 + !!(25%8) -> 2 + 3 + 1 -> 6 + //2nd case, 5 * 1 int16 -> (10,5) (5,2) (1:25) -> 4 : 2 + 25/4 + !!(25%4) -> 2 + 6 + 1 -> 9 + //3th case, 5 * 5 int32 -> (10,5) (5,3) (1:25) -> 5 : 2 + 25/2 + !!(25%2) -> 2 + 12 + 1 -> 15 + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + 2 + _iRows * _iCols / (sizeof(double) / (_iPrecision % 10 )) + (int)(!!(_iRows * _iCols)) % (sizeof(double) / (_iPrecision % 10 )); + + return sciErr; +} + +static SciErr allocCommonMatrixOfIntegerInList(void* _pvCtx, int _iVar, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iPrecision, int _iRows, int _iCols, void** _pvData) +{ + int iNewPos = Top - Rhs + _iVar; + int* piEnd = NULL; + int* piParent = NULL; + + if (_pstName) + { + piParent = getLastNamedListAddress(_pstName, _iItemPos); + } + else + { + piParent = getLastListAddress(_iVar, _iItemPos); + } + + SciErr sciErr = fillCommonMatrixOfIntegerInList(_pvCtx, _iVar, piParent, _iItemPos, _iPrecision, _iRows, _iCols, _pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_INT_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "allocMatrixOfIntegerInList", _iItemPos + 1); + return sciErr; + } + + piEnd = (int*) * _pvData + _iRows * _iCols / (sizeof(int) / (_iPrecision % 10)) + (int)(!!(_iRows * _iCols)) % (sizeof(int) / (_iPrecision % 10)); + closeList(iNewPos, piEnd); + + if (_iItemPos == piParent[1]) + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + popListAddress(_iVar); + } + return sciErr; +} + +SciErr allocMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned char** _pucData) +{ + return allocCommonMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_UINT8, _iRows, _iCols, (void **)_pucData); +} + +SciErr allocMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned short** _pusData) +{ + return allocCommonMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_UINT16, _iRows, _iCols, (void**)_pusData); +} + +SciErr allocMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned int** _puiData) +{ + return allocCommonMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_UINT32, _iRows, _iCols, (void**)_puiData); +} + +SciErr allocMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, char** _pcData) +{ + return allocCommonMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_INT8, _iRows, _iCols, (void**)_pcData); +} + +SciErr allocMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, short** _psData) +{ + return allocCommonMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_INT16, _iRows, _iCols, (void**)_psData); +} + +SciErr allocMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piData) +{ + return allocCommonMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_INT32, _iRows, _iCols, (void**)_piData); +} + +static SciErr createCommomMatrixOfIntegerInList(void* _pvCtx, int _iVar, const char* _pstName, int* _piParent, int _iItemPos, int _iPrecision, int _iRows, int _iCols, const void* _pvData) +{ + void *pvData = NULL; + + SciErr sciErr = allocCommonMatrixOfIntegerInList(_pvCtx, _iVar, _pstName, _piParent, _iItemPos, _iPrecision, _iRows, _iCols, &pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfIntegerInList", _iItemPos + 1); + return sciErr; + } + + if (pvData != NULL) + { + memcpy(pvData, _pvData, _iRows * _iCols * (_iPrecision % 10)); + } + return sciErr; +} + +SciErr createMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData) +{ + return createCommomMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_UINT8, _iRows, _iCols, _pucData); +} + +SciErr createMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData) +{ + return createCommomMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_UINT16, _iRows, _iCols, _pusData); +} + +SciErr createMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData) +{ + return createCommomMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_UINT32, _iRows, _iCols, _puiData); +} + +SciErr createMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData) +{ + return createCommomMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_INT8, _iRows, _iCols, _pcData); +} + +SciErr createMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData) +{ + return createCommomMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_INT16, _iRows, _iCols, _psData); +} + +SciErr createMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData) +{ + return createCommomMatrixOfIntegerInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, SCI_INT32, _iRows, _iCols, _piData); +} + +static SciErr getCommonMatrixOfIntegerInList(void* _pvCtx, int* _piParent, int _iItemPos, int _iPrecision, int* _piRows, int* _piCols, void** _pvData) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_INT_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getMatrixOfIntegerInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = getCommonMatrixOfInteger(_pvCtx, piAddr, _iPrecision, _piRows, _piCols, _pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_INT_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getMatrixOfIntegerInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + return sciErr; +} + +SciErr getMatrixOfUnsignedInteger8InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned char** _pucData) +{ + return getCommonMatrixOfIntegerInList(_pvCtx, _piParent, _iItemPos, SCI_UINT8, _piRows, _piCols, (void**)_pucData); +} + +SciErr getMatrixOfUnsignedInteger16InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned short** _pusData) +{ + return getCommonMatrixOfIntegerInList(_pvCtx, _piParent, _iItemPos, SCI_UINT16, _piRows, _piCols, (void**)_pusData); +} + +SciErr getMatrixOfUnsignedInteger32InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned int** _puiData) +{ + return getCommonMatrixOfIntegerInList(_pvCtx, _piParent, _iItemPos, SCI_UINT32, _piRows, _piCols, (void**)_puiData); +} + +SciErr getMatrixOfInteger8InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, char** _pcData) +{ + return getCommonMatrixOfIntegerInList(_pvCtx, _piParent, _iItemPos, SCI_INT8, _piRows, _piCols, (void**)_pcData); +} + +SciErr getMatrixOfInteger16InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, short** _psData) +{ + return getCommonMatrixOfIntegerInList(_pvCtx, _piParent, _iItemPos, SCI_INT16, _piRows, _piCols, (void**)_psData); +} + +SciErr getMatrixOfInteger32InList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int** _piData) +{ + return getCommonMatrixOfIntegerInList(_pvCtx, _piParent, _iItemPos, SCI_INT32, _piRows, _piCols, (void**)_piData); +} + +static SciErr createCommonMatrixOfIntegerInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iPrecision, int _iRows, int _iCols, const void* _pvData) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonMatrixOfIntegerInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = createCommomMatrixOfIntegerInList(_pvCtx, Top, _pstName, piParent, _iItemPos, _iPrecision, _iRows, _iCols, _pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createMatrixOfIntegerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_INT_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createMatrixOfIntegerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + //integer : size in int32 + //1st case, 5 * 1 int8 -> 10 5 1 1 (1,2,3,4) (5,x,x,x) -> 6 : 4 + 5/4 + !!(5%4) -> 4 + 1 + 1 -> 6 + //2nd case, 5 * 1 int16 -> 10 5 1 2 (1,2) (3,4) (5,x) -> 7 : 4 + 5/2 + !!(5%2) -> 4 + 2 + 1 -> 7 + //3th case, 5 * 1 int32 -> 10 5 1 4 1 2 3 4 5 -> 9 : 4 + 5/1 + !!(5%1) -> 4 + 5 + 0 -> 9 + piEnd = piChildAddr + 4 + _iRows * _iCols / (sizeof(int) / (_iPrecision % 10)) + (int)(!!(_iRows * _iCols)) % ((sizeof(int) / (_iPrecision % 10))); + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr createMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData) +{ + return createCommonMatrixOfIntegerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_UINT8, _iRows, _iCols, _pucData); +} + +SciErr createMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData) +{ + return createCommonMatrixOfIntegerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_UINT16, _iRows, _iCols, _pusData); +} + +SciErr createMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData) +{ + return createCommonMatrixOfIntegerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_UINT32, _iRows, _iCols, _puiData); +} + +SciErr createMatrixOfInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData) +{ + return createCommonMatrixOfIntegerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_INT8, _iRows, _iCols, _pcData); +} + +SciErr createMatrixOfInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData) +{ + return createCommonMatrixOfIntegerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_INT16, _iRows, _iCols, _psData); +} + +SciErr createMatrixOfInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData) +{ + return createCommonMatrixOfIntegerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_INT32, _iRows, _iCols, _piData); +} + +static SciErr readCommonMatrixOfIntgerInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iPrecision, int* _piRows, int* _piCols, void* _pvData) +{ + SciErr sciErr = sciErrInit(); + int iNbItem = 0; + int* piAddr = NULL; + int* piRoot = NULL; + void* pvData = NULL; + + if (_piParent == NULL) + { + sciErr = readNamedList(_pvCtx, _pstName, &iNbItem, &piRoot); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_INT_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfIntgerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piRoot, _iItemPos, &piAddr); + } + else + { + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_INT_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfIntgerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getCommonMatrixOfInteger(_pvCtx, piAddr, _iPrecision, _piRows, _piCols, &pvData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_INT_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readMatrixOfIntgerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + if (_pvData == NULL) + { + return sciErr; + } + + memcpy(_pvData, pvData, (_iPrecision % 10 ) **_piRows **_piCols); + return sciErr; +} + +SciErr readMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned char* _pucData) +{ + return readCommonMatrixOfIntgerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_UINT8, _piRows, _piCols, _pucData); +} + +SciErr readMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned short* _pusData) +{ + return readCommonMatrixOfIntgerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_UINT16, _piRows, _piCols, _pusData); +} + +SciErr readMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, unsigned int* _puiData) +{ + return readCommonMatrixOfIntgerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_UINT32, _piRows, _piCols, _puiData); +} + +SciErr readMatrixOfIntger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, char* _pcData) +{ + return readCommonMatrixOfIntgerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_INT8, _piRows, _piCols, _pcData); +} + +SciErr readMatrixOfIntger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, short* _psData) +{ + return readCommonMatrixOfIntgerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_INT16, _piRows, _piCols, _psData); +} + +SciErr readMatrixOfIntger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piData) +{ + return readCommonMatrixOfIntgerInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, SCI_INT32, _piRows, _piCols, _piData); +} + +/********************* +* sparses functions * +*********************/ + +static SciErr fillCommonSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg, int* _piTotalSize) +{ + int iNbItem = 0; + int iTotalLen = 0; + int* piOffset = NULL; + int* piNbItemRow = NULL; + int* piColPos = NULL; + int* piChildAddr = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + int iItemLen = 0; + + //Does item can be added in the list + SciErr sciErr = getListItemNumber(_pvCtx, _piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexSparseMatrixInList" : "createComplexSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexSparseMatrixInList" : "createSparseMatrixInNamedList", _iItemPos + 1); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, _piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexSparseMatrixInList" : "createComplexSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillCommonSparseMatrix(_pvCtx, piChildAddr, _iComplex, _iRows, _iCols, _iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexSparseMatrixInList" : "createComplexSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + piOffset = _piParent + 2; + + iItemLen = 5 + _iRows + _iNbItem + !((_iRows + _iNbItem) % 2); + iItemLen += iTotalLen * 2; + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + ((iItemLen + 1) / 2); + + memcpy(piNbItemRow, _piNbItemRow, _iRows * sizeof(int)); + memcpy(piColPos, _piColPos, _iNbItem * sizeof(int)); + + memcpy(pdblReal, _pdblReal, _iNbItem * sizeof(double)); + if (_iComplex) + { + memcpy(pdblImg, _pdblImg, _iNbItem * sizeof(double)); + } + + *_piTotalSize = iTotalLen; + return sciErr; +} + +static SciErr createCommonSparseMatrixInList(void* _pvCtx, int _iVar, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg) +{ + int* piAddr = NULL; + int *piEnd = NULL; + int iItemLen = 0; + int iTotalLen = 0; + int* piParent = NULL; + + if (_pstName) + { + piParent = getLastNamedListAddress(_pstName, _iItemPos); + } + else + { + piParent = getLastListAddress(_iVar, _iItemPos); + } + + SciErr sciErr = getListItemAddress(_pvCtx, piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexSparseMatrixInList" : "createComplexSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillCommonSparseMatrixInList(_pvCtx, _iVar, piParent, _iItemPos, _iComplex, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexSparseMatrixInList" : "createComplexSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + iItemLen = 5 + _iRows + _iNbItem + !((_iRows + _iNbItem) % 2); + iItemLen += iTotalLen * 2; + piEnd = piAddr + iItemLen; + if (_iItemPos == piParent[1]) + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + popListAddress(_iVar); + } + + closeList(_iVar, piEnd); + + return sciErr; +} + +SciErr createSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal) +{ + return createCommonSparseMatrixInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, 0, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr createComplexSparseMatrixInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg) +{ + return createCommonSparseMatrixInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, 1, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + +SciErr createCommonSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int iItemLen = 0; + int *piAddr = NULL; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonSparseMatrixInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = createCommonSparseMatrixInList(_pvCtx, Top, _pstName, piParent, _iItemPos, _iComplex, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SPARSE_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), _iComplex ? "createComplexSparseMatrixInNamedList" : "createSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SPARSE_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), _iComplex ? "createComplexSparseMatrixInNamedList" : "createSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + iItemLen = 5 + _iRows + _iNbItem + !((_iRows + _iNbItem) % 2); + iItemLen += _iNbItem * (_iComplex + 1) * 2; + piEnd = piChildAddr + iItemLen; + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr createSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal) +{ + return createCommonSparseMatrixInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 0, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr createComplexSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg) +{ + return createCommonSparseMatrixInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 1, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + +static SciErr getCommonSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_SPARSE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "getComplexSparseMatrixInList" : "getSparseMatrixInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = getCommonSparseMatrix(_pvCtx, piAddr, _iComplex, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_SPARSE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), _iComplex ? "getComplexSparseMatrixInList" : "getSparseMatrixInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + return sciErr; +} + +SciErr getSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal) +{ + return getCommonSparseMatrixInList(_pvCtx, _piParent, _iItemPos, 0, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr getComplexSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + return getCommonSparseMatrixInList(_pvCtx, _piParent, _iItemPos, 1, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + +static SciErr readCommonSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iNbItem = 0; + int* piAddr = NULL; + int* piRoot = NULL; + int* piNbItemRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (_piParent == NULL) + { + sciErr = readNamedList(_pvCtx, _pstName, &iNbItem, &piRoot); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_SPARSE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexSparseMatrixInNamedList" : "readSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piRoot, _iItemPos, &piAddr); + } + else + { + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_SPARSE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexSparseMatrixInNamedList" : "readSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getCommonSparseMatrix(_pvCtx, piAddr, _iComplex, _piRows, _piCols, _piNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_SPARSE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), _iComplex ? "readComplexSparseMatrixInNamedList" : "readSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + if (_piNbItemRow == NULL) + { + return sciErr; + } + memcpy(_piNbItemRow, piNbItemRow, *_piRows * sizeof(int)); + + if (_piColPos == NULL) + { + return sciErr; + } + memcpy(_piColPos, piColPos, *_piNbItem * sizeof(int)); + + if (_pdblReal == NULL || (_iComplex && _pdblImg == NULL)) + { + return sciErr; + } + + memcpy(_pdblReal, pdblReal, sizeof(double) **_piNbItem); + if (_iComplex) + { + memcpy(_pdblImg, pdblImg, sizeof(double) **_piNbItem); + } + + return sciErr; +} + +SciErr readSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal) +{ + return readCommonSparseMatrixInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 0, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr readComplexSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg) +{ + return readCommonSparseMatrixInNamedList(_pvCtx, _pstName, _piParent, _iItemPos, 1, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + + +/***************************** +* boolean sparses functions * +*****************************/ +static SciErr fillBooleanSparseMatrixInList(void* _pvCtx, int _iVar, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos) +{ + int iNbItem = 0; + int* piOffset = NULL; + int* piNbItemRow = NULL; + int* piColPos = NULL; + int* piChildAddr = NULL; + int iItemLen = 0; + + int* piParent = NULL; + + if (_pstName) + { + piParent = getLastNamedListAddress(_pstName, _iItemPos); + } + else + { + piParent = getLastListAddress(_iVar, _iItemPos); + } + + //Does item can be added in the list + SciErr sciErr = getListItemNumber(_pvCtx, piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createBooleanSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createBooleanSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createBooleanSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillBooleanSparseMatrix(_pvCtx, piChildAddr, _iRows, _iCols, _iNbItem, &piNbItemRow, &piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createBooleanSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + piOffset = piParent + 2; + + iItemLen = 5 + _iRows + _iNbItem + !((_iRows + _iNbItem) % 2); + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + ((iItemLen + 1) / 2); + + memcpy(piNbItemRow, _piNbItemRow, _iRows * sizeof(int)); + memcpy(piColPos, _piColPos, _iNbItem * sizeof(int)); + + return sciErr; +} + +SciErr createBooleanSparseMatrixInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos) +{ + int* piAddr = NULL; + int *piEnd = NULL; + int iItemLen = 0; + int* piParent = getLastListAddress(_iVar, _iItemPos); + + SciErr sciErr = getListItemAddress(_pvCtx, piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createBooleanSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillBooleanSparseMatrixInList(_pvCtx, _iVar, NULL, piParent, _iItemPos, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createBooleanSparseMatrixInList", _iItemPos + 1); + return sciErr; + } + + iItemLen = 5 + _iRows + _iNbItem + !((_iRows + _iNbItem) % 2); + piEnd = piAddr + iItemLen; + if (_iItemPos == piParent[1]) + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + popListAddress(_iVar); + } + + closeList(_iVar, piEnd); + + return sciErr; +} + +SciErr createBooleanSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int iItemLen = 0; + int *piAddr = NULL; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createBooleanSparseMatrixInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = fillBooleanSparseMatrixInList(_pvCtx, Top, _pstName, piParent, _iItemPos, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_SPARSE_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createBooleanSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_SPARSE_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createBooleanSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + iItemLen = 5 + _iRows + _iNbItem + !((_iRows + _iNbItem) % 2); + piEnd = piChildAddr + iItemLen; + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr getBooleanSparseMatrixInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_BOOLEAN_SPARSE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getBooleanSparseMatrixInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = getBooleanSparseMatrix(_pvCtx, piAddr, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_BOOLEAN_SPARSE_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getBooleanSparseMatrixInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + return sciErr; +} + +SciErr readBooleanSparseMatrixInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos) +{ + SciErr sciErr = sciErrInit(); + int iNbItem = 0; + int* piAddr = NULL; + int* piRoot = NULL; + int* piNbItemRow = NULL; + int* piColPos = NULL; + + if (_piParent == NULL) + { + sciErr = readNamedList(_pvCtx, _pstName, &iNbItem, &piRoot); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_BOOLEAN_SPARSE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readBooleanSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piRoot, _iItemPos, &piAddr); + } + else + { + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_BOOLEAN_SPARSE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readBooleanSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getBooleanSparseMatrix(_pvCtx, piAddr, _piRows, _piCols, _piNbItem, &piNbItemRow, &piColPos); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_BOOLEAN_SPARSE_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readBooleanSparseMatrixInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + if (_piNbItemRow == NULL) + { + return sciErr; + } + memcpy(_piNbItemRow, piNbItemRow, *_piRows * sizeof(int)); + + if (_piColPos == NULL) + { + return sciErr; + } + memcpy(_piColPos, piColPos, *_piNbItem * sizeof(int)); + + return sciErr; +} + +/********************* +* Pointer functions * +*********************/ +SciErr getPointerInList(void* _pvCtx, int* _piParent, int _iItemPos, void** _pvPtr) +{ + int* piAddr = NULL; + + SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_POINTER_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getPointerInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + sciErr = getPointer(_pvCtx, piAddr, _pvPtr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_POINTER_IN_LIST, _("%s: Unable to get address of item #%d in argument #%d"), "getPointerInList", _iItemPos + 1, getRhsFromAddress(_pvCtx, _piParent)); + return sciErr; + } + + return sciErr; +} + +SciErr createPointerInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, void* _pvPtr) +{ + int iNbItem = 0; + int* piOffset = NULL; + int* piChildAddr = NULL; + void* pvPtr = NULL; + int* piEnd = NULL; + int iNewPos = Top - Rhs + _iVar; + int* piParent = getLastListAddress(_iVar, _iItemPos); + + //Does item can be added in the list + SciErr sciErr = getListItemNumber(_pvCtx, piParent, &iNbItem); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POINTER_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1); + return sciErr; + } + + if (iNbItem < _iItemPos) + { + addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createPointerInList", _iItemPos + 1); + return sciErr; + } + + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POINTER_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1); + return sciErr; + } + + sciErr = fillPointer(_pvCtx, piChildAddr, &pvPtr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POINTER_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1); + return sciErr; + } + + ((double*)pvPtr)[0] = (double) ((unsigned long int) _pvPtr); + + piOffset = piParent + 2; + piOffset[_iItemPos] = piOffset[_iItemPos - 1] + 3;//2 for header and 1 for data ( n * 64 bits ) + + piEnd = piChildAddr + 6;//4 for header and 2 for data ( n * 32 bits ) + closeList(iNewPos, piEnd); + + if (_iItemPos == piParent[1]) + { + updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd); + popListAddress(_iVar); + } + return sciErr; +} + +SciErr readPointerInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, void** _pvPtr) +{ + SciErr sciErr = sciErrInit(); + int iNbItem = 0; + int* piAddr = NULL; + int* piRoot = NULL; + + if (_piParent == NULL) + { + sciErr = readNamedList(_pvCtx, _pstName, &iNbItem, &piRoot); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_POINTER_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readPointerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getListItemAddress(_pvCtx, piRoot, _iItemPos, &piAddr); + } + else + { + sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_POINTER_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readPointerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = getPointer(_pvCtx, piAddr, _pvPtr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_POINTER_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "readPointerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + return sciErr; +} + +SciErr createPointerInNamedList(void* _pvCtx, const char* _pstName, int* /*_piParent*/, int _iItemPos, void* _pvPtr) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + int* piEnd = NULL; + int* piChildAddr = NULL; + int* piParent = getLastNamedListAddress(_pstName, _iItemPos); + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createPointerInNamedList", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = createPointerInList(_pvCtx, Top, piParent, _iItemPos, _pvPtr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POINTER_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createPointerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POINTER_IN_NAMED_LIST, _("%s: Unable to create list item #%d in variable \"%s\""), "createPointerInNamedList", _iItemPos + 1, _pstName); + return sciErr; + } + + piEnd = piChildAddr + 6;//4 for header + 2 for data + closeList(Top, piEnd); + + if (_iItemPos == piParent[1]) + { + updateNamedListOffset(_pvCtx, Top, _pstName, piParent, _iItemPos, piEnd); + popNamedListAddress(_pstName); + } + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + + + +/******************** +* tools functions * +********************/ + +static void updateNamedListOffset(void* _pvCtx, int _iVar, const char* _pstName, int *_piCurrentNode, int _iItemPos, int *_piEnd) +{ + updateCommunListOffset(_pvCtx, _iVar, _pstName, _piCurrentNode, _iItemPos, _piEnd); +} + +static void updateListOffset(void* _pvCtx, int _iVar, int *_piCurrentNode, int _iItemPos, int *_piEnd) +{ + int iNewPos = Top - Rhs + _iVar; + updateCommunListOffset(_pvCtx, iNewPos, NULL, _piCurrentNode, _iItemPos, _piEnd); +} + +//internal tool functions +static void updateCommunListOffset(void* _pvCtx, int _iVar, const char* _pstName, int *_piCurrentNode, int _iItemPos, int *_piEnd) +{ + //find list depth and update list offset for last item + int i = 0; + int iMaxDepth = 0; //we are already in a list + int **piParent = NULL; + + if (_pstName == NULL) + { + int iLocalVar = _iVar - Top + Rhs; + iMaxDepth = getDepthList(iLocalVar); + if (iMaxDepth == 0) + { + return; + } + + piParent = (int**)MALLOC(sizeof(int*) * iMaxDepth); + getListAdressses(iLocalVar, piParent); + } + else + { + iMaxDepth = getDepthNamedList(_pstName); + if (iMaxDepth == 0) + { + return; + } + + piParent = (int**)MALLOC(sizeof(int*) * iMaxDepth); + getNamedListAdressses(_pstName, piParent); + } + // } + + for (i = iMaxDepth - 2 ; i >= 0 ; i--) + { + int j = 0; + int iItem = piParent[i][1]; + int *piOffset = piParent[i] + 2; + int *piData = piOffset + iItem + 1 + !(iItem % 2); + + //for all nodes + for (j = iItem - 1 ; j >= 0 ; j--) + { + if (piOffset[j] == -1) + { + continue; + } + + int* piItem = piData + ((piOffset[j] - 1) * 2); + + if (piItem == piParent[i + 1]) + { + int iOffset = 0; + iOffset = piOffset[j] + (int)((_piEnd - piItem + 1) / 2); + piOffset[j + 1] = iOffset; + break; + } + //else + //{ + // break; + // //if this item is not the last of the parent list + // //we don't need to continue to check the uppers levels + //} + } + } + + FREE(piParent); +} + +static void closeList(int _iVar, int *_piEnd) +{ + //Get Root address; + int *piRoot = istk(iadr(*Lstk(_iVar))); + int iAddr = *Lstk(_iVar); + + int iOffsetData = 2 + piRoot[1] + 1 + !(piRoot[1] % 2); + int iScale = (int)(_piEnd - (piRoot + iOffsetData)); + int iDoubleSclale = (iScale + 1) / 2; + + updateLstk(_iVar, sadr(iadr(iAddr) + iOffsetData), iDoubleSclale); +} +/*--------------------------------------------------------------------------*/ + +int isListType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_list); +} + +/*--------------------------------------------------------------------------*/ +int isNamedListType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_list); +} + +/*--------------------------------------------------------------------------*/ +int isTListType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_tlist); +} + +/*--------------------------------------------------------------------------*/ +int isNamedTListType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_tlist); +} + +/*--------------------------------------------------------------------------*/ +int isMListType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_mlist); +} + +/*--------------------------------------------------------------------------*/ +int isNamedMListType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_mlist); +} + +/*--------------------------------------------------------------------------*/ diff --git a/modules/api_scilab/src/cpp/api_optional.cpp b/modules/api_scilab/src/cpp/api_optional.cpp new file mode 100755 index 000000000..23382c819 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_optional.cpp @@ -0,0 +1,117 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS + * + * 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 + */ + +#include "api_scilab.h" +#include "localization.h" +#include "Scierror.h" +#include "call_scilab.h" +#include "sciprint.h" + +static int findOptional(void* _pvCtx, char *fname, rhs_opts opts[]); +static void printOptionalNames(void* _pvCtx, rhs_opts opts[]); + +/**************************/ +/* optional functions */ +/**************************/ +int getOptionals(void* _pvCtx, char* fname, rhs_opts opts[]) +{ + int k, i = 0; + char name[nlgh + 1]; + int nopt = NumOpt(); /* optional arguments on the stack */ + + /* reset first field since opts is declared static in calling function */ + /* this could be avoided with ansi compilers by removing static in the + * opts declaration */ + + while (opts[i].pstName != NULL) + { + opts[i].iPos = -1; + i++; + } + + /* Walking through last arguments */ + + for (k = Rhs - nopt + 1; k <= Rhs; k++) + { + if (IsOpt(k, name) == 0) + { + Scierror(999, _("%s: Optional arguments name=val must be at the end.\n"), fname); + return 0; + } + else + { + int isopt = findOptional(_pvCtx, name, opts); + + if (isopt >= 0) + { + rhs_opts *ro = &opts[isopt]; + ro->iPos = k; + getVarAddressFromPosition(_pvCtx, k, &ro->piAddr); + getVarType(_pvCtx, ro->piAddr, &ro->iType); + getVarDimension(_pvCtx, ro->piAddr, &ro->iRows, &ro->iCols); + } + else + { + sciprint(_("%s: Unrecognized optional arguments %s.\n"), fname, name); + printOptionalNames(_pvCtx, opts); + SciError(999); + return 0; + } + } + } + return 1; +} + +static int findOptional(void* _pvCtx, char *fname, rhs_opts opts[]) +{ + int rep = -1, i = 0; + + while (opts[i].pstName != NULL) + { + int cmp; + + /* name is terminated by white space and we want to ignore them */ + if ((cmp = strcmp(fname, opts[i].pstName)) == 0) + { + rep = i; + break; + } + else if (cmp < 0) + { + break; + } + else + { + i++; + } + } + return rep; +} + +void printOptionalNames(void* _pvCtx, rhs_opts opts[]) +/* array of optinal names (in alphabetical order) +* the array is null terminated */ +{ + int i = 0; + + if (opts[i].pstName == NULL) + { + sciprint(_("Optional argument list is empty.\n")); + return; + } + sciprint(_("Optional arguments list: \n")); + while (opts[i + 1].pstName != NULL) + { + sciprint("%s, ", opts[i].pstName); + i++; + } + sciprint(_("and %s.\n"), opts[i].pstName); +} diff --git a/modules/api_scilab/src/cpp/api_pointer.cpp b/modules/api_scilab/src/cpp/api_pointer.cpp new file mode 100755 index 000000000..98b984687 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_pointer.cpp @@ -0,0 +1,205 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include "api_scilab.h" +#include "api_internal_common.h" +#include "localization.h" + +#include "MALLOC.h" +#include "call_scilab.h" + +SciErr getPointer(void* _pvCtx, int* _piAddress, void** _pvPtr) +{ + SciErr sciErr = sciErrInit(); + int iType = 0; + double *pdblTmp = NULL; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getPointer"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_POINTER, _("%s: Unable to get argument #%d"), "getPointer", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (iType != sci_pointer) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getPointer", _("pointer")); + return sciErr; + } + + pdblTmp = (double*)(_piAddress + 4); + + *_pvPtr = (void*)((unsigned long int)(*pdblTmp)); + return sciErr; +} + +SciErr fillPointer(void* _pvCtx, int *_piAddress, void** _pvPtr) +{ + SciErr sciErr = sciErrInit(); + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "fillPointer"); + return sciErr; + } + + _piAddress[0] = sci_pointer; + _piAddress[1] = 1; + _piAddress[2] = 1; + _piAddress[3] = 0; + + *_pvPtr = _piAddress + 4; + + return sciErr; +} + +SciErr allocPointer(void* _pvCtx, int _iVar, void** _pvPtr) +{ + SciErr sciErr = sciErrInit(); + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int* piAddr = NULL; + void* pvPtr = NULL; + + int iMemSize = 2; + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(iAddr)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + sciErr = fillPointer(_pvCtx, piAddr, &pvPtr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_POINTER, _("%s: Unable to create variable in Scilab memory"), "allocPointer"); + return sciErr; + } + + *_pvPtr = pvPtr; + updateInterSCI(_iVar, '$', iAddr, sadr(iadr(iAddr) + 4)); + updateLstk(iNewPos, sadr(iadr(iAddr) + 4), 2); + + return sciErr; +} + +SciErr createPointer(void* _pvCtx, int _iVar, void* _pvPtr) +{ + void* pvPtr = NULL; + + SciErr sciErr = allocPointer(_pvCtx, _iVar, &pvPtr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POINTER, _("%s: Unable to create variable in Scilab memory"), "createPointer"); + return sciErr; + } + + ((double*)pvPtr)[0] = (double) ((unsigned long int)_pvPtr); + + return sciErr; +} + +SciErr createNamedPointer(void* _pvCtx, const char* _pstName, int* _pvPtr) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + void* pvPtr = NULL; + int *piAddr = NULL; + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createNamedPointer", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + Top = Top + Nbvars + 1; + + int iMemSize = 1; + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(*Lstk(Top))); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + //write matrix information + sciErr = fillPointer(_pvCtx, piAddr, &pvPtr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_POINTER, _("%s: Unable to create %s named \"%s\""), "createNamedPointer", _("pointer"), _pstName); + return sciErr; + } + + //copy data in stack + ((double*)pvPtr)[0] = (double) ((unsigned long int)_pvPtr); + + updateLstk(Top, *Lstk(Top) + sadr(4), 2); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + return sciErr; +} + +SciErr readNamedPointer(void* _pvCtx, const char* _pstName, void** _pvPtr) +{ + int* piAddr = NULL; + void *pvPtr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_POINTER, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfBoolean", _pstName); + return sciErr; + } + + sciErr = getPointer(_pvCtx, piAddr, &pvPtr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_POINTER, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfBoolean", _pstName); + return sciErr; + } + + *_pvPtr = pvPtr; + + return sciErr; +} +/*--------------------------------------------------------------------------*/ +int isPointerType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_pointer); +} +/*--------------------------------------------------------------------------*/ +int isNamedPointerType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_pointer); +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/api_scilab/src/cpp/api_poly.cpp b/modules/api_scilab/src/cpp/api_poly.cpp new file mode 100755 index 000000000..9159c30cf --- /dev/null +++ b/modules/api_scilab/src/cpp/api_poly.cpp @@ -0,0 +1,618 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_poly.h" +#include "localization.h" + +#include "MALLOC.h" +#include "call_scilab.h" +extern "C" { +#include "code2str.h" +}; + + +static int getCommonAllocatedSinglePoly(void* _pvCtx, int* _piAddress, int _iComplex, int* _piNbCoef, double** _pdblReal, double** _pdblImg); +static int getCommonAllocatedNamedSinglePoly(void* _pvCtx, const char* _pstName, int _iComplex, int* _piNbCoef, double** _pdblReal, double** _pdblImg); +static int getCommonAllocatedMatrixOfPoly(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg); +static int getCommonAllocatedNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg); + + +SciErr getPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen) +{ + SciErr sciErr = sciErrInit(); + char *pstVarName = NULL; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getPolyVariableName"); + return sciErr; + } + + if (_piAddress[0] != sci_poly) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getPolyVariableName", _("polynomial matrix")); + return sciErr; + } + + if (_pstVarName == NULL) + { + return sciErr; + } + + *_piVarNameLen = 4; + pstVarName = (char*)MALLOC(sizeof(char) * 5); + code2str(&pstVarName, &_piAddress[4], *_piVarNameLen); + for (int i = 0 ; i < *_piVarNameLen ; i++) + { + if (pstVarName[i] == ' ') + { + memset(pstVarName + i, 0x00, *_piVarNameLen - i); + *_piVarNameLen = i; + break; + } + } + pstVarName[4] = 0; + + strcpy(_pstVarName, pstVarName); + FREE(pstVarName); + + return sciErr; +} + +SciErr getMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal) +{ + return getCommonMatrixOfPoly(_pvCtx, _piAddress, 0, _piRows, _piCols, _piNbCoef, _pdblReal, NULL); +} + +SciErr getComplexMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + return getCommonMatrixOfPoly(_pvCtx, _piAddress, 1, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr getCommonMatrixOfPoly(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iType = 0; + int iSize = 0; + int *piOffset = NULL; + double *pdblReal = NULL; + double *pdblImg = NULL; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), _iComplex ? "getComplexMatrixOfPoly" : "getMatrixOfPoly"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_POLY, _("%s: Unable to get argument #%d"), _iComplex ? "getComplexMatrixOfPoly" : "getMatrixOfPoly", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (iType != sci_poly) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), _iComplex ? "getComplexMatrixOfPoly" : "getMatrixOfPoly", _("polynomial matrix")); + return sciErr; + } + + if (isVarComplex(_pvCtx, _piAddress) != _iComplex) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_COMPLEXITY, _("%s: Bad call to get a non complex matrix"), _iComplex ? "getComplexMatrixOfPoly" : "getMatrixOfPoly"); + return sciErr; + } + + sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_POLY, _("%s: Unable to get argument #%d"), _iComplex ? "getComplexMatrixOfPoly" : "getMatrixOfPoly", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + iSize = *_piRows **_piCols; + + if (_piNbCoef == NULL) + { + return sciErr; + } + + piOffset = _piAddress + 8; //4 for header and 4 for variable name + for (int i = 0 ; i < iSize ; i++) + { + _piNbCoef[i] = piOffset[i + 1] - piOffset[i]; + } + + if (_pdblReal == NULL) + { + return sciErr; + } + + pdblReal = (double*)(piOffset + iSize + 1 + ((iSize + 1) % 2 == 0 ? 0 : 1 )); + for (int i = 0 ; i < iSize ; i++) + { + memcpy(_pdblReal[i], pdblReal + piOffset[i] - 1, sizeof(double) * _piNbCoef[i]); + } + + if (_iComplex == 1) + { + pdblImg = pdblReal + piOffset[iSize] - 1; + for (int i = 0 ; i < iSize ; i++) + { + memcpy(_pdblImg[i], pdblImg + piOffset[i] - 1, sizeof(double) * _piNbCoef[i]); + } + } + return sciErr; +} + +SciErr createMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal) +{ + return createCommonMatrixOfPoly(_pvCtx, _iVar, 0, _pstVarName, _iRows, _iCols, _piNbCoef, _pdblReal, NULL); +} + +SciErr createComplexMatrixOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + return createCommonMatrixOfPoly(_pvCtx, _iVar, 1, _pstVarName, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr createCommonMatrixOfPoly(void* _pvCtx, int _iVar, int _iComplex, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + int *piAddr = NULL; + int iSize = _iRows * _iCols; + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int iTotalLen = 0; + + //return empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + SciErr sciErr = fillCommonMatrixOfPoly(_pvCtx, piAddr, _pstVarName, _iComplex, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_POLY, _("%s: Unable to create variable in Scilab memory"), _iComplex ? "createComplexMatrixOfPoly" : "createMatrixOfPoly"); + return sciErr; + } + + updateInterSCI(_iVar, '$', iAddr, iAddr + 4 + 4 + iSize + 1); + updateLstk(iNewPos, iAddr + 4 + 4 + iSize + 1, iTotalLen); + + return sciErr; +} + +SciErr fillCommonMatrixOfPoly(void* _pvCtx, int* _piAddress, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg, int* _piTotalLen) +{ + SciErr sciErr = sciErrInit(); + int* piOffset = NULL; + int *piVarName = NULL; + int iSize = _iRows * _iCols; + + double *pdblReal = NULL; + double *pdblImg = NULL; + + //header + _piAddress[0] = sci_poly; + _piAddress[1] = _iRows; + _piAddress[2] = _iCols; + _piAddress[3] = _iComplex; + + + //4 for header + piVarName = _piAddress + 4;//4 for header + if (strlen(_pstVarName) > 4) //4 characters max + { + addErrorMessage(&sciErr, API_ERROR_TOO_LONG_VAR, _("%s: Formal variable name of polynomial can't exceed 4 characters")); + return sciErr; + } + + //fill variable name with space ( 40 sergescii ) + piVarName[0] = 40; + piVarName[1] = 40; + piVarName[2] = 40; + piVarName[3] = 40; + str2code(piVarName, &_pstVarName); + + piOffset = _piAddress + 8; //4 for header and 4 for variable name + piOffset[0] = 1; + for (int i = 0 ; i < iSize ; i++) + { + piOffset[i + 1] = piOffset[i] + _piNbCoef[i]; + } + + pdblReal = (double*)(piOffset + iSize + 1 + ((iSize + 1) % 2 == 0 ? 0 : 1 )); + + for (int i = 0 ; i < iSize ; i++) + { + memcpy(pdblReal + piOffset[i] - 1, _pdblReal[i], _piNbCoef[i] * sizeof(double)); + } + + if (_iComplex == 1) + { + pdblImg = pdblReal + piOffset[iSize] - 1; + for (int i = 0 ; i < iSize ; i++) + { + memcpy(pdblImg + piOffset[i] - 1, _pdblImg[i], _piNbCoef[i] * sizeof(double)); + } + } + + *_piTotalLen = (piOffset[iSize] - 1) * (_iComplex + 1) * 2; + return sciErr; +} + +SciErr createNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal) +{ + return createCommonNamedMatrixOfPoly(_pvCtx, _pstName, _pstVarName, 0, _iRows, _iCols, _piNbCoef, _pdblReal, NULL); +} + +SciErr createNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + return createCommonNamedMatrixOfPoly(_pvCtx, _pstName, _pstVarName, 1, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr createCommonNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, char* _pstVarName, int _iComplex, int _iRows, int _iCols, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + int iTotalLen = 0; + + //return named empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createNamedMatrixOfDouble(_pvCtx, _pstName, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createNamedEmptyMatrix"); + } + return sciErr; + } + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonNamedMatrixOfPoly", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (unsigned long)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + //write matrix information + sciErr = fillCommonMatrixOfPoly(_pvCtx, piAddr, _pstVarName, _iComplex, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_POLY, _("%s: Unable to create %s named \"%s\""), _iComplex ? "createNamedComplexMatrixOfPoly" : "createNamedMatrixOfPoly", _("matrix of double"), _pstName); + return sciErr; + } + + + //update "variable index" + updateLstk(Top, *Lstk(Top) + 4, iTotalLen); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; +} + +SciErr readNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal) +{ + return readCommonNamedMatrixOfPoly(_pvCtx, _pstName, 0, _piRows, _piCols, _piNbCoef, _pdblReal, NULL); +} + +SciErr readNamedComplexMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + return readCommonNamedMatrixOfPoly(_pvCtx, _pstName, 1, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); +} + +SciErr readCommonNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + int* piAddr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_POLY, _("%s: Unable to get variable \"%s\""), _iComplex ? "readNamedComplexMatrixOfPoly" : "readNamedMatrixOfPoly", _pstName); + return sciErr; + } + + if (_iComplex == 1) + { + sciErr = getComplexMatrixOfPoly(_pvCtx, piAddr, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); + } + else + { + sciErr = getMatrixOfPoly(_pvCtx, piAddr, _piRows, _piCols, _piNbCoef, _pdblReal); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_POLY, _("%s: Unable to get variable \"%s\""), _iComplex ? "readNamedComplexMatrixOfPoly" : "readNamedMatrixOfPoly", _pstName); + return sciErr; + } + + return sciErr; +} + +/*shortcut functions */ + +/*--------------------------------------------------------------------------*/ +int isPolyType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_poly); +} +/*--------------------------------------------------------------------------*/ +int isNamedPolyType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_poly); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedSinglePoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal) +{ + return getCommonAllocatedSinglePoly(_pvCtx, _piAddress, 0, _piNbCoef, _pdblReal, NULL); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedSingleComplexPoly(void* _pvCtx, int* _piAddress, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + return getCommonAllocatedSinglePoly(_pvCtx, _piAddress, 1, _piNbCoef, _pdblReal, _pdblImg); +} +/*--------------------------------------------------------------------------*/ +static int getCommonAllocatedSinglePoly(void* _pvCtx, int* _piAddress, int _iComplex, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + + if (isScalar(_pvCtx, _piAddress) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_POLY, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), _iComplex ? "getAllocatedSingleComplexPoly" : "getAllocatedSinglePoly", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = getCommonMatrixOfPoly(_pvCtx, _piAddress, _iComplex, &iRows, &iCols, _piNbCoef, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_POLY, _("%s: Unable to get argument #%d"), _iComplex ? "getAllocatedSingleComplexPoly" : "getAllocatedSinglePoly", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pdblReal = (double*)MALLOC(sizeof(double) **_piNbCoef); + + if (_iComplex) + { + *_pdblImg = (double*)MALLOC(sizeof(double) **_piNbCoef); + } + + sciErr = getCommonMatrixOfPoly(_pvCtx, _piAddress, _iComplex, &iRows, &iCols, _piNbCoef, _pdblReal, _pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_POLY, _("%s: Unable to get argument #%d"), _iComplex ? "getAllocatedSingleComplexPoly" : "getAllocatedSinglePoly", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedNamedSinglePoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal) +{ + return getCommonAllocatedNamedSinglePoly(_pvCtx, _pstName, 0, _piNbCoef, _pdblReal, NULL); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedNamedSingleComplexPoly(void* _pvCtx, const char* _pstName, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + return getCommonAllocatedNamedSinglePoly(_pvCtx, _pstName, 1, _piNbCoef, _pdblReal, _pdblImg); +} +/*--------------------------------------------------------------------------*/ +static int getCommonAllocatedNamedSinglePoly(void* _pvCtx, const char* _pstName, int _iComplex, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (isNamedScalar(_pvCtx, _pstName) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_SINGLE_POLY, _("%s: Wrong type for input argument \"%s\": A scalar expected.\n"), _iComplex ? "getAllocatedNamedSingleComplexPoly" : "getAllocatedNamedSinglePoly", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = readCommonNamedMatrixOfPoly(_pvCtx, _pstName, _iComplex, &iRows, &iCols, _piNbCoef, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_SINGLE_POLY, _("%s: Unable to get argument \"%s\""), _iComplex ? "getAllocatedNamedSingleComplexPoly" : "getAllocatedNamedSinglePoly", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pdblReal = (double*)MALLOC(sizeof(double) **_piNbCoef); + memcpy(*_pdblReal, pdblReal, sizeof(double) **_piNbCoef); + + if (_iComplex) + { + *_pdblImg = (double*)MALLOC(sizeof(double) **_piNbCoef); + memcpy(*_pdblImg, pdblImg, sizeof(double) **_piNbCoef); + } + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedMatrixOfPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal) +{ + return getCommonAllocatedMatrixOfPoly(_pvCtx, _piAddress, 0, _piRows, _piCols, _piNbCoef, _pdblReal, NULL); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedMatrixOfComplexPoly(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg) +{ + return getCommonAllocatedMatrixOfPoly(_pvCtx, _piAddress, 1, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); +} +/*--------------------------------------------------------------------------*/ +static int getCommonAllocatedMatrixOfPoly(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg) +{ + SciErr sciErr = getCommonMatrixOfPoly(_pvCtx, _piAddress, _iComplex, _piRows, _piCols, NULL, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_MATRIX_POLY, _("%s: Unable to get argument #%d"), _iComplex ? "getAllocatedMatrixOfComplexPoly" : "getAllocatedMatrixOfPoly", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_piNbCoef = (int*)MALLOC(sizeof(int) **_piRows **_piCols); + + sciErr = getCommonMatrixOfPoly(_pvCtx, _piAddress, _iComplex, _piRows, _piCols, *_piNbCoef, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_MATRIX_POLY, _("%s: Unable to get argument #%d"), _iComplex ? "getAllocatedMatrixOfComplexPoly" : "getAllocatedMatrixOfPoly", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pdblReal = (double**)MALLOC(sizeof(double*) **_piRows **_piCols); + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + (*_pdblReal)[i] = (double*)MALLOC(sizeof(double) * (*_piNbCoef)[i]); + } + + if (_iComplex) + { + *_pdblImg = (double**)MALLOC(sizeof(double*) **_piRows **_piCols); + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + (*_pdblImg)[i] = (double*)MALLOC(sizeof(double) * (*_piNbCoef)[i]); + } + } + + sciErr = getCommonMatrixOfPoly(_pvCtx, _piAddress, _iComplex, _piRows, _piCols, *_piNbCoef, *_pdblReal, _pdblImg == NULL ? NULL : *_pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_MATRIX_POLY, _("%s: Unable to get argument #%d"), _iComplex ? "getAllocatedSingleComplexPoly" : "getAllocatedSinglePoly", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal) +{ + return getCommonAllocatedNamedMatrixOfPoly(_pvCtx, _pstName, 0, _piRows, _piCols, _piNbCoef, _pdblReal, NULL); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedNamedMatrixOfComplexPoly(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg) +{ + return getCommonAllocatedNamedMatrixOfPoly(_pvCtx, _pstName, 1, _piRows, _piCols, _piNbCoef, _pdblReal, _pdblImg); +} +/*--------------------------------------------------------------------------*/ +static int getCommonAllocatedNamedMatrixOfPoly(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int** _piNbCoef, double*** _pdblReal, double*** _pdblImg) +{ + SciErr sciErr = readCommonNamedMatrixOfPoly(_pvCtx, _pstName, _iComplex, _piRows, _piCols, NULL, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_MATRIX_POLY, _("%s: Unable to get argument \"%s\""), _iComplex ? "getAllocatedNamedMatrixOfComplexPoly" : "getAllocatedNamedMatrixOfPoly", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_piNbCoef = (int*)MALLOC(sizeof(int) **_piRows **_piCols); + + sciErr = readCommonNamedMatrixOfPoly(_pvCtx, _pstName, _iComplex, _piRows, _piCols, *_piNbCoef, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_MATRIX_POLY, _("%s: Unable to get argument \"%s\""), _iComplex ? "getAllocatedNamedMatrixOfComplexPoly" : "getAllocatedNamedMatrixOfPoly", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pdblReal = (double**)MALLOC(sizeof(double*) **_piRows **_piCols); + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + (*_pdblReal)[i] = (double*)MALLOC(sizeof(double) * (*_piNbCoef)[i]); + } + + if (_iComplex) + { + *_pdblImg = (double**)MALLOC(sizeof(double*) **_piRows **_piCols); + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + (*_pdblImg)[i] = (double*)MALLOC(sizeof(double) * (*_piNbCoef)[i]); + } + } + + sciErr = readCommonNamedMatrixOfPoly(_pvCtx, _pstName, _iComplex, _piRows, _piCols, *_piNbCoef, *_pdblReal, _pdblImg == NULL ? NULL : *_pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_MATRIX_POLY, _("%s: Unable to get argument \"%s\""), _iComplex ? "getAllocatedNamedMatrixOfComplexPoly" : "getAllocatedNamedMatrixOfPoly", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedSinglePoly(double* _pdblReal) +{ + FREE(_pdblReal); +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedSingleComplexPoly(double* _pdblReal, double* _pdblImg) +{ + freeAllocatedSinglePoly(_pdblReal); + FREE(_pdblImg); +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedMatrixOfPoly(int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal) +{ + FREE(_piNbCoef); + + for (int i = 0 ; i < _iRows * _iCols ; i++) + { + FREE(_pdblReal[i]); + } + FREE(_pdblReal); +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedMatrixOfComplexPoly(int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg) +{ + freeAllocatedMatrixOfPoly(_iRows, _iCols, _piNbCoef, _pdblReal); + + for (int i = 0 ; i < _iRows * _iCols ; i++) + { + FREE(_pdblImg[i]); + } + FREE(_pdblImg); +} diff --git a/modules/api_scilab/src/cpp/api_sparse.cpp b/modules/api_scilab/src/cpp/api_sparse.cpp new file mode 100755 index 000000000..59241fafe --- /dev/null +++ b/modules/api_scilab/src/cpp/api_sparse.cpp @@ -0,0 +1,514 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_sparse.h" +#include "localization.h" + +#include "MALLOC.h" +#include "call_scilab.h" + + +static int getCommonAllocatedSparseMatrix(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); +static int getCommonNamedAllocatedSparseMatrix(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg); + + +//internal sparse functions +SciErr getSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal) +{ + return getCommonSparseMatrix(_pvCtx, _piAddress, 0, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr getComplexSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + return getCommonSparseMatrix(_pvCtx, _piAddress, 1, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + +SciErr getCommonSparseMatrix(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iPos = 0; + int iType = 0; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), _iComplex ? "getComplexSparseMatrix" : "getSparseMatrix"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_SPARSE, _("%s: Unable to get argument #%d"), _iComplex ? "getComplexSparseMatrix" : "getSparseMatrix", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (iType != sci_sparse) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), _iComplex ? "getComplexSparseMatrix" : "getSparseMatrix", _("sparse matrix")); + return sciErr; + } + + if (isVarComplex(_pvCtx, _piAddress) != _iComplex) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_COMPLEXITY, _("%s: Bad call to get a non complex matrix"), _iComplex ? "getComplexSparseMatrix" : "getSparseMatrix"); + return sciErr; + } + + + sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_SPARSE, _("%s: Unable to get argument #%d"), _iComplex ? "getComplexSparseMatrix" : "getSparseMatrix", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + *_piNbItem = _piAddress[4]; + + if (_piNbItemRow == NULL) + { + return sciErr; + } + *_piNbItemRow = _piAddress + 5;//4 for header + 1 for NbItem + + if (_piColPos == NULL) + { + return sciErr; + } + *_piColPos = *_piNbItemRow + *_piRows; + + if (_pdblReal == NULL) + { + return sciErr; + } + + iPos = (*_piNbItem + *_piRows) % 2 == 1 ? 0 : 1; + *_pdblReal = (double*)(*_piColPos + *_piNbItem + iPos); + if (_iComplex == 1 && _pdblImg != NULL) + { + *_pdblImg = *_pdblReal + *_piNbItem; + } + return sciErr; +} + +SciErr allocSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal) +{ + return allocCommonSparseMatrix(_pvCtx, _iVar, 0, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr allocComplexSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + return allocCommonSparseMatrix(_pvCtx, _iVar, 1, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + +SciErr allocCommonSparseMatrix(void* _pvCtx, int _iVar, int _iComplex, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int iTotalSize = 0; + int iOffset = 0; + int* piAddr = NULL; + + //return empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + //header + offset + int iMemSize = (5 + _iRows + _iNbItem + !((_iRows + _iNbItem) % 2)) / 2; + //+ items size + iMemSize += _iNbItem * (_iComplex + 1); + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(iAddr)); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + sciErr = fillCommonSparseMatrix(_pvCtx, piAddr, _iComplex, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg, &iTotalSize); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_ALLOC_SPARSE, _("%s: Unable to create variable in Scilab memory"), _iComplex ? "allocComplexSparseMatrix" : "allocSparseMatrix"); + return sciErr; + } + + iOffset = 5;//4 for header + 1 for NbItem + iOffset += _iRows + _iNbItem + !((_iRows + _iNbItem) % 2); + + updateInterSCI(_iVar, '$', iAddr, sadr(iadr(iAddr) + iOffset)); + updateLstk(iNewPos, sadr(iadr(iAddr) + iOffset), iTotalSize); + return sciErr; +} + +SciErr fillCommonSparseMatrix(void* _pvCtx, int *_piAddress, int _iComplex, int _iRows, int _iCols, int _iNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg, int* _piTotalSize) +{ + SciErr sciErr = sciErrInit(); + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "fillCommonSparseMatrix"); + return sciErr; + } + + _piAddress[0] = sci_sparse; + _piAddress[1] = Min(_iRows, _iRows * _iCols); + _piAddress[2] = Min(_iCols, _iRows * _iCols); + _piAddress[3] = _iComplex; + + _piAddress[4] = _iNbItem; + + *_piNbItemRow = _piAddress + 5;//4 for header + 1 for NbItem + *_piColPos = *_piNbItemRow + _iRows; + *_pdblReal = (double*)(*_piColPos + _iNbItem + !((_iRows + _iNbItem) % 2)); + + if (_iComplex == 1) + { + *_pdblImg = *_pdblReal + _iNbItem; + } + + *_piTotalSize = _iNbItem * (_iComplex + 1); + return sciErr; +} + +SciErr createSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal) +{ + return createCommonSparseMatrix(_pvCtx, _iVar, 0, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr createComplexSparseMatrix(void* _pvCtx, int _iVar, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg) +{ + return createCommonSparseMatrix(_pvCtx, _iVar, 1, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + +SciErr createCommonSparseMatrix(void* _pvCtx, int _iVar, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg) +{ + int* piNbItemRow = NULL; + int* piColPos = NULL; + int iOne = 1; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + SciErr sciErr = allocCommonSparseMatrix(_pvCtx, _iVar, _iComplex, _iRows, _iCols, _iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SPARSE, _("%s: Unable to create variable in Scilab memory"), _iComplex ? "createComplexSparseMatrix" : "createSparseMatrix"); + return sciErr; + } + + memcpy(piNbItemRow, _piNbItemRow, _iRows * sizeof(int)); + memcpy(piColPos, _piColPos, _iNbItem * sizeof(int)); + C2F(dcopy)(&_iNbItem, const_cast<double*>(_pdblReal), &iOne, pdblReal, &iOne); + if (_iComplex) + { + C2F(dcopy)(&_iNbItem, const_cast<double*>(_pdblImg), &iOne, pdblImg, &iOne); + } + return sciErr; +} + +SciErr createNamedSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal) +{ + return createCommonNamedSparseMatrix(_pvCtx, _pstName, 0, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr createNamedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg) +{ + return createCommonNamedSparseMatrix(_pvCtx, _pstName, 1, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + +SciErr createCommonNamedSparseMatrix(void* _pvCtx, const char* _pstName, int _iComplex, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos, const double* _pdblReal, const double* _pdblImg) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int iTotalSize = 0; + int iPos = 0; + + int* piAddr = NULL; + int* piNbItemRow = NULL; + int* piColPos = NULL; + int iOne = 1; + double* pdblReal = NULL; + double* pdblImg = NULL; + + //return named empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createNamedMatrixOfDouble(_pvCtx, _pstName, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createNamedEmptyMatrix"); + } + return sciErr; + } + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createCommonNamedSparseMatrix", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + Top = Top + Nbvars + 1; + + //header + offset + int iMemSize = (5 + _iRows + _iNbItem + !((_iRows + _iNbItem) % 2)) / 2; + //+ items size + iMemSize += _iNbItem * (_iComplex + 1); + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(*Lstk(Top))); + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + sciErr = fillCommonSparseMatrix(_pvCtx, piAddr, _iComplex, _iRows, _iCols, _iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg, &iTotalSize); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SPARSE, _("%s: Unable to create %s named \"%s\""), _iComplex ? "createNamedComplexSparseMatrix" : "createNamedSparseMatrix", _("sparse matrix"), _pstName); + return sciErr; + } + + memcpy(piNbItemRow, _piNbItemRow, _iRows * sizeof(int)); + memcpy(piColPos, _piColPos, _iNbItem * sizeof(int)); + C2F(dcopy)(&_iNbItem, const_cast<double*>(_pdblReal), &iOne, pdblReal, &iOne); + if (_iComplex) + { + C2F(dcopy)(&_iNbItem, const_cast<double*>(_pdblImg), &iOne, pdblImg, &iOne); + } + + iPos = 5;//4 for header + 1 for NbItem + iPos += _iRows + _iNbItem; + + //update "variable index" + updateLstk(Top, *Lstk(Top) + iPos, iTotalSize); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + + return sciErr; + +} + +SciErr readNamedSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal) +{ + return readCommonNamedSparseMatrix(_pvCtx, _pstName, 0, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} + +SciErr readNamedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg) +{ + return readCommonNamedSparseMatrix(_pvCtx, _pstName, 1, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} + +SciErr readCommonNamedSparseMatrix(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg) +{ + int* piAddr = NULL; + int* piNbItemRow = 0; + int* piColPos = 0; + int iOne = 1; + + double* pdblReal = NULL; + double* pdblImg = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_SPARSE, _("%s: Unable to get variable \"%s\""), _iComplex ? "readNamedComplexSparseMatrix" : "readNamedSparseMatrix", _pstName); + return sciErr; + } + + if (_iComplex == 1) + { + sciErr = getComplexSparseMatrix(_pvCtx, piAddr, _piRows, _piCols, _piNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(_pvCtx, piAddr, _piRows, _piCols, _piNbItem, &piNbItemRow, &piColPos, &pdblReal); + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_SPARSE, _("%s: Unable to get variable \"%s\""), _iComplex ? "readNamedComplexSparseMatrix" : "readNamedSparseMatrix", _pstName); + return sciErr; + } + + if (_piNbItemRow == NULL) + { + return sciErr; + } + + memcpy(_piNbItemRow, piNbItemRow, *_piRows * sizeof(int)); + + if (_piColPos == NULL) + { + return sciErr; + } + + memcpy(_piColPos, piColPos, *_piNbItem * sizeof(int)); + + + if (_pdblReal == NULL) + { + return sciErr; + } + + C2F(dcopy)(_piNbItem, pdblReal, &iOne, _pdblReal, &iOne); + + if (_iComplex && _pdblImg) + { + C2F(dcopy)(_piNbItem, pdblImg, &iOne, _pdblImg, &iOne); + } + + return sciErr; +} + +/* shortcut functions */ + +/*--------------------------------------------------------------------------*/ +int isSparseType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_sparse); +} +/*--------------------------------------------------------------------------*/ +int isNamedSparseType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_sparse); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal) +{ + return getCommonAllocatedSparseMatrix(_pvCtx, _piAddress, 0, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedComplexSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + return getCommonAllocatedSparseMatrix(_pvCtx, _piAddress, 1, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} +/*--------------------------------------------------------------------------*/ +static int getCommonAllocatedSparseMatrix(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + int* piNbItemRow = NULL; + int* piColPos = NULL; + int iOne = 1; + double* pdblReal = NULL; + double* pdblImg = NULL; + + SciErr sciErr = getCommonSparseMatrix(_pvCtx, _piAddress, _iComplex, _piRows, _piCols, _piNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SPARSE, _("%s: Unable to get argument #%d"), _iComplex ? "getAllocatedComplexSparseMatrix" : "getAllocatedSparseMatrix", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_piNbItemRow = (int*)MALLOC(sizeof(int) **_piRows); + memcpy(*_piNbItemRow, piNbItemRow, sizeof(int) **_piRows); + + *_piColPos = (int*)MALLOC(sizeof(int) **_piNbItem); + memcpy(*_piColPos, piColPos, sizeof(int) **_piNbItem); + + *_pdblReal = (double*)MALLOC(sizeof(double) **_piNbItem); + C2F(dcopy)(_piNbItem, pdblReal, &iOne, *_pdblReal, &iOne); + + if (_iComplex) + { + *_pdblImg = (double*)MALLOC(sizeof(double) **_piNbItem); + C2F(dcopy)(_piNbItem, pdblImg, &iOne, *_pdblImg, &iOne); + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getNamedAllocatedSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal) +{ + return getCommonNamedAllocatedSparseMatrix(_pvCtx, _pstName, 0, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL); +} +/*--------------------------------------------------------------------------*/ +int getNamedAllocatedComplexSparseMatrix(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + return getCommonNamedAllocatedSparseMatrix(_pvCtx, _pstName, 1, _piRows, _piCols, _piNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg); +} +/*--------------------------------------------------------------------------*/ +static int getCommonNamedAllocatedSparseMatrix(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg) +{ + SciErr sciErr = readCommonNamedSparseMatrix(_pvCtx, _pstName, _iComplex, _piRows, _piCols, _piNbItem, NULL, NULL, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_ALLOC_SPARSE, _("%s: Unable to get argument \"%s\""), _iComplex ? "getNamedAllocatedComplexSparseMatrix" : "getNamedAllocatedSparseMatrix", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_piNbItemRow = (int*)MALLOC(sizeof(int) **_piRows); + *_piColPos = (int*)MALLOC(sizeof(int) **_piNbItem); + + *_pdblReal = (double*)MALLOC(sizeof(double) **_piNbItem); + if (_iComplex) + { + *_pdblImg = (double*)MALLOC(sizeof(double) **_piNbItem); + } + + sciErr = readCommonNamedSparseMatrix(_pvCtx, _pstName, _iComplex, _piRows, _piCols, _piNbItem, *_piNbItemRow, *_piColPos, *_pdblReal, *_pdblImg); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_NAMED_ALLOC_SPARSE, _("%s: Unable to get argument \"%s\""), _iComplex ? "getNamedAllocatedComplexSparseMatrix" : "getNamedAllocatedSparseMatrix", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedSparseMatrix(int* _piNbItemRows, int* _piColPos, double* _pdblReal) +{ + FREE(_piNbItemRows); + FREE(_piColPos); + FREE(_pdblReal); +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedComplexSparseMatrix(int* _piNbItemRows, int* _piColPos, double* _pdblReal, double* _pdblImg) +{ + freeAllocatedSparseMatrix(_piNbItemRows, _piColPos, _pdblReal); + FREE(_pdblImg); +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/api_scilab/src/cpp/api_string.cpp b/modules/api_scilab/src/cpp/api_string.cpp new file mode 100755 index 000000000..9ca905752 --- /dev/null +++ b/modules/api_scilab/src/cpp/api_string.cpp @@ -0,0 +1,994 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Antoine ELIAS + * Copyright (C) 2009-2011 - DIGITEO - Allan CORNET + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +/*--------------------------------------------------------------------------*/ +#include <string.h> + +#include "charEncoding.h" +#include "MALLOC.h" +#include "api_scilab.h" +#include "api_internal_common.h" +#include "api_internal_string.h" +#include "call_scilab.h" +#include "localization.h" + +extern "C" +{ +#include "code2str.h" +#include "freeArrayOfString.h" +}; +/*--------------------------------------------------------------------------*/ + +/*******************************/ +/* string matrix functions */ +/*******************************/ + +SciErr getMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings) +{ + SciErr sciErr = sciErrInit(); + int *piOffset = NULL; + int *piData = NULL; + int iType = 0; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getMatrixOfString"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_STRING, _("%s: Unable to get argument #%d"), "getMatrixOfString", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (iType != sci_strings) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getMatrixOfString", _("string matrix")); + return sciErr; + } + + sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_STRING, _("%s: Unable to get argument #%d"), "getMatrixOfString", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (_piLength == NULL) + { + return sciErr; + } + + piOffset = _piAddress + 4; + + //non cummulative length + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + _piLength[i] = piOffset[i + 1] - piOffset[i]; + } + + if (_pstStrings == NULL || *_pstStrings == NULL) + { + return sciErr; + } + + piData = piOffset + *_piRows **_piCols + 1; + + int sum = 0; + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + if (_pstStrings[i] == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_SUBSTRING_POINTER, _("%s: Invalid argument address"), "getMatrixOfString"); + return sciErr; + } + code2str(&_pstStrings[i], piData + sum, _piLength[i]); + sum += _piLength[i]; + _pstStrings[i][_piLength[i]] = 0; + } + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr createMatrixOfString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const char* const * _pstStrings) +{ + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int iTotalLen = 0; + int *piAddr = NULL; + + //return empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + SciErr sciErr = fillMatrixOfString(_pvCtx, piAddr, _iRows, _iCols, _pstStrings, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_STRING, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfString"); + return sciErr; + } + + updateInterSCI(_iVar, '$', iAddr, sadr(iadr(iAddr) + 5 + _iRows * _iCols)); + updateLstk(iNewPos, sadr(iadr(iAddr) + 5 + _iRows * _iCols + !((_iRows * _iCols) % 2)), (iTotalLen + 1) / (sizeof(double) / sizeof(int))); + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr fillMatrixOfString(void* _pvCtx, int* _piAddress, int _iRows, int _iCols, const char* const* _pstStrings, int* _piTotalLen) +{ + SciErr sciErr = sciErrInit(); + int* piOffset = NULL; + int* piData = NULL; + int iOffset = 0; + int iTotalSize = 0; + int iMemSize = 0; + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(*Lstk(Top))); + + for (int i = 0; i < _iRows * _iCols; i++) + { + iTotalSize = iTotalSize + (int)strlen(_pstStrings[i]) + 1; + } + + iMemSize = iTotalSize + 2; + + if (iMemSize > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, iMemSize); + return sciErr; + } + + _piAddress[0] = sci_strings; + _piAddress[1] = _iRows; + _piAddress[2] = _iCols; + _piAddress[3] = 0; //always 0 + + piOffset = _piAddress + 4; + piOffset[0] = 1; //Always 1 + piData = piOffset + _iRows * _iCols + 1; + + if (_pstStrings == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "fillMatrixOfString"); + return sciErr; + } + + for (int i = 0 ; i < _iRows * _iCols ; i++) + { + if (_pstStrings[i] == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_SUBSTRING_POINTER, _("%s: Invalid argument address"), "getMatrixOfString"); + return sciErr; + } + + int iLen = (int)strlen(_pstStrings[i]); + str2code(piData + iOffset, &_pstStrings[i]); + iOffset += iLen; + piData[iOffset] = 0; + piOffset[i + 1] = piOffset[i] + iLen; + } + + *_piTotalLen = piOffset[_iRows * _iCols] - 1; + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr createNamedMatrixOfString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const char* const* _pstStrings) +{ + SciErr sciErr = sciErrInit(); + int iVarID[nsiz]; + int iSaveRhs = Rhs; + int iSaveTop = Top; + int *piAddr = NULL; + int iTotalLen = 0; + + //return named empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + sciErr = createNamedMatrixOfDouble(_pvCtx, _pstName, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createNamedEmptyMatrix"); + } + return sciErr; + } + + if (!checkNamedVarFormat(_pvCtx, _pstName)) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createNamedMatrixOfString", _pstName); + return sciErr; + } + + C2F(str2name)(_pstName, iVarID, (int)strlen(_pstName)); + Top = Top + Nbvars + 1; + + getNewVarAddressFromPosition(_pvCtx, Top, &piAddr); + + //write matrix information + sciErr = fillMatrixOfString(_pvCtx, piAddr, _iRows, _iCols, _pstStrings, &iTotalLen); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_STRING, _("%s: Unable to create %s named \"%s\""), "createNamedMatrixOfString", _("matrix of string"), _pstName); + return sciErr; + } + + //update "variable index" + + updateLstk(Top, sadr(iadr(*Lstk(Top)) + 5 + _iRows * _iCols), iTotalLen); + + Rhs = 0; + //Add name in stack reference list + createNamedVariable(iVarID); + + Top = iSaveTop; + Rhs = iSaveRhs; + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr readNamedMatrixOfString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings) +{ + int* piAddr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_STRING, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfString", _pstName); + return sciErr; + } + + sciErr = getMatrixOfString(_pvCtx, piAddr, _piRows, _piCols, _piLength, _pstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_STRING, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfString", _pstName); + return sciErr; + } + + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr getMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piwLength, wchar_t** _pwstStrings) +{ + SciErr sciErr = sciErrInit(); + int iType = 0; + char **pstStrings = NULL; + int *piLenStrings = NULL; + int strSize = 0; + + if (_piAddress == NULL) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "getMatrixOfWideString"); + return sciErr; + } + + sciErr = getVarType(_pvCtx, _piAddress, &iType); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_WIDE_STRING, _("%s: Unable to get argument #%d"), "getMatrixOfWideString", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (iType != sci_strings) + { + addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getMatrixOfWideString", _("string matrix")); + return sciErr; + } + + sciErr = getVarDimension(_pvCtx, _piAddress, _piRows, _piCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_WIDE_STRING, _("%s: Unable to get argument #%d"), "getMatrixOfWideString", getRhsFromAddress(_pvCtx, _piAddress)); + return sciErr; + } + + if (_piwLength == NULL) + { + return sciErr; + } + + strSize = (*_piRows **_piCols); + piLenStrings = (int*)MALLOC(sizeof(int) * strSize); + + // get length UTF size + sciErr = getMatrixOfString(_pvCtx, _piAddress, _piRows, _piCols, piLenStrings, pstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_WIDE_STRING, _("%s: Unable to get argument #%d"), "getMatrixOfWideString", getRhsFromAddress(_pvCtx, _piAddress)); + if (piLenStrings) + { + FREE(piLenStrings); + piLenStrings = NULL; + } + return sciErr; + } + + pstStrings = (char**)MALLOC(sizeof(char*) * strSize); + memset(pstStrings, 0x00, sizeof(char*) * strSize); + + for (int i = 0; i < strSize; i++) + { + pstStrings[i] = (char*)MALLOC(sizeof(char) * (piLenStrings[i] + 1)); + } + + // get strings UTF format + sciErr = getMatrixOfString(_pvCtx, _piAddress, _piRows, _piCols, piLenStrings, pstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_WIDE_STRING, _("%s: Unable to get argument #%d"), "getMatrixOfWideString", getRhsFromAddress(_pvCtx, _piAddress)); + if (piLenStrings) + { + FREE(piLenStrings); + piLenStrings = NULL; + } + freeArrayOfString(pstStrings, strSize); + return sciErr; + } + + for (int i = 0; i < (*_piRows **_piCols); i++) + { + wchar_t* wString = to_wide_string(pstStrings[i]); + if (wString) + { + _piwLength[i] = (int)wcslen(wString); + FREE(wString); + wString = NULL; + } + else + { + _piwLength[i] = 0; + addErrorMessage(&sciErr, API_ERROR_GET_WIDE_STRING, _("%s: Unable to convert to wide string #%d"), "getMatrixOfWideString", getRhsFromAddress(_pvCtx, _piAddress)); + if (piLenStrings) + { + FREE(piLenStrings); + piLenStrings = NULL; + } + freeArrayOfString(pstStrings, strSize); + return sciErr; + } + } + + if ( (_pwstStrings == NULL) || (*_pwstStrings == NULL) ) + { + if (piLenStrings) + { + FREE(piLenStrings); + piLenStrings = NULL; + } + freeArrayOfString(pstStrings, strSize); + return sciErr; + } + + for (int i = 0; i < (*_piRows **_piCols); i++) + { + if (pstStrings[i]) + { + wchar_t *wcstring = to_wide_string(pstStrings[i]); + if (wcstring) + { + if (_pwstStrings[i]) + { + wcscpy(_pwstStrings[i], wcstring); + _piwLength[i] = (int)wcslen(_pwstStrings[i]); + } + else + { + _pwstStrings[i] = NULL; + _piwLength[i] = 0; + } + FREE(wcstring); + wcstring = NULL; + } + else + { + // case to_wide_string fails + _pwstStrings[i] = NULL; + _piwLength[i] = 0; + addErrorMessage(&sciErr, API_ERROR_GET_WIDE_STRING, _("%s: Unable to convert to wide string #%d"), "getMatrixOfWideString", getRhsFromAddress(_pvCtx, _piAddress)); + if (piLenStrings) + { + FREE(piLenStrings); + piLenStrings = NULL; + } + freeArrayOfString(pstStrings, strSize); + return sciErr; + } + } + else + { + // case to_wide_string fails + _pwstStrings[i] = NULL; + _piwLength[i] = 0; + } + } + + freeArrayOfString(pstStrings, strSize); + if (piLenStrings) + { + FREE(piLenStrings); + piLenStrings = NULL; + } + + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr createMatrixOfWideString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const wchar_t* const* _pstwStrings) +{ + char **pStrings = NULL; + + //return empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix"); + } + return sciErr; + } + + pStrings = (char**)MALLOC( sizeof(char*) * (_iRows * _iCols) ); + + for (int i = 0; i < (_iRows * _iCols) ; i++) + { + pStrings[i] = wide_string_to_UTF8(_pstwStrings[i]); + } + + SciErr sciErr = createMatrixOfString(_pvCtx, _iVar, _iRows, _iCols, pStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_WIDE_STRING, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfWideString"); + } + + freeArrayOfString(pStrings, _iRows * _iCols); + + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr createNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const wchar_t* const* _pwstStrings) +{ + char **pStrings = NULL; + + //return named empty matrix + if (_iRows == 0 && _iCols == 0) + { + double dblReal = 0; + SciErr sciErr = createNamedMatrixOfDouble(_pvCtx, _pstName, 0, 0, &dblReal); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createNamedEmptyMatrix"); + } + return sciErr; + } + + pStrings = (char**)MALLOC( sizeof(char*) * (_iRows * _iCols) ); + + for (int i = 0; i < (_iRows * _iCols) ; i++) + { + pStrings[i] = wide_string_to_UTF8(_pwstStrings[i]); + } + + SciErr sciErr = createNamedMatrixOfString(_pvCtx, _pstName, _iRows, _iCols, pStrings); + freeArrayOfString(pStrings, _iRows * _iCols); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_WIDE_STRING, _("%s: Unable to create %s named \"%s\""), "createNamedMatrixOfWideString", _("matrix of wide string"), _pstName); + return sciErr; + } + + return sciErr; +} +/*--------------------------------------------------------------------------*/ +SciErr readNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, int* _piwLength, wchar_t** _pwstStrings) +{ + int* piAddr = NULL; + + SciErr sciErr = getVarAddressFromName(_pvCtx, _pstName, &piAddr); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_WIDE_STRING, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfWideString", _pstName); + return sciErr; + } + + sciErr = getMatrixOfWideString(_pvCtx, piAddr, _piRows, _piCols, _piwLength, _pwstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_READ_NAMED_WIDE_STRING, _("%s: Unable to get variable \"%s\""), "readNamedMatrixOfWideString", _pstName); + return sciErr; + } + + return sciErr; +} + +/*shortcut functions*/ +/*--------------------------------------------------------------------------*/ +int isStringType(void* _pvCtx, int* _piAddress) +{ + return checkVarType(_pvCtx, _piAddress, sci_strings); +} +/*--------------------------------------------------------------------------*/ +int isNamedStringType(void* _pvCtx, const char* _pstName) +{ + return checkNamedVarType(_pvCtx, _pstName, sci_strings); +} +/*--------------------------------------------------------------------------*/ +int getAllocatedSingleString(void* _pvCtx, int* _piAddress, char** _pstData) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + int iLen = 0; + + if (isScalar(_pvCtx, _piAddress) == 0 || isStringType(_pvCtx, _piAddress) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_STRING, _("%s: Wrong type for input argument #%d: A single string expected.\n"), "getAllocatedSingleString", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = getMatrixOfString(_pvCtx, _piAddress, &iRows, &iCols, &iLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_STRING, _("%s: Unable to get argument data"), "getAllocatedSingleString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pstData = (char*)MALLOC(sizeof(char) * (iLen + 1)); //+1 for null termination + + sciErr = getMatrixOfString(_pvCtx, _piAddress, &iRows, &iCols, &iLen, _pstData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_STRING, _("%s: Unable to get argument data"), "getAllocatedSingleString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int getAllocatedSingleWideString(void* _pvCtx, int* _piAddress, wchar_t** _pwstData) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + int iLen = 0; + + if (isScalar(_pvCtx, _piAddress) == 0 || isStringType(_pvCtx, _piAddress) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_WIDE_STRING, _("%s: Wrong type for input argument #%d: A single string expected.\n"), "getAllocatedSingleWideString", getRhsFromAddress(_pvCtx, _piAddress)); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = getMatrixOfWideString(_pvCtx, _piAddress, &iRows, &iCols, &iLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_WIDE_STRING, _("%s: Unable to get argument data"), "getAllocatedSingleWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pwstData = (wchar_t*)MALLOC(sizeof(wchar_t) * (iLen + 1)); //+1 for null termination + + sciErr = getMatrixOfWideString(_pvCtx, _piAddress, &iRows, &iCols, &iLen, _pwstData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_SINGLE_WIDE_STRING, _("%s: Unable to get argument data"), "getAllocatedSingleWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, char*** _pstData) +{ + SciErr sciErr = getMatrixOfString(_pvCtx, _piAddress, _piRows, _piCols, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedMatrixOfString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + int* piLen = (int*)MALLOC(sizeof(int) **_piRows **_piCols); + *_pstData = (char**)MALLOC(sizeof(char*) **_piRows **_piCols); + + sciErr = getMatrixOfString(_pvCtx, _piAddress, _piRows, _piCols, piLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedMatrixOfString"); + printError(&sciErr, 0); + if (piLen) + { + FREE(piLen); + piLen = NULL; + } + return sciErr.iErr; + } + + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + (*_pstData)[i] = (char*)MALLOC(sizeof(char) * (piLen[i] + 1));//+1 for null termination + } + + sciErr = getMatrixOfString(_pvCtx, _piAddress, _piRows, _piCols, piLen, *_pstData); + if (piLen) + { + FREE(piLen); + piLen = NULL; + } + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedMatrixOfString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, wchar_t*** _pwstData) +{ + SciErr sciErr = getMatrixOfWideString(_pvCtx, _piAddress, _piRows, _piCols, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_WIDE_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedMatrixOfWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + int* piLen = (int*)MALLOC(sizeof(int) **_piRows **_piCols); + *_pwstData = (wchar_t**)MALLOC(sizeof(wchar_t*) **_piRows **_piCols); + + sciErr = getMatrixOfWideString(_pvCtx, _piAddress, _piRows, _piCols, piLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_WIDE_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedMatrixOfWideString"); + if (piLen) + { + FREE(piLen); + piLen = NULL; + } + if (*_pwstData) + { + FREE(*_pwstData); + *_pwstData = NULL; + } + printError(&sciErr, 0); + return sciErr.iErr; + } + + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + (*_pwstData)[i] = (wchar_t*)MALLOC(sizeof(wchar_t) * (piLen[i] + 1));//+1 for null termination + } + + sciErr = getMatrixOfWideString(_pvCtx, _piAddress, _piRows, _piCols, piLen, *_pwstData); + + if (piLen) + { + FREE(piLen); + piLen = NULL; + } + + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_WIDE_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedMatrixOfWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedNamedSingleString(void* _pvCtx, const char* _pstName, char** _pstData) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + int iLen = 0; + + if (isNamedScalar(_pvCtx, _pstName) == 0 || isNamedStringType(_pvCtx, _pstName) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_SINGLE_STRING, _("%s: Wrong type for input argument \"%s\": A single string expected.\n"), "getAllocatedNamedSingleString", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = readNamedMatrixOfString(_pvCtx, _pstName, &iRows, &iCols, &iLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_SINGLE_STRING, _("%s: Unable to get argument data"), "getAllocatedNamedSingleString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pstData = (char*)MALLOC(sizeof(char) * (iLen + 1)); //+1 for null termination + + sciErr = readNamedMatrixOfString(_pvCtx, _pstName, &iRows, &iCols, &iLen, _pstData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_SINGLE_STRING, _("%s: Unable to get argument data"), "getAllocatedNamedSingleString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedNamedSingleWideString(void* _pvCtx, const char* _pstName, wchar_t** _pwstData) +{ + SciErr sciErr = sciErrInit(); + int iRows = 0; + int iCols = 0; + int iLen = 0; + + if (isNamedScalar(_pvCtx, _pstName) == 0 || isNamedStringType(_pvCtx, _pstName) == 0) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_SINGLE_WIDE_STRING, _("%s: Wrong type for input argument \"%s\": A single string expected.\n"), "getAllocatedNamedSingleWideString", _pstName); + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = readNamedMatrixOfWideString(_pvCtx, _pstName, &iRows, &iCols, &iLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_SINGLE_WIDE_STRING, _("%s: Unable to get argument data"), "getAllocatedNamedSingleWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pwstData = (wchar_t*)MALLOC(sizeof(wchar_t) * (iLen + 1)); //+1 for null termination + + sciErr = readNamedMatrixOfWideString(_pvCtx, _pstName, &iRows, &iCols, &iLen, _pwstData); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_SINGLE_WIDE_STRING, _("%s: Unable to get argument data"), "getAllocatedNamedSingleWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedNamedMatrixOfString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, char*** _pstData) +{ + SciErr sciErr = readNamedMatrixOfString(_pvCtx, _pstName, _piRows, _piCols, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedNamedMatrixOfString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + int* piLen = (int*)MALLOC(sizeof(int) **_piRows **_piCols); + + sciErr = readNamedMatrixOfString(_pvCtx, _pstName, _piRows, _piCols, piLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedNamedMatrixOfString"); + if (piLen) + { + FREE(piLen); + piLen = NULL; + } + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pstData = (char**)MALLOC(sizeof(char*) **_piRows **_piCols); + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + (*_pstData)[i] = (char*)MALLOC(sizeof(char) * (piLen[i] + 1));//+1 for null termination + } + + sciErr = readNamedMatrixOfString(_pvCtx, _pstName, _piRows, _piCols, piLen, *_pstData); + if (piLen) + { + FREE(piLen); + piLen = NULL; + } + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedNamedMatrixOfString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int getAllocatedNamedMatrixOfWideString(void* _pvCtx, const char* _pstName, int* _piRows, int* _piCols, wchar_t*** _pwstData) +{ + int iRows = 0; + int iCols = 0; + int* piLen = 0; + + SciErr sciErr = readNamedMatrixOfWideString(_pvCtx, _pstName, &iRows, &iCols, NULL, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_WIDE_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedNamedMatrixOfWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + piLen = (int*)MALLOC(sizeof(int) **_piRows **_piCols); + + sciErr = readNamedMatrixOfWideString(_pvCtx, _pstName, &iRows, &iCols, piLen, NULL); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_WIDE_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedNamedMatrixOfWideString"); + if (piLen) + { + FREE(piLen); + piLen = NULL; + } + printError(&sciErr, 0); + return sciErr.iErr; + } + + *_pwstData = (wchar_t**)MALLOC(sizeof(wchar_t*) **_piRows **_piCols); + + for (int i = 0 ; i < *_piRows **_piCols ; i++) + { + *_pwstData[i] = (wchar_t*)MALLOC(sizeof(wchar_t) * (piLen[i] + 1));//+1 for null termination + } + + sciErr = readNamedMatrixOfWideString(_pvCtx, _pstName, &iRows, &iCols, piLen, *_pwstData); + if (piLen) + { + FREE(piLen); + piLen = NULL; + } + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_GET_ALLOC_NAMED_WIDE_STRING_MATRIX, _("%s: Unable to get argument data"), "getAllocatedNamedMatrixOfWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createSingleString(void* _pvCtx, int _iVar, const char* _pstStrings) +{ + SciErr sciErr = createMatrixOfString(_pvCtx, _iVar, 1, 1, &_pstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SINGLE_STRING, _("%s: Unable to get argument data"), "createSingleString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} + +int allocSingleString(void* _pvCtx, int _iVar, int _iLen, const char** _pstStrings) +{ + SciErr sciErr = sciErrInit(); + int iNewPos = Top - Rhs + _iVar; + int iAddr = *Lstk(iNewPos); + int* piAddr = NULL; + int* piOffset = NULL; + char* pstString = NULL; + + int iFreeSpace = iadr(*Lstk(Bot)) - (iadr(*Lstk(Top))); + + if (_iLen + 2 > iFreeSpace) + { + addStackSizeError(&sciErr, ((StrCtx*)_pvCtx)->pstName, _iLen + 2); + return sciErr.iErr; + } + + getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr); + + piAddr[0] = sci_strings; + piAddr[1] = 1; + piAddr[2] = 1; + piAddr[3] = 0; + + piOffset = piAddr + 4; + piOffset[0] = 1; //Always 1 + piOffset[1] = _iLen + 1; + pstString = (char*)(piOffset + 2); //2 offsets + + // Fill the string with spaces + memset(pstString, ' ', _iLen); + + updateInterSCI(_iVar, 'c', iAddr, cadr(iadr(iAddr) + 5 + 1)); + updateLstk(iNewPos, sadr(iadr(iAddr) + 5 + 1), (_iLen + 1) / (sizeof(double) / sizeof(int))); + *_pstStrings = pstString; + return 0; +} + +/*--------------------------------------------------------------------------*/ +int createSingleWideString(void* _pvCtx, int _iVar, const wchar_t* _pwstStrings) +{ + SciErr sciErr = createMatrixOfWideString(_pvCtx, _iVar, 1, 1, &_pwstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_SINGLE_WIDE_STRING, _("%s: Unable to get argument data"), "createSingleWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createNamedSingleString(void* _pvCtx, const char* _pstName, const char* _pstStrings) +{ + SciErr sciErr = createNamedMatrixOfString(_pvCtx, _pstName, 1, 1, &_pstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SINGLE_STRING, _("%s: Unable to get argument data"), "createSingleString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +int createNamedSingleWideString(void* _pvCtx, const char* _pstName, const wchar_t* _pwstStrings) +{ + SciErr sciErr = createNamedMatrixOfWideString(_pvCtx, _pstName, 1, 1, &_pwstStrings); + if (sciErr.iErr) + { + addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_SINGLE_WIDE_STRING, _("%s: Unable to get argument data"), "createSingleWideString"); + printError(&sciErr, 0); + return sciErr.iErr; + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedSingleString(char* _pstData) +{ + FREE(_pstData); +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedSingleWideString(wchar_t* _pwstData) +{ + FREE(_pwstData); +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedMatrixOfString(int _iRows, int _iCols, char** _pstData) +{ + for (int i = 0 ; i < _iRows * _iCols ; i++) + { + FREE(_pstData[i]); + } + FREE(_pstData); +} +/*--------------------------------------------------------------------------*/ +void freeAllocatedMatrixOfWideString(int _iRows, int _iCols, wchar_t** _pwstData) +{ + for (int i = 0 ; i < _iRows * _iCols ; i++) + { + FREE(_pwstData[i]); + } + FREE(_pwstData); +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_boolean.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_boolean.lo new file mode 100755 index 000000000..497339e46 --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_boolean.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_boolean.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_boolean.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo new file mode 100755 index 000000000..6beae372e --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_boolean_sparse.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_boolean_sparse.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_common.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_common.lo new file mode 100755 index 000000000..6c7a9e3b4 --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_common.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_common.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_common.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_double.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_double.lo new file mode 100755 index 000000000..247129bd3 --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_double.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_double.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_double.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_error.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_error.lo new file mode 100755 index 000000000..d1f53d82b --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_error.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_error.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_error.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_handle.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_handle.lo new file mode 100755 index 000000000..6c6988883 --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_handle.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_handle.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_handle.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_hypermat.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_hypermat.lo new file mode 100755 index 000000000..204c64124 --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_hypermat.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_hypermat.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_hypermat.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_int.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_int.lo new file mode 100755 index 000000000..3bee0bedd --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_int.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_int.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_int.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_list.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_list.lo new file mode 100755 index 000000000..b63910881 --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_list.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_list.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_list.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_optional.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_optional.lo new file mode 100755 index 000000000..01720c840 --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_optional.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_optional.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_optional.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_pointer.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_pointer.lo new file mode 100755 index 000000000..a7dfa76eb --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_pointer.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_pointer.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_pointer.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_poly.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_poly.lo new file mode 100755 index 000000000..ea91eae4c --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_poly.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_poly.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_poly.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_sparse.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_sparse.lo new file mode 100755 index 000000000..a4e233c9f --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_sparse.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_sparse.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_sparse.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_string.lo b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_string.lo new file mode 100755 index 000000000..eda4ea753 --- /dev/null +++ b/modules/api_scilab/src/cpp/libsciapi_scilab_la-api_string.lo @@ -0,0 +1,12 @@ +# src/cpp/libsciapi_scilab_la-api_string.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciapi_scilab_la-api_string.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11046.c b/modules/api_scilab/tests/nonreg_tests/bug_11046.c new file mode 100755 index 000000000..189c044e2 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11046.c @@ -0,0 +1,14 @@ +#include "api_scilab.h" +#if API_SCILAB_VERSION < 3 +#include "stack-c.h" +#endif +#include "localization.h" +#include "Scierror.h" + +int sci_bug_11046(char *fname) +{ + CheckRhs(0, 0); + sciprint("Overload call macro\n"); // %_myscifun + OverLoad(0); + return 0; +} diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11046.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_11046.dia.ref new file mode 100755 index 000000000..2096f178e --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11046.dia.ref @@ -0,0 +1,43 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11046 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/11046 +// +// <-- Short Description --> +// Sometimes, OverLoad(0) did not call %_xxx but %x_xxx overload +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/bug_11046")); +cd(pathconvert(TMPDIR+"/bug_11046")); +copyfile(SCI+"/modules/api_scilab/tests/nonreg_tests/bug_11046.c",pathconvert(TMPDIR+"/bug_11046/bug_11046.c",%F)); +ilib_build("gw_bug_11046", ["bug_11046", "sci_bug_11046"], "bug_11046.c", []); +exec("loader.sce"); +function %_bug_11046() + disp('OK default overload called.') +endfunction +//call %_myscifun +bug_11046(); +Overload call macro + + OK default overload called. +function [x] = call_overload(a, b) + bug_11046(); + x = 2; +endfunction +function call_overload2(a, b) +endfunction +//try to call %s_bug_11046 +call_overload2(1, call_overload(1,2)); +Overload call macro + + OK default overload called. diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11046.tst b/modules/api_scilab/tests/nonreg_tests/bug_11046.tst new file mode 100755 index 000000000..bd5294aca --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11046.tst @@ -0,0 +1,44 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11046 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/11046 +// +// <-- Short Description --> +// Sometimes, OverLoad(0) did not call %_xxx but %x_xxx overload + +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/bug_11046")); +cd(pathconvert(TMPDIR+"/bug_11046")); +copyfile(SCI+"/modules/api_scilab/tests/nonreg_tests/bug_11046.c",pathconvert(TMPDIR+"/bug_11046/bug_11046.c",%F)); +ilib_build("gw_bug_11046", ["bug_11046", "sci_bug_11046"], "bug_11046.c", []); +exec("loader.sce"); + +function %_bug_11046() + disp('OK default overload called.') +endfunction + +//call %_myscifun +bug_11046(); + + +function [x] = call_overload(a, b) + bug_11046(); + x = 2; +endfunction + +function call_overload2(a, b) +endfunction + +//try to call %s_bug_11046 +call_overload2(1, call_overload(1,2)); diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11093.c b/modules/api_scilab/tests/nonreg_tests/bug_11093.c new file mode 100755 index 000000000..dc373c6e4 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11093.c @@ -0,0 +1,43 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +#include <stdlib.h> +#include <api_scilab.h> +#include <Scierror.h> +#include <MALLOC.h> +#include <localization.h> +// ============================================================================= +int sci_bug_11093(char *fname) +{ + SciErr sciErr; + int* piAddr = NULL; + char* pstName = NULL; + int iRet = 0; + + checkInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + + if (getAllocatedSingleString(pvApiCtx, piAddr, &pstName)) + { + return 1; + } + + iRet = isNamedVarExist(pvApiCtx, pstName); + FREE(pstName); + + createScalarBoolean(pvApiCtx, Rhs + 1, iRet); + LhsVar(1) = Rhs + 1; + return 0; +} +// ============================================================================= diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11093.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_11093.dia.ref new file mode 100755 index 000000000..843279430 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11093.dia.ref @@ -0,0 +1,32 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// <-- Non-regression test for bug 7242 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7242 +// +// <-- Short Description --> +// Check name is already used by a variable +// or un function ( built-in or macro ) +BUGNAME = "bug_11093"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".c"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".c", DEST); + assert_checkequal(isfile(DEST), %T); + gw_functions = [BUGNAME, "sci_" + BUGNAME]; + ilib_build("lib" + BUGNAME, gw_functions, BUGNAME + ".c", []); + exec loader.sce; + execstr("a = " + BUGNAME + "(""cos"")", "errcatch"); + assert_checktrue(a); + execstr("b = " + BUGNAME + "(""myFunctionThatNotExist"")", "errcatch"); + assert_checkfalse(b); +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11093.tst b/modules/api_scilab/tests/nonreg_tests/bug_11093.tst new file mode 100755 index 000000000..17c2ae1f4 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11093.tst @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 7242 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7242 +// +// <-- Short Description --> +// Check name is already used by a variable +// or un function ( built-in or macro ) + +BUGNAME = "bug_11093"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".c"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".c", DEST); + assert_checkequal(isfile(DEST), %T); + + gw_functions = [BUGNAME, "sci_" + BUGNAME]; + + ilib_build("lib" + BUGNAME, gw_functions, BUGNAME + ".c", []); + exec loader.sce; + execstr("a = " + BUGNAME + "(""cos"")", "errcatch"); + assert_checktrue(a); + execstr("b = " + BUGNAME + "(""myFunctionThatNotExist"")", "errcatch"); + assert_checkfalse(b); +end
\ No newline at end of file diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11106.c b/modules/api_scilab/tests/nonreg_tests/bug_11106.c new file mode 100755 index 000000000..2fb1fe9ba --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11106.c @@ -0,0 +1,63 @@ +/* ========================================================================== */ +/* bug 8587 */ +/* Allan CORNET - 2010 - DIGITEO */ +/* ========================================================================== */ +#include <api_scilab.h> +#include <Scierror.h> +#include <MALLOC.h> +/* ========================================================================== */ +int sci_bug_11106(char *fname) +{ + int* piAddr = NULL; + char pstRet[64]; + + getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + + if (isStringType(pvApiCtx, piAddr)) + { + //named check + char* pstVar = NULL; + getAllocatedSingleString(pvApiCtx, piAddr, &pstVar); + + if (isNamedListType(pvApiCtx, pstVar)) + { + sprintf(pstRet, "%s", "isNamedList"); + } + else if (isNamedTListType(pvApiCtx, pstVar)) + { + sprintf(pstRet, "%s", "isNamedTList"); + } + else if (isNamedMListType(pvApiCtx, pstVar)) + { + sprintf(pstRet, "%s", "isNamedMList"); + } + else + { + sprintf(pstRet, "%s", "unmanaged named type"); + } + FREE(pstVar); + } + else + { + if (isListType(pvApiCtx, piAddr)) + { + sprintf(pstRet, "%s", "isList"); + } + else if (isTListType(pvApiCtx, piAddr)) + { + sprintf(pstRet, "%s", "isTList"); + } + else if (isMListType(pvApiCtx, piAddr)) + { + sprintf(pstRet, "%s", "isMList"); + } + else + { + sprintf(pstRet, "%s", "unmanaged type"); + } + } + createSingleString(pvApiCtx, Rhs + 1, pstRet); + LhsVar(1) = Rhs + 1; + return 0; +} +/* ========================================================================== */ diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11106.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_11106.dia.ref new file mode 100755 index 000000000..f084a72c2 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11106.dia.ref @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11106 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11106 +// +// <-- Short Description --> +ilib_verbose(0); +test_path = get_absolute_file_path('bug_11106.tst'); +currentpath = pwd(); +cd TMPDIR; +mkdir('bug_11106'); +cd('bug_11106'); +copyfile(SCI+'/modules/api_scilab/tests/nonreg_tests/bug_11106.c' , 'bug_11106.c'); +files = ['bug_11106.c']; +ilib_build('lib_bug_11106', ['bug_11106', 'sci_bug_11106'], files, []); +exec loader.sce; +chdir(currentpath); +a = list(); +b = tlist("test"); +c = mlist("test"); +d = 1; +assert_checkequal(bug_11106(a), "isList"); +assert_checkequal(bug_11106(b), "isTList"); +assert_checkequal(bug_11106(c), "isMList"); +assert_checkequal(bug_11106(d), "unmanaged type"); +assert_checkequal(bug_11106("a"), "isNamedList"); +assert_checkequal(bug_11106("b"), "isNamedTList"); +assert_checkequal(bug_11106("c"), "isNamedMList"); +assert_checkequal(bug_11106("d"), "unmanaged named type"); diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11106.tst b/modules/api_scilab/tests/nonreg_tests/bug_11106.tst new file mode 100755 index 000000000..6dd8590fa --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11106.tst @@ -0,0 +1,45 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11106 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11106 +// +// <-- Short Description --> + +ilib_verbose(0); +test_path = get_absolute_file_path('bug_11106.tst'); +currentpath = pwd(); +cd TMPDIR; +mkdir('bug_11106'); +cd('bug_11106'); +copyfile(SCI+'/modules/api_scilab/tests/nonreg_tests/bug_11106.c' , 'bug_11106.c'); + +files = ['bug_11106.c']; +ilib_build('lib_bug_11106', ['bug_11106', 'sci_bug_11106'], files, []); +exec loader.sce; +chdir(currentpath); + +a = list(); +b = tlist("test"); +c = mlist("test"); +d = 1; + +assert_checkequal(bug_11106(a), "isList"); +assert_checkequal(bug_11106(b), "isTList"); +assert_checkequal(bug_11106(c), "isMList"); +assert_checkequal(bug_11106(d), "unmanaged type"); + +assert_checkequal(bug_11106("a"), "isNamedList"); +assert_checkequal(bug_11106("b"), "isNamedTList"); +assert_checkequal(bug_11106("c"), "isNamedMList"); +assert_checkequal(bug_11106("d"), "unmanaged named type"); + + diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11461.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_11461.dia.ref new file mode 100755 index 000000000..50fc0ef5f --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11461.dia.ref @@ -0,0 +1,25 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11461 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11461 +// +// <-- Short Description --> +// +// api_list was not able to create lists and sub lists with undefined items +listRef = list(); +listRef(1) = 1; +listRef(4) = list(1,2,3); +listRef(5) = 1; +myList = listRef; +export_to_hdf5(TMPDIR + "/test.sod", "myList"); +clear myList; +import_from_hdf5(TMPDIR + "/test.sod"); +assert_checkequal(listRef, myList); diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11461.tst b/modules/api_scilab/tests/nonreg_tests/bug_11461.tst new file mode 100755 index 000000000..e2c5c9d70 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11461.tst @@ -0,0 +1,27 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11461 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11461 +// +// <-- Short Description --> +// +// api_list was not able to create lists and sub lists with undefined items + +listRef = list(); +listRef(1) = 1; +listRef(4) = list(1,2,3); +listRef(5) = 1; +myList = listRef; +export_to_hdf5(TMPDIR + "/test.sod", "myList"); +clear myList; +import_from_hdf5(TMPDIR + "/test.sod"); +assert_checkequal(listRef, myList); + diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11538.c b/modules/api_scilab/tests/nonreg_tests/bug_11538.c new file mode 100755 index 000000000..6eee1eb6b --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11538.c @@ -0,0 +1,49 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS + * + * 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 + * + * Please note that piece of code will be rewrited for the Scilab 6 family + * However, the API (profile of the functions in the header files) will be + * still available and supported in Scilab 6. + */ + +#include "api_scilab.h" + +int sci_bug_11538(char* fname, int length) +{ + SciErr sciErr; + int* piAddr = NULL; + wchar_t* pwstData = NULL; + char* pstData = NULL; + + CheckRhs(1, 1); + CheckLhs(1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + if (getAllocatedSingleString(pvApiCtx, piAddr, &pstData)) + { + Scierror(999, "Failed to get data as ascii string"); + return 1; + } + + if (getAllocatedSingleWideString(pvApiCtx, piAddr, &pwstData)) + { + Scierror(999, "Failed to get data as wide string"); + return 1; + } + + LhsVar(0) = 1; + return 0; +} diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11538.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_11538.dia.ref new file mode 100755 index 000000000..ee4b190d1 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11538.dia.ref @@ -0,0 +1,31 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11538 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/11538 +// +// <-- Short Description --> +// check failed of to_wide_string function in WideString functions +// The conversion does not fail under Windows do we can not check that we have an error +if getos() <> "Windows" then + ilib_verbose(0); + test_path = get_absolute_file_path('bug_11538.tst'); + currentpath = pwd(); + cd TMPDIR; + mkdir('bug_11538'); + cd('bug_11538'); + copyfile(SCI+'/modules/api_scilab/tests/nonreg_tests/bug_11538.c' , 'bug_11538.c'); + ilib_build('gw_bug_11538', ['bug_11538', 'sci_bug_11538'], 'bug_11538.c', []); + exec loader.sce; + ierr = execstr("bug_11538(""abs"")", "errcatch"); + assert_checktrue(ierr == 0); + ierr = execstr("bug_11538(ascii(190:210))", "errcatch"); + assert_checkfalse(ierr == 0); +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_11538.tst b/modules/api_scilab/tests/nonreg_tests/bug_11538.tst new file mode 100755 index 000000000..3566d7333 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_11538.tst @@ -0,0 +1,33 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 11538 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/11538 +// +// <-- Short Description --> +// check failed of to_wide_string function in WideString functions + +// The conversion does not fail under Windows do we can not check that we have an error +if getos() <> "Windows" then + ilib_verbose(0); + test_path = get_absolute_file_path('bug_11538.tst'); + currentpath = pwd(); + cd TMPDIR; + mkdir('bug_11538'); + cd('bug_11538'); + copyfile(SCI+'/modules/api_scilab/tests/nonreg_tests/bug_11538.c' , 'bug_11538.c'); + ilib_build('gw_bug_11538', ['bug_11538', 'sci_bug_11538'], 'bug_11538.c', []); + exec loader.sce; + + ierr = execstr("bug_11538(""abs"")", "errcatch"); + assert_checktrue(ierr == 0); + ierr = execstr("bug_11538(ascii(190:210))", "errcatch"); + assert_checkfalse(ierr == 0); +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_12426.tst b/modules/api_scilab/tests/nonreg_tests/bug_12426.tst new file mode 100755 index 000000000..8d2df4131 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_12426.tst @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Simon MARCHETTO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- INTERACTIVE TEST --> +// +// <-- Non-regression test for bug 12426 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12426 +// +// <-- Short Description --> +// By using addErrorMessage, random string error can be displayed. + +// exec SCI/modules/api_scilab/tests/nonreg_tests/bug_12426.tst +ilib_verbose(0); +directory = get_absolute_file_path("bug_12426.tst"); +exec(directory + "/build_bug_12426_gateway.sce"); +exec(TMPDIR + "/bug_12426_gateway/loader.sce"); + +n = int32(1); +disp("add 1 error message"); +addErrorMessage(n); + +n = int32(4); +disp("add 4 error messages"); +addErrorMessage(n); + +n = int32(5); +disp("add 5 error messages"); +addErrorMessage(n); + +n = int32(6); +disp("add 6 error messages"); +addErrorMessage(n); diff --git a/modules/api_scilab/tests/nonreg_tests/bug_7242.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_7242.dia.ref new file mode 100755 index 000000000..ab98adb74 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_7242.dia.ref @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// <-- Non-regression test for bug 7242 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7242 +// +// <-- Short Description --> +// API was unable to retrieve named variable address +// when variable name is passed in argument of function +function result = myExport(data, filepath) + result = export_to_hdf5(filepath, "data"); +endfunction +myData = "blam"; +myFile = TMPDIR + "/myFile.sod"; +if ~myExport(myData, myFile) then bugmes();quit;end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_7242.tst b/modules/api_scilab/tests/nonreg_tests/bug_7242.tst new file mode 100755 index 000000000..e051c2c65 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_7242.tst @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 7242 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=7242 +// +// <-- Short Description --> +// API was unable to retrieve named variable address +// when variable name is passed in argument of function + +function result = myExport(data, filepath) + result = export_to_hdf5(filepath, "data"); +endfunction + +myData = "blam"; +myFile = TMPDIR + "/myFile.sod"; + +if ~myExport(myData, myFile) then pause,end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_7409.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_7409.dia.ref new file mode 100755 index 000000000..60dc3b4b7 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_7409.dia.ref @@ -0,0 +1,34 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - Artem GLEBOV +// Copyright (C) 2011 - DIGITEO - Sylvestre Ledru +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 7409 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/7409 +// +// <-- Short Description --> +// +BUGNAME = "sci_empty_test"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".cpp"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".cpp", DEST); + assert_checkequal(isfile(DEST), %T); + ilib_build("lib" + BUGNAME,[BUGNAME, BUGNAME], BUGNAME + ".cpp", []); + exec loader.sce; + [a,b]=sci_empty_test(); + assert_checkequal(a,[]); + assert_checkequal(b,[]); +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_7409.tst b/modules/api_scilab/tests/nonreg_tests/bug_7409.tst new file mode 100755 index 000000000..dab8063e9 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_7409.tst @@ -0,0 +1,36 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - Artem GLEBOV +// Copyright (C) 2011 - DIGITEO - Sylvestre Ledru +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 7409 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/7409 +// +// <-- Short Description --> +// + +BUGNAME = "sci_empty_test"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".cpp"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".cpp", DEST); + assert_checkequal(isfile(DEST), %T); + ilib_build("lib" + BUGNAME,[BUGNAME, BUGNAME], BUGNAME + ".cpp", []); + exec loader.sce; + [a,b]=sci_empty_test(); + assert_checkequal(a,[]); + assert_checkequal(b,[]); +end + diff --git a/modules/api_scilab/tests/nonreg_tests/bug_8587.c b/modules/api_scilab/tests/nonreg_tests/bug_8587.c new file mode 100755 index 000000000..18c327cc6 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_8587.c @@ -0,0 +1,49 @@ +/* ========================================================================== */ +/* bug 8587 */ +/* Allan CORNET - 2010 - DIGITEO */ +/* ========================================================================== */ +#include <api_scilab.h> +#include <BOOL.h> +#include <Scierror.h> +#include <MALLOC.h> +/* ========================================================================== */ +int sci_readDoubles(char *fname) +{ +#define NAME_MATRIX_TO_READ "REF_TEST_MATRIX" +#define REF_SIZE_COLS 3 +#define REF_SIZE_ROWS 2 + SciErr sciErr; + int nbRow = 0; + int nbCol = 0; + double * matrixOfDouble = NULL; + + sciErr = readNamedMatrixOfDouble(pvApiCtx, NAME_MATRIX_TO_READ, &nbRow, &nbCol , NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + } + + if ((nbRow != REF_SIZE_ROWS) || (nbCol != REF_SIZE_COLS)) + { + Scierror(999, "%s: Wrong size for input argument #%s.\n", fname, NAME_MATRIX_TO_READ); + return 0; + } + + matrixOfDouble = (double*)MALLOC((nbRow * nbCol) * sizeof(double)); + + sciErr = readNamedMatrixOfDouble(pvApiCtx, NAME_MATRIX_TO_READ, &nbRow, &nbCol, matrixOfDouble); + if (sciErr.iErr) + { + printError(&sciErr, 0); + } + + sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, nbRow, nbCol, matrixOfDouble); + if (sciErr.iErr) + { + printError(&sciErr, 0); + } + + LhsVar(1) = Rhs + 1; + return 0; +} +/* ========================================================================== */ diff --git a/modules/api_scilab/tests/nonreg_tests/bug_8587.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_8587.dia.ref new file mode 100755 index 000000000..231101745 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_8587.dia.ref @@ -0,0 +1,32 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 8587 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8587 +// +// <-- Short Description --> +// readNamedMatrixOfDouble (readCommonNamedMatrixOfDouble) returned wrong values +ilib_verbose(0); +currentpath = pwd(); +cd TMPDIR; +mkdir('bug_8587'); +TEST_DIR = TMPDIR + filesep() + 'bug_8587'; +copyfile(SCI+'/modules/api_scilab/tests/nonreg_tests/bug_8587.c' , TEST_DIR + filesep() + 'bug_8587.c'); +chdir(TEST_DIR); +files = ['bug_8587.c']; +ilib_build('lib_bug_8587', ['readDoubles', 'sci_readDoubles'], files, []); +exec loader.sce; +chdir(currentpath); +REF_TEST_MATRIX = [1 2 3; 4 5 6]; +REF_TEST_MATRIX_COPY = [1 2 3; 4 5 6]; +if execstr("result = readDoubles()", "errcatch") <> 0 then bugmes();quit;end +if ~or(REF_TEST_MATRIX_COPY == REF_TEST_MATRIX) then bugmes();quit;end +if ~or(result == REF_TEST_MATRIX) then bugmes();quit;end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_8587.tst b/modules/api_scilab/tests/nonreg_tests/bug_8587.tst new file mode 100755 index 000000000..3e60a1aae --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_8587.tst @@ -0,0 +1,33 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 8587 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8587 +// +// <-- Short Description --> +// readNamedMatrixOfDouble (readCommonNamedMatrixOfDouble) returned wrong values + +ilib_verbose(0); +currentpath = pwd(); +cd TMPDIR; +mkdir('bug_8587'); +TEST_DIR = TMPDIR + filesep() + 'bug_8587'; +copyfile(SCI+'/modules/api_scilab/tests/nonreg_tests/bug_8587.c' , TEST_DIR + filesep() + 'bug_8587.c'); +chdir(TEST_DIR); +files = ['bug_8587.c']; +ilib_build('lib_bug_8587', ['readDoubles', 'sci_readDoubles'], files, []); +exec loader.sce; +chdir(currentpath); +REF_TEST_MATRIX = [1 2 3; 4 5 6]; +REF_TEST_MATRIX_COPY = [1 2 3; 4 5 6]; +if execstr("result = readDoubles()", "errcatch") <> 0 then pause, end +if ~or(REF_TEST_MATRIX_COPY == REF_TEST_MATRIX) then pause, end +if ~or(result == REF_TEST_MATRIX) then pause, end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_8688.c b/modules/api_scilab/tests/nonreg_tests/bug_8688.c new file mode 100755 index 000000000..57e5018f5 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_8688.c @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +#include <stdlib.h> +#include <api_scilab.h> +#include <Scierror.h> +#include <MALLOC.h> +#include <localization.h> + +int sci_bug_8688(char *fname) +{ + SciErr sciErr; + int N = 20000000; + char **ptrStrs = (char **)MALLOC(sizeof(char*) * N); + int i = 0; + + if (ptrStrs == NULL) + { + Scierror(999, "memory allocation error"); + } + + for (i = 0; i < N; i++) + { + ptrStrs[i] = strdup("TEST BUG 8688."); + } + + sciErr = createMatrixOfString(pvApiCtx, Rhs + 1, 1, N, ptrStrs); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + LhsVar(1) = 1; + return 0; +} +// ============================================================================= diff --git a/modules/api_scilab/tests/nonreg_tests/bug_8688.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_8688.dia.ref new file mode 100755 index 000000000..fc69e603d --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_8688.dia.ref @@ -0,0 +1,29 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 8688 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/8688 +// +// <-- Short Description --> +// fillMatrixOfString did not check available memory on stack. +BUGNAME = "bug_8688"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".c"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".c", DEST); + assert_checkequal(isfile(DEST), %T); + ilib_build("lib" + BUGNAME,[BUGNAME,"sci_" + BUGNAME], BUGNAME + ".c", []); + exec loader.sce; + assert_checkequal(execstr("bug_8688()", "errcatch"), 0); +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_8688.tst b/modules/api_scilab/tests/nonreg_tests/bug_8688.tst new file mode 100755 index 000000000..568a26982 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_8688.tst @@ -0,0 +1,31 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 8688 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/8688 +// +// <-- Short Description --> +// fillMatrixOfString did not check available memory on stack. + +BUGNAME = "bug_8688"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".c"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".c", DEST); + assert_checkequal(isfile(DEST), %T); + ilib_build("lib" + BUGNAME,[BUGNAME,"sci_" + BUGNAME], BUGNAME + ".c", []); + exec loader.sce; + assert_checkequal(execstr("bug_8688()", "errcatch"), 0); +end + diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9264.c b/modules/api_scilab/tests/nonreg_tests/bug_9264.c new file mode 100755 index 000000000..a590346b8 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9264.c @@ -0,0 +1,90 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +#include <stdlib.h> +#include "api_scilab.h" +#include "Scierror.h" +#include "MALLOC.h" +#include "localization.h" + +// ============================================================================= +// The aim of this function is just to retrieve from the stack an array of strings +// to test the speed of the function getMatrixOfString. +// ============================================================================= +int sci_bug9264(char *fname) +{ + SciErr err; + int *piAddressVarOne = NULL; + int rows = 0, cols = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + err = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne); + if (err.iErr) + { + printError(&err, 0); + return 0; + } + + if (isStringType(pvApiCtx, piAddressVarOne)) + { + int i = 0; + int size = 0; + int* lengths = NULL; + char **str = NULL; + + err = getVarDimension(pvApiCtx, piAddressVarOne, &rows, &cols); + if (err.iErr) + { + printError(&err, 0); + return -1; + } + + if (rows < 1 || cols < 1) + { + Scierror(999, _("%s: Wrong size for input argument #%d.\n"), fname, 1); + return 0; + } + + size = rows * cols; + lengths = (int*)MALLOC(sizeof(int) * size); + if (!lengths) + { + Scierror(999, _("%s: No more memory.\n"), fname); + return 0; + } + + err = getMatrixOfString(pvApiCtx, piAddressVarOne, &rows, &cols, lengths, NULL); + if (err.iErr) + { + FREE(lengths); + printError(&err, 0); + return 0; + } + + str = (char**)MALLOC(sizeof(char*) * size); + for (; i < size; i++) + { + str[i] = (char*)MALLOC(sizeof(char) * (lengths[i] + 1)); + if (str[i] == NULL) + { + freeArrayOfString(str, i); + Scierror(999, _("%s: No more memory.\n"), fname); + return 0; + } + } + + err = getMatrixOfString(pvApiCtx, piAddressVarOne, &rows, &cols, lengths, str); + + FREE(lengths); + freeArrayOfString(str, size); + } + + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9264.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_9264.dia.ref new file mode 100755 index 000000000..ba151f161 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9264.dia.ref @@ -0,0 +1,32 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 9264 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/9264 +// +// <-- Short Description --> +// Big loss of performance on mputl +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir("bug_9264"); + cd("bug_9264"); + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/bug_9264.c", TMPDIR + "/bug_9264/bug_9264.c"); + if ~isfile(TMPDIR + "/bug_9264/bug_9264.c") then bugmes();quit;end + ilib_build("build_c",["bug9264","sci_bug9264"], "bug_9264.c", []); + exec loader.sce; + M = string(rand(200,1000)); + tic(); + bug9264(M); + T = toc(); + // More than 2 seconds to read a matrix is not normal + if T > 2 then bugmes();quit;end +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9264.tst b/modules/api_scilab/tests/nonreg_tests/bug_9264.tst new file mode 100755 index 000000000..07cb81758 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9264.tst @@ -0,0 +1,33 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 9264 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/9264 +// +// <-- Short Description --> +// Big loss of performance on mputl + +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir("bug_9264"); + cd("bug_9264"); + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/bug_9264.c", TMPDIR + "/bug_9264/bug_9264.c"); + if ~isfile(TMPDIR + "/bug_9264/bug_9264.c") then pause, end + ilib_build("build_c",["bug9264","sci_bug9264"], "bug_9264.c", []); + exec loader.sce; + + M = string(rand(200,1000)); + tic(); + bug9264(M); + T = toc(); + // More than 2 seconds to read a matrix is not normal + if T > 2 then pause, end +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9707.c b/modules/api_scilab/tests/nonreg_tests/bug_9707.c new file mode 100755 index 000000000..988e5f5f7 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9707.c @@ -0,0 +1,84 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +#include <stdlib.h> +#include <api_scilab.h> +#include <Scierror.h> +#include <MALLOC.h> +#include <localization.h> +// ============================================================================= +int sci_bug_9707_1(char *fname) +{ + SciErr sciErr; + const char varname[] = "1"; + + + sciErr = createNamedMatrixOfString(pvApiCtx, varname, 1, 1, &fname); + if (sciErr.iErr) + { + printError(&sciErr, 0); + Scierror(999, _("%s: Invalid variable name.\n"), fname); + } + return 0; +} +// ============================================================================= +int sci_bug_9707_2(char *fname) +{ + SciErr sciErr; + const char varname[] = ""; + + sciErr = createNamedMatrixOfString(pvApiCtx, varname, 1, 1, &fname); + if (sciErr.iErr) + { + printError(&sciErr, 0); + Scierror(999, _("%s: Invalid variable name.\n"), fname); + } + return 0; +} +// ============================================================================= +int sci_bug_9707_3(char *fname) +{ + SciErr sciErr; + const char varname[] = " "; + + sciErr = createNamedMatrixOfString(pvApiCtx, varname, 1, 1, &fname); + if (sciErr.iErr) + { + printError(&sciErr, 0); + Scierror(999, _("%s: Invalid variable name.\n"), fname); + } + return 0; +} +// ============================================================================= +int sci_bug_9707_4(char *fname) +{ + SciErr sciErr; + const char varname[] = "Scilab Variable"; + + sciErr = createNamedMatrixOfString(pvApiCtx, varname, 1, 1, &fname); + if (sciErr.iErr) + { + printError(&sciErr, 0); + Scierror(999, _("%s: Invalid variable name.\n"), fname); + } + return 0; +} +// ============================================================================= +int sci_bug_9707_OK(char *fname) +{ + SciErr sciErr; + const char varname[] = "VAR_9707"; + + sciErr = createNamedMatrixOfString(pvApiCtx, varname, 1, 1, &fname); + if (sciErr.iErr) + { + printError(&sciErr, 0); + Scierror(999, _("%s: Invalid variable name.\n"), fname); + } + return 0; +} +// ============================================================================= diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9707.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_9707.dia.ref new file mode 100755 index 000000000..ed0ea865d --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9707.dia.ref @@ -0,0 +1,41 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 9707 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/9707 +// +// <-- Short Description --> +// createNamedXXX did not check variable name +BUGNAME = "bug_9707"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".c"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".c", DEST); + assert_checkequal(isfile(DEST), %T); + gw_functions = [BUGNAME+ "_1","sci_" + BUGNAME + "_1"; + BUGNAME+ "_2","sci_" + BUGNAME + "_2"; + BUGNAME+ "_3","sci_" + BUGNAME + "_3"; + BUGNAME+ "_4","sci_" + BUGNAME + "_4"; + BUGNAME+ "_OK","sci_" + BUGNAME + "_OK"]; + ilib_build("lib" + BUGNAME, gw_functions, BUGNAME + ".c", []); + exec loader.sce; + assert_checkequal(execstr("bug_9707_1()", "errcatch"), 999); + assert_checkequal(execstr("bug_9707_2()", "errcatch"), 999); + assert_checkequal(execstr("bug_9707_3()", "errcatch"), 999); + assert_checkequal(execstr("bug_9707_4()", "errcatch"), 999); + assert_checkequal(execstr("bug_9707_OK()", "errcatch"), 0); + assert_checkequal(VAR_9707 == "bug_9707_OK", %t); +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9707.tst b/modules/api_scilab/tests/nonreg_tests/bug_9707.tst new file mode 100755 index 000000000..1a08a0fe0 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9707.tst @@ -0,0 +1,44 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 9707 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/9707 +// +// <-- Short Description --> +// createNamedXXX did not check variable name + +BUGNAME = "bug_9707"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".c"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".c", DEST); + assert_checkequal(isfile(DEST), %T); + + gw_functions = [BUGNAME+ "_1","sci_" + BUGNAME + "_1"; + BUGNAME+ "_2","sci_" + BUGNAME + "_2"; + BUGNAME+ "_3","sci_" + BUGNAME + "_3"; + BUGNAME+ "_4","sci_" + BUGNAME + "_4"; + BUGNAME+ "_OK","sci_" + BUGNAME + "_OK"]; + + ilib_build("lib" + BUGNAME, gw_functions, BUGNAME + ".c", []); + exec loader.sce; + assert_checkequal(execstr("bug_9707_1()", "errcatch"), 999); + assert_checkequal(execstr("bug_9707_2()", "errcatch"), 999); + assert_checkequal(execstr("bug_9707_3()", "errcatch"), 999); + assert_checkequal(execstr("bug_9707_4()", "errcatch"), 999); + assert_checkequal(execstr("bug_9707_OK()", "errcatch"), 0); + assert_checkequal(VAR_9707 == "bug_9707_OK", %t); +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9708.c b/modules/api_scilab/tests/nonreg_tests/bug_9708.c new file mode 100755 index 000000000..52e73ee0f --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9708.c @@ -0,0 +1,30 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +#include <stdlib.h> +#include <api_scilab.h> +#include <Scierror.h> +#include <MALLOC.h> +#include <localization.h> + +int sci_bug_9708(char *fname) +{ + SciErr sciErr; + const char varname[] = "iputhereavariabletoolongforscilabandthereisnoerror"; + + sciErr = createNamedMatrixOfString(pvApiCtx, varname, 1, 1, &varname); + if (sciErr.iErr) + { + printError(&sciErr, 0); + Scierror(999, _("%s: Invalid variable name.\n"), fname); + return 0; + } + + LhsVar(1) = 1; + return 0; +} +// ============================================================================= diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9708.dia.ref b/modules/api_scilab/tests/nonreg_tests/bug_9708.dia.ref new file mode 100755 index 000000000..03f8f020b --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9708.dia.ref @@ -0,0 +1,31 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 9708 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/9708 +// +// <-- Short Description --> +// createNamedXXX did not check length of variable name +BUGNAME = "bug_9708"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".c"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".c", DEST); + assert_checkequal(isfile(DEST), %T); + ilib_build("lib" + BUGNAME,[BUGNAME,"sci_" + BUGNAME], BUGNAME + ".c", []); + exec loader.sce; + assert_checkequal(execstr("bug_9708()", "errcatch"), 999); +end diff --git a/modules/api_scilab/tests/nonreg_tests/bug_9708.tst b/modules/api_scilab/tests/nonreg_tests/bug_9708.tst new file mode 100755 index 000000000..d2548e174 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/bug_9708.tst @@ -0,0 +1,33 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 9708 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/9708 +// +// <-- Short Description --> +// createNamedXXX did not check length of variable name + +BUGNAME = "bug_9708"; +ilib_verbose(0); +if haveacompiler() then + cd TMPDIR; + mkdir(BUGNAME); + cd(BUGNAME); + DEST = TMPDIR + "/" + BUGNAME + "/" + BUGNAME + ".c"; + copyfile(SCI + "/modules/api_scilab/tests/nonreg_tests/" + BUGNAME + ".c", DEST); + assert_checkequal(isfile(DEST), %T); + ilib_build("lib" + BUGNAME,[BUGNAME,"sci_" + BUGNAME], BUGNAME + ".c", []); + exec loader.sce; + assert_checkequal(execstr("bug_9708()", "errcatch"), 999); +end + diff --git a/modules/api_scilab/tests/nonreg_tests/build_bug_12426_gateway.sce b/modules/api_scilab/tests/nonreg_tests/build_bug_12426_gateway.sce new file mode 100755 index 000000000..01a8f34c6 --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/build_bug_12426_gateway.sce @@ -0,0 +1,59 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Simon MARCHETTO +// +// 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 + +gatewayName = "bug_12426_gateway"; +lib1 = "api_scilab"; +lib1include = SCI + "/modules/" + lib1 + "/includes"; +func1 = "addErrorMessage"; + +previous_dir = pwd(); +cd(get_absolute_file_path("build_" + gatewayName + ".sce")); +current_dir = pwd(); +mkdir(TMPDIR + "/" + gatewayName); +cd(TMPDIR + "/" + gatewayName); + +ilib_name = gatewayName; +files = ["sci_" + func1 + ".c"]; + +for i = 1 : size(files, "*") + copyfile(current_dir + "/" + files(i), TMPDIR + "/" + gatewayName); +end + +if getos() == "Windows" then + libs = SCI + "/bin/" + lib1; + cflags = "-I " + lib1include; + +elseif isdir(lib1include) + // Unix source version + libs = SCI + "/modules/" + lib1 + "/.libs/libsci" + lib1; + cflags = "-I " + lib1include; +else + // Unix binary version + SCI_LIB = strsubst(SCI,"/share\/scilab$/", "lib/scilab", "r"); + SCI_INCLUDE = strsubst(SCI,"/share\/scilab$/", "include/scilab", "r"); + libs = SCI_LIB + "/libscilab-cli"; + cflags = "-I " + SCI_INCLUDE; +end + +// name known in scilab, C function called +table = [func1, "sci_" + func1]; + +ilib_build(ilib_name, table, files, libs, [], "", cflags); + +cd(previous_dir); + +clear ilib_build; +clear table; +clear libs; +clear files; +clear ilib_name; +clear previous_dir; +clear gateway_c_dir; +clear SCI_LIB; +clear SCI_INCLUDE; diff --git a/modules/api_scilab/tests/nonreg_tests/sci_addErrorMessage.c b/modules/api_scilab/tests/nonreg_tests/sci_addErrorMessage.c new file mode 100755 index 000000000..c9ca6809a --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/sci_addErrorMessage.c @@ -0,0 +1,55 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) Scilab Enterprises - 2013 - Simon MARCHETTO +* +* 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 +* +*/ + +#include <stdio.h> +#include "api_scilab.h" +#include "api_int.h" + +/*--------------------------------------------------------------------------*/ +int sci_addErrorMessage(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int *piAddressVarOne = NULL; + int errorMessageCount = 0; + sciErr.iMsgCount = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne); + if (!sciErr.iErr) + { + if (isIntegerType(pvApiCtx, piAddressVarOne)) + { + if (!getScalarInteger32(pvApiCtx, piAddressVarOne, + &errorMessageCount)) + { + ; + } + { + SciErr sciErr; + char errMsg[100]; + int i = 0; + sciErr.iMsgCount = 0; + + for (i = 1; i <= errorMessageCount; i++) + { + sprintf(errMsg, "Error %d", i); + addErrorMessage(&sciErr, 999, errMsg); + } + printError(&sciErr, 0); + + return -1; + } + } + } + return -1; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/api_scilab/tests/nonreg_tests/sci_empty_test.cpp b/modules/api_scilab/tests/nonreg_tests/sci_empty_test.cpp new file mode 100755 index 000000000..4cb54645f --- /dev/null +++ b/modules/api_scilab/tests/nonreg_tests/sci_empty_test.cpp @@ -0,0 +1,62 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Artem GLEBOV <aglebov@acm.org> + * + * 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 + * + */ + +/* ==================================================================== */ +extern "C" +{ +#include "api_scilab.h" +#include "Scierror.h" + + /** + * The gateway function for soap_servers() + * @param[in] fname the name of the file for the error messages + * @return 0 if successful, a negative value otherwise + */ + int sci_empty_test(char *fname) + { + SciErr sciErr; + + // allocate memory for values + double dOut = 0; + char *cOut = "zero"; + + // this function does not take input arguments + CheckInputArgument(pvApiCtx, 0, 0); + + // the number of output arguments must be 2 + CheckOutputArgument(pvApiCtx, 2, 2); + + // create results on stack + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 0, 0, &dOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 0, 0, &cOut); + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + + return 0; + } + /* ==================================================================== */ +} /* extern "C" */ + +/* ==================================================================== */ diff --git a/modules/api_scilab/tests/unit_tests/booleanExample.c b/modules/api_scilab/tests/unit_tests/booleanExample.c new file mode 100755 index 000000000..7d6d060f4 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/booleanExample.c @@ -0,0 +1,81 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "MALLOC.h" + +int booleanExample(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + //CheckInputArgument(pvApiCtx, 1, 1); + //CheckOutputArgument(pvApiCtx, 0, 1); + CheckRhs(1, 1); + CheckLhs(0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if (isBooleanType(pvApiCtx, piAddr)) + { + if (isScalar(pvApiCtx, piAddr)) + { + int iBool = 0; + iRet = getScalarBoolean(pvApiCtx, piAddr, &iBool); + if (iRet) + { + return 0; + } + iRet = createScalarBoolean(pvApiCtx, Rhs + 1, iBool); + //iRet = createScalarBoolean(pvApiCtx, nbInputArgument + 1, iBool); + if (iRet) + { + return 0; + } + } + else + { + int iRows = 0; + int iCols = 0; + int *piBool = NULL; + + sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBoolean(pvApiCtx, Rhs + 1, iRows, iCols, piBool); + //sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument + 1, iRows, iCols, piBool); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + LhsVar(1) = Rhs + 1; + //AssignOutputVariable(1) = nbInputArgument + 1; + } + else + { + LhsVar(1) = 0; + //AssignOutputVariable(1) = 0; + } + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/booleanExample.dia.ref b/modules/api_scilab/tests/unit_tests/booleanExample.dia.ref new file mode 100755 index 000000000..9f5e9782f --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/booleanExample.dia.ref @@ -0,0 +1,22 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/booleanExample")); +cd(pathconvert(TMPDIR+"/booleanExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/booleanExample.c",pathconvert(TMPDIR+"/booleanExample/booleanExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_booleanExample", ["booleanExample", "booleanExample"], "booleanExample.c", [], "", "", cflags); +exec("loader.sce"); +a = %t; +b = %f; +c = [a,b;b,a;a,b;b,a]; +d = c'; +assert_checkequal(booleanExample(a), a); +assert_checkequal(booleanExample(b), b); +assert_checkequal(booleanExample(c), c); +assert_checkequal(booleanExample(d), d); diff --git a/modules/api_scilab/tests/unit_tests/booleanExample.tst b/modules/api_scilab/tests/unit_tests/booleanExample.tst new file mode 100755 index 000000000..8fc007610 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/booleanExample.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/booleanExample")); +cd(pathconvert(TMPDIR+"/booleanExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/booleanExample.c",pathconvert(TMPDIR+"/booleanExample/booleanExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_booleanExample", ["booleanExample", "booleanExample"], "booleanExample.c", [], "", "", cflags); +exec("loader.sce"); + +a = %t; +b = %f; +c = [a,b;b,a;a,b;b,a]; +d = c'; +assert_checkequal(booleanExample(a), a); +assert_checkequal(booleanExample(b), b); +assert_checkequal(booleanExample(c), c); +assert_checkequal(booleanExample(d), d); diff --git a/modules/api_scilab/tests/unit_tests/booleanSparseExample.c b/modules/api_scilab/tests/unit_tests/booleanSparseExample.c new file mode 100755 index 000000000..8135fc770 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/booleanSparseExample.c @@ -0,0 +1,63 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int booleanSparseExample(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isBooleanSparseType(pvApiCtx, piAddr)) + { + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + + iRet = getAllocatedBooleanSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos); + if (iRet) + { + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + return iRet; + } + + sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos); + if (sciErr.iErr) + { + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedBooleanSparse(piNbItemRow, piColPos); + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/booleanSparseExample.dia.ref b/modules/api_scilab/tests/unit_tests/booleanSparseExample.dia.ref new file mode 100755 index 000000000..4a495d27a --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/booleanSparseExample.dia.ref @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/booleanSparseExample")); +cd(pathconvert(TMPDIR+"/booleanSparseExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/booleanSparseExample.c",pathconvert(TMPDIR+"/booleanSparseExample/booleanSparseExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_booleanSparseExample",["booleanSparseExample","booleanSparseExample"],"booleanSparseExample.c",[],"","",cflags); +exec("loader.sce"); +bsp = sparse([1,1;2,2;3,3],[%t,%t,%t]); +assert_checkequal(booleanSparseExample(bsp), bsp); diff --git a/modules/api_scilab/tests/unit_tests/booleanSparseExample.tst b/modules/api_scilab/tests/unit_tests/booleanSparseExample.tst new file mode 100755 index 000000000..3417c9058 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/booleanSparseExample.tst @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/booleanSparseExample")); +cd(pathconvert(TMPDIR+"/booleanSparseExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/booleanSparseExample.c",pathconvert(TMPDIR+"/booleanSparseExample/booleanSparseExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_booleanSparseExample",["booleanSparseExample","booleanSparseExample"],"booleanSparseExample.c",[],"","",cflags); +exec("loader.sce"); + +bsp = sparse([1,1;2,2;3,3],[%t,%t,%t]); +assert_checkequal(booleanSparseExample(bsp), bsp); diff --git a/modules/api_scilab/tests/unit_tests/boolean_writing_api.c b/modules/api_scilab/tests/unit_tests/boolean_writing_api.c new file mode 100755 index 000000000..857f02945 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/boolean_writing_api.c @@ -0,0 +1,104 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int write_boolean(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i, j; + //first variable info : boolean matrix of boolean 3 x 4 + int iRows1 = 3; + int iCols1 = 4; + int* pboolOutput1 = NULL; + //second variable info : boolean matrix of boolean 4 x 6 + int iRows2 = 4; + int iCols2 = 6; + int* pboolOutput2 = NULL; + + /************************ + * First variable * + ************************/ + + //alloc array of data in OS memory + pboolOutput1 = (int*)malloc(sizeof(int) * iRows1 * iCols1); + //fill array with incremental values + //[ %t %f %t %f + // %t %f %t %f + // %t %f %t %f ] + for (i = 0 ; i < iRows1 ; i++) + { + for (j = 0 ; j < iCols1 ; j++) + { + pboolOutput1[i + iRows1 * j] = (i * iCols1 + j) % 2 == FALSE; + } + } + + //can be written in a single loop + //for(i = 0 ; i < iRows1 * iCols1; i++) + //{ + // pboolOutput1[i] = i % 2 == FALSE; + //} + //create a variable from a existing data array + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows1, iCols1, pboolOutput1); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //after creation, we can free memory. + free(pboolOutput1); + + + /************************* + * Second variable * + *************************/ + + //reserve space in scilab memory and fill it + sciErr = allocMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRows2, iCols2, &pboolOutput2); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //fill array with incremental values + //[ %f %t %f %t %f %t + // %f %t %f %t %f %t + // %f %t %f %t %f %t + // %f %t %f %t %f %t ] + for (i = 0 ; i < iRows2 ; i++) + { + for (j = 0 ; j < iCols2 ; j++) + { + pboolOutput2[i + iRows2 * j] = (i * iCols2 + j) % 2 == TRUE; + } + } + + //can be written in a single loop + //for(i = 0 ; i < iRows2 * iCols2; i++) + //{ + // pboolOutput2[i] = i % 2 == TRUE; + //} + // /!\ DO NOT FREE MEMORY, in this case, it's the Scilab memory + //assign allocated variables to Lhs position + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/boolean_writing_api.dia.ref b/modules/api_scilab/tests/unit_tests/boolean_writing_api.dia.ref new file mode 100755 index 000000000..a41858c25 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/boolean_writing_api.dia.ref @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/boolean_writing_api")); +cd(pathconvert(TMPDIR+"/boolean_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/boolean_writing_api.c",pathconvert(TMPDIR+"/boolean_writing_api/boolean_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("boolean_writing",["write_boolean","write_boolean"],"boolean_writing_api.c",[],"","",cflags); +exec("loader.sce"); +a_ref = [ %t %f %t %f + %t %f %t %f + %t %f %t %f ]; +b_ref = [ %f %t %f %t %f %t + %f %t %f %t %f %t + %f %t %f %t %f %t + %f %t %f %t %f %t ]; +[a,b] = write_boolean(); +if or(a <> a_ref) then bugmes();quit;end +if or(b <> b_ref) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/boolean_writing_api.tst b/modules/api_scilab/tests/unit_tests/boolean_writing_api.tst new file mode 100755 index 000000000..e0599a87e --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/boolean_writing_api.tst @@ -0,0 +1,28 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/boolean_writing_api")); +cd(pathconvert(TMPDIR+"/boolean_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/boolean_writing_api.c",pathconvert(TMPDIR+"/boolean_writing_api/boolean_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("boolean_writing",["write_boolean","write_boolean"],"boolean_writing_api.c",[],"","",cflags); +exec("loader.sce"); + +a_ref = [ %t %f %t %f + %t %f %t %f + %t %f %t %f ]; + +b_ref = [ %f %t %f %t %f %t + %f %t %f %t %f %t + %f %t %f %t %f %t + %f %t %f %t %f %t ]; + +[a,b] = write_boolean(); +if or(a <> a_ref) then pause;end +if or(b <> b_ref) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.c b/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.c new file mode 100755 index 000000000..865791b2c --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.c @@ -0,0 +1,22 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" + +int callOverload(char *fname, unsigned long fname_len) +{ + CheckRhs(1, 1); + CheckLhs(0, 1); + + CallOverloadFunction(1); + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.dia.ref b/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.dia.ref new file mode 100755 index 000000000..7a002bdb6 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.dia.ref @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/calloverloadfunction_api")); +cd(pathconvert(TMPDIR+"/calloverloadfunction_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.c",pathconvert(TMPDIR+"/calloverloadfunction_api/calloverloadfunction_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("callOverload", ["getSize", "callOverload"], "calloverloadfunction_api.c", [], "", "", cflags); +exec("loader.sce"); +function x = %c_getSize(a) + x = length(a); +endfunction +function x = %s_getSize(a) + x = size(a); +endfunction +a = [1,2;3,4]; +a_ref = [2,2]; +assert_checkequal(getSize(a), a_ref); +b = ["May","the","puffin";"be","with","you"]; +b_ref = [3,3,6;2,4,3]; +assert_checkequal(getSize(b), b_ref); diff --git a/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.tst b/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.tst new file mode 100755 index 000000000..06f421c4f --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.tst @@ -0,0 +1,32 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/calloverloadfunction_api")); +cd(pathconvert(TMPDIR+"/calloverloadfunction_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/calloverloadfunction_api.c",pathconvert(TMPDIR+"/calloverloadfunction_api/calloverloadfunction_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("callOverload", ["getSize", "callOverload"], "calloverloadfunction_api.c", [], "", "", cflags); +exec("loader.sce"); + +function x = %c_getSize(a) + x = length(a); +endfunction + +function x = %s_getSize(a) + x = size(a); +endfunction + + +a = [1,2;3,4]; +a_ref = [2,2]; +assert_checkequal(getSize(a), a_ref); + +b = ["May","the","puffin";"be","with","you"]; +b_ref = [3,3,6;2,4,3]; +assert_checkequal(getSize(b), b_ref); diff --git a/modules/api_scilab/tests/unit_tests/check_matrix_dimension.c b/modules/api_scilab/tests/unit_tests/check_matrix_dimension.c new file mode 100755 index 000000000..a9ceb332b --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/check_matrix_dimension.c @@ -0,0 +1,69 @@ +#include "api_scilab.h" +#include "sciprint.h" + +int check_matrix_dimension(char * fname) +{ + SciErr sciErr; + int* piAddr = NULL; + int iRows = 0; + int iCols = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + if (checkVarDimension(pvApiCtx, piAddr, iCols, iRows)) + { + sciprint("checkVarDimension returns false\n"); + } + else + { + sciprint("checkVarDimension returns true\n"); + } + + if (isRowVector(pvApiCtx, piAddr)) + { + sciprint("isRowVector\n"); + } + + if (isColumnVector(pvApiCtx, piAddr)) + { + sciprint("isColumnVector\n"); + } + + if (isVector(pvApiCtx, piAddr)) + { + sciprint("isVector\n"); + } + + if (isScalar(pvApiCtx, piAddr)) + { + sciprint("isScalar\n"); + } + + if (isSquareMatrix(pvApiCtx, piAddr)) + { + sciprint("isSquareMatrix\n"); + } + + if (isEmptyMatrix(pvApiCtx, piAddr)) + { + sciprint("isEmptyMatrix\n"); + } + + //no return value + AssignOutputVariable(pvApiCtx, 0) = 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/check_matrix_dimension.dia.ref b/modules/api_scilab/tests/unit_tests/check_matrix_dimension.dia.ref new file mode 100755 index 000000000..ea7f70cb4 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/check_matrix_dimension.dia.ref @@ -0,0 +1,32 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/check_matrix_dimension")); +cd(pathconvert(TMPDIR+"/check_matrix_dimension")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/check_matrix_dimension.c",pathconvert(TMPDIR+"/check_matrix_dimension/check_matrix_dimension.c",%F)); +ilib_build("gw_check_matrix_dimension",["check_matrix_dimension","check_matrix_dimension"],"check_matrix_dimension.c",[]); +exec("loader.sce"); +check_matrix_dimension([1,2,3;4,5,6]); +checkVarDimension returns true +check_matrix_dimension([1,2,3]); +checkVarDimension returns true +isRowVector +isVector +check_matrix_dimension([1;2;3]); +checkVarDimension returns true +isColumnVector +isVector +check_matrix_dimension([1]); +checkVarDimension returns false +isScalar +check_matrix_dimension([1,2;3,4]); +checkVarDimension returns false +isSquareMatrix +check_matrix_dimension([]); +checkVarDimension returns false +isEmptyMatrix diff --git a/modules/api_scilab/tests/unit_tests/check_matrix_dimension.tst b/modules/api_scilab/tests/unit_tests/check_matrix_dimension.tst new file mode 100755 index 000000000..76024bbf8 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/check_matrix_dimension.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/check_matrix_dimension")); +cd(pathconvert(TMPDIR+"/check_matrix_dimension")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/check_matrix_dimension.c",pathconvert(TMPDIR+"/check_matrix_dimension/check_matrix_dimension.c",%F)); +ilib_build("gw_check_matrix_dimension",["check_matrix_dimension","check_matrix_dimension"],"check_matrix_dimension.c",[]); +exec("loader.sce"); + + +check_matrix_dimension([1,2,3;4,5,6]); +check_matrix_dimension([1,2,3]); +check_matrix_dimension([1;2;3]); +check_matrix_dimension([1]); +check_matrix_dimension([1,2;3,4]); +check_matrix_dimension([]); + + diff --git a/modules/api_scilab/tests/unit_tests/common_function.dia.ref b/modules/api_scilab/tests/unit_tests/common_function.dia.ref new file mode 100755 index 000000000..7b3103f22 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/common_function.dia.ref @@ -0,0 +1,45 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/common_function")); +cd(pathconvert(TMPDIR+"/common_function")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/common_function_api.c",pathconvert(TMPDIR+"/common_function/common_function_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("common_function",["common_function","common_function"],"common_function_api.c",[],"","",cflags); +exec("loader.sce"); +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) +Variable 1 information: + Type: double + Complex: Yes + Dimensions: 2 x 3 + +Variable 2 information: + Type: strings + Dimensions: 3 x 2 + +Variable 3 information: + Type: signed integer 8 bits + Dimensions: 1 x 3 + +Variable 4 information: + Type: unsigned integer 16 bits + Dimensions: 1 x 3 + +Variable 5 information: + Type: list + Dimensions: 3 + + ans = + + T diff --git a/modules/api_scilab/tests/unit_tests/common_function.tst b/modules/api_scilab/tests/unit_tests/common_function.tst new file mode 100755 index 000000000..03a62d53c --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/common_function.tst @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/common_function")); +cd(pathconvert(TMPDIR+"/common_function")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/common_function_api.c",pathconvert(TMPDIR+"/common_function/common_function_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("common_function",["common_function","common_function"],"common_function_api.c",[],"","",cflags); +exec("loader.sce"); + +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l4 = uint16([1000,2000,3000]); +l5 = list(l1,l2,l3); +l = list(l1,l2,l3,l4,l5); +common_function(l(1:$)) diff --git a/modules/api_scilab/tests/unit_tests/common_function_api.c b/modules/api_scilab/tests/unit_tests/common_function_api.c new file mode 100755 index 000000000..52d742ad7 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/common_function_api.c @@ -0,0 +1,161 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +SciErr printf_info(void* _pvCtx, int _iVar); + +int common_function(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i; + int *piAddr1 = NULL; + int iBool = 0; + + for (i = 0 ; i < nbInputArgument(pvApiCtx) ; i++) + { + sciErr = printf_info(pvApiCtx, i + 1); + if (sciErr.iErr) + { + printError(&sciErr, 0); + break; + } + sciprint("\n\n"); + } + + //1 for true, 0 for false + iBool = sciErr.iErr == 0 ? 1 : 0; + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} + +SciErr printf_info(void* _pvCtx, int _iVar) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int iComplex = 0; + + sciErr = getVarAddressFromPosition(_pvCtx, _iVar, &piAddr); + if (sciErr.iErr) + { + return sciErr; + } + + sciprint("Variable %d information:\n", _iVar); + + sciErr = getVarType(_pvCtx, piAddr, &iType); + if (sciErr.iErr) + { + return sciErr; + } + + sciprint("\tType: "); + switch (iType) + { + case sci_matrix : + sciprint("double\n"); + break; + case sci_poly : + sciprint("polynomial\n"); + break; + case sci_boolean : + sciprint("boolean\n"); + break; + case sci_sparse : + sciprint("sparse\n"); + break; + case sci_boolean_sparse : + sciprint("boolean_sparse\n"); + break; + case sci_ints : + { + char pstSigned[] = "signed"; + char pstUnsigned[] = "unsigned"; + char* pstSign = pstSigned; + int iPrec = 0; + + sciErr = getMatrixOfIntegerPrecision(_pvCtx, piAddr, &iPrec); + if (sciErr.iErr) + { + return sciErr; + } + + if (iPrec > 10) + { + pstSign = pstUnsigned; + } + + sciprint("%s integer %d bits\n", pstSign, (iPrec % 10) * 8); + } + break; + case sci_strings : + sciprint("strings\n"); + break; + case sci_list : + sciprint("list\n"); + break; + case sci_tlist : + sciprint("tlist\n"); + break; + case sci_mlist : + sciprint("mlist\n"); + break; + default : + sciprint("Not manage by this function\n"); + return sciErr; + } + + if (isVarComplex(_pvCtx, piAddr)) + { + sciprint("\tComplex: Yes\n"); + } + + sciprint("\tDimensions: "); + if (isVarMatrixType(_pvCtx, piAddr)) + { + sciErr = getVarDimension(_pvCtx, piAddr, &iRows, &iCols); + if (sciErr.iErr) + { + return sciErr; + } + + sciprint("%d x %d", iRows, iCols); + } + else + { + sciErr = getListItemNumber(_pvCtx, piAddr, &iItem); + if (sciErr.iErr) + { + return sciErr; + } + + sciprint("%d", iItem); + } + return sciErr; +} diff --git a/modules/api_scilab/tests/unit_tests/common_list_api.c b/modules/api_scilab/tests/unit_tests/common_list_api.c new file mode 100755 index 000000000..54203b851 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/common_list_api.c @@ -0,0 +1,108 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int get_list_info(void* _pvCtx, int* _piAddress); +void insert_indent(void); + +static int iLocalTab = 1; + +int common_list(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_list_info(pvApiCtx, piAddr); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} +int get_list_info(void* _pvCtx, int* _piAddress) +{ + SciErr sciErr; + int i = 0; + int iRet = 0; + int iItem = 0; + + //get list item number, failed if variable is not a kind of list + sciErr = getListItemNumber(_pvCtx, _piAddress, &iItem); + if (sciErr.iErr) + { + printError(&sciErr, 0); + sciprint("This variable is not a list"); + return 0; + } + + sciprint("List (%d items) -> address : 0x%08X) : \n", iItem, _piAddress); + + for (i = 0 ; i < iItem ; i++) + { + int iType = 0; + int* piAddrChild = NULL; + + sciErr = getListItemAddress(_pvCtx, _piAddress, i + 1, &piAddrChild); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarType(_pvCtx, piAddrChild, &iType); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (iType == sci_list || iType == sci_tlist || iType == sci_mlist) + { + insert_indent(); + sciprint("Child %d -> ", i + 1); + iLocalTab++; + iRet = get_list_info(_pvCtx, piAddrChild); + iLocalTab--; + + if (iRet) + { + return 1; + } + } + else + { + insert_indent(); + sciprint("Child %d -> address : 0x%08X\n", i + 1, piAddrChild); + } + } + + return 0; +} +void insert_indent(void) +{ + int i = 0; + for (i = 0 ; i < iLocalTab ; i++) + { + sciprint("\t"); + } +} diff --git a/modules/api_scilab/tests/unit_tests/common_list_api.tst b/modules/api_scilab/tests/unit_tests/common_list_api.tst new file mode 100755 index 000000000..f9a9b1c02 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/common_list_api.tst @@ -0,0 +1,28 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +// <-- NO CHECK REF --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/common_list_api")); +cd(pathconvert(TMPDIR+"/common_list_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/common_list_api.c",pathconvert(TMPDIR+"/common_list_api/common_list_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("common_list",["common_list","common_list"],"common_list_api.c",[],"","",cflags); +exec("loader.sce"); + + +l1 = [1,2*%i,3;%i,2,3*%i]; +l2 = ["may","the";"puffin","be";"with","you"]; +l3 = int8([1,2,3]); +l5 = list(l1,l2,l3); +l4 = list(l5, list(l5,l5)); +l6 = uint16([1000,2000,3000]); +l = list(l1,l2,l3,l6,l4,l5); +common_list(l) + + diff --git a/modules/api_scilab/tests/unit_tests/common_read_api.c b/modules/api_scilab/tests/unit_tests/common_read_api.c new file mode 100755 index 000000000..59c7fceca --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/common_read_api.c @@ -0,0 +1,612 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +static int iTab = 0; +void insert_indent(void) +{ + int i = 0; + for (i = 0 ; i < iTab ; i++) + { + sciprint("\t"); + } +} + +int get_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_list_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_double_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_poly_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_boolean_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_sparse_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_bsparse_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_integer_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_string_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); +int get_pointer_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos); + +int common_read(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int iItem = 0; + int iRet = 0; + int *piAddr = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + get_info(pvApiCtx, 1, NULL, piAddr, 0); + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} + +int get_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRet = 0; + int iType = 0; + + sciErr = getVarType(_pvCtx, _piAddr, &iType); + switch (iType) + { + case sci_matrix : + iRet = get_double_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_poly : + iRet = get_poly_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean : + iRet = get_boolean_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_sparse : + iRet = get_sparse_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_boolean_sparse : + iRet = get_bsparse_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_ints : + iRet = get_integer_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_strings : + iRet = get_string_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_list : + insert_indent(); + sciprint("List "); + iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_tlist : + insert_indent(); + sciprint("TList "); + iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_mlist : + insert_indent(); + sciprint("MList "); + iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + case sci_pointer : + iRet = get_pointer_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos); + break; + default : + insert_indent(); + sciprint("Unknown type\n"); + return 1; + } + return iRet; +} + +int get_list_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRet = 0; + int iItem = 0; + int* piChild = NULL; + + sciErr = getListItemNumber(_pvCtx, _piAddr, &iItem); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("(%d)\n", iItem); + for (i = 0 ; i < iItem ; i++) + { + sciErr = getListItemAddress(_pvCtx, _piAddr, i + 1, &piChild); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + iTab++; + iRet = get_info(_pvCtx, _iRhs, _piAddr, piChild, i + 1); + iTab--; + } + return 0;; +} + +int get_double_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (_iItemPos == 0) + { + //not in list + if (isVarComplex(_pvCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDouble(_pvCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDouble(_pvCtx, _piAddr, &iRows, &iCols, &pdblReal); + } + } + else + { + if (isVarComplex(_pvCtx, _piAddr)) + { + sciErr = getComplexMatrixOfDoubleInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + sciErr = getMatrixOfDoubleInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal); + } + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Double (%d x %d)\n", iRows, iCols); + return 0;; +} + +int get_poly_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iLen = 0; + int iRows = 0; + int iCols = 0; + char pstVar[16]; + int* piCoeff = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + sciErr = getPolyVariableName(_pvCtx, _piAddr, pstVar, &iLen); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (_iItemPos == 0) + { + //not in list + sciErr = getMatrixOfPoly(_pvCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfPoly(_pvCtx, _piAddr, &iRows, &iCols, piCoeff, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for (i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if (isVarComplex(_pvCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPoly(_pvCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfPoly(_pvCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + } + else + { + sciErr = getMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piCoeff = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for (i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]); + } + + if (isVarComplex(_pvCtx, _piAddr)) + { + sciErr = getComplexMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg); + } + else + { + sciErr = getMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal); + } + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Poly (%d x %d), varname : \'%s\'\n", iRows, iCols, pstVar); + + for (i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + + free(pdblReal); + free(pdblImg); + free(piCoeff); + return 0;; +} +int get_boolean_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int* piBool = NULL; + + if (_iItemPos == 0) + { + sciErr = getMatrixOfBoolean(_pvCtx, _piAddr, &iRows, &iCols, &piBool); + } + else + { + sciErr = getMatrixOfBooleanInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool); + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean (%d x %d)\n", iRows, iCols); + return 0; +} +int get_sparse_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (_iItemPos == 0) + { + //Not in list + if (isVarComplex(_pvCtx, _piAddr)) + { + sciErr = getComplexSparseMatrix(_pvCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(_pvCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + else + { + if (isVarComplex(_pvCtx, _piAddr)) + { + sciErr = getComplexSparseMatrixInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrixInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal); + } + } + + insert_indent(); + sciprint("Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} + +int get_bsparse_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iRows = 0; + int iCols = 0; + int iItem = 0; + int* piNbRow = NULL; + int* piColPos = NULL; + + if (_iItemPos == 0) + { + //Not in list + sciErr = getBooleanSparseMatrix(_pvCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + else + { + sciErr = getBooleanSparseMatrixInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos); + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem); + return 0;; +} +int get_integer_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int iPrec = 0; + int iRows = 0; + int iCols = 0; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + + if (_iItemPos == 0) + { + //Not in list + sciErr = getMatrixOfIntegerPrecision(_pvCtx, _piAddr, &iPrec); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch (iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8(_pvCtx, _piAddr, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16(_pvCtx, _piAddr, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32(_pvCtx, _piAddr, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8(_pvCtx, _piAddr, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16(_pvCtx, _piAddr, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32(_pvCtx, _piAddr, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + else + { + sciErr = getMatrixOfIntegerPrecision(_pvCtx, _piAddr, &iPrec); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + switch (iPrec) + { + case SCI_INT8 : + sciErr = getMatrixOfInteger8InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData); + break; + case SCI_INT16 : + sciErr = getMatrixOfInteger16InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &psData); + break; + case SCI_INT32 : + sciErr = getMatrixOfInteger32InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &piData); + break; + case SCI_UINT8 : + sciErr = getMatrixOfUnsignedInteger8InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData); + break; + case SCI_UINT16 : + sciErr = getMatrixOfUnsignedInteger16InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData); + break; + case SCI_UINT32 : + sciErr = getMatrixOfUnsignedInteger32InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData); + break; + default : + return 1; + } + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + + if (iPrec > 10) + { + sciprint("Unsigned "); + } + + sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols); + return 0;; +} +int get_string_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + int i; + int iRows = 0; + int iCols = 0; + int* piLen = NULL; + char **pstData = NULL; + + if (_iItemPos == 0) + { + //Not in list + sciErr = getMatrixOfString(_pvCtx, _piAddr, &iRows, &iCols, NULL, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + sciErr = getMatrixOfString(_pvCtx, _piAddr, &iRows, &iCols, piLen, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for (i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfString(_pvCtx, _piAddr, &iRows, &iCols, piLen, pstData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + sciErr = getMatrixOfStringInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + sciErr = getMatrixOfStringInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + + for (i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + sciErr = getMatrixOfStringInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Strings (%d x %d)\n", iRows, iCols); + return 0;; +} +int get_pointer_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos) +{ + SciErr sciErr; + void* pvPtr = NULL; + + if (_iItemPos == 0) + { + sciErr = getPointer(_pvCtx, _piAddr, &pvPtr); + } + else + { + sciErr = getPointerInList(_pvCtx, _piParent, _iItemPos, &pvPtr); + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + insert_indent(); + sciprint("Pointer : 0x%08X\n", pvPtr); + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/common_read_api.tst b/modules/api_scilab/tests/unit_tests/common_read_api.tst new file mode 100755 index 000000000..399f7ff80 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/common_read_api.tst @@ -0,0 +1,36 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +// <-- NO CHECK REF --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/common_read_api")); +cd(pathconvert(TMPDIR+"/common_read_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/common_read_api.c",pathconvert(TMPDIR+"/common_read_api/common_read_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("common_read",["common_read","common_read"],"common_read_api.c",[],"","",cflags); +exec("loader.sce"); + + +function read_all() +d = [1,2,3;4,5,6;7,8,9];common_read(d); +s=poly(0,"x");p=1+s+2*s^2;p = [(p * 2),(p * s + 3);(p * 2 * s ** 2 - 6),(12 - 4 * p * (- s) ** 2)];common_read(p); +b = [%t,%f;%t,%f;%f,%t];common_read(b); +sp=sparse([2,-1,0,0,0;-1,2,-1,0,0;0,-1,2,-1,0;0,0,-1,2,-1;0,0,0,-1,2]);common_read(sp); +bsp=sparse([1,2;4,5;3,10],[%t,%t,%t]);common_read(bsp); +i8 = int8([1,2,3]);common_read(i8); +ui32 = uint32([3;2;1]);common_read(ui32); +str = ["may", "the", "puffin"; "be", "with","you"];common_read(str); +if with_module('umfpack') then + Cp = taucs_chfact(sp); + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str), Cp); +else + l = list(list(d, p, list(b, sp)), list(i8, bsp), list(ui32, str)); +end +common_read(l) +endfunction +read_all; diff --git a/modules/api_scilab/tests/unit_tests/deleteNamedVariable.c b/modules/api_scilab/tests/unit_tests/deleteNamedVariable.c new file mode 100755 index 000000000..2b78811c9 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/deleteNamedVariable.c @@ -0,0 +1,47 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "MALLOC.h" + +int sci_deleteNamedVariable(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int iRet = 0; + int* piAddr = NULL; + char* pstVarName = NULL; + + CheckRhs(1, 1); + CheckLhs(1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 1; + } + + if (getAllocatedSingleString(pvApiCtx, piAddr, &pstVarName)) + { + //error + return 1; + } + + if (isNamedVarExist(pvApiCtx, pstVarName)) + { + iRet = deleteNamedVariable(pvApiCtx, pstVarName); + } + + createScalarBoolean(pvApiCtx, Rhs + 1, iRet); + AssignOutputVariable(pvApiCtx, 1) = Rhs + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/deleteNamedVariable.dia.ref b/modules/api_scilab/tests/unit_tests/deleteNamedVariable.dia.ref new file mode 100755 index 000000000..39e74479f --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/deleteNamedVariable.dia.ref @@ -0,0 +1,30 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/deleteNamedVariable")); +cd(pathconvert(TMPDIR+"/deleteNamedVariable")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/deleteNamedVariable.c",pathconvert(TMPDIR+"/deleteNamedVariable/deleteNamedVariable.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +setenv('DEBUG_SCILAB_DYNAMIC_LINK','YES'); +ilib_build("gw_deleteNamedVariable", ["deleteNamedVariable", "sci_deleteNamedVariable"], "deleteNamedVariable.c", [], "", "", cflags); +exec("loader.sce"); +function test() + assert_checkequal(exists("a"), 1); + assert_checkequal(a, 1); + a = 2; + assert_checkequal(a, 2); + assert_checktrue(deleteNamedVariable("a")); + assert_checkequal(exists("a"), 1); + assert_checkequal(a, 1); +endfunction +a = 1; +test(); +assert_checkequal(a, 1); +deleteNamedVariable("a"); +assert_checkequal(exists("a"), 0); diff --git a/modules/api_scilab/tests/unit_tests/deleteNamedVariable.tst b/modules/api_scilab/tests/unit_tests/deleteNamedVariable.tst new file mode 100755 index 000000000..9a958ab45 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/deleteNamedVariable.tst @@ -0,0 +1,33 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +//exec SCI/modules\api_scilab\tests\unit_tests\deleteNamedVariable.tst +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/deleteNamedVariable")); +cd(pathconvert(TMPDIR+"/deleteNamedVariable")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/deleteNamedVariable.c",pathconvert(TMPDIR+"/deleteNamedVariable/deleteNamedVariable.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +setenv('DEBUG_SCILAB_DYNAMIC_LINK','YES'); +ilib_build("gw_deleteNamedVariable", ["deleteNamedVariable", "sci_deleteNamedVariable"], "deleteNamedVariable.c", [], "", "", cflags); +exec("loader.sce"); + +function test() + assert_checkequal(exists("a"), 1); + assert_checkequal(a, 1); + a = 2; + assert_checkequal(a, 2); + assert_checktrue(deleteNamedVariable("a")); + assert_checkequal(exists("a"), 1); + assert_checkequal(a, 1); +endfunction + +a = 1; +test(); +assert_checkequal(a, 1); +deleteNamedVariable("a"); +assert_checkequal(exists("a"), 0); diff --git a/modules/api_scilab/tests/unit_tests/doubleExample.c b/modules/api_scilab/tests/unit_tests/doubleExample.c new file mode 100755 index 000000000..8cfee6a50 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/doubleExample.c @@ -0,0 +1,127 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int doubleExample(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if (iRet) + { + return iRet; + } + + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if (isDoubleType(pvApiCtx, piAddr)) + { + if (isScalar(pvApiCtx, piAddr)) + { + double dblReal = 0; + double dblImg = 0; + + if (isVarComplex(pvApiCtx, piAddr)) + { + iRet = getScalarComplexDouble(pvApiCtx, piAddr, &dblReal, &dblImg); + if (iRet) + { + return iRet; + } + + iRet = createScalarComplexDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblReal, dblImg); + if (iRet) + { + return iRet; + } + } + else + { + iRet = getScalarDouble(pvApiCtx, piAddr, &dblReal); + if (iRet) + { + return iRet; + } + + iRet = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblReal); + if (iRet) + { + return iRet; + } + } + } + else + { + int iRows = 0; + int iCols = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (isVarComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal, pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + else + { + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/doubleExample.dia.ref b/modules/api_scilab/tests/unit_tests/doubleExample.dia.ref new file mode 100755 index 000000000..3d15243e2 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/doubleExample.dia.ref @@ -0,0 +1,22 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/doubleExample")); +cd(pathconvert(TMPDIR+"/doubleExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/doubleExample.c",pathconvert(TMPDIR+"/doubleExample/doubleExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_doubleExample",["doubleExample","doubleExample"],"doubleExample.c",[],"","",cflags); +exec("loader.sce"); +a = 1; +b = %i; +c = [1,2,3;4,5,6]; +d = c(1:$) + c($:-1:1) * %i; +assert_checkequal(doubleExample(a), a); +assert_checkequal(doubleExample(b), b); +assert_checkequal(doubleExample(c), c); +assert_checkequal(doubleExample(d), d); diff --git a/modules/api_scilab/tests/unit_tests/doubleExample.tst b/modules/api_scilab/tests/unit_tests/doubleExample.tst new file mode 100755 index 000000000..90a445c08 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/doubleExample.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/doubleExample")); +cd(pathconvert(TMPDIR+"/doubleExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/doubleExample.c",pathconvert(TMPDIR+"/doubleExample/doubleExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_doubleExample",["doubleExample","doubleExample"],"doubleExample.c",[],"","",cflags); +exec("loader.sce"); + +a = 1; +b = %i; +c = [1,2,3;4,5,6]; +d = c(1:$) + c($:-1:1) * %i; +assert_checkequal(doubleExample(a), a); +assert_checkequal(doubleExample(b), b); +assert_checkequal(doubleExample(c), c); +assert_checkequal(doubleExample(d), d); diff --git a/modules/api_scilab/tests/unit_tests/double_reading_api.c b/modules/api_scilab/tests/unit_tests/double_reading_api.c new file mode 100755 index 000000000..582dd77c2 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/double_reading_api.c @@ -0,0 +1,100 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int read_double(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i; + //first variable info : real matrix of double + int iType = 0; + int iRows = 0; + int iCols = 0; + int iComplex = 0; + int *piAddr = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + /************************ + * First variable * + ************************/ + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //check type + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if (sciErr.iErr || iType != sci_matrix) + { + printError(&sciErr, 0); + return 0; + } + + //get complexity + iComplex = isVarComplex(pvApiCtx, piAddr); + + //check complexity + if (iComplex) + { + //get size and data from Scilab memory + sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg); + } + else + { + //get size and data from Scilab memory + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with data + //if variable is complex, switch real part and imaginary part otherwise multiply by -1 + if (iComplex) + { + sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblImg, pdblReal); + } + else + { + for (i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = pdblReal[i] * -1; + } + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal); + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/double_reading_api.dia.ref b/modules/api_scilab/tests/unit_tests/double_reading_api.dia.ref new file mode 100755 index 000000000..26261e8af --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/double_reading_api.dia.ref @@ -0,0 +1,25 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/double_reading_api")); +cd(pathconvert(TMPDIR+"/double_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/double_reading_api.c",pathconvert(TMPDIR+"/double_reading_api/double_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("double_reading",["read_double","read_double"],"double_reading_api.c",[],"","",cflags); +exec("loader.sce"); +a = [ 0 1 2 3; .. + 4 5 6 7; .. + 8 9 10 11]; +b = [ 23*%i, 1+22*%i, 2+21*%i, 3+20*%i, 4+19*%i, 5+18*%i; .. + 6+17*%i, 7+16*%i, 8+15*%i, 9+14*%i, 10+13*%i, 11+12*%i; .. + 12+11*%i, 13+10*%i, 14+9*%i, 15+8*%i, 16+7*%i, 17+6*%i; .. + 18+5*%i, 19+4*%i, 20+3*%i, 21+2*%i, 22+1*%i, 23]; +a2 = read_double(a); +b2 = read_double(b); +if or(a2 <> a * -1) then bugmes();quit;end +if or(b2 <> (imag(b) + real(b) * %i)) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/double_reading_api.tst b/modules/api_scilab/tests/unit_tests/double_reading_api.tst new file mode 100755 index 000000000..decadf8ff --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/double_reading_api.tst @@ -0,0 +1,27 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/double_reading_api")); +cd(pathconvert(TMPDIR+"/double_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/double_reading_api.c",pathconvert(TMPDIR+"/double_reading_api/double_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("double_reading",["read_double","read_double"],"double_reading_api.c",[],"","",cflags); +exec("loader.sce"); + +a = [ 0 1 2 3; .. + 4 5 6 7; .. + 8 9 10 11]; +b = [ 23*%i, 1+22*%i, 2+21*%i, 3+20*%i, 4+19*%i, 5+18*%i; .. + 6+17*%i, 7+16*%i, 8+15*%i, 9+14*%i, 10+13*%i, 11+12*%i; .. + 12+11*%i, 13+10*%i, 14+9*%i, 15+8*%i, 16+7*%i, 17+6*%i; .. + 18+5*%i, 19+4*%i, 20+3*%i, 21+2*%i, 22+1*%i, 23]; +a2 = read_double(a); +b2 = read_double(b); +if or(a2 <> a * -1) then pause;end +if or(b2 <> (imag(b) + real(b) * %i)) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/double_writing_api.c b/modules/api_scilab/tests/unit_tests/double_writing_api.c new file mode 100755 index 000000000..d8bcc62b5 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/double_writing_api.c @@ -0,0 +1,107 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int write_double(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i, j; + //first variable info : real matrix of double 3 x 4 + int iRows1 = 3; + int iCols1 = 4; + double* pdblReal1 = NULL; + //second variable info : complex matrix of double 4 x 6 + int iRows2 = 4; + int iCols2 = 6; + double* pdblReal2 = NULL; + double* pdblImg2 = NULL; + + /************************ + * First variable * + ************************/ + + //alloc array of data in OS memory + pdblReal1 = (double*)malloc(sizeof(double) * iRows1 * iCols1); + //fill array with incremental values + //[ 0 1 2 3 + // 4 5 6 7 + // 8 9 10 11] + for (i = 0 ; i < iRows1 ; i++) + { + for (j = 0 ; j < iCols1 ; j++) + { + pdblReal1[i + iRows1 * j] = i * iCols1 + j; + } + } + + //can be written in a single loop + //for(i = 0 ; i < iRows1 * iCols1; i++) + //{ + // pdblReal1[i] = i; + //} + //create a variable from a existing data array + + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows1, iCols1, pdblReal1); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //after creation, we can free memory. + free(pdblReal1); + + + /************************* + * Second variable * + *************************/ + + //reserve space in scilab memory and fill it + sciErr = allocComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRows2, iCols2, &pdblReal2, &pdblImg2); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //fill array with incremental values for real part and decremental for imaginary part + //[ 23i 1+22i 2+21i 3+20i 4+19i 5+18i + // 6+17i 7+16i 8+15i 9+14i 10+13i 11+12i + // 12+11i 13+10i 14+9i 15+8i 16+7i 17+6i + // 18+5i 19+4i 20+3i 21+2i 22+1i 23 ] + for (i = 0 ; i < iRows2 ; i++) + { + for (j = 0 ; j < iCols2 ; j++) + { + pdblReal2[i + iRows2 * j] = i * iCols2 + j; + pdblImg2 [i + iRows2 * j] = (iRows2 * iCols2 - 1) - (i * iCols2 + j); + } + } + + //can be written in a single loop + //for(i = 0 ; i < iRows2 * iCols2; i++) + //{ + // pdblReal2[i] = i; + // pdblImg2 [i] = (iRows2 * iCols2 - 1) - i; + //} + // /!\ DO NOT FREE MEMORY, in this case, it's the Scilab memory + //assign allocated variables to Lhs position + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/double_writing_api.dia.ref b/modules/api_scilab/tests/unit_tests/double_writing_api.dia.ref new file mode 100755 index 000000000..6035abcb1 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/double_writing_api.dia.ref @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/double_writing_api")); +cd(pathconvert(TMPDIR+"/double_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/double_writing_api.c",pathconvert(TMPDIR+"/double_writing_api/double_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("double_writing",["write_double","write_double"],"double_writing_api.c",[],"","",cflags); +exec("loader.sce"); +a_ref = [ 0 1 2 3; .. + 4 5 6 7; .. + 8 9 10 11]; +b_ref = [ 23*%i, 1+22*%i, 2+21*%i, 3+20*%i, 4+19*%i, 5+18*%i; .. + 6+17*%i, 7+16*%i, 8+15*%i, 9+14*%i, 10+13*%i, 11+12*%i; .. + 12+11*%i, 13+10*%i, 14+9*%i, 15+8*%i, 16+7*%i, 17+6*%i; .. + 18+5*%i, 19+4*%i, 20+3*%i, 21+2*%i, 22+1*%i, 23]; +[a,b] = write_double(); +if or(a <> a_ref) then bugmes();quit;end +if or(b <> b_ref) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/double_writing_api.tst b/modules/api_scilab/tests/unit_tests/double_writing_api.tst new file mode 100755 index 000000000..c65a4f661 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/double_writing_api.tst @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/double_writing_api")); +cd(pathconvert(TMPDIR+"/double_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/double_writing_api.c",pathconvert(TMPDIR+"/double_writing_api/double_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("double_writing",["write_double","write_double"],"double_writing_api.c",[],"","",cflags); +exec("loader.sce"); + +a_ref = [ 0 1 2 3; .. + 4 5 6 7; .. + 8 9 10 11]; +b_ref = [ 23*%i, 1+22*%i, 2+21*%i, 3+20*%i, 4+19*%i, 5+18*%i; .. + 6+17*%i, 7+16*%i, 8+15*%i, 9+14*%i, 10+13*%i, 11+12*%i; .. + 12+11*%i, 13+10*%i, 14+9*%i, 15+8*%i, 16+7*%i, 17+6*%i; .. + 18+5*%i, 19+4*%i, 20+3*%i, 21+2*%i, 22+1*%i, 23]; +[a,b] = write_double(); +if or(a <> a_ref) then pause;end +if or(b <> b_ref) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/hypermatExample.c b/modules/api_scilab/tests/unit_tests/hypermatExample.c new file mode 100755 index 000000000..bc11b3277 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/hypermatExample.c @@ -0,0 +1,90 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int hypermatExample(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if (iRet) + { + return iRet; + } + + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if (isHypermatType(pvApiCtx, piAddr)) + { + int * dims = NULL; + int ndims; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (isHypermatComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createComplexHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal, pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + else + { + sciErr = getHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/hypermatExample.dia.ref b/modules/api_scilab/tests/unit_tests/hypermatExample.dia.ref new file mode 100755 index 000000000..e18c6c38e --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/hypermatExample.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/hypermatExample")); +cd(pathconvert(TMPDIR+"/hypermatExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/hypermatExample.c",pathconvert(TMPDIR+"/hypermatExample/hypermatExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_hypermatExample",["hypermatExample","hypermatExample"],"hypermatExample.c",[],"","",cflags); +exec("loader.sce"); +a = hypermat([1 2 3], ones(1,6)); +b = a + %i*hypermat([1 2 3], 1:6); +assert_checkequal(hypermatExample(a), a); +assert_checkequal(hypermatExample(b), b); diff --git a/modules/api_scilab/tests/unit_tests/hypermatExample.tst b/modules/api_scilab/tests/unit_tests/hypermatExample.tst new file mode 100755 index 000000000..fb4d19567 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/hypermatExample.tst @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/hypermatExample")); +cd(pathconvert(TMPDIR+"/hypermatExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/hypermatExample.c",pathconvert(TMPDIR+"/hypermatExample/hypermatExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_hypermatExample",["hypermatExample","hypermatExample"],"hypermatExample.c",[],"","",cflags); +exec("loader.sce"); + +a = hypermat([1 2 3], ones(1,6)); +b = a + %i*hypermat([1 2 3], 1:6); + +assert_checkequal(hypermatExample(a), a); +assert_checkequal(hypermatExample(b), b); diff --git a/modules/api_scilab/tests/unit_tests/hypermatIntExample.c b/modules/api_scilab/tests/unit_tests/hypermatIntExample.c new file mode 100755 index 000000000..089b5f9a1 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/hypermatIntExample.c @@ -0,0 +1,174 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int hypermatIntExample(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isEmptyMatrix(pvApiCtx, piAddr)) + { + iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1); + if (iRet) + { + return iRet; + } + + AssignOutputVariable(pvApiCtx, 1) = 0; + } + else if (isHypermatType(pvApiCtx, piAddr)) + { + int * dims = NULL; + int ndims; + void * data = NULL; + int htype = 0; + int precision; + + sciErr = getHypermatType(pvApiCtx, piAddr, &htype); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (htype == sci_ints) + { + sciErr = getHypermatOfIntegerPrecision(pvApiCtx, piAddr, &precision); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + switch (precision) + { + case SCI_INT8: + sciErr = getHypermatOfInteger8(pvApiCtx, piAddr, &dims, &ndims, (char*)&data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const char*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT8: + sciErr = getHypermatOfUnsignedInteger8(pvApiCtx, piAddr, &dims, &ndims, (unsigned char*)&data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned char*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_INT16: + sciErr = getHypermatOfInteger16(pvApiCtx, piAddr, &dims, &ndims, (short*)&data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const short*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT16: + sciErr = getHypermatOfUnsignedInteger16(pvApiCtx, piAddr, &dims, &ndims, (unsigned short*)&data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned short*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_INT32: + sciErr = getHypermatOfInteger32(pvApiCtx, piAddr, &dims, &ndims, (int*)&data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const int*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + case SCI_UINT32: + sciErr = getHypermatOfUnsignedInteger32(pvApiCtx, piAddr, &dims, &ndims, (unsigned int*)&data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + sciErr = createHypermatOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned int*)data); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + break; + } + } + else + { + Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname, 1); + return 1; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/hypermatIntExample.dia.ref b/modules/api_scilab/tests/unit_tests/hypermatIntExample.dia.ref new file mode 100755 index 000000000..5446f8952 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/hypermatIntExample.dia.ref @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/hypermatIntExample")); +cd(pathconvert(TMPDIR+"/hypermatIntExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/hypermatIntExample.c",pathconvert(TMPDIR+"/hypermatIntExample/hypermatIntExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_hypermatIntExample",["hypermatIntExample","hypermatIntExample"],"hypermatIntExample.c",[],"","",cflags); +exec("loader.sce"); +a = hypermat([1 2 3], int8(1:6)); +b = hypermat([1 2 3], uint8(1:6)); +c = hypermat([1 2 3], int16(1:6)); +d = hypermat([1 2 3], uint16(1:6)); +e = hypermat([1 2 3], int32(1:6)); +f = hypermat([1 2 3], uint32(1:6)); +assert_checkequal(hypermatIntExample(a), a); +assert_checkequal(hypermatIntExample(b), b); +assert_checkequal(hypermatIntExample(c), c); +assert_checkequal(hypermatIntExample(d), d); +assert_checkequal(hypermatIntExample(e), e); +assert_checkequal(hypermatIntExample(f), f); diff --git a/modules/api_scilab/tests/unit_tests/hypermatIntExample.tst b/modules/api_scilab/tests/unit_tests/hypermatIntExample.tst new file mode 100755 index 000000000..abb142134 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/hypermatIntExample.tst @@ -0,0 +1,29 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/hypermatIntExample")); +cd(pathconvert(TMPDIR+"/hypermatIntExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/hypermatIntExample.c",pathconvert(TMPDIR+"/hypermatIntExample/hypermatIntExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_hypermatIntExample",["hypermatIntExample","hypermatIntExample"],"hypermatIntExample.c",[],"","",cflags); +exec("loader.sce"); + +a = hypermat([1 2 3], int8(1:6)); +b = hypermat([1 2 3], uint8(1:6)); +c = hypermat([1 2 3], int16(1:6)); +d = hypermat([1 2 3], uint16(1:6)); +e = hypermat([1 2 3], int32(1:6)); +f = hypermat([1 2 3], uint32(1:6)); + +assert_checkequal(hypermatIntExample(a), a); +assert_checkequal(hypermatIntExample(b), b); +assert_checkequal(hypermatIntExample(c), c); +assert_checkequal(hypermatIntExample(d), d); +assert_checkequal(hypermatIntExample(e), e); +assert_checkequal(hypermatIntExample(f), f); diff --git a/modules/api_scilab/tests/unit_tests/integer_reading_api.c b/modules/api_scilab/tests/unit_tests/integer_reading_api.c new file mode 100755 index 000000000..bb8a964c1 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/integer_reading_api.c @@ -0,0 +1,277 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn); + +int read_integer(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + //output variable info + int iRows8 = 0; + int iCols8 = 0; + int iRows16 = 0; + int iCols16 = 0; + int iRows32 = 0; + int iCols32 = 0; + int iRowsu8 = 0; + int iColsu8 = 0; + int iRowsu16 = 0; + int iColsu16 = 0; + int iRowsu32 = 0; + int iColsu32 = 0; + int iPrec = 0; + int* piAddr8 = NULL; + int* piAddr16 = NULL; + int* piAddr32 = NULL; + int* piAddru8 = NULL; + int* piAddru16 = NULL; + int* piAddru32 = NULL; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + char* pcDataOut = NULL; + short* psDataOut = NULL; + int* piDataOut = NULL; + unsigned char* pucDataOut = NULL; + unsigned short* pusDataOut = NULL; + unsigned int* puiDataOut = NULL; + + //check input/output arguments count + CheckInputArgument(pvApiCtx, 6, 6); + CheckOutputArgument(pvApiCtx, 6, 6); + + //get varialbe address + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr8); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddru8); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr16); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddru16); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr32); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddru32); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr8, &iPrec); + if (sciErr.iErr || iPrec != SCI_INT8) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru8, &iPrec); + if (sciErr.iErr || iPrec != SCI_UINT8) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr16, &iPrec); + if (sciErr.iErr || iPrec != SCI_INT16) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru16, &iPrec); + if (sciErr.iErr || iPrec != SCI_UINT16) + { + printError(&sciErr, 0); + return 0; + } + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr32, &iPrec); + if (sciErr.iErr || iPrec != SCI_INT32) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru32, &iPrec); + if (sciErr.iErr || iPrec != SCI_UINT32) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger8(pvApiCtx, piAddr8, &iRows8, &iCols8, &pcData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddru8, &iRowsu8, &iColsu8, &pucData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger16(pvApiCtx, piAddr16, &iRows16, &iCols16, &psData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddru16, &iRowsu16, &iColsu16, &pusData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger32(pvApiCtx, piAddr32, &iRows32, &iCols32, &piData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddru32, &iRowsu32, &iColsu32, &puiData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc and fill new variable + pcDataOut = (char*)create_output(2, 1, iRows8, iCols8, (void*)pcData); + pucDataOut = (unsigned char*)create_output(4, 1, iRowsu8, iColsu8, (void*)pucData); + psDataOut = (short*)create_output(8, 2, iRows16, iCols16, (void*)psData); + pusDataOut = (unsigned short*)create_output(16, 2, iRowsu16, iColsu16, (void*)pusData); + piDataOut = (int*)create_output(32, 4, iRows32, iCols32, (void*)piData); + puiDataOut = (unsigned int*)create_output(64, 4, iRowsu32, iColsu32, (void*)puiData); + + //create new variable + sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows8, iCols8, pcDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRowsu8, iColsu8, pucDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 3, iRows16, iCols16, psDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 4, iRowsu16, iColsu16, pusDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 5, iRows32, iCols32, piDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 6, iRowsu32, iColsu32, puiDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3; + AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4; + AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5; + AssignOutputVariable(pvApiCtx, 6) = nbInputArgument(pvApiCtx) + 6; + return 0; +} + +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn) +{ + int i = 0; + void* pvDataOut = (void*)malloc(_iSize * _iRows * _iCols); + for (i = 0 ; i < _iRows * _iCols ; i++) + { + int iVal = 0; + memcpy(&iVal, (char*)_pvDataIn + i * _iSize, _iSize); + iVal *= _iCoeff; + memcpy((char*)pvDataOut + i * _iSize, &iVal, _iSize); + } + return pvDataOut; +} diff --git a/modules/api_scilab/tests/unit_tests/integer_reading_api.dia.ref b/modules/api_scilab/tests/unit_tests/integer_reading_api.dia.ref new file mode 100755 index 000000000..256a72888 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/integer_reading_api.dia.ref @@ -0,0 +1,39 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/integer_reading_api")); +cd(pathconvert(TMPDIR+"/integer_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/integer_reading_api.c",pathconvert(TMPDIR+"/integer_reading_api/integer_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("integer_reading",["read_integer","read_integer"],"integer_reading_api.c",[],"","",cflags); +exec("loader.sce"); +a8 = int8([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au8 = uint8([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a16 = int16([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au16 = uint16([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a32 = int32([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au32 = uint32([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +[c8, cu8, c16, cu16, c32, cu32] = read_integer(a8, au8, a16, au16, a32, au32); +if or(c8 <> a8 * 2) then bugmes();quit;end +if or(cu8 <> au8 * 4) then bugmes();quit;end +if or(c16 <> a16 * 8) then bugmes();quit;end +if or(cu16 <> au16 * 16) then bugmes();quit;end +if or(c32 <> a32 * 32) then bugmes();quit;end +if or(cu32 <> au32 * 64) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/integer_reading_api.tst b/modules/api_scilab/tests/unit_tests/integer_reading_api.tst new file mode 100755 index 000000000..1eef39a6a --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/integer_reading_api.tst @@ -0,0 +1,41 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/integer_reading_api")); +cd(pathconvert(TMPDIR+"/integer_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/integer_reading_api.c",pathconvert(TMPDIR+"/integer_reading_api/integer_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("integer_reading",["read_integer","read_integer"],"integer_reading_api.c",[],"","",cflags); +exec("loader.sce"); + +a8 = int8([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au8 = uint8([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a16 = int16([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au16 = uint16([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a32 = int32([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au32 = uint32([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +[c8, cu8, c16, cu16, c32, cu32] = read_integer(a8, au8, a16, au16, a32, au32); +if or(c8 <> a8 * 2) then pause;end +if or(cu8 <> au8 * 4) then pause;end +if or(c16 <> a16 * 8) then pause;end +if or(cu16 <> au16 * 16) then pause;end +if or(c32 <> a32 * 32) then pause;end +if or(cu32 <> au32 * 64) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/integer_writing_api.c b/modules/api_scilab/tests/unit_tests/integer_writing_api.c new file mode 100755 index 000000000..f24466d90 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/integer_writing_api.c @@ -0,0 +1,277 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn); +int read_integer(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + //output variable info + int iRows8 = 0; + int iCols8 = 0; + int iRows16 = 0; + int iCols16 = 0; + int iRows32 = 0; + int iCols32 = 0; + int iRowsu8 = 0; + int iColsu8 = 0; + int iRowsu16 = 0; + int iColsu16 = 0; + int iRowsu32 = 0; + int iColsu32 = 0; + int iPrec = 0; + int* piAddr8 = NULL; + int* piAddr16 = NULL; + int* piAddr32 = NULL; + int* piAddru8 = NULL; + int* piAddru16 = NULL; + int* piAddru32 = NULL; + char* pcData = NULL; + short* psData = NULL; + int* piData = NULL; + unsigned char* pucData = NULL; + unsigned short* pusData = NULL; + unsigned int* puiData = NULL; + char* pcDataOut = NULL; + short* psDataOut = NULL; + int* piDataOut = NULL; + unsigned char* pucDataOut = NULL; + unsigned short* pusDataOut = NULL; + unsigned int* puiDataOut = NULL; + + //check input/output arguments count + CheckInputArgument(pvApiCtx, 6, 6); + CheckOutputArgument(pvApiCtx, 6, 6); + + //get varialbe address + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr8); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddru8); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr16); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddru16); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr32); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddru32); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr8, &iPrec); + if (sciErr.iErr || iPrec != SCI_INT8) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru8, &iPrec); + if (sciErr.iErr || iPrec != SCI_UINT8) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr16, &iPrec); + if (sciErr.iErr || iPrec != SCI_INT16) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru16, &iPrec); + if (sciErr.iErr || iPrec != SCI_UINT16) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr32, &iPrec); + if (sciErr.iErr || iPrec != SCI_INT32) + { + printError(&sciErr, 0); + return 0; + } + + //check variable precision + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddru32, &iPrec); + if (sciErr.iErr || iPrec != SCI_UINT32) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger8(pvApiCtx, piAddr8, &iRows8, &iCols8, &pcData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddru8, &iRowsu8, &iColsu8, &pucData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger16(pvApiCtx, piAddr16, &iRows16, &iCols16, &psData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddru16, &iRowsu16, &iColsu16, &pusData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfInteger32(pvApiCtx, piAddr32, &iRows32, &iCols32, &piData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //retrieve dimensions and data + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddru32, &iRowsu32, &iColsu32, &puiData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc and fill new variable + pcDataOut = (char*)create_output(2, 1, iRows8, iCols8, (void*)pcData); + pucDataOut = (unsigned char*)create_output(4, 1, iRowsu8, iColsu8, (void*)pucData); + psDataOut = (short*)create_output(8, 2, iRows16, iCols16, (void*)psData); + pusDataOut = (unsigned short*)create_output(16, 2, iRowsu16, iColsu16, (void*)pusData); + piDataOut = (int*)create_output(32, 4, iRows32, iCols32, (void*)piData); + puiDataOut = (unsigned int*)create_output(64, 4, iRowsu32, iColsu32, (void*)puiData); + + //create new variable + sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows8, iCols8, pcDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRowsu8, iColsu8, pucDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 3, iRows16, iCols16, psDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 4, iRowsu16, iColsu16, pusDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 5, iRows32, iCols32, piDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //create new variable + sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 6, iRowsu32, iColsu32, puiDataOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; + AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3; + AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4; + AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5; + AssignOutputVariable(pvApiCtx, 6) = nbInputArgument(pvApiCtx) + 6; + return 0; +} + +void* create_output(int _iCoeff, int _iSize, int _iRows, int _iCols, void* _pvDataIn) +{ + int i = 0; + void* pvDataOut = (void*)malloc(_iSize * _iRows * _iCols); + for (i = 0 ; i < _iRows * _iCols ; i++) + { + int iVal = 0; + memcpy(&iVal, (char*)_pvDataIn + i * _iSize, _iSize); + iVal *= _iCoeff; + memcpy((char*)pvDataOut + i * _iSize, &iVal, _iSize); + } + return pvDataOut; +} diff --git a/modules/api_scilab/tests/unit_tests/integer_writing_api.dia.ref b/modules/api_scilab/tests/unit_tests/integer_writing_api.dia.ref new file mode 100755 index 000000000..bc553ddb7 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/integer_writing_api.dia.ref @@ -0,0 +1,39 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/integer_writing_api")); +cd(pathconvert(TMPDIR+"/integer_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/integer_writing_api.c",pathconvert(TMPDIR+"/integer_writing_api/integer_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("integer_writing",["read_integer","read_integer"],"integer_writing_api.c",[],"","",cflags); +exec("loader.sce"); +a8 = int8([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au8 = uint8([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a16 = int16([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au16 = uint16([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a32 = int32([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au32 = uint32([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +[c8, cu8, c16, cu16, c32, cu32] = read_integer(a8, au8, a16, au16, a32, au32); +if or(c8 <> a8 * 2) then bugmes();quit;end +if or(cu8 <> au8 * 4) then bugmes();quit;end +if or(c16 <> a16 * 8) then bugmes();quit;end +if or(cu16 <> au16 * 16) then bugmes();quit;end +if or(c32 <> a32 * 32) then bugmes();quit;end +if or(cu32 <> au32 * 64) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/integer_writing_api.tst b/modules/api_scilab/tests/unit_tests/integer_writing_api.tst new file mode 100755 index 000000000..ee2388e97 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/integer_writing_api.tst @@ -0,0 +1,41 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/integer_writing_api")); +cd(pathconvert(TMPDIR+"/integer_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/integer_writing_api.c",pathconvert(TMPDIR+"/integer_writing_api/integer_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("integer_writing",["read_integer","read_integer"],"integer_writing_api.c",[],"","",cflags); +exec("loader.sce"); + +a8 = int8([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au8 = uint8([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a16 = int16([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au16 = uint16([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +a32 = int32([ 1 -2 3 -4 5; .. + -6 7 -8 9 -10; .. + 11 -12 13 -14 15]); +au32 = uint32([ 1 2 3 4 5; .. + 6 7 8 9 10; .. + 11 12 13 14 15]); +[c8, cu8, c16, cu16, c32, cu32] = read_integer(a8, au8, a16, au16, a32, au32); +if or(c8 <> a8 * 2) then pause;end +if or(cu8 <> au8 * 4) then pause;end +if or(c16 <> a16 * 8) then pause;end +if or(cu16 <> au16 * 16) then pause;end +if or(c32 <> a32 * 32) then pause;end +if or(cu32 <> au32 * 64) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/list_createlist_api.c b/modules/api_scilab/tests/unit_tests/list_createlist_api.c new file mode 100755 index 000000000..cf3c72a23 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/list_createlist_api.c @@ -0,0 +1,134 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int list_createlist(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int *piAddr = NULL; + int* piChild = NULL; + double pdblData1[] = {1, 3, 5, 2, 4, 6}; + double pdblData2[] = {6, 4, 2, 5, 3, 1}; + char *pstData[] = {"may", "be", "the", "with", "puffin", "you"}; + short psData[] = {1, 4, 2, 5, 3, 6}; + double pdblPoly1[] = {1}; + double pdblPoly2[] = { -2, -1}; + double pdblPoly3[] = {1, 2, 3}; + double pdblPoly4[] = { -4, -3, -2, -1}; + double pdblPoly5[] = {1, 2, 3, 4, 5}; + double pdblPoly6[] = { -6, -5, -4, -3, -2, -1}; + double *pdblPoly[] = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6}; + int piCoef[] = {1, 3, 5, 2, 4, 6}; + int piNbItemRow[] = {1, 2, 1}; + int piColPos[] = {8, 4, 7, 2}; + double pdblSReal[] = {1, 2, 3, 4}; + double pdblSImg[] = {4, 3, 2, 1}; + int piBool[] = {1, 0, 1, 0, 1, 0, 1, 0, 1}; + double* pdblDataPtr = NULL; + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //add list in list + sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pdblDataPtr = (double*)malloc(sizeof(double) * 4); + pdblDataPtr[0] = 1; + pdblDataPtr[1] = 2; + pdblDataPtr[2] = 3; + pdblDataPtr[3] = 4; + + sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/list_createlist_api.dia.ref b/modules/api_scilab/tests/unit_tests/list_createlist_api.dia.ref new file mode 100755 index 000000000..f3b0936fd --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/list_createlist_api.dia.ref @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/list_createlist_api")); +cd(pathconvert(TMPDIR+"/list_createlist_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/list_createlist_api.c",pathconvert(TMPDIR+"/list_createlist_api/list_createlist_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("list_createlist",["list_createlist","list_createlist"],"list_createlist_api.c",[],"","",cflags); +exec("loader.sce"); +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then bugmes();quit;end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then bugmes();quit;end + if size(l(i)) <> dim_ref(i) then bugmes();quit;end +end diff --git a/modules/api_scilab/tests/unit_tests/list_createlist_api.tst b/modules/api_scilab/tests/unit_tests/list_createlist_api.tst new file mode 100755 index 000000000..bce05ab68 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/list_createlist_api.tst @@ -0,0 +1,25 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/list_createlist_api")); +cd(pathconvert(TMPDIR+"/list_createlist_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/list_createlist_api.c",pathconvert(TMPDIR+"/list_createlist_api/list_createlist_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("list_createlist",["list_createlist","list_createlist"],"list_createlist_api.c",[],"","",cflags); +exec("loader.sce"); + +size_ref = 8; +type_ref = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"]; +dim_ref = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3); +l = list_createlist(); +if size(l) <> size_ref then pause;end +for i = 1 : size_ref + if typeof(l(i)) <> type_ref(i) then pause;end + if size(l(i)) <> dim_ref(i) then pause;end +end diff --git a/modules/api_scilab/tests/unit_tests/pointer_reading_api.c b/modules/api_scilab/tests/unit_tests/pointer_reading_api.c new file mode 100755 index 000000000..8bea9503c --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/pointer_reading_api.c @@ -0,0 +1,69 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ +#include <stdlib.h> +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int read_pointer(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + + CheckInputArgument(pvApiCtx, 0, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + if (nbInputArgument(pvApiCtx) == 0) + { + //create mode + double* pdblData = (double*)malloc(sizeof(double) * 2 * 2); + pdblData[0] = 1; + pdblData[1] = 3; + pdblData[2] = 2; + pdblData[3] = 4; + sciErr = createPointer(pvApiCtx, nbInputArgument(pvApiCtx) + 1, (void*)pdblData); + } + else if (nbInputArgument(pvApiCtx) == 1) + { + //read mode + int iType = 0; + int* piAddr = NULL; + void* pvPtr = NULL; + double* pdblData = NULL; + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getPointer(pvApiCtx, piAddr, &pvPtr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pdblData = (double*)pvPtr; + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 2, 2, pdblData); + } + else + { + return 0; + } + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/pointer_reading_api.dia.ref b/modules/api_scilab/tests/unit_tests/pointer_reading_api.dia.ref new file mode 100755 index 000000000..19789235c --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/pointer_reading_api.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/pointer_reading_api")); +cd(pathconvert(TMPDIR+"/pointer_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/pointer_reading_api.c",pathconvert(TMPDIR+"/pointer_reading_api/pointer_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("pointer_reading",["read_pointer","read_pointer"],"pointer_reading_api.c",[],"","",cflags); +exec("loader.sce"); +b_ref = [1,2;3,4]; +a = read_pointer(); +b = read_pointer(a); +if or(b <> b_ref) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/pointer_reading_api.tst b/modules/api_scilab/tests/unit_tests/pointer_reading_api.tst new file mode 100755 index 000000000..731ddcf60 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/pointer_reading_api.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/pointer_reading_api")); +cd(pathconvert(TMPDIR+"/pointer_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/pointer_reading_api.c",pathconvert(TMPDIR+"/pointer_reading_api/pointer_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("pointer_reading",["read_pointer","read_pointer"],"pointer_reading_api.c",[],"","",cflags); +exec("loader.sce"); + +b_ref = [1,2;3,4]; +a = read_pointer(); +b = read_pointer(a); +if or(b <> b_ref) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/polyExample.c b/modules/api_scilab/tests/unit_tests/polyExample.c new file mode 100755 index 000000000..aab37c356 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/polyExample.c @@ -0,0 +1,148 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int polyExample(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isPolyType(pvApiCtx, piAddr)) + { + char pstVarName[64]; + int iLen = 0; + + sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarName, &iLen); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + + if (isScalar(pvApiCtx, piAddr)) + { + int iNbCoef = 0; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedSingleComplexPoly(pvApiCtx, piAddr, &iNbCoef, &pdblReal, &pdblImg); + if (iRet) + { + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + return iRet; + } + + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal, &pdblImg); + if (sciErr.iErr) + { + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedSingleComplexPoly(pdblReal, pdblImg); + } + else + { + iRet = getAllocatedSinglePoly(pvApiCtx, piAddr, &iNbCoef, &pdblReal); + if (iRet) + { + freeAllocatedSinglePoly(pdblReal); + return iRet; + } + + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal); + if (sciErr.iErr) + { + freeAllocatedSinglePoly(pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedSinglePoly(pdblReal); + } + } + else + { + int iRows = 0; + int iCols = 0; + int* piNbCoef = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + + if (isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedMatrixOfComplexPoly(pvApiCtx, piAddr, &iRows, &iCols, &piNbCoef, &pdblReal, &pdblImg); + if (iRet) + { + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + return iRet; + } + + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg); + if (sciErr.iErr) + { + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg); + } + else + { + iRet = getAllocatedMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, &piNbCoef, &pdblReal); + if (iRet) + { + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + return iRet; + } + + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal); + if (sciErr.iErr) + { + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal); + } + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/polyExample.dia.ref b/modules/api_scilab/tests/unit_tests/polyExample.dia.ref new file mode 100755 index 000000000..be6076309 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/polyExample.dia.ref @@ -0,0 +1,22 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/polyExample")); +cd(pathconvert(TMPDIR+"/polyExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/polyExample.c",pathconvert(TMPDIR+"/polyExample/polyExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_polyExample",["polyExample","polyExample"],"polyExample.c",[],"","",cflags); +exec("loader.sce"); +a = %s; +b = (2 + 3*%i) * %s; +c = [a, 2*a, 3*a;4*a, 5*a, 6*a]; +d = [c + c * %i]; +assert_checkequal(polyExample(a), a); +assert_checkequal(polyExample(b), b); +assert_checkequal(polyExample(c), c); +assert_checkequal(polyExample(d), d); diff --git a/modules/api_scilab/tests/unit_tests/polyExample.tst b/modules/api_scilab/tests/unit_tests/polyExample.tst new file mode 100755 index 000000000..732e8a3f2 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/polyExample.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/polyExample")); +cd(pathconvert(TMPDIR+"/polyExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/polyExample.c",pathconvert(TMPDIR+"/polyExample/polyExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_polyExample",["polyExample","polyExample"],"polyExample.c",[],"","",cflags); +exec("loader.sce"); + +a = %s; +b = (2 + 3*%i) * %s; +c = [a, 2*a, 3*a;4*a, 5*a, 6*a]; +d = [c + c * %i]; +assert_checkequal(polyExample(a), a); +assert_checkequal(polyExample(b), b); +assert_checkequal(polyExample(c), c); +assert_checkequal(polyExample(d), d); diff --git a/modules/api_scilab/tests/unit_tests/poly_reading_api.c b/modules/api_scilab/tests/unit_tests/poly_reading_api.c new file mode 100755 index 000000000..1217ead61 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/poly_reading_api.c @@ -0,0 +1,161 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int read_poly(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i, j; + //variable info + int iRows = 0; + int iCols = 0; + int iVarLen = 0; + int* piAddr = NULL; + int* piNbCoef = NULL; + double** pdblReal = NULL; + double** pdblImg = NULL; + char* pstVarname = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isVarComplex(pvApiCtx, piAddr) == FALSE) + { + //Error + return 0; + } + + //get variable name length + sciErr = getPolyVariableName(pvApiCtx, piAddr, NULL, &iVarLen); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc buff to receive variable name + pstVarname = (char*)malloc(sizeof(char) * (iVarLen + 1));//1 for null termination + + //get variable name + sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarname, &iVarLen); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //First call: retrieve dimmension + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc array of coefficient + piNbCoef = (int*)malloc(sizeof(int) * iRows * iCols); + + //Second call: retrieve coefficient + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, NULL, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //alloc arrays of data + pdblReal = (double**)malloc(sizeof(double*) * iRows * iCols); + pdblImg = (double**)malloc(sizeof(double*) * iRows * iCols); + + for (i = 0 ; i < iRows * iCols ; i++) + { + pdblReal[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + pdblImg[i] = (double*)malloc(sizeof(double) * piNbCoef[i]); + } + + //Third call: retrieve data + sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, pdblReal, pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with Data + //Invert polynomials in the matrix and invert coefficients + for (i = 0 ; i < (iRows * iCols) / 2 ; i++) + { + int iPos1 = iRows * iCols - 1 - i; + double* pdblSave = NULL; + int iNbCoefSave = 0; + //switch array of coefficient + pdblSave = pdblReal[i]; + pdblReal[i] = pdblReal[iPos1]; + pdblReal[iPos1] = pdblSave; + pdblSave = pdblImg[i]; + pdblImg[i] = pdblImg[iPos1]; + pdblImg[iPos1] = pdblSave; + //switch number of coefficient + iNbCoefSave = piNbCoef[i]; + piNbCoef[i] = piNbCoef[iPos1]; + piNbCoef[iPos1] = iNbCoefSave; + } + + //switch coefficient + for (i = 0 ; i < iRows * iCols ; i++) + { + for (j = 0 ; j < piNbCoef[i] / 2 ; j++) + { + int iPos2 = piNbCoef[i] - 1 - j; + double dblVal = pdblReal[i][j]; + pdblReal[i][j] = pdblReal[i][iPos2]; + pdblReal[i][iPos2] = dblVal; + dblVal = pdblImg[i][j]; + pdblImg[i][j] = pdblImg[i][iPos2]; + pdblImg[i][iPos2] = dblVal; + } + } + + sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarname, iRows, iCols, piNbCoef, pdblReal, pdblImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //free OS memory + free(pstVarname); + free(piNbCoef); + for (i = 0 ; i < iRows * iCols ; i++) + { + free(pdblReal[i]); + free(pdblImg[i]); + } + free(pdblReal); + free(pdblImg); + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/poly_reading_api.dia.ref b/modules/api_scilab/tests/unit_tests/poly_reading_api.dia.ref new file mode 100755 index 000000000..3fbd8e478 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/poly_reading_api.dia.ref @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/poly_reading_api")); +cd(pathconvert(TMPDIR+"/poly_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/poly_reading_api.c",pathconvert(TMPDIR+"/poly_reading_api/poly_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("poly_reading",["read_poly","read_poly"],"poly_reading_api.c",[],"","",cflags); +exec("loader.sce"); +coeff1 = [ .. +29*%i,22*%i,16*%i,11*%i,7*%i,30,23,17,12,8,-31*%i,-24*%i,-18*%i,-13*%i,-9*%i,32,25,19,14,10,-33*%i,-26*%i,-20*%i,-15*%i,0,34,27,21,0,0,0,-28*%i,0,0,0,36-35*%i,0,0,0,0; .. +4*%i,2*%i,%i,22,16,5,-3,0,-23*%i,-17*%i,-6*%i,0,0,24,18,0,0,0,-25*%i,-19*%i,0,0,0,26,20,0,0,0,-27*%i,-21*%i,0,0,0,28,0,0,0,0,0,0; .. +11,7,4,2,1,-12*%i,-8*%i,-5*%i,3*%i,0,13,9,6,0,0,-14*%i,-10*%i,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; +x = poly(0, "x"); +p1 = 1; +p2 = 2 * x + 3 * %i; +p3 = 4 * x**2 - 5 * %i * x + 6; +p4 = 7 * x**3 - 8 * %i * x**2 + 9 * x - 10 * %i; +p5 = 11 * x**4 - 12 * %i * x**3 + 13 * x**2 - 14 * %i * x + 15; +p6 = 16 * x**5 - 17 * %i * x**4 + 18 * x**3 - 19 * %i * x**2 + 20 * x - 21 * %i; +p7 = 22 * x**6 - 23 * %i * x**5 + 24 * x**4 - 25 * %i * x**3 + 26 * x**2 - 27 * %i * x + 28; +p8 = %i; +p9 = 2 * %i * x - 3; +p10 = 4 * %i * x**2 + 5 * x - 6 * %i; +p11 = 7 * %i * x**3 + 8 * x**2 - 9 * %i * x + 10; +p12 = 11 * %i * x**4 + 12 * x**3 - 13 * %i * x**2 + 14 * x - 15 * %i; +p13 = 16 * %i * x**5 + 17 * x**4 - 18 * %i * x**3 + 19 * x**2 - 20 * %i * x + 21; +p14 = 22 * %i * x**6 + 23 * x**5 - 24 * %i * x**4 + 25 * x**3 - 26 * %i * x**2 + 27 * x - 28 * %i; +p15 = 29 * %i * x**7 + 30 * x**6 - 31 * %i * x**5 + 32 * x**4 - 33 * %i * x**3 + 34 * x**2 - 35 * %i + 36; +p = [p1, p2, p3, p4, p5 ; p6, p7, p8, p9 ,p10 ; p11, p12, p13, p14, p15]; +p1 = read_poly(p); +coeff2 = coeff(p1); +if or(coeff2 <> coeff1) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/poly_reading_api.tst b/modules/api_scilab/tests/unit_tests/poly_reading_api.tst new file mode 100755 index 000000000..2e6a0230b --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/poly_reading_api.tst @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/poly_reading_api")); +cd(pathconvert(TMPDIR+"/poly_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/poly_reading_api.c",pathconvert(TMPDIR+"/poly_reading_api/poly_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("poly_reading",["read_poly","read_poly"],"poly_reading_api.c",[],"","",cflags); +exec("loader.sce"); + +coeff1 = [ .. +29*%i,22*%i,16*%i,11*%i,7*%i,30,23,17,12,8,-31*%i,-24*%i,-18*%i,-13*%i,-9*%i,32,25,19,14,10,-33*%i,-26*%i,-20*%i,-15*%i,0,34,27,21,0,0,0,-28*%i,0,0,0,36-35*%i,0,0,0,0; .. +4*%i,2*%i,%i,22,16,5,-3,0,-23*%i,-17*%i,-6*%i,0,0,24,18,0,0,0,-25*%i,-19*%i,0,0,0,26,20,0,0,0,-27*%i,-21*%i,0,0,0,28,0,0,0,0,0,0; .. +11,7,4,2,1,-12*%i,-8*%i,-5*%i,3*%i,0,13,9,6,0,0,-14*%i,-10*%i,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; +x = poly(0, "x"); +p1 = 1; +p2 = 2 * x + 3 * %i; +p3 = 4 * x**2 - 5 * %i * x + 6; +p4 = 7 * x**3 - 8 * %i * x**2 + 9 * x - 10 * %i; +p5 = 11 * x**4 - 12 * %i * x**3 + 13 * x**2 - 14 * %i * x + 15; +p6 = 16 * x**5 - 17 * %i * x**4 + 18 * x**3 - 19 * %i * x**2 + 20 * x - 21 * %i; +p7 = 22 * x**6 - 23 * %i * x**5 + 24 * x**4 - 25 * %i * x**3 + 26 * x**2 - 27 * %i * x + 28; +p8 = %i; +p9 = 2 * %i * x - 3; +p10 = 4 * %i * x**2 + 5 * x - 6 * %i; +p11 = 7 * %i * x**3 + 8 * x**2 - 9 * %i * x + 10; +p12 = 11 * %i * x**4 + 12 * x**3 - 13 * %i * x**2 + 14 * x - 15 * %i; +p13 = 16 * %i * x**5 + 17 * x**4 - 18 * %i * x**3 + 19 * x**2 - 20 * %i * x + 21; +p14 = 22 * %i * x**6 + 23 * x**5 - 24 * %i * x**4 + 25 * x**3 - 26 * %i * x**2 + 27 * x - 28 * %i; +p15 = 29 * %i * x**7 + 30 * x**6 - 31 * %i * x**5 + 32 * x**4 - 33 * %i * x**3 + 34 * x**2 - 35 * %i + 36; +p = [p1, p2, p3, p4, p5 ; p6, p7, p8, p9 ,p10 ; p11, p12, p13, p14, p15]; +p1 = read_poly(p); +coeff2 = coeff(p1); +if or(coeff2 <> coeff1) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/poly_writing_api.c b/modules/api_scilab/tests/unit_tests/poly_writing_api.c new file mode 100755 index 000000000..4c919f6c7 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/poly_writing_api.c @@ -0,0 +1,56 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int write_poly(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + //output variable info : polinomial matrix 2 x 4 + //[ x + 2 x^2 - 4x + 5 4x^3 - 14x^2 + 18 ; + // 2x^3 - 12x^2 + 64 1 8x^5 + 32x^3] + int iRows = 2; + int iCols = 3; + //varname "x" + char pstVarName[2] = {"x"}; + //coeficient array + int piNbCoef[6] = {2, 4, 3, 1, 4, 6}; + //data array + double *pdblReal[6] = {0}; + double pdblPoly0[2] = {2, 1}; + double pdblPoly1[4] = {64, 0, -12, 2}; + double pdblPoly2[3] = {5, -4, 1}; + double pdblPoly3[1] = {1}; + double pdblPoly4[4] = {18, 0, -14, 4}; + double pdblPoly5[6] = {0, 0, 0, 32, 0, 8}; + pdblReal[0] = pdblPoly0; + pdblReal[1] = pdblPoly1; + pdblReal[2] = pdblPoly2; + pdblReal[3] = pdblPoly3; + pdblReal[4] = pdblPoly4; + pdblReal[5] = pdblPoly5; + + sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/poly_writing_api.dia.ref b/modules/api_scilab/tests/unit_tests/poly_writing_api.dia.ref new file mode 100755 index 000000000..b9fc726e1 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/poly_writing_api.dia.ref @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/poly_writing_api")); +cd(pathconvert(TMPDIR+"/poly_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/poly_writing_api.c",pathconvert(TMPDIR+"/poly_writing_api/poly_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("poly_writing",["write_poly","write_poly"],"poly_writing_api.c",[],"","",cflags); +exec("loader.sce"); +p_ref = [2 5 18 1 -4 0 0 1 -14 0 0 4 0 0 0 0 0 0;64 1 0 0 0 0 -12 0 0 2 0 32 0 0 0 0 0 8]; +l = list(); +a = write_poly(); +p = coeff(a); +if or(p <> p_ref) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/poly_writing_api.tst b/modules/api_scilab/tests/unit_tests/poly_writing_api.tst new file mode 100755 index 000000000..da6dd90a0 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/poly_writing_api.tst @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/poly_writing_api")); +cd(pathconvert(TMPDIR+"/poly_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/poly_writing_api.c",pathconvert(TMPDIR+"/poly_writing_api/poly_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("poly_writing",["write_poly","write_poly"],"poly_writing_api.c",[],"","",cflags); +exec("loader.sce"); + +p_ref = [2 5 18 1 -4 0 0 1 -14 0 0 4 0 0 0 0 0 0;64 1 0 0 0 0 -12 0 0 2 0 32 0 0 0 0 0 8]; +l = list(); +a = write_poly(); +p = coeff(a); +if or(p <> p_ref) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c b/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c new file mode 100755 index 000000000..e657efcf1 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c @@ -0,0 +1,64 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int read_write_boolean(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i; + //first variable info : real matrix of double + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int* piBool = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //get size and data from Scilab memory + sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with data + for (i = 0 ; i < iRows * iCols ; i++) + { + piBool[i] = piBool[i] == 0 ? 1 : 0; + } + + sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/read_write_boolean_api.dia.ref b/modules/api_scilab/tests/unit_tests/read_write_boolean_api.dia.ref new file mode 100755 index 000000000..9eae33690 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/read_write_boolean_api.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/read_write_boolean_api")); +cd(pathconvert(TMPDIR+"/read_write_boolean_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c",pathconvert(TMPDIR+"/read_write_boolean_api/read_write_boolean_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("read_write_boolean",["read_write_boolean","read_write_boolean"],"read_write_boolean_api.c",[],"","",cflags); +exec("loader.sce"); +a = [%t, %f, %t ; %f, %t, %f ; %t, %f, %t]; +a_ref = [%f, %t, %f ; %t, %f, %t ; %f, %t, %f]; +b = read_write_boolean(a); +if or(b <> a_ref) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/read_write_boolean_api.tst b/modules/api_scilab/tests/unit_tests/read_write_boolean_api.tst new file mode 100755 index 000000000..ec4913dc2 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/read_write_boolean_api.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/read_write_boolean_api")); +cd(pathconvert(TMPDIR+"/read_write_boolean_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/read_write_boolean_api.c",pathconvert(TMPDIR+"/read_write_boolean_api/read_write_boolean_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("read_write_boolean",["read_write_boolean","read_write_boolean"],"read_write_boolean_api.c",[],"","",cflags); +exec("loader.sce"); + +a = [%t, %f, %t ; %f, %t, %f ; %t, %f, %t]; +a_ref = [%f, %t, %f ; %t, %f, %t ; %f, %t, %f]; +b = read_write_boolean(a); +if or(b <> a_ref) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c b/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c new file mode 100755 index 000000000..44abd1536 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c @@ -0,0 +1,97 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int read_write_bsparse(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i = 0; + int j = 0; + int k = 0; + //first variable info : real matrix of double + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + int iCol = 0; + int iNewCol = 0; + int iNewItem = 0; + int* piNewRow = NULL; + int* piNewCol = NULL; + + //check input and output arguments + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + //get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //get size and data from Scilab memory + sciErr = getBooleanSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Do something with data + //convert %T -> %F and %F -> %T + iNewItem = (iRows * iCols) - iNbItem; + piNewRow = (int*)MALLOC(sizeof(int) * iRows); + piNewCol = (int*)MALLOC(sizeof(int) * iNewItem); + + for (i = 0 ; i < iRows ; i++) + { + piNewRow[i] = iCols - piNbItemRow[i]; + for (j = 0 ; j < iCols ; j++) + { + int iFind = 0; + for (k = 0 ; k < piNbItemRow[i] ; k++) + { + if (piColPos[iCol + k] == (j + 1)) + { + iFind = 1; + break; + } + } + + if (iFind == 0) + { + piNewCol[iNewCol++] = (j + 1); + } + } + + iCol += piNbItemRow[i]; + } + + sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNewItem, piNewRow, piNewCol); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.dia.ref b/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.dia.ref new file mode 100755 index 000000000..a42c55f92 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/read_write_bsparse_api")); +cd(pathconvert(TMPDIR+"/read_write_bsparse_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c",pathconvert(TMPDIR+"/read_write_bsparse_api/read_write_bsparse_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("read_write_bsparse",["read_write_bsparse","read_write_bsparse"],"read_write_bsparse_api.c",[],"","",cflags); +exec("loader.sce"); +a = sparse([%t, %f, %t ; %f, %t, %f ; %t, %f, %t]); +a_ref = sparse([%f, %t, %f ; %t, %f, %t ; %f, %t, %f]); +b = read_write_bsparse(a); +if or(b <> a_ref) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst b/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst new file mode 100755 index 000000000..804c13a4d --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/read_write_bsparse_api")); +cd(pathconvert(TMPDIR+"/read_write_bsparse_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/read_write_bsparse_api.c",pathconvert(TMPDIR+"/read_write_bsparse_api/read_write_bsparse_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("read_write_bsparse",["read_write_bsparse","read_write_bsparse"],"read_write_bsparse_api.c",[],"","",cflags); +exec("loader.sce"); + +a = sparse([%t, %f, %t ; %f, %t, %f ; %t, %f, %t]); +a_ref = sparse([%f, %t, %f ; %t, %f, %t ; %f, %t, %f]); +b = read_write_bsparse(a); +if or(b <> a_ref) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/sparseExample.c b/modules/api_scilab/tests/unit_tests/sparseExample.c new file mode 100755 index 000000000..e1858058d --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparseExample.c @@ -0,0 +1,91 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int sparseExample(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isSparseType(pvApiCtx, piAddr)) + { + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + if (isVarComplex(pvApiCtx, piAddr)) + { + iRet = getAllocatedComplexSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + if (iRet) + { + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + return iRet; + } + + sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg); + if (sciErr.iErr) + { + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg); + } + else + { + iRet = getAllocatedSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal); + if (iRet) + { + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + return iRet; + } + + sciErr = createSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal); + if (sciErr.iErr) + { + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal); + } + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/sparseExample.dia.ref b/modules/api_scilab/tests/unit_tests/sparseExample.dia.ref new file mode 100755 index 000000000..a62678f12 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparseExample.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/sparseExample")); +cd(pathconvert(TMPDIR+"/sparseExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/sparseExample.c",pathconvert(TMPDIR+"/sparseExample/sparseExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gwsparseExample",["sparseExample","sparseExample"],"sparseExample.c",[],"","",cflags); +exec("loader.sce"); +a = sparse([1,1;2,2;3,3], [1, 2, 3]); +b = sparse([1,1;2,2;3,3], [1 + 2 * %i, 3 , -4 * %i]); +assert_checkequal(sparseExample(a), a); +assert_checkequal(sparseExample(b), b); diff --git a/modules/api_scilab/tests/unit_tests/sparseExample.tst b/modules/api_scilab/tests/unit_tests/sparseExample.tst new file mode 100755 index 000000000..6de647673 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparseExample.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/sparseExample")); +cd(pathconvert(TMPDIR+"/sparseExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/sparseExample.c",pathconvert(TMPDIR+"/sparseExample/sparseExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gwsparseExample",["sparseExample","sparseExample"],"sparseExample.c",[],"","",cflags); +exec("loader.sce"); + +a = sparse([1,1;2,2;3,3], [1, 2, 3]); +b = sparse([1,1;2,2;3,3], [1 + 2 * %i, 3 , -4 * %i]); +assert_checkequal(sparseExample(a), a); +assert_checkequal(sparseExample(b), b); diff --git a/modules/api_scilab/tests/unit_tests/sparse_reading_api.c b/modules/api_scilab/tests/unit_tests/sparse_reading_api.c new file mode 100755 index 000000000..f7f66ff73 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparse_reading_api.c @@ -0,0 +1,77 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int read_sparse(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i, j, k; + int* piAddr = NULL; + int iRows = 0; + int iCols = 0; + int iNbItem = 0; + int* piNbItemRow = NULL; + int* piColPos = NULL; + double* pdblReal = NULL; + double* pdblImg = NULL; + + CheckInputArgument(pvApiCtx, 1, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isVarComplex(pvApiCtx, piAddr)) + { + sciErr = getComplexSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg); + } + else + { + sciErr = getSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal); + } + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciprint("Sparse %d item(s)\n", iNbItem); + k = 0; + + for (i = 0 ; i < iRows ; i++) + { + for (j = 0 ; j < piNbItemRow[i] ; j++) + { + sciprint("(%d,%d) = %f", i + 1, piColPos[k], pdblReal[k]); + if (isVarComplex(pvApiCtx, piAddr)) + { + sciprint(" %+fi", pdblImg[k]); + } + + sciprint("\n"); + k++; + } + } + + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = 0; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/sparse_reading_api.dia.ref b/modules/api_scilab/tests/unit_tests/sparse_reading_api.dia.ref new file mode 100755 index 000000000..0fa69642e --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparse_reading_api.dia.ref @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/sparse_reading_api")); +cd(pathconvert(TMPDIR+"/sparse_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/sparse_reading_api.c",pathconvert(TMPDIR+"/sparse_reading_api/sparse_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("sparse_reading",["read_sparse","read_sparse"],"sparse_reading_api.c",[],"","",cflags); +exec("loader.sce"); +sp=sparse([1,2;4,5;3,10],[1 + 2*%i,2 - 3*%i,-3 + 4*%i]); +read_sparse(sp); +Sparse 3 item(s) +(1,2) = 1.000000 +2.000000i +(3,10) = -3.000000 +4.000000i +(4,5) = 2.000000 -3.000000i diff --git a/modules/api_scilab/tests/unit_tests/sparse_reading_api.tst b/modules/api_scilab/tests/unit_tests/sparse_reading_api.tst new file mode 100755 index 000000000..2f034d68c --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparse_reading_api.tst @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/sparse_reading_api")); +cd(pathconvert(TMPDIR+"/sparse_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/sparse_reading_api.c",pathconvert(TMPDIR+"/sparse_reading_api/sparse_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("sparse_reading",["read_sparse","read_sparse"],"sparse_reading_api.c",[],"","",cflags); +exec("loader.sce"); + +sp=sparse([1,2;4,5;3,10],[1 + 2*%i,2 - 3*%i,-3 + 4*%i]); +read_sparse(sp); diff --git a/modules/api_scilab/tests/unit_tests/sparse_writing_api.c b/modules/api_scilab/tests/unit_tests/sparse_writing_api.c new file mode 100755 index 000000000..a6d42e412 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparse_writing_api.c @@ -0,0 +1,37 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int write_sparse(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int piNbItemRow[] = {1, 2, 1}; + int piColPos[] = {8, 4, 7, 2}; + double pdblSReal[] = {1, 2, 3, 4}; + double pdblSImg[] = {4, 3, 2, 1}; + int iNbItem = 4; + + sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 3, 10, iNbItem, piNbItemRow, piColPos, pdblSReal, pdblSImg); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/sparse_writing_api.dia.ref b/modules/api_scilab/tests/unit_tests/sparse_writing_api.dia.ref new file mode 100755 index 000000000..dbc1a5646 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparse_writing_api.dia.ref @@ -0,0 +1,17 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/sparse_writing_api")); +cd(pathconvert(TMPDIR+"/sparse_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/sparse_writing_api.c",pathconvert(TMPDIR+"/sparse_writing_api/sparse_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("sparse_writing",["write_sparse","write_sparse"],"sparse_writing_api.c",[],"","",cflags); +exec("loader.sce"); +sp_ref = sparse([1,8;2,4;2,7;3,2],[1+4*%i,2+3*%i,3+2*%i,4+%i], [3,10]); +sp = write_sparse(); +if or(sp <> sp_ref) then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/sparse_writing_api.tst b/modules/api_scilab/tests/unit_tests/sparse_writing_api.tst new file mode 100755 index 000000000..c6ebbca6a --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/sparse_writing_api.tst @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/sparse_writing_api")); +cd(pathconvert(TMPDIR+"/sparse_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/sparse_writing_api.c",pathconvert(TMPDIR+"/sparse_writing_api/sparse_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("sparse_writing",["write_sparse","write_sparse"],"sparse_writing_api.c",[],"","",cflags); +exec("loader.sce"); + +sp_ref = sparse([1,8;2,4;2,7;3,2],[1+4*%i,2+3*%i,3+2*%i,4+%i], [3,10]); +sp = write_sparse(); +if or(sp <> sp_ref) then pause;end diff --git a/modules/api_scilab/tests/unit_tests/stringExample.c b/modules/api_scilab/tests/unit_tests/stringExample.c new file mode 100755 index 000000000..c20239551 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/stringExample.c @@ -0,0 +1,89 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int stringExample(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int* piAddr = NULL; + int iType = 0; + int iRet = 0; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 0, 1); + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if (isStringType(pvApiCtx, piAddr)) + { + if (isScalar(pvApiCtx, piAddr)) + { + char* pstData = NULL; + + iRet = getAllocatedSingleString(pvApiCtx, piAddr, &pstData); + if (iRet) + { + freeAllocatedSingleString(pstData); + return iRet; + } + + iRet = createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstData); + if (iRet) + { + freeAllocatedSingleString(pstData); + return iRet; + } + + freeAllocatedSingleString(pstData); + } + else + { + int iRows = 0; + int iCols = 0; + char** pstData = NULL; + + iRet = getAllocatedMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, &pstData); + if (iRet) + { + freeAllocatedMatrixOfString(iRows, iCols, pstData); + return iRet; + } + + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pstData); + if (sciErr.iErr) + { + freeAllocatedMatrixOfString(iRows, iCols, pstData); + printError(&sciErr, 0); + return sciErr.iErr; + } + + freeAllocatedMatrixOfString(iRows, iCols, pstData); + } + + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + } + else + { + AssignOutputVariable(pvApiCtx, 1) = 0; + } + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/stringExample.dia.ref b/modules/api_scilab/tests/unit_tests/stringExample.dia.ref new file mode 100755 index 000000000..de70b26d9 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/stringExample.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/stringExample")); +cd(pathconvert(TMPDIR+"/stringExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/stringExample.c",pathconvert(TMPDIR+"/stringExample/stringExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_stringExample",["stringExample","stringExample"],"stringExample.c",[],"","",cflags); +exec("loader.sce"); +a = "Scilab"; +b = ["New","Scilab";"API","functions"]; +assert_checkequal(stringExample(a), a); +assert_checkequal(stringExample(b), b); diff --git a/modules/api_scilab/tests/unit_tests/stringExample.tst b/modules/api_scilab/tests/unit_tests/stringExample.tst new file mode 100755 index 000000000..5e7093b34 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/stringExample.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/stringExample")); +cd(pathconvert(TMPDIR+"/stringExample")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/stringExample.c",pathconvert(TMPDIR+"/stringExample/stringExample.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("gw_stringExample",["stringExample","stringExample"],"stringExample.c",[],"","",cflags); +exec("loader.sce"); + +a = "Scilab"; +b = ["New","Scilab";"API","functions"]; +assert_checkequal(stringExample(a), a); +assert_checkequal(stringExample(b), b); diff --git a/modules/api_scilab/tests/unit_tests/string_reading_api.c b/modules/api_scilab/tests/unit_tests/string_reading_api.c new file mode 100755 index 000000000..53ec28c9a --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/string_reading_api.c @@ -0,0 +1,124 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int read_string(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + int i, j; + int iLen = 0; + //variable info + int iRows = 0; + int iCols = 0; + int* piAddr = NULL; + int* piLen = NULL; + char** pstData = NULL; + //output variable + int iRowsOut = 1; + int iColsOut = 1; + char* pstOut = NULL; + //check input and output arguments + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + //get variable address + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //first call to retrieve dimensions + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + //second call to retrieve length of each string + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for (i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + } + + //third call to retrieve data + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, pstData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //computer length of all strings + for (i = 0 ; i < iRows * iCols ; i++) + { + iLen += piLen[i]; + } + + //alloc output variable + pstOut = (char*)malloc(sizeof(char) * (iLen + iRows * iCols)); + //initialize string to 0x00 + memset(pstOut, 0x00, sizeof(char) * (iLen + iRows * iCols)); + + //concat input strings in output string + for (i = 0 ; i < iRows ; i++) + { + for (j = 0 ; j < iCols ; j++) + { + int iCurLen = strlen(pstOut); + if (iCurLen) + { + strcat(pstOut, " "); + } + strcpy(pstOut + strlen(pstOut), pstData[j * iRows + i]); + } + } + + //create new variable + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRowsOut, iColsOut, &pstOut); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //free memory + free(piLen); + + for (i = 0 ; i < iRows * iCols ; i++) + { + free(pstData[i]); + } + + free(pstData); + free(pstOut); + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/string_reading_api.dia.ref b/modules/api_scilab/tests/unit_tests/string_reading_api.dia.ref new file mode 100755 index 000000000..37ed5796f --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/string_reading_api.dia.ref @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/string_reading_api")); +cd(pathconvert(TMPDIR+"/string_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/string_reading_api.c",pathconvert(TMPDIR+"/string_reading_api/string_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("string_reading",["read_string","read_string"],"string_reading_api.c",[],"","",cflags); +exec("loader.sce"); +a_ref = ["may the puffin be with you"]; +a = ["may", "the", "puffin"; "be","with","you"]; +b = read_string(a); +if a_ref <> b then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/string_reading_api.tst b/modules/api_scilab/tests/unit_tests/string_reading_api.tst new file mode 100755 index 000000000..ec98ca81b --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/string_reading_api.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/string_reading_api")); +cd(pathconvert(TMPDIR+"/string_reading_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/string_reading_api.c",pathconvert(TMPDIR+"/string_reading_api/string_reading_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("string_reading",["read_string","read_string"],"string_reading_api.c",[],"","",cflags); +exec("loader.sce"); + +a_ref = ["may the puffin be with you"]; +a = ["may", "the", "puffin"; "be","with","you"]; +b = read_string(a); +if a_ref <> b then pause;end diff --git a/modules/api_scilab/tests/unit_tests/string_writing_api.c b/modules/api_scilab/tests/unit_tests/string_writing_api.c new file mode 100755 index 000000000..f1fec6968 --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/string_writing_api.c @@ -0,0 +1,56 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009-2010 - DIGITEO + * + * 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 + * + */ + +#include "api_scilab.h" +#include "Scierror.h" +#include "localization.h" +#include "sciprint.h" +#include "MALLOC.h" + +int write_string(char *fname, unsigned long fname_len) +{ + SciErr sciErr; + //variable info : matrix of string 2 x 3 + int iRows = 2; + int iCols = 3; + char** pstData = NULL; + //data to put in the new variable + char string11[] = "may"; + char string21[] = "be"; + char string12[] = "the"; + char string22[] = "with"; + char string13[] = "puffin"; + char string23[] = "you"; + //alloc new array + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + //copy data address to the "main" array + pstData[0] = string11; + pstData[1] = string21; + pstData[2] = string12; + pstData[3] = string22; + pstData[4] = string13; + pstData[5] = string23; + + //create the variable + sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pstData); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //free container + free(pstData); + //assign allocated variables to Lhs position + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + return 0; +} diff --git a/modules/api_scilab/tests/unit_tests/string_writing_api.dia.ref b/modules/api_scilab/tests/unit_tests/string_writing_api.dia.ref new file mode 100755 index 000000000..d4505706f --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/string_writing_api.dia.ref @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/string_writing_api")); +cd(pathconvert(TMPDIR+"/string_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/string_writing_api.c",pathconvert(TMPDIR+"/string_writing_api/string_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("string_writing",["write_string","write_string"],"string_writing_api.c",[],"","",cflags); +exec("loader.sce"); +a_ref = "may the puffin be with you "; +b = []; +a = write_string(); +for i=1:size(a,"r") + for j=1:size(a,"c") + b = b + a(i,j); + b = b + " "; + end +end +if b <> a_ref then bugmes();quit;end diff --git a/modules/api_scilab/tests/unit_tests/string_writing_api.tst b/modules/api_scilab/tests/unit_tests/string_writing_api.tst new file mode 100755 index 000000000..5f399e22d --- /dev/null +++ b/modules/api_scilab/tests/unit_tests/string_writing_api.tst @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> +ilib_verbose(0); +mkdir(pathconvert(TMPDIR+"/string_writing_api")); +cd(pathconvert(TMPDIR+"/string_writing_api")); +copyfile(SCI+"/modules/api_scilab/tests/unit_tests/string_writing_api.c",pathconvert(TMPDIR+"/string_writing_api/string_writing_api.c",%F)); +cflags = "-I"+SCI+"/modules/localization/includes"; +ilib_build("string_writing",["write_string","write_string"],"string_writing_api.c",[],"","",cflags); +exec("loader.sce"); + +a_ref = "may the puffin be with you "; +b = []; +a = write_string(); +for i=1:size(a,"r") + for j=1:size(a,"c") + b = b + a(i,j); + b = b + " "; + end +end +if b <> a_ref then pause;end |