Merge commit 'origin/master' into atoms
Pierre MARECHAL [Fri, 26 Jun 2009 14:22:45 +0000 (16:22 +0200)]
116 files changed:
scilab/Version.incl
scilab/configure
scilab/configure.ac
scilab/contrib/toolbox_skeleton/DESCRIPTION [new file with mode: 0644]
scilab/contrib/toolbox_skeleton/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/etc/modules.xml.in
scilab/etc/modules.xml.vc
scilab/modules/Makefile.am
scilab/modules/Makefile.in
scilab/modules/atoms/Makefile.am [new file with mode: 0644]
scilab/modules/atoms/Makefile.in [new file with mode: 0644]
scilab/modules/atoms/atoms.iss [new file with mode: 0644]
scilab/modules/atoms/changelog.txt [new file with mode: 0644]
scilab/modules/atoms/etc/atoms.quit [new file with mode: 0644]
scilab/modules/atoms/etc/atoms.start [new file with mode: 0644]
scilab/modules/atoms/etc/repositories [new file with mode: 0644]
scilab/modules/atoms/help/en_US/addchapter.sce [new file with mode: 0644]
scilab/modules/atoms/help/en_US/atomsAddRepository.xml [new file with mode: 0644]
scilab/modules/atoms/help/en_US/atomsDelRepository.xml [new file with mode: 0644]
scilab/modules/atoms/help/en_US/atomsRepositories.xml [new file with mode: 0644]
scilab/modules/atoms/help/fr_FR/addchapter.sce [new file with mode: 0644]
scilab/modules/atoms/license.txt [new file with mode: 0644]
scilab/modules/atoms/macros/atomsAddRepository.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsAutoload.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsDelRepository.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsGetInstalled.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsGetLoaded.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsInstall.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsInstallCategory.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsIsInstalled.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsIsLoaded.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsList.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsLoad.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsRemove.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsRepositories.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsSearch.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsShow.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atomsUpdate.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsAUWriteAccess.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsAddAutoload.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsCatTree.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsCheckConflict.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsCompareVersion.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsCompatibleVersions.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsConstant.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsDecoupVersion.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsDelAutoload.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsDependencyTree.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsDisplayMessage.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsExtractValue.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetAutoload.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetConfig.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetDepChilds.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetDepParents.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledDetails.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledPath.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledStatus.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledVers.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetMRVersion.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetTOOLBOXES.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsGetVersions.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsInstallList.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsInstallRegister.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsInstallUnregister.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsIsCompatible.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsIsPackage.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsListDescription.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsNormalizeName.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsReadDesc.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsReadDescFunctions.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsReadFile.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsReadTOOLBOXES.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsRegisterToolbox.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsRemoveList.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsSelectPosition.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsSeparateSignVersion.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsSeparateVersionDep.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsSetConfig.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsSplitValue.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsSubstituteString.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsToolboxDetails.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsToolboxDirectory.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsToolboxMirror.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsUnregisterToolbox.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsVerifVersionScilab.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsVersionCompare.sci [new file with mode: 0644]
scilab/modules/atoms/macros/atoms_internals/atomsVersionSort.sci [new file with mode: 0644]
scilab/modules/atoms/macros/buildmacros.bat [new file with mode: 0644]
scilab/modules/atoms/macros/buildmacros.sce [new file with mode: 0644]
scilab/modules/atoms/macros/cleanmacros.bat [new file with mode: 0644]
scilab/modules/atoms/readme.txt [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/atomsIsInstalled.tst [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/atomsVersionCompare.tst [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/testfonctions.dia.ref [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/testfonctions.tst [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/conflitB/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/conflitB/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/local1/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/local1/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/local2/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/local2/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testA/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testA/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testB/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testB/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testC/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testC/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testD/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testD/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testE/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/testE/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/truc/DESCRIPTION [new file with mode: 0644]
scilab/modules/atoms/tests/unit_tests/toolboxes/truc/DESCRIPTION-FUNCTIONS [new file with mode: 0644]
scilab/modules/atoms/version.xml [new file with mode: 0644]
scilab/modules/core/includes/version.h
scilab/modules/functions/macros/genlib.sci

index 80e8b92..f803f4e 100644 (file)
@@ -1 +1 @@
-SCIVERSION=Scilab-master-GIT
+SCIVERSION=Scilab-atoms-GIT
index eac105c..e9814cb 100755 (executable)
@@ -46220,7 +46220,7 @@ if test "$enable_stop_on_warning" = yes; then
    CXXFLAGS="$CXXFLAGS -Werror -O0"
 fi
 
-ac_config_files="$ac_config_files libs/MALLOC/Makefile libs/dynamiclibrary/Makefile libs/doublylinkedlist/Makefile libs/hashtable/Makefile libs/libst/Makefile contrib/Makefile modules/helptools/Makefile modules/helptools/macros/xmlfiletohtml.sci modules/data_structures/Makefile modules/differential_equations/Makefile modules/optimization/Makefile modules/elementary_functions/Makefile modules/special_functions/Makefile modules/io/Makefile modules/shell/Makefile modules/completion/Makefile modules/history_manager/Makefile modules/jvm/Makefile modules/sound/Makefile modules/statistics/Makefile modules/mexlib/Makefile modules/sparse/Makefile modules/linear_algebra/Makefile modules/polynomials/Makefile modules/symbolic/Makefile modules/signal_processing/Makefile modules/arnoldi/Makefile modules/interpolation/Makefile modules/intersci/Makefile modules/localization/Makefile modules/metanet/Makefile modules/cacsd/Makefile modules/boolean/Makefile modules/integer/Makefile modules/double/Makefile modules/fileio/Makefile modules/spreadsheet/Makefile modules/string/Makefile modules/time/Makefile modules/graphics/Makefile modules/graphic_export/Makefile modules/renderer/Makefile modules/action_binding/Makefile modules/gui/Makefile modules/pvm/Makefile modules/randlib/Makefile modules/tclsci/Makefile modules/windows_tools/Makefile modules/core/Makefile modules/call_scilab/Makefile modules/fftw/Makefile modules/umfpack/Makefile modules/scicos/Makefile modules/scicos_blocks/Makefile modules/functions/Makefile modules/dynamic_link/Makefile modules/overloading/Makefile modules/javasci/Makefile modules/maple2scilab/Makefile modules/m2sci/Makefile modules/compatibility_functions/Makefile modules/texmacs/Makefile modules/scipad/Makefile modules/scilab2fortran/Makefile modules/development_tools/Makefile modules/output_stream/Makefile modules/console/Makefile modules/demo_tools/Makefile modules/genetic_algorithms/Makefile modules/simulated_annealing/Makefile modules/parameters/Makefile modules/matio/Makefile modules/Makefile libs/Makefile Makefile scilab.pc etc/modules.xml etc/classpath.xml modules/jvm/etc/jvm_options.xml scilab-lib.properties scilab-lib-doc.properties"
+ac_config_files="$ac_config_files libs/MALLOC/Makefile libs/dynamiclibrary/Makefile libs/doublylinkedlist/Makefile libs/hashtable/Makefile libs/libst/Makefile contrib/Makefile modules/helptools/Makefile modules/helptools/macros/xmlfiletohtml.sci modules/data_structures/Makefile modules/differential_equations/Makefile modules/optimization/Makefile modules/elementary_functions/Makefile modules/special_functions/Makefile modules/io/Makefile modules/shell/Makefile modules/completion/Makefile modules/history_manager/Makefile modules/jvm/Makefile modules/sound/Makefile modules/statistics/Makefile modules/mexlib/Makefile modules/sparse/Makefile modules/linear_algebra/Makefile modules/polynomials/Makefile modules/symbolic/Makefile modules/signal_processing/Makefile modules/arnoldi/Makefile modules/interpolation/Makefile modules/intersci/Makefile modules/localization/Makefile modules/metanet/Makefile modules/cacsd/Makefile modules/boolean/Makefile modules/integer/Makefile modules/double/Makefile modules/fileio/Makefile modules/spreadsheet/Makefile modules/string/Makefile modules/time/Makefile modules/graphics/Makefile modules/graphic_export/Makefile modules/renderer/Makefile modules/action_binding/Makefile modules/gui/Makefile modules/pvm/Makefile modules/randlib/Makefile modules/tclsci/Makefile modules/windows_tools/Makefile modules/core/Makefile modules/call_scilab/Makefile modules/fftw/Makefile modules/umfpack/Makefile modules/scicos/Makefile modules/scicos_blocks/Makefile modules/functions/Makefile modules/dynamic_link/Makefile modules/overloading/Makefile modules/javasci/Makefile modules/maple2scilab/Makefile modules/m2sci/Makefile modules/compatibility_functions/Makefile modules/texmacs/Makefile modules/scipad/Makefile modules/scilab2fortran/Makefile modules/development_tools/Makefile modules/output_stream/Makefile modules/console/Makefile modules/demo_tools/Makefile modules/genetic_algorithms/Makefile modules/simulated_annealing/Makefile modules/parameters/Makefile modules/matio/Makefile modules/atoms/Makefile modules/Makefile libs/Makefile Makefile scilab.pc etc/modules.xml etc/classpath.xml modules/jvm/etc/jvm_options.xml scilab-lib.properties scilab-lib-doc.properties"
 
 
 # Detection of the module for the future version of Scilab 6
@@ -47150,6 +47150,7 @@ do
     "modules/simulated_annealing/Makefile") CONFIG_FILES="$CONFIG_FILES modules/simulated_annealing/Makefile" ;;
     "modules/parameters/Makefile") CONFIG_FILES="$CONFIG_FILES modules/parameters/Makefile" ;;
     "modules/matio/Makefile") CONFIG_FILES="$CONFIG_FILES modules/matio/Makefile" ;;
+    "modules/atoms/Makefile") CONFIG_FILES="$CONFIG_FILES modules/atoms/Makefile" ;;
     "modules/Makefile") CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;;
     "libs/Makefile") CONFIG_FILES="$CONFIG_FILES libs/Makefile" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
index a4ba5b5..71236cc 100644 (file)
@@ -1452,6 +1452,7 @@ modules/genetic_algorithms/Makefile
 modules/simulated_annealing/Makefile
 modules/parameters/Makefile
 modules/matio/Makefile
+modules/atoms/Makefile
 modules/Makefile
 libs/Makefile
 Makefile
diff --git a/scilab/contrib/toolbox_skeleton/DESCRIPTION b/scilab/contrib/toolbox_skeleton/DESCRIPTION
new file mode 100644 (file)
index 0000000..77de8f3
--- /dev/null
@@ -0,0 +1,38 @@
+Toolbox: toolbox_skeleton
+
+Title: Toolbox Skeleton
+
+Summary: Skeleton of a valid atoms package
+
+Version: 1.3
+
+Author: Allan CORNET <allan.cornet@scilab.org>
+
+Maintainer: Allan CORNET <allan.cornet@scilab.org>
+ Pierre MARECHAL <pierre.marechal@scilab.org>
+
+Category: biology - Robotic_2
+ CatB - SScat2
+ biology - modelisation_III
+
+Entity: Digiteo
+
+WebSite: http://www.scilab.org
+
+License: CeCILL
+
+ScilabVersion: >= 5.0
+
+Depends: 
+
+Date: 2009-03-26
+
+Description: files to the new Docbook based format.
+ install xmltodocbook
+ - linux : unzip xmltodocbook.zip and exec builder.sce
+ - windows : click on xmltodocbook-1.0.exe
+ load toolbox in scilab
+ exec loader.sce
+ help xmltodocbook 
diff --git a/scilab/contrib/toolbox_skeleton/DESCRIPTION-FUNCTIONS b/scilab/contrib/toolbox_skeleton/DESCRIPTION-FUNCTIONS
new file mode 100644 (file)
index 0000000..b22edc3
--- /dev/null
@@ -0,0 +1,4 @@
+scilab_sum - scilab_sum from scilab
+fortran_sum - sum from fortran
+c_sum - sum from C
+c_sub - substraction from C
index f186c2b..74c1dd8 100644 (file)
@@ -80,5 +80,6 @@
 <module name="genetic_algorithms" activate="yes"/>
 <module name="simulated_annealing" activate="yes"/>
 <module name="parameters" activate="yes"/>
+<module name="atoms" activate="yes"/>
 <module name="matio" activate="@MATIO_ENABLE@"/>
 </modules>
index 092f997..1ea4c0b 100644 (file)
@@ -83,4 +83,5 @@
 <module name="simulated_annealing" activate="yes"/>
 <module name="parameters" activate="yes"/>
 <module name="matio" activate="yes"/>
+<module name="atoms" activate="yes"/>
 </modules>
index bf1f206..3d37140 100644 (file)
@@ -80,7 +80,8 @@ demo_tools \
 genetic_algorithms \
 simulated_annealing \
 parameters \
-matio
+matio \
+atoms
 
 #umfpack
 
index 5df1a3e..6927fcd 100644 (file)
@@ -137,7 +137,7 @@ DIST_SUBDIRS = core output_stream action_binding arnoldi \
        sparse windows_tools functions overloading maple2scilab m2sci \
        texmacs scipad scilab2fortran development_tools \
        compatibility_functions helptools fftw umfpack demo_tools \
-       genetic_algorithms simulated_annealing parameters matio \
+       genetic_algorithms simulated_annealing parameters matio atoms \
        scicos_blocks scicos . javasci
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
@@ -375,8 +375,8 @@ SUBDIRS = core output_stream action_binding arnoldi \
        functions overloading maple2scilab m2sci texmacs scipad \
        scilab2fortran development_tools compatibility_functions \
        helptools fftw umfpack demo_tools genetic_algorithms \
-       simulated_annealing parameters matio $(am__append_1) scicos . \
-       $(am__append_2)
+       simulated_annealing parameters matio atoms $(am__append_1) \
+       scicos . $(am__append_2)
 
 #### Basic files ####
 libscilab_la_rootdir = $(mydatadir)
diff --git a/scilab/modules/atoms/Makefile.am b/scilab/modules/atoms/Makefile.am
new file mode 100644 (file)
index 0000000..cfa420a
--- /dev/null
@@ -0,0 +1,25 @@
+# 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-en.txt
+
+modulename=atoms
+
+#### atoms : Conf files ####
+libsciatoms_la_rootdir = $(mydatadir)
+libsciatoms_la_root_DATA = changelog.txt license.txt readme.txt version.xml
+
+#### atoms : init scripts ####
+
+libsciatoms_la_etcdir = $(mydatadir)/etc
+libsciatoms_la_etc_DATA = etc/atoms.quit etc/atoms.start etc/repositories
+
+#### atoms : internal functions ####
+
+MACROSDIRSEXT = macros/atoms_internals
+
+include $(top_srcdir)/Makefile.incl.am
diff --git a/scilab/modules/atoms/Makefile.in b/scilab/modules/atoms/Makefile.in
new file mode 100644 (file)
index 0000000..516b0f7
--- /dev/null
@@ -0,0 +1,787 @@
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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
+#
+# This file must be used under the terms of the CeCILL.
+# This source file is licensed as described in the file COPYING, which
+# you should have received as part of this distribution.  The terms
+# are also available at
+# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+# 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-en.txt
+#
+
+##########
+### Makefile included stuff
+### Target, variable, suffixes which are supposed to be usefull in every makefile.am
+##########
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@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 = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/Makefile.incl.am
+@NEED_JAVA_TRUE@am__append_1 = java
+subdir = modules/atoms
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/docbook.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.m4 \
+       $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/libs_by_debian.m4 \
+       $(top_srcdir)/m4/libsmath.m4 $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/libxml2.m4 $(top_srcdir)/m4/ocaml.m4 \
+       $(top_srcdir)/m4/pcre.m4 $(top_srcdir)/m4/pkg.m4 \
+       $(top_srcdir)/m4/pvm.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 = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/modules/core/includes/machine.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+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 = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libsciatoms_la_etcdir)" \
+       "$(DESTDIR)$(libsciatoms_la_rootdir)"
+libsciatoms_la_etcDATA_INSTALL = $(INSTALL_DATA)
+libsciatoms_la_rootDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(libsciatoms_la_etc_DATA) $(libsciatoms_la_root_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+ANT = @ANT@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AVALON_FRAMEWORK = @AVALON_FRAMEWORK@
+AWK = @AWK@
+BATIK = @BATIK@
+BLAS_LIBS = @BLAS_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMMONS_IO = @COMMONS_IO@
+COMMONS_LOGGING = @COMMONS_LOGGING@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEMOTOOLS_ENABLE = @DEMOTOOLS_ENABLE@
+DEPDIR = @DEPDIR@
+DOCBOOK_ROOT = @DOCBOOK_ROOT@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FFTW3_LIB = @FFTW3_LIB@
+FFTW_ENABLE = @FFTW_ENABLE@
+FLEXDOCK = @FLEXDOCK@
+FLIBS = @FLIBS@
+FOP = @FOP@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GIWS_BIN = @GIWS_BIN@
+GLUEGEN_RT = @GLUEGEN_RT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GRAPHICS_ENABLE = @GRAPHICS_ENABLE@
+GREP = @GREP@
+GUI_ENABLE = @GUI_ENABLE@
+HDF5_CFLAGS = @HDF5_CFLAGS@
+HDF5_ENABLE = @HDF5_ENABLE@
+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@
+JAVAH = @JAVAH@
+JAVASCI_ENABLE = @JAVASCI_ENABLE@
+JAVA_DEBUG_OPTIONS = @JAVA_DEBUG_OPTIONS@
+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@
+JHALL = @JHALL@
+JOGL = @JOGL@
+JROSETTA_API = @JROSETTA_API@
+JROSETTA_ENGINE = @JROSETTA_ENGINE@
+LAPACK_LIBS = @LAPACK_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOOKS = @LOOKS@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MATIO_CFLAGS = @MATIO_CFLAGS@
+MATIO_ENABLE = @MATIO_ENABLE@
+MATIO_LIBS = @MATIO_LIBS@
+MKDIR_P = @MKDIR_P@
+MSGCAT = @MSGCAT@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OCAMLC = @OCAMLC@
+OCAMLDEP = @OCAMLDEP@
+OCAMLLEX = @OCAMLLEX@
+OCAMLOPT = @OCAMLOPT@
+OCAMLYACC = @OCAMLYACC@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+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@
+PVMGETARCH = @PVMGETARCH@
+PVM_ARCH = @PVM_ARCH@
+PVM_ENABLE = @PVM_ENABLE@
+PVM_INCLUDE = @PVM_INCLUDE@
+PVM_LIB = @PVM_LIB@
+PYTHON = @PYTHON@
+RANLIB = @RANLIB@
+RELOCATABLE = @RELOCATABLE@
+RT_LIB = @RT_LIB@
+SAXON = @SAXON@
+SCICOS_ENABLE = @SCICOS_ENABLE@
+SCILAB_LIBRARY_VERSION = @SCILAB_LIBRARY_VERSION@
+SCIPAD_ENABLE = @SCIPAD_ENABLE@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SET_RELOCATABLE = @SET_RELOCATABLE@
+SHELL = @SHELL@
+SKINLF = @SKINLF@
+STRIP = @STRIP@
+SWIG_BIN = @SWIG_BIN@
+SWIG_JAVA = @SWIG_JAVA@
+SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@
+TCLTK_LIBS = @TCLTK_LIBS@
+TCL_INC_PATH = @TCL_INC_PATH@
+TK_INC_PATH = @TK_INC_PATH@
+UMFPACK_ENABLE = @UMFPACK_ENABLE@
+UMFPACK_LIB = @UMFPACK_LIB@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WITH_OCAML = @WITH_OCAML@
+WITH_TKSCI = @WITH_TKSCI@
+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_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+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@
+modulename = atoms
+
+#### atoms : Conf files ####
+libsciatoms_la_rootdir = $(mydatadir)
+libsciatoms_la_root_DATA = changelog.txt license.txt readme.txt version.xml
+
+#### atoms : init scripts ####
+libsciatoms_la_etcdir = $(mydatadir)/etc
+libsciatoms_la_etc_DATA = etc/atoms.quit etc/atoms.start etc/repositories
+
+#### atoms : internal functions ####
+MACROSDIRSEXT = macros/atoms_internals
+
+# Where all the Scilab stuff is installed (macros, help, ...)
+mydatadir = $(pkgdatadir)/modules/$(modulename)
+
+# 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
+# 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
+$(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/atoms/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --foreign  modules/atoms/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_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
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+install-libsciatoms_la_etcDATA: $(libsciatoms_la_etc_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(libsciatoms_la_etcdir)" || $(MKDIR_P) "$(DESTDIR)$(libsciatoms_la_etcdir)"
+       @list='$(libsciatoms_la_etc_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(libsciatoms_la_etcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(libsciatoms_la_etcdir)/$$f'"; \
+         $(libsciatoms_la_etcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(libsciatoms_la_etcdir)/$$f"; \
+       done
+
+uninstall-libsciatoms_la_etcDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libsciatoms_la_etc_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libsciatoms_la_etcdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(libsciatoms_la_etcdir)/$$f"; \
+       done
+install-libsciatoms_la_rootDATA: $(libsciatoms_la_root_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(libsciatoms_la_rootdir)" || $(MKDIR_P) "$(DESTDIR)$(libsciatoms_la_rootdir)"
+       @list='$(libsciatoms_la_root_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(libsciatoms_la_rootDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(libsciatoms_la_rootdir)/$$f'"; \
+         $(libsciatoms_la_rootDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(libsciatoms_la_rootdir)/$$f"; \
+       done
+
+uninstall-libsciatoms_la_rootDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libsciatoms_la_root_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libsciatoms_la_rootdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(libsciatoms_la_rootdir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$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 $(DATA) all-local
+installdirs:
+       for dir in "$(DESTDIR)$(libsciatoms_la_etcdir)" "$(DESTDIR)$(libsciatoms_la_rootdir)"; 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:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+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 mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local install-libsciatoms_la_etcDATA \
+       install-libsciatoms_la_rootDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am: install-html-local
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libsciatoms_la_etcDATA \
+       uninstall-libsciatoms_la_rootDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am all-local check check-am check-local clean \
+       clean-generic clean-libtool clean-local distclean \
+       distclean-generic distclean-libtool distclean-local 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-libsciatoms_la_etcDATA \
+       install-libsciatoms_la_rootDATA install-man install-pdf \
+       install-pdf-am install-ps install-ps-am install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-libsciatoms_la_etcDATA \
+       uninstall-libsciatoms_la_rootDATA
+
+
+# This target enables tests for Scilab
+check-local: $(top_builddir)/scilab-bin
+       @COMMAND="test_run('$(modulename)');quit";\
+       export LANG=C;\
+       $(top_builddir)/bin/scilab -nwni -nb -e "$$COMMAND"
+check-code:
+       @if test -f build.xml; then \
+               $(ANT) checkstyle; \
+       fi;\
+       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)
+@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 ! -z "$(SWIG_WRAPPERS)"; then \
+@SWIG_TRUE@            for file in $(SWIG_WRAPPERS) ; do \
+@SWIG_TRUE@                    echo "Swig process of $$file ..."; \
+@SWIG_TRUE@                    $(SWIG_BIN) $(SWIG_JAVA) -package $$SWIG_PACKAGENAME  -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@    if test ! -z "$(GIWS_WRAPPERS)"; then \
+@GIWS_TRUE@            for file in $(GIWS_WRAPPERS) ; do \
+@GIWS_TRUE@                    echo "GIWS process of $$file ..."; \
+@GIWS_TRUE@                    $(GIWS_BIN) --output-dir $$GIWS_OUTPUTDIR --throws-exception-on-error --description-file $$file; \
+@GIWS_TRUE@            done; \
+@GIWS_TRUE@    fi
+
+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
+
+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:
+# 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";\
+                       for specialExt in $(MACROSSPECIALEXT); do \
+                               specialExtDir="$$specialExtDir $(srcdir)/$$dir/$$specialExt"; \
+                       done; \
+                       FILELIST="$$FILELIST $$specialExtDir"; \
+                 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 macros and help (generated automatically by Scilab)
+@NEED_JAVA_TRUE@clean-local: clean-java clean-macros
+@NEED_JAVA_FALSE@clean-local: clean-macros
+
+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/scilab/modules/atoms/atoms.iss b/scilab/modules/atoms/atoms.iss
new file mode 100644 (file)
index 0000000..824b603
--- /dev/null
@@ -0,0 +1,39 @@
+; 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.
+;
+;##############################################################################################################
+; Script d'installation Inno Setup (5.2.1) pour scilab
+; Version TRUNK
+;##############################################################################################################
+;--------------------------------------------------------------------------------------------------------------
+; atoms module
+;--------------------------------------------------------------------------------------------------------------
+;
+#define ATOMS "atoms"
+;
+Source: modules\{#ATOMS}\VERSION.xml; DestDir: {app}\modules\{#ATOMS}; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\readme.txt; DestDir: {app}\modules\{#ATOMS}; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\license.txt; DestDir: {app}\modules\{#ATOMS}; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\changelog.txt; DestDir: {app}\modules\{#ATOMS}; Components: {#COMPN_ATOMS}
+;
+Source: modules\{#ATOMS}\etc\{#ATOMS}.quit; DestDir: {app}\modules\{#ATOMS}\etc; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\etc\{#ATOMS}.start; DestDir: {app}\modules\{#ATOMS}\etc; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\etc\repositories; DestDir: {app}\modules\{#ATOMS}\etc; Components: {#COMPN_ATOMS}
+;
+Source: modules\{#ATOMS}\help\addchapter.sce; DestDir: {app}\modules\{#ATOMS}\help; Flags: recursesubdirs; Components:  {#COMPN_ATOMS}
+;
+Source: modules\{#ATOMS}\macros\lib; DestDir: {app}\modules\{#ATOMS}\macros; Flags: recursesubdirs; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\macros\names; DestDir: {app}\modules\{#ATOMS}\macros; Flags: recursesubdirs; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\macros\*.bin; DestDir: {app}\modules\{#ATOMS}\macros; Flags: recursesubdirs; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\macros\*.sci; DestDir: {app}\modules\{#ATOMS}\macros; Flags: recursesubdirs; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\macros\buildmacros.sce; DestDir: {app}\modules\{#ATOMS}\macros; Flags: recursesubdirs; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\macros\buildmacros.bat; DestDir: {app}\modules\{#ATOMS}\macros; Flags: recursesubdirs; Components: {#COMPN_ATOMS}
+Source: modules\{#ATOMS}\macros\cleanmacros.bat; DestDir: {app}\modules\{#ATOMS}\macros; Flags: recursesubdirs; Components: {#COMPN_ATOMS}
+;
+;Source: modules\{#ATOMS}\demos\*.*; DestDir: {app}\modules\{#ATOMS}\demos; Flags: recursesubdirs; Components: {#COMPN_ATOMS}
+;
+Source: modules\{#ATOMS}\tests\*.*; DestDir: {app}\modules\{#ATOMS}\tests; Flags: recursesubdirs; Components: {#COMPN_ATOMS} and {#COMPN_TESTS}
+;
+
diff --git a/scilab/modules/atoms/changelog.txt b/scilab/modules/atoms/changelog.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/scilab/modules/atoms/etc/atoms.quit b/scilab/modules/atoms/etc/atoms.quit
new file mode 100644 (file)
index 0000000..78dfe46
--- /dev/null
@@ -0,0 +1,15 @@
+// ====================================================================
+// This file contains command to be executed at the end 
+// of a scilab session for atoms module
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA  - Delphine Gasc (2008)
+// 
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution.  The terms
+// are also available at    
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// ====================================================================
+// delete help chapter
+del_help_chapter('atoms',%T);
+// ====================================================================
diff --git a/scilab/modules/atoms/etc/atoms.start b/scilab/modules/atoms/etc/atoms.start
new file mode 100644 (file)
index 0000000..5c3fdb9
--- /dev/null
@@ -0,0 +1,20 @@
+// ====================================================================
+// atoms module initialisation file 
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA - Delphine Gasc (2008)
+// 
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution.  The terms
+// are also available at    
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// ====================================================================
+//Load  functions librarie
+load('SCI/modules/atoms/macros/lib');
+load('SCI/modules/atoms/macros/atoms_internals/lib');
+// ====================================================================
+//add help chapter
+add_module_help_chapter('atoms');
+// ====================================================================
+// Create user's toolboxes directory
+mkdir(atomsToolboxDirectory());
diff --git a/scilab/modules/atoms/etc/repositories b/scilab/modules/atoms/etc/repositories
new file mode 100644 (file)
index 0000000..18f561a
--- /dev/null
@@ -0,0 +1 @@
+http://atoms.scilab.org
\ No newline at end of file
diff --git a/scilab/modules/atoms/help/en_US/addchapter.sce b/scilab/modules/atoms/help/en_US/addchapter.sce
new file mode 100644 (file)
index 0000000..91bc060
--- /dev/null
@@ -0,0 +1,12 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+path = SCI+"/modules/atoms/help/"+getdefaultlanguage();
+add_help_chapter("Atoms",path,%T);
+clear path add_help_chapter;
diff --git a/scilab/modules/atoms/help/en_US/atomsAddRepository.xml b/scilab/modules/atoms/help/en_US/atomsAddRepository.xml
new file mode 100644 (file)
index 0000000..cdc0b78
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="atomsAddRepository">
+  <info>
+       <pubdate>$LastChangedDate$</pubdate>
+  </info>
+  <refnamediv>
+    <refname>atomsAddRepository</refname>
+    <refpurpose>Add one or several URLs to the list of managed repositories</refpurpose>
+  </refnamediv>
+  
+  <!-- ===================================================================== -->
+  <!-- Calling Sequence -->
+  <!-- ===================================================================== -->
+
+  <refsynopsisdiv>
+    <title>Calling Sequence</title>
+    <synopsis>
+         nbAdd = atomsAddRepository(url[,allusers])
+       </synopsis>
+  </refsynopsisdiv>
+  
+  <!-- ===================================================================== -->
+  <!-- Parameters -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Parameters</title>
+       
+    <variablelist>
+      <varlistentry>
+        <term>url</term>
+        <listitem>
+          <para>
+                       Matrix of strings : list of the URLs to add
+                 </para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>allusers</term>
+        <listitem>
+          <para>
+                       A boolean : if this parameter is equal to TRUE (%T), URLs are added
+                       for all users of the computer. The list of available URL for all users
+                       is defined in SCI/.atoms/repositories.
+                       
+                       If allusers is set to TRUE (%T) and the directory SCI/.atoms/ is not
+                       write accessible, atomsAddRepository will produce an error.
+                       
+                       if this parameter is equal to FALSE (%T), the URL is only added
+                       for the current user. The list of URL only available for the current
+                       user is defined in SCIHOME/atoms/repositories.
+                 </para>
+        </listitem>
+      </varlistentry>
+         
+      <varlistentry>
+        <term>nbAdd</term>
+        <listitem>
+          <para>
+                       An integer : the number of repositories successfully added.
+                 </para>
+        </listitem>
+      </varlistentry>
+         
+    </variablelist>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Description -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Description</title>
+    <para>
+         
+       </para>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Examples -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Examples</title>
+    <programlisting role="example">
+<![CDATA[
+atomsRepositories()
+atomsAddRepository(["http://www.repository1.com";"http://www.repository1.com"
+atomsRepositories()
+]]>
+       </programlisting>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- See also -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>See Also</title>
+    <simplelist type="inline">
+      <member>
+        <link linkend="atomsDelRepository">atomsDelRepository</link>
+      </member>
+      <member>
+        <link linkend="atomsRepositories">atomsRepositories</link>
+      </member>
+    </simplelist>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Authors -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Authors</title>
+    <simplelist type="vert">
+      <member>Pierre MARECHAL - DIGITEO</member>
+    </simplelist>
+  </refsection>
+</refentry>
diff --git a/scilab/modules/atoms/help/en_US/atomsDelRepository.xml b/scilab/modules/atoms/help/en_US/atomsDelRepository.xml
new file mode 100644 (file)
index 0000000..316391c
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="atomsDelRepository">
+  <info>
+       <pubdate>$LastChangedDate$</pubdate>
+  </info>
+  <refnamediv>
+    <refname>atomsDelRepository</refname>
+    <refpurpose>Remove one or several URLs from the list of managed repositories</refpurpose>
+  </refnamediv>
+  
+  <!-- ===================================================================== -->
+  <!-- Calling Sequence -->
+  <!-- ===================================================================== -->
+
+  <refsynopsisdiv>
+    <title>Calling Sequence</title>
+    <synopsis>
+         nbDel = atomsDelRepository(url[,allusers])
+       </synopsis>
+  </refsynopsisdiv>
+  
+  <!-- ===================================================================== -->
+  <!-- Parameters -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Parameters</title>
+       
+    <variablelist>
+      <varlistentry>
+        <term>url</term>
+        <listitem>
+          <para>
+                       Matrix of strings : list of the URLs to remove
+                 </para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>allusers</term>
+        <listitem>
+          <para>
+                       A boolean : if this parameter is equal to TRUE (%T), URLs are removed
+                       from "allusers" and "user" list.
+                       
+                       If allusers is set to TRUE (%T) and the directory SCI/.atoms/ is not
+                       write accessible, atomsDelRepository will produce an error.
+                       
+                       if this parameter is equal to FALSE (%T), URLs are only removed
+                       from "user" list.
+                 </para>
+        </listitem>
+      </varlistentry>
+         
+      <varlistentry>
+        <term>nbDel</term>
+        <listitem>
+          <para>
+                       An integer : the number of repositories successfully removed.
+                 </para>
+        </listitem>
+      </varlistentry>
+         
+    </variablelist>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Description -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Description</title>
+    <para>
+         
+       </para>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Examples -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Examples</title>
+    <programlisting role="example">
+<![CDATA[
+atomsRepositories()
+atomsAddRepository(["http://www.repository1.com";"http://www.repository2.com"])
+atomsRepositories()
+atomsDelRepository(["http://www.repository1.com";"http://www.repository2.com"])
+atomsRepositories()
+]]>
+       </programlisting>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- See also -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>See Also</title>
+    <simplelist type="inline">
+      <member>
+        <link linkend="atomsDelRepository">atomsAddRepository</link>
+      </member>
+      <member>
+        <link linkend="atomsRepositories">atomsRepositories</link>
+      </member>
+    </simplelist>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Authors -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Authors</title>
+    <simplelist type="vert">
+      <member>Pierre MARECHAL - DIGITEO</member>
+    </simplelist>
+  </refsection>
+</refentry>
diff --git a/scilab/modules/atoms/help/en_US/atomsRepositories.xml b/scilab/modules/atoms/help/en_US/atomsRepositories.xml
new file mode 100644 (file)
index 0000000..41492fd
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="atomsRepositories">
+  <info>
+       <pubdate>$LastChangedDate$</pubdate>
+  </info>
+  <refnamediv>
+    <refname>atomsRepositories</refname>
+    <refpurpose>Get the list of managed repositories</refpurpose>
+  </refnamediv>
+  
+  <!-- ===================================================================== -->
+  <!-- Calling Sequence -->
+  <!-- ===================================================================== -->
+
+  <refsynopsisdiv>
+    <title>Calling Sequence</title>
+    <synopsis>
+         repositories = atomsRepositories(level)
+       </synopsis>
+  </refsynopsisdiv>
+  
+  <!-- ===================================================================== -->
+  <!-- Parameters -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Parameters</title>
+       
+    <variablelist>
+      <varlistentry>
+        <term>level</term>
+        <listitem>
+          <para>
+                       Character string : Filter the output matrix according to repositories
+                       are officials, have been added for all users or have been added for the
+                       current user.
+                 </para>
+        </listitem>
+      </varlistentry>
+         
+      <varlistentry>
+        <term>repositories</term>
+        <listitem>
+          <para>
+                       Matrix of strings : the first column give the list of repositories
+                       managed by ATOMS and the second column indicate if the repository is
+                       a official repository, if the repository has been added for all users
+                       or only for the current user.
+                 </para>
+        </listitem>
+      </varlistentry>
+         
+    </variablelist>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Description -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Description</title>
+    <para>
+         
+       </para>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Examples -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Examples</title>
+    <programlisting role="example">
+<![CDATA[
+atomsRepositories()
+atomsRepositories('official')
+atomsRepositories('allusers')
+atomsRepositories('user')
+]]>
+       </programlisting>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- See also -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>See Also</title>
+    <simplelist type="inline">
+      <member>
+        <link linkend="atomsRepositories">atomsAddRepository</link>
+      </member>
+      <member>
+        <link linkend="atomsRepositories">atomsDelRepository</link>
+      </member>
+    </simplelist>
+  </refsection>
+  
+  <!-- ===================================================================== -->
+  <!-- Authors -->
+  <!-- ===================================================================== -->
+  
+  <refsection>
+    <title>Authors</title>
+    <simplelist type="vert">
+      <member>Pierre MARECHAL - DIGITEO</member>
+    </simplelist>
+  </refsection>
+</refentry>
diff --git a/scilab/modules/atoms/help/fr_FR/addchapter.sce b/scilab/modules/atoms/help/fr_FR/addchapter.sce
new file mode 100644 (file)
index 0000000..91bc060
--- /dev/null
@@ -0,0 +1,12 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+path = SCI+"/modules/atoms/help/"+getdefaultlanguage();
+add_help_chapter("Atoms",path,%T);
+clear path add_help_chapter;
diff --git a/scilab/modules/atoms/license.txt b/scilab/modules/atoms/license.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/scilab/modules/atoms/macros/atomsAddRepository.sci b/scilab/modules/atoms/macros/atomsAddRepository.sci
new file mode 100644 (file)
index 0000000..4e8bd24
--- /dev/null
@@ -0,0 +1,114 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Add an URL to the list of repositories, and returns
+
+function nbAdd = atomsAddRepository(url,allusers)
+       
+       rhs                    = argn(2);
+       nbAdd                = 0;
+       repositories         = []; // Column vector that contain user repositories
+       currentRepositories  = atomsRepositories();
+       currentRepositories  = currentRepositories(:,1);
+       valid_url_pattern    = "/^((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\:\/\/)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(\/($|[a-zA-Z0-9\.\,\;\?\''\\\+&amp;%\$#\=~_\-]+))*$/";
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsAddRepository",1,2));
+       end
+       
+       // Check URLs specified as first input argument
+       // =========================================================================
+       
+       if type(url) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsAddRepository",1));
+       end
+       
+       for i=1:size(url,"*")
+               if ~ regexp(url(i),valid_url_pattern,"o") == 1 then
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: This ("+url(i)+") is not a valid URL.\n"),"atomsAddRepository",1));
+               end
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 1 then
+               // By default, add the repository for all users (if we have write access
+               // of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsDelRepository",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsDelRepository",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Define the path of the file that will record the change according to
+       // the "allusers" value
+       // =========================================================================
+       
+       if allusers then
+               atoms_directory = pathconvert(SCI+"/.atoms");
+       else
+               atoms_directory = pathconvert(SCIHOME+"/atoms");
+       end
+       
+       // Does the atoms_directory exist, if not create it
+       // =========================================================================
+       
+       if ~ isdir(atoms_directory) then
+               mkdir(atoms_directory);
+       end
+       
+       // Does the SCIHOME/atoms/repositories exist, if yes load it
+       // =========================================================================
+       
+       if fileinfo(atoms_directory+"repositories") <> [] then
+               repositories = mgetl(atoms_directory+"repositories");
+       end
+       
+       // Loop on each URL specified as input argument
+       // =========================================================================
+       
+       for i=1:size(url,"*")
+               disp(currentRepositories);
+               // Add the URL only if it doesn't already exist
+               if find( currentRepositories == url(i) ) == [] then
+                       repositories = [ repositories ; url(i) ];
+                       nbAdd = nbAdd + 1;
+               end
+       end
+       
+       // Apply changes
+       // =========================================================================
+       
+       if nbAdd > 0 then
+               
+               mputl(repositories, atoms_directory+"repositories");
+               
+               // Delete the packages file (created by atomsGetTOOLBOXES) to force reload
+               // the different distant TOOLBOXES files
+               mdelete(pathconvert(SCIHOME+"/.atoms/packages",%F));
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsAutoload.sci b/scilab/modules/atoms/macros/atomsAutoload.sci
new file mode 100644 (file)
index 0000000..e1ce660
--- /dev/null
@@ -0,0 +1,85 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Load the toolboxes that are marked "autoload"
+
+function result = atomsAutoload()
+       
+       // Check input parameters
+       // =========================================================================
+       rhs = argn(2);
+       if rhs > 0 then
+               error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"atomsAutoload",0))
+       end
+       
+       // Get the list of packages to load
+       // =========================================================================
+       packages = atomsGetAutoload();
+       
+       // Libraries to resume
+       // =========================================================================
+       libs_resume = [];
+       
+       // Get the list of lib [before]
+       // =====================================================================
+       libs_before = librarieslist();
+       
+       // Load the wanted packages
+       // =========================================================================
+       result = atomsLoad(packages(:,1),packages(:,2));
+       
+       // Get the list of lib [after]
+       // =====================================================================
+       libs_after = librarieslist();
+       
+       // Loop on libs_after
+       // =====================================================================
+       for i=1:size(libs_after,"*")
+               
+               if find(libs_after(i) == libs_before) == [] then
+                       libs_resume = [ libs_resume ; libs_after(i) ];
+               end
+       end
+       
+       // If libs_resume is empty, the job is done
+       // =========================================================================
+       if isempty(libs_resume) then
+               return;
+       end
+       
+       // Build the resume cmd
+       // =========================================================================
+       
+       resume_cmd = "[";
+       
+       for i=1:size(libs_resume,"*")
+               resume_cmd = resume_cmd + libs_resume(i);
+               if i<size(libs_resume,"*") then
+                       resume_cmd = resume_cmd + ",";
+               else
+                       resume_cmd = resume_cmd + "] = resume(";
+               end
+       end
+       
+       for i=1:size(libs_resume,"*")
+               resume_cmd = resume_cmd + libs_resume(i);
+               if i<size(libs_resume,"*") then
+                       resume_cmd = resume_cmd + ",";
+               else
+                       resume_cmd = resume_cmd + ");";
+               end
+       end
+       
+       // Exec the resume cmd
+       // =========================================================================
+       execstr(resume_cmd,"errcatch");
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsDelRepository.sci b/scilab/modules/atoms/macros/atomsDelRepository.sci
new file mode 100644 (file)
index 0000000..baea832
--- /dev/null
@@ -0,0 +1,104 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Remove an URL to the list of repositories, and returns
+
+function nbDel = atomsDelRepository(url,allusers)
+       
+       rhs   = argn(2);
+       nbDel = 0;
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsDelRepository",1,2));
+       end
+       
+       // Check URLs specified as first input argument
+       // =========================================================================
+       
+       if type(url) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsDelRepository",1));
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 1 then
+               // By default, add the repository for all users (if we have write access
+               // of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsDelRepository",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsDelRepository",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Define the path of the files that will record the change according to
+       // the "allusers" value and the existence of the latter
+       // =========================================================================
+       
+       atoms_files = [];
+       
+       if fileinfo( pathconvert(SCIHOME+"/atoms/repositories",%F) )<> [] then
+               atoms_files = [ atoms_files ; pathconvert(SCIHOME+"/atoms/repositories",%F) ];
+       end
+       
+       if allusers & (fileinfo( pathconvert(SCI+"/.atoms/repositories",%F) )<>[]) then
+               atoms_files = [ atoms_files ; pathconvert(SCI+"/.atoms/repositories",%F) ];
+       end
+       
+       // Loop on each repositories file specified as first input argument
+       // =========================================================================
+       
+       for i=1:size(atoms_files,"*")
+               
+               // Get the URLs list in this file
+               repositories = mgetl(atoms_files(i));
+               
+               // Loop on each URL specified as first input argument
+               for j=1:size(url,"*")
+                       indice = find( repositories == url(j) );
+                       if indice <> [] then
+                               repositories(indice) = [];
+                               nbDel = nbDel + 1;
+                       end
+               end
+               
+               if repositories == [] then
+                       mdelete(atoms_files(i));
+               else
+                       // Apply changes on this file
+                       mputl(repositories,atoms_files(i));
+               
+                       
+               end
+       end
+       
+       // Delete the packages file (created by atomsGetTOOLBOXES) to force reload
+       // the different distant TOOLBOXES files
+       // =========================================================================
+       
+       if nbDel > 0 then
+               mdelete(pathconvert(SCIHOME+"/.atoms/packages",%F));
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsGetInstalled.sci b/scilab/modules/atoms/macros/atomsGetInstalled.sci
new file mode 100644 (file)
index 0000000..7926e53
--- /dev/null
@@ -0,0 +1,87 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Return a 4xn string matrix :
+// 
+// !toolbox2          0.1  user     /home/pmarecha/.Scilab/scilab-branch-atoms/atoms/contrib/toolbox2/0.1  A  !
+// !                                                                                                          !
+// !toolbox2          0.2  user     /home/pmarecha/.Scilab/scilab-branch-atoms/atoms/contrib/toolbox2/0.2  A  !
+// !                                                                                                          !
+// !toolbox_skeleton  1.3  alluser  /home/pmarecha/work/atoms/scilab/contrib/toolbox_skeleton/1.3          I  !
+
+function packages = atomsGetInstalled(allusers)
+       
+       rhs      = argn(2);
+       packages = [];
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs > 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: at most %d expected.\n"),"atomsGetInstalled",1));
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 0 then
+               allusers = %T;
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsGetInstalled",1));
+               end
+       end
+       
+       // Define the differents path of the file where are installed
+       // =========================================================================
+       
+       installed_files = [];
+       user_file       = pathconvert(SCIHOME+"/atoms/installed",%F);
+       alluser_file    = pathconvert(SCI+"/.atoms/installed",%F);
+       
+       if fileinfo(user_file)<>[] then
+               installed_files = [ installed_files ; user_file "user" ];
+       end
+       
+       if allusers & (fileinfo(alluser_file)<>[]) then
+               installed_files = [ installed_files ; alluser_file "allusers"];
+       end
+       
+       // Loop on each "installed" file specified as first input argument
+       // =========================================================================
+       
+       for i=1:size(installed_files(:,1),"*")
+               
+               // Get the installed package list in this file
+               installed = mgetl(installed_files(i,1));
+               
+               // Loop on each URL specified as first input argument
+               for j=1:size(installed,"*")
+                       current_status       = part(installed(j),1:1);
+                       installed(j)         = part(installed(j),5:length(installed(j)));
+                       current_name_length  = regexp(installed(j),"/\s-\s/","o");
+                       current_name         = part(installed(j),1:current_name_length-1);
+                       current_version      = part(installed(j),current_name_length+3:length(installed(j)));
+                       
+                       if installed_files(i,2) == "user" then
+                               // user
+                               current_path  = pathconvert(SCIHOME+"/atoms/"+current_name+"/"+current_version,%F); 
+                       else
+                               // all users
+                               current_path = pathconvert(SCI+"/contrib/"+current_name+"/"+current_version,%F);
+                       end
+                       
+                       packages = [ packages ; current_name current_version installed_files(i,2) current_path current_status];
+               end
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsGetLoaded.sci b/scilab/modules/atoms/macros/atomsGetLoaded.sci
new file mode 100644 (file)
index 0000000..7b710e0
--- /dev/null
@@ -0,0 +1,48 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Return a 4xn string matrix :
+// 
+// !toolbox2          0.1  user     /home/pmarecha/.Scilab/scilab-branch-atoms/atoms/contrib/toolbox2/0.1  A  !
+// !                                                                                                          !
+// !toolbox2          0.2  user     /home/pmarecha/.Scilab/scilab-branch-atoms/atoms/contrib/toolbox2/0.2  A  !
+// !                                                                                                          !
+// !toolbox_skeleton  1.3  alluser  /home/pmarecha/work/atoms/scilab/contrib/toolbox_skeleton/1.3          I  !
+
+function packages = atomsGetLoaded()
+       
+       packages = [];
+       
+       // Define the differents path of the file where are installed
+       // =========================================================================
+       loaded_file   = pathconvert(TMPDIR+"/atoms/loaded",%F);
+       
+       if fileinfo(loaded_file) == [] then
+               packages = [];
+               return;
+       end
+       
+       // load the loaded_file
+       // =========================================================================
+       loaded = mgetl(loaded_file);
+       
+       // Loop on each URL specified as first input argument
+       // =========================================================================
+       
+       for i=1:size(loaded,"*")
+               current_name_length  = regexp(loaded(i),"/\s-\s/","o");
+               current_name         = part(loaded(i),1:current_name_length-1);
+               current_version      = part(loaded(i),current_name_length+3:length(loaded(i)));
+               
+               packages = [ packages ; atomsGetInstalledDetails(current_name,current_version) ];
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsInstall.sci b/scilab/modules/atoms/macros/atomsInstall.sci
new file mode 100644 (file)
index 0000000..414ba58
--- /dev/null
@@ -0,0 +1,344 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Installation of a toolbox
+
+function result = atomsInstall(packages,allusers)
+       
+       result = [];
+       
+       // Save the initial path
+       // =========================================================================
+       initialpath = pwd();
+       
+       // Get scilab version (needed for later)
+       // =========================================================================
+       sciversion = strcat(string(getversion("scilab")) + ".");
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs = argn(2);
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"atomsInstall",1,2))
+       end
+       
+       if type(packages) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstall",1));
+       end
+       
+       packages = stripblanks(packages);
+       
+       // Operating system detection
+       // =========================================================================
+       
+       if ~MSDOS then
+               OSNAME = unix_g('uname');
+               MACOSX = (strcmpi(OSNAME,"darwin") == 0);
+               LINUX  = (strcmpi(OSNAME,"linux") == 0);
+       else
+               MACOSX = %F;
+               LINUX  = %F;
+       end
+       
+       if MSDOS then
+               OSNAME = "windows";
+       elseif LINUX then
+               OSNAME = "linux";
+       elseif MACOSX then
+               OSNAME = "macosx";
+       end
+       
+       // Verbose Mode ?
+       // =========================================================================
+       if strcmpi(atomsGetConfig("Verbose"),"True") == 0 then
+               VERBOSE = %T;
+       else
+               VERBOSE = %F;
+       end
+       
+       // Install for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 1 then
+               // By default, install for all users (if we have write access of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsInstall",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsInstall",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Define the "archives" directory path
+       // Create it if it's not exist
+       // =========================================================================
+       
+       if allusers then
+               archives_directory = pathconvert(SCI+"/contrib/archives");
+       else
+               archives_directory = pathconvert(SCIHOME+"/atoms/archives");
+       end
+       
+       if ~ isdir( archives_directory ) then
+               status = mkdir( archives_directory );
+               if status <> 1 then
+                       chdir(initialpath);
+                       error(msprintf( ..
+                               gettext("%s: The directory ""%s"" cannot been created, please check if you have write access on this directory.\n"),..
+                               "atomsInstall", ..
+                               archives_directory));
+               end
+       end
+       
+       // Get the install list
+       // =========================================================================
+       [install_package_list,dependency_tree] = atomsInstallList(packages);
+       
+       // Loop on install_package_list to print if a package has to be installed
+       // or not
+       // =========================================================================
+       if VERBOSE 
+               for i=1:size(install_package_list(:,1),"*")
+                       if install_package_list(i,1) == "+" then
+                               mprintf("\t%s (%s) will be installed\n",install_package_list(i,3),install_package_list(i,4));
+                       elseif install_package_list(i,1) == "~" then
+                               mprintf("\t%s (%s) is already installed and up-to-date\n",install_package_list(i,3),install_package_list(i,4));
+                       end
+               end
+       end
+       
+       // Now really install the packages
+       // =========================================================================
+       
+       for i=1:size(install_package_list(:,1),"*")
+               
+               this_package_name    = install_package_list(i,3);
+               this_package_version = install_package_list(i,4);
+               
+               this_package_details = dependency_tree(this_package_name+" - "+this_package_version);
+               
+               if install_package_list(i,1) <> "+" then
+                       continue;
+               end
+               
+               if VERBOSE then
+                       mprintf("\tInstalling %s (%s) ...",this_package_name,this_package_version);
+               end
+               
+               // Define the path of the directory where will be installed this toolbox
+               // =====================================================================
+               
+               if allusers then
+                       atoms_directory = pathconvert(SCI+"/contrib/"+this_package_name);
+               else
+                       atoms_directory = pathconvert(SCIHOME+"/atoms/"+this_package_name);
+               end
+               
+               // Create the parent directory of this toolbox if it's not already exist
+               // =====================================================================
+               
+               if ~ isdir( atoms_directory ) then
+                       status = mkdir( atoms_directory );
+                       if status <> 1 then
+                               chdir(initialpath);
+                               error(msprintf( ..
+                                       gettext("%s: The directory ""%s"" cannot been created, please check if you have write access on this directory.\n"),..
+                                       atoms_directory));
+                       end
+               end
+               
+               // Define the path of the downloaded file
+               // =====================================================================
+               
+               fileout = pathconvert(atoms_directory+this_package_details(OSNAME+"Name"),%F);
+               filein  = this_package_details(OSNAME+"Url");
+               
+               // Get the package
+               // =====================================================================
+               
+               if MSDOS then
+                       download_cmd =  getshortpathname(pathconvert(SCI+"/tools/curl/curl.exe",%F)) +" -s """+ filein + """ -o """ + fileout + """";
+               else
+                       download_cmd = "wget "+ filein + " -O " + fileout;
+               end
+               
+               [rep,stat,err] = unix_g(download_cmd)
+               
+               if stat ~= 0 then
+                       disp(download_cmd);
+                       disp(err);
+               end
+               
+               // Check the md5sum
+               // =====================================================================
+               
+               filemd5 = getmd5(fileout);
+               
+               if filemd5 <> this_package_details(OSNAME+"Md5") then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: The downloaded binary file (%s) doesn''t check the MD5SUM.\n"),"atomsInstall",fileout));
+               end
+               
+               // unarchive it
+               // =====================================================================
+               
+               chdir( atoms_directory );
+               
+               // get the list of directories before unarchive
+               dir_list_before = atomsListDir();
+               
+               if ( LINUX | MACOSX ) & regexp(fileout,"/\.tar\.gz$/","o") <> [] then
+                       
+                       extract_cmd = "tar xzf "+ fileout + " -C """+ atoms_directory + """";
+                       
+               elseif regexp(fileout,"/\.zip$/","o") <> [] then
+                       
+                       if MSDOS then
+                               extract_cmd = getshortpathname(pathconvert(SCI+"/tools/zip/unzip.exe",%F));
+                       else
+                               extract_cmd = "unzip";
+                       end
+                       
+                       extract_cmd = extract_cmd + " -q """ + fileout + """ -d """ + pathconvert(atoms_directory,%F) +"""";
+                       
+               else
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: internal error, the archive ""%s"" cannot be extracted on this operating system.\n"),"atomsInstall",fileout));
+               
+               end
+               
+               [rep,stat,err] = unix_g(extract_cmd);
+               
+               if stat ~= 0 then
+                       disp(extract_cmd);
+                       disp(err);
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: internal error, the extraction of the archive ""%s"" has failed.\n"),"atomsInstall",fileout));
+               end
+               
+               // get the list of directories after unarchive
+               dir_list_after = atomsListDir();
+               
+               // Get the name of the created directory
+               // =====================================================================
+               
+               unarchive_dir = "";
+               
+               for j=1:size(dir_list_after,"*")
+                       if find(dir_list_after(j) == dir_list_before) == [] then
+                               unarchive_dir = dir_list_after(j);
+                               break;
+                       end
+               end
+               
+               // Rename the created directory
+               // =====================================================================
+               
+               if MSDOS then
+                       rename_cmd = "rename";
+               else
+                       rename_cmd = "mv";
+               end
+               
+               rename_cmd = rename_cmd+" """+unarchive_dir+""" """+this_package_version+"""";
+               
+               [rep,stat]=unix_g(rename_cmd)
+               
+               if stat <> 0 then
+                       disp(rename_cmd);
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: Error while creating the directory ''%s''.\n"),"atomsInstall",pathconvert(atoms_directory+this_package_version)));
+               end
+               
+               // Register the successfully installed package
+               // =====================================================================
+               
+               if install_package_list(i,2) == "U" then
+                       // Intentionnaly Installed
+                       this_package_status = "I";
+               else
+                       // Automaticaly installed
+                       this_package_status = "A";
+               end
+               
+               atomsInstallRegister(this_package_name,this_package_version,this_package_status,allusers);
+               
+               // Autoload the toolbox unless precised
+               // =====================================================================
+               
+               if ~ (atomsGetConfig("autoload") == "False") then
+                       atomsAddAutoload(this_package_name,this_package_version,allusers);
+               end
+               
+               // Move the archive file (.tar.gz or .zip file) to the archive directory
+               // =====================================================================
+               
+               stat = copyfile( fileout , archives_directory );
+               
+               if stat <> 1 then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: Error while copying the file ''%s'' to the directory ''%s''.\n"),"atomsInstall",fileout,archives_directory));
+               end
+               
+               mdelete( fileout );
+               
+               // Fill the result matrix
+               // =====================================================================
+               
+               result = [ result ; atomsGetInstalledDetails(this_package_name,this_package_version) ];
+               
+               // Sucess message if needed
+               // =====================================================================
+               
+               if VERBOSE then
+                       mprintf(" success\n");
+               end
+       end
+       
+       // Go to the initial location
+       // =========================================================================
+       chdir(initialpath);
+       
+endfunction
+
+
+// =============================================================================
+// Just get the list of the directories present in the current directory
+// =============================================================================
+
+function result = atomsListDir()
+       
+       result = [];
+       
+       items  = listfiles();
+       
+       // Loop on items
+       for i=1:size(items,"*")
+               if isdir(items(i)) then
+                       result = [ result ; items(i) ];
+               end
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsInstallCategory.sci b/scilab/modules/atoms/macros/atomsInstallCategory.sci
new file mode 100644 (file)
index 0000000..d6f40f4
--- /dev/null
@@ -0,0 +1,46 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Installation of a toolbox sub-category  
+
+function result = atomsInstallCategory(cat, sscat, checkVersionScilab)
+  rhs = argn(2)
+
+  if (rhs == 2 | rhs == 1 | rhs == 3) then
+  if rhs == 2
+    checkVersionScilab = %t
+  end
+  result = %f
+  // we load the list of all the available toolboxes in the net
+  desc = atomsReadDesc("")
+  [nbTool, m] = size(desc("Toolbox"))
+  for i=1:nbTool
+    catTool = desc("Category")(i)
+    // We watch if this toolbox belong to the asked cat/sscat
+    regularExpression = "/" + cat + " \((\w*, )*" + sscat + "(, \w*)*\)/"
+    // If yes, we install it if it is convenient for the Scilab version
+    if regexp(catTool, regularExpression) <> [] & ((atomsVerifVersionScilab(desc("ScilabVersion")(i)) & checkVersionScilab) | ~checkVersionScilab)
+      // We can't take result = atomsInstall() there is a install error, result = %f
+      atomsInstall(desc("Toolbox")(i));
+      result = %t
+    end   
+  end
+  // If we have installed nothing
+  if ~result
+    atomsDisplayMessage(_("None of the toolboxes match in this category/sub-category for your version"))
+  end
+  return result
+  else
+    error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"atomsInstallCategory",1,3))
+  end
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsIsInstalled.sci b/scilab/modules/atoms/macros/atomsIsInstalled.sci
new file mode 100644 (file)
index 0000000..dffe031
--- /dev/null
@@ -0,0 +1,95 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Returns TRUE if a package is installed, FALSE otherwise
+
+// Input parameters :
+//   name     : matrix of strings
+//   version  : matrix of strings
+//   allusers : boolean
+
+// Output parameters :
+//   res      : matrix of boolean
+
+function res = atomsIsInstalled(name,version,allusers)
+       
+       rhs           = argn(2);
+       res           = [];
+       installed     = []; // Column vector that contain user repositories
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 1 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsIsInstalled",1,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsIsInstalled",1));
+       end
+       
+       if rhs>1 &  (~isempty(version)) & type(version)<>10  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsIsInstalled",2));
+       end
+       
+       // name and version must have the same size
+       // =========================================================================
+       
+       if rhs>1 & version<>[] & or(size(name)<>size(version)) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsIsInstalled",1,2));
+       end
+       
+       // Value of version if not precised
+       // =========================================================================
+       
+       if rhs < 2 then
+               version = [];
+       end
+       
+       // allusers management
+       // =========================================================================
+       
+       if rhs < 3 then
+               allusers = %T;
+       end
+       
+       // Get the list of installed packages
+       // =========================================================================
+       packages = atomsGetInstalled(allusers);
+       
+       
+       // Loop on name
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               if isempty(version) then
+                       // Just check the name
+                       res(i) = or(packages(:,1) == name(i));
+               
+               else
+                       // Filter on names
+                       packages_version = packages( find(packages(:,1) == name(i)) , 2 );
+                       
+                       // Check if the wnated version is present$
+                       res(i) = or(packages_version == version(i) );
+               end
+               
+       end
+       
+       // Reshape the matrix
+       // =========================================================================
+       res = matrix(res,size(name) );
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsIsLoaded.sci b/scilab/modules/atoms/macros/atomsIsLoaded.sci
new file mode 100644 (file)
index 0000000..0d5f3ab
--- /dev/null
@@ -0,0 +1,104 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Output arguments :
+
+//   res  :  .%T if the toolbox is loaded in this scilab session
+//           . Matrix of boolean ( n x 1 ) 
+//           . mandatory
+
+//   version_out : . If the toolbox is loaded, version_out is the version of the
+//                   loaded toolbox
+//                   otherwise, version_out = "-1"
+//                 . Matrix of string (n x 1)
+//                 . mandatory
+
+function [res,version_out] = atomsIsLoaded(name,version)
+       
+       rhs         = argn(2);
+       lhs         = argn(1);
+       res         = [];
+       version_out = [];
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsIsLoaded",1,2));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsIsLoaded",1));
+       end
+       
+       if rhs>1 &  (~isempty(version)) & type(version)<>10  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsIsLoaded",2));
+       end
+       
+       // name and version must have the same size
+       // =========================================================================
+       
+       if rhs>1 & version<>[] & or(size(name)<>size(version)) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsIsLoaded",1,2));
+       end
+       
+       // Value of version if not precised
+       // =========================================================================
+       
+       if rhs < 2 then
+               version = [];
+       end
+       
+       // Get the list of installed packages
+       // =========================================================================
+       packages = atomsGetLoaded();
+       
+       // Loop on name
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               if isempty(version) then
+                       // Just check the name
+                       res(i) = or(packages(:,1) == name(i));
+                       
+               else
+                       // Filter on names
+                       packages_version = packages( find(packages(:,1) == name(i)) , 2 );
+                       
+                       // Check if the wanted version is present$
+                       res(i) = or(packages_version == version(i) );
+               end
+               
+               if lhs>1 then
+                       if res(i) then
+                               version_out(i) = packages( find(packages(:,1) == name(i)) , 2 )
+                       else
+                               version_out(i) = "";
+                       end
+               end
+               
+       end
+       
+       // Reshape the matrix [res]
+       // =========================================================================
+       res = matrix(res,size(name) );
+       
+       // Reshape the matrix [version_out]
+       // =========================================================================
+       if lhs > 1
+               version_out = matrix(version_out,size(name) );
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsList.sci b/scilab/modules/atoms/macros/atomsList.sci
new file mode 100644 (file)
index 0000000..44013fa
--- /dev/null
@@ -0,0 +1,67 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// display of the available toolboxes
+
+function atomsList()
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs = argn(2);
+       
+       if rhs <> 0 then
+               error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"atomsInstall",0))
+       end
+       
+       // Get the list of available toolboxes
+       // =========================================================================
+       
+       packages_struct    = atomsGetTOOLBOXES();
+       
+       packages_list      = getfield(1,packages_struct);
+       packages_list(1:2) = [];
+       
+       packages_disp      = [];
+       
+       // Loop on package list
+       // =========================================================================
+       
+       for i=1:size(packages_list,"*")
+               
+               this_package_name = packages_list(i);
+               
+               // Get the list of versions compatibles with this version of Scilab
+               this_package_versions = atomsCompatibleVersions(packages_list(i));
+               
+               if isempty(this_package_versions) then
+                       continue;
+               end
+               
+               // Use the Most Recent Version
+               this_package_version = this_package_versions(1);
+               
+               // Get the details of this toolbox
+               this_package_details = atomsToolboxDetails(this_package_name,this_package_version);
+               this_package_summary = this_package_details("Summary");
+               
+               packages_disp        = [ packages_disp ; this_package_name this_package_summary ];
+               
+       end
+       
+       // Loop on package list ... a second time
+       // =========================================================================
+       
+       for i=1:size(packages_disp(:,1),"*")
+               mprintf("% "+string(max(length(packages_disp(:,1))))+"s - %s\n",packages_disp(i,1),packages_disp(i,2));
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsLoad.sci b/scilab/modules/atoms/macros/atomsLoad.sci
new file mode 100644 (file)
index 0000000..f2cfcc7
--- /dev/null
@@ -0,0 +1,300 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Load one or several toolboxes
+
+function result = atomsLoad(name,version)
+       
+       // Init the output argument
+       // =========================================================================
+       result = [];
+       
+       // Check number of input arguments
+       // =========================================================================
+       rhs = argn(2);
+       if rhs <> 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsLoad",2));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsLoad",1));
+       end
+       
+       if type(version) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsLoad",2));
+       end
+       
+       // name and version must have the same size
+       // =========================================================================
+       
+       if or( size(name) <> size(version) ) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsLoad",1,2));
+       end
+       
+       // Check if the packages to load are installed
+       // =========================================================================
+       
+       if or( ~ atomsIsInstalled(name,version) ) then
+               for i=1:size(name,"*")
+                       if ~atomsIsInstalled(name(i),version(i)) then
+                               error(msprintf(gettext("%s: the package ''%s - %s'' is not installed.\n"),"atomsLoad",name(i),version(i)));
+                       end
+               end
+       end
+       
+       // Get path of the toolboxes
+       // =========================================================================
+       path = atomsGetInstalledPath(name,version);
+       
+       // Create the TMPDIR/atoms directory
+       // =========================================================================
+       if ~ isdir(TMPDIR+"/atoms") then
+               status = mkdir( TMPDIR+"/atoms" );
+               if status <> 1 then
+                       error(msprintf( ..
+                               gettext("%s: The directory ""%s"" cannot been created, please check if you have write access on this directory.\n"), ..
+                               "atomsLoad", ..
+                               TMPDIR+"/atoms"));
+               end
+       end
+       
+       // Verbose Mode ?
+       // =========================================================================
+       if strcmpi(atomsGetConfig("Verbose"),"True") == 0 then
+               VERBOSE = %T;
+       else
+               VERBOSE = %F;
+       end
+       
+       // Define the path of the loaded file
+       // =========================================================================
+       loaded_file = pathconvert(TMPDIR+"/atoms/loaded",%F);
+       
+       // Does the loaded file exist, if yes load it
+       // =========================================================================
+       nbAdd = 0;
+       if fileinfo(loaded_file) <> [] then
+               loaded = mgetl(loaded_file);
+       else
+               loaded = [];
+       end
+       
+       // Loop on packages gived by the user
+       // =========================================================================
+       
+       mandatory_packages      = struct();
+       mandatory_packages_name = struct();
+       mandatory_packages_mat  = [];
+       
+       for i=1:size(name,"*")
+               
+               // Check if the user try to load 2 versions of the same toolbox at the
+               // same time
+               // =====================================================================
+               if size( find( name(i) == name ) > 1 ) then
+                       this_versions = version( find( name(i) == name ) );
+                       for j=2:size(this_versions,"*")
+                               if this_versions(j) <> this_versions(1) then
+                                       mprintf(gettext("%s: Several versions of a package (%s) cannot be loaded at the same scilab session :\n"),"atomsLoad",name(i));
+                                       mprintf(gettext("\t - You''ve asked ''%s - %s''\n"),name(i),this_versions(1));
+                                       mprintf(gettext("\t - You''ve asked ''%s - %s''\n"),name(i),this_versions(j));
+                                       mprintf("\n");
+                                       error("");
+                               end
+                       end
+               end
+               
+               // Check if this toolbox is already loaded
+               // =====================================================================
+               if atomsIsLoaded(name(i),version(i)) then
+                       if VERBOSE then
+                               mprintf("\tThe package %s (%s) is already loaded\n",name(i),version(i));
+                       end
+                       continue;
+               end
+               
+               // Check if another version of this toolbox is already loaded
+               // =====================================================================
+               [is_loaded,loaded_version] =  atomsIsLoaded(name(i));
+               if is_loaded then
+                       error(msprintf(gettext("%s: Another version of the package %s is already loaded : %s\n","atomsLoad",name(i),loaded_version)));
+                       continue;
+               end
+               
+               mandatory_packages(name(i)+" - "+version(i)) = "asked_by_user";
+               mandatory_packages_name(name(i)) = version(i);
+               mandatory_packages_mat = [ mandatory_packages_mat ; name(i) version(i) path(i) ];
+               
+       end
+       
+       // Fill the list of package to load
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               childs = atomsGetDepChilds(name(i),version(i));
+               
+               for j=1:size( childs(:,1) , "*")
+                       
+                       // Check if it is already loaded
+                       // -------------------------------------------------------
+                       if atomsIsLoaded( childs(j,1) , childs(j,2) ) then
+                               continue;
+                       end
+                       
+                       // Check if another version of this package is already loaded
+                       // -------------------------------------------------------
+                       [is_loaded,loaded_version] =  atomsIsLoaded(childs(j,1));
+                       if is_loaded then
+                               mprintf(gettext("%s: Several versions of a package (%s) cannot be loaded at the same scilab session :\n"),"atomsLoad",childs(j,1));
+                               mprintf(gettext("\t - ''%s - %s'' is already loaded\n"),childs(j,1),loaded_version);
+                               mprintf(gettext("\t - ''%s - %s'' is needed by ''%s - %s''\n"),childs(j,1),childs(j,2),name(i),version(i));
+                               mprintf("\n");
+                               error("");
+                       end
+                       
+                       // Check if it is already in the list
+                       // -------------------------------------------------------
+                       if isfield( mandatory_packages , childs(j,1)+" - "+childs(j,2) ) then
+                               continue;
+                       end
+                       
+                       // Check if another version is already in the list
+                       // -------------------------------------------------------
+                       if isfield( mandatory_packages_name , childs(j,1) ) then
+                               
+                               // if it's not the name version => error
+                               if mandatory_packages_name(childs(j,1)) <> childs(j,2) then
+                                       
+                                       mprintf(gettext("%s: Several versions of a package (%s) cannot be loaded at the same scilab session :\n"),"atomsLoad",childs(j,1));
+                                       mprintf(gettext("\t - ''%s - %s'' is needed by ''%s - %s''\n"),childs(j,1),childs(j,2),name(i),version(i));
+                                       
+                                       // The other version of the package is asked by the user
+                                       if mandatory_packages(childs(j,1)+" - "+mandatory_packages_name(childs(j,1))) == "asked_by_user" then
+                                               mprintf(gettext("\t - You''ve asked ''%s - %s''\n"),childs(j,1),mandatory_packages_name(childs(j,1)));
+                                       
+                                       // The other version of the package is a need by another package
+                                       else
+                                               mprintf(gettext("\t - ''%s - %s'' is needed by ''%s''\n"), .. 
+                                                       childs(j,1), .. // name
+                                                       mandatory_packages_name(childs(j,1)), .. // version
+                                                       mandatory_packages(childs(j,1)+" - "+mandatory_packages_name(childs(j,1))) .. // name - version
+                                                       );
+                                       end
+                                       
+                                       mprintf("\n");
+                                       error("");
+                               end
+                       end
+                       
+                       // The child has passed the test, add it to the mandatory
+                       // packages to load
+                       // -------------------------------------------------------
+                       
+                       mandatory_packages(childs(j,1)+" - "+childs(j,2)) = name(i)+" - "+version(i);
+                       mandatory_packages_name(childs(j,1)) = childs(j,2);
+                       mandatory_packages_mat = [ mandatory_packages_mat ; childs(j,1) childs(j,2) atomsGetInstalledPath(childs(j,1),childs(j,2)) ];
+                       
+               end
+       end
+       
+       // Libraries to resume
+       // =========================================================================
+       libs_resume = [];
+       
+       for i=1:size(mandatory_packages_mat(:,1),"*")
+               
+               this_package_name    = mandatory_packages_mat(i,1);
+               this_package_version = mandatory_packages_mat(i,2);
+               this_package_path    = mandatory_packages_mat(i,3);
+               
+               // Get the list of lib
+               // =====================================================================
+               libs_before = librarieslist();
+               
+               // Exec the loader
+               // =====================================================================
+               
+               loader_file = pathconvert(this_package_path) + "loader.sce";
+               
+               if fileinfo(loader_file)==[] then
+                       error(msprintf(gettext("%s: The file ''%s'' doesn''t exist or is not read accessible.\n"),"atomsLoad",loader_file));
+               end
+               
+               exec( loader_file );
+               
+               // Get the list of libraries (macros)
+               // =====================================================================
+               libs_after = librarieslist();
+               
+               // Loop on libs_after
+               // =====================================================================
+               for j=1:size(libs_after,"*")
+                       
+                       if find(libs_after(j) == libs_before) == [] then
+                               libs_resume = [ libs_resume ; libs_after(j) ];
+                       end
+               end
+               
+               // Fill the output argument
+               // =====================================================================
+               result = [ result ; mandatory_packages_mat(i,:) ];
+               
+               // fill the loaded matrix
+               // =====================================================================
+               if find(loaded == this_package_name + " - " + this_package_version) == [] then
+                       nbAdd  = nbAdd + 1;
+                       loaded = [ loaded ; this_package_name + " - " + this_package_version ];
+               end
+               
+       end
+       
+       // Apply changes
+       // =========================================================================
+       if nbAdd > 0 then
+               mputl(loaded,loaded_file);
+       end
+       
+       // If libs_resume is empty, the job is done
+       // =========================================================================
+       if isempty(libs_resume) then
+               return;
+       end
+       
+       // Build the resume cmd
+       // =========================================================================
+       
+       resume_cmd = "[";
+       
+       for i=1:size(libs_resume,"*")
+               resume_cmd = resume_cmd + libs_resume(i);
+               if i<size(libs_resume,"*") then
+                       resume_cmd = resume_cmd + ",";
+               else
+                       resume_cmd = resume_cmd + "] = resume(";
+               end
+       end
+       
+       for i=1:size(libs_resume,"*")
+               resume_cmd = resume_cmd + libs_resume(i);
+               if i<size(libs_resume,"*") then
+                       resume_cmd = resume_cmd + ",";
+               else
+                       resume_cmd = resume_cmd + ");";
+               end
+       end
+       
+       // Exec the resume cmd
+       // =========================================================================
+       // execstr(resume_cmd,"errcatch");
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsRemove.sci b/scilab/modules/atoms/macros/atomsRemove.sci
new file mode 100644 (file)
index 0000000..1475b18
--- /dev/null
@@ -0,0 +1,193 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Remove a toolbox
+
+function result = atomsRemove(packages,allusers)
+       
+       result = [];
+       
+       // Save the current path
+       // =========================================================================
+       initialpath = pwd();
+       
+       // Get scilab version (needed for later)
+       // =========================================================================
+       sciversion = strcat(string(getversion('scilab')) + ".");
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs = argn(2);
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"atomsRemove",1,2))
+       end
+       
+       if type(packages) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsRemove",1));
+       end
+       
+       packages = stripblanks(packages);
+       
+       // Operating system detection
+       // =========================================================================
+       
+       if ~MSDOS then
+               OSNAME = unix_g('uname');
+               MACOSX = (strcmpi(OSNAME,"darwin") == 0);
+               LINUX  = (strcmpi(OSNAME,"linux") == 0);
+       else
+               MACOSX = %F;
+               LINUX  = %F;
+       end
+       
+       if MSDOS then
+               OSNAME = "windows";
+       elseif LINUX then
+               OSNAME = "linux";
+       elseif MACOSX then
+               OSNAME = "macosx";
+       end
+       
+       // Verbose Mode ?
+       // =========================================================================
+       if strcmpi(atomsGetConfig("Verbose"),"True") == 0 then
+               VERBOSE = %T;
+       else
+               VERBOSE = %F;
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 1 then
+               // By default, uninstall the package (if we have write access
+               // of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsRemove",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsRemove",2,pathconvert(SCI+"/.atoms")));
+               end
+       end 
+       
+       // Build the list of package to Uninstall
+       // =========================================================================
+       remove_package_list = atomsRemoveList(packages,allusers);
+       
+       
+       // Loop on remList to print if a package has to be remove
+       // or not
+       // =========================================================================
+       if VERBOSE 
+               for i=1:size(remove_package_list(:,1),"*")
+                       if remove_package_list(i,1) == "-" then
+                               mprintf("\t%s (%s) will be removed\n",remove_package_list(i,3),remove_package_list(i,4));
+                       elseif (remove_package_list(i,1) == "~") & (remove_package_list(i,1) == "B") then
+                               mprintf("\t%s (%s) cannot be removed and will be broken\n",remove_package_list(i,3),remove_package_list(i,4));
+                       end
+               end
+       end
+       
+       // Now we have the list of package that have to be uninstalled
+       // =========================================================================
+       
+       for i=1:size(remove_package_list(:,1),"*")
+               
+               // If the package must be keeped, the job is done
+               if remove_package_list(i,1) <> "-" then
+                       continue;
+               end
+               
+               this_package_name      = remove_package_list(i,3);
+               this_package_version   = remove_package_list(i,4);
+               this_package_insdet    = atomsGetInstalledDetails(this_package_name,this_package_version);
+               this_package_directory = this_package_insdet(4);
+               
+               if VERBOSE then
+                       mprintf( "\tRemoving %s (%s) ... " , this_package_name , this_package_version );
+               end
+               
+               // Check if this_package_directory start with SCI or SCIHOME
+               
+               if (grep(this_package_directory,pathconvert(SCI)) == []) & ..
+                       (grep(this_package_directory,pathconvert(SCIHOME)) == []) then
+                       
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: The directory of this package (%s-%s) is located neither in SCI nor in SCIHOME. For security reason, ATOMS refuses to delete this directory.\n"),"atomsRemove",this_package_name,this_package_version));
+               end
+               
+               uninstall_status = rmdir(this_package_directory,"s");
+               
+               if uninstall_status<>1 then
+                       chdir(initialpath);
+                       error(msprintf( ..
+                               gettext("%s: The directory of this package (%s-%s) cannot been deleted, please check if you have write access on this directory : %s.\n"),..
+                               "atomsRemove", ..
+                               this_package_name, ..
+                               this_package_version, ..
+                               this_package_directory));
+               end
+               
+               // Check if the parent directory (directory name == toolbox name ) is empty 
+               // If yes, detete it
+               // =====================================================================
+               this_package_root_dir = part(this_package_directory,1:length(pathconvert(this_package_directory)) - length(this_package_version) - 1 );
+               
+               if isdir(this_package_root_dir) & listfiles(this_package_root_dir)==[] then
+                       stat = rmdir(this_package_root_dir);
+                       if stat<>1 then
+                               chdir(initialpath);
+                               error(msprintf( ..
+                                       gettext("%s: The root directory of this package (%s-%s) cannot been deleted, please check if you have write access on this directory : %s.\n"),..
+                                       "atomsRemove", ..
+                                       this_package_name, ..
+                                       this_package_version, ..
+                                       this_package_root_dir));
+                       end
+               end
+               
+               // Remove this toolbox from the list of installed packages
+               // =====================================================================
+               atomsInstallUnregister(this_package_name,this_package_version,allusers);
+               
+               // Remove this toolbox from the list of autoloaded packages
+               // =====================================================================
+               atomsDelAutoload(this_package_name,this_package_version);
+               
+               // Fill the result matrix
+               // =====================================================================
+               result = [ result ; this_package_insdet ];
+               
+               // Sucess message if needed
+               // =====================================================================
+               if VERBOSE then
+                       mprintf(" success\n");
+               end
+       end
+       
+       // Go to the initial location
+       chdir(initialpath);
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsRepositories.sci b/scilab/modules/atoms/macros/atomsRepositories.sci
new file mode 100644 (file)
index 0000000..186413d
--- /dev/null
@@ -0,0 +1,88 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// get the list of repositories
+
+function repositories = atomsRepositories(level)
+       
+       rhs           = argn(2);
+       repositories  = [];
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs > 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsRepositories",0,1));
+       end
+       
+       // Check input argument type (if any)
+       // =========================================================================
+       
+       if (rhs==1) & (type(level) <> 10) then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: Single string expected.\n"),"atomsRepositories",1));
+       end
+       
+       // Check input argument dimension (if any)
+       // =========================================================================
+       
+       if (rhs==1) & (size(level,"*")<>1) then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: Single string expected.\n"),"atomsRepositories",1));
+       end
+       
+       // Check input argument values (if any)
+       // =========================================================================
+       
+       if (rhs==1) & (and(level<>["user","allusers","official"])) then
+               error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''official'' expected.\n"),"atomsRepositories",1));
+       end
+       
+       // Define the needed paths
+       // =========================================================================
+       
+       official_repositories = pathconvert(SCI+"/modules/atoms/etc/repositories",%F);
+       allusers_repositories = pathconvert(SCI+"/.atoms/repositories",%F);
+       user_repositories     = pathconvert(SCIHOME+"/atoms/repositories",%F);
+       
+       // official repositories
+       // =========================================================================
+       
+       if (rhs == 0) | ((rhs == 1) & (level == "official")) then
+               if fileinfo(official_repositories) <> [] then
+                       url_list = mgetl(official_repositories);
+                       for i=1:size(url_list,"*")
+                               repositories = [ repositories ; url_list(i)  "official" ];
+                       end
+               end
+       end
+       
+       // All users repositories
+       // =========================================================================
+       
+       if (rhs == 0) | ((rhs == 1) & (level == "allusers")) then
+               if fileinfo(allusers_repositories) <> [] then
+                       url_list = mgetl(allusers_repositories);
+                       for i=1:size(url_list,"*")
+                               repositories = [ repositories ; url_list(i)  "allusers" ];
+                       end
+               end
+       end
+       
+       // User repositories
+       // =========================================================================
+       
+       if (rhs == 0) | ((rhs == 1) & (level == "user")) then
+               if fileinfo(user_repositories) <> [] then
+                       url_list = mgetl(user_repositories);
+                       for i=1:size(url_list,"*")
+                               repositories = [ repositories ; url_list(i)  "user" ];
+                       end
+               end
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsSearch.sci b/scilab/modules/atoms/macros/atomsSearch.sci
new file mode 100644 (file)
index 0000000..414475e
--- /dev/null
@@ -0,0 +1,86 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// Search
+
+function packages_disp = atomsSearch( search , fields )
+       
+       rhs = argn(2);
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsSearch",1,2));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(search) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsSearch",1));
+       end
+       
+       if (rhs>1) & (type(fields)<>10)  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsSearch",2));
+       end
+       
+       // Check input parameters dimensions
+       // =========================================================================
+       
+       if size(search,"*") <> 1 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsSearch",1));
+       end
+       
+       // Don't take into account the character cast
+       // =========================================================================
+       search = convstr(search,"l");
+       
+       // Get the list of available toolboxes
+       // =========================================================================
+       
+       packages_struct    = atomsGetTOOLBOXES();
+       
+       packages_list      = getfield(1,packages_struct);
+       packages_list(1:2) = [];
+       
+       packages_disp      = [];
+       
+       // Loop on package list
+       // =========================================================================
+       
+       for i=1:size(packages_list,"*")
+               
+               this_package_name = packages_list(i);
+               
+               // Get the list of versions compatibles with this version of Scilab
+               this_package_versions = atomsCompatibleVersions(packages_list(i));
+               
+               if isempty(this_package_versions) then
+                       continue;
+               end
+               
+               // Use the Most Recent Version
+               this_package_version = this_package_versions(1);
+               
+               // Get the details of this toolbox
+               this_package_details = atomsToolboxDetails(this_package_name,this_package_version);
+               this_package_summary = this_package_details("Summary");
+               
+               if grep( convstr(this_package_name,"l") , search ) <> [] then
+                       packages_disp = [ packages_disp ; this_package_name this_package_summary ];
+               elseif grep( convstr(this_package_summary,"l") , search ) <> [] then
+                       packages_disp = [ packages_disp ; this_package_name this_package_summary ];
+               end
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsShow.sci b/scilab/modules/atoms/macros/atomsShow.sci
new file mode 100644 (file)
index 0000000..aef32b7
--- /dev/null
@@ -0,0 +1,191 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Show information on a package
+
+function atomsShow(name,version)
+       
+       rhs = argn(2);
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsShow",1,2));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsShow",1));
+       end
+       
+       if (rhs>1) & (type(version)<>10)  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsShow",2));
+       end
+       
+       // Check input parameters dimensions
+       // =========================================================================
+       
+       if size(name,"*") <> 1 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsShow",1));
+       end
+       
+       if (rhs>1) & (size(version,"*") <> 1) then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsShow",2));
+       end
+       
+       // Get the details of this package
+       // =========================================================================
+       
+       details = atomsToolboxDetails(name,version);
+       
+       fields_map = [];
+       fields_map = [ fields_map ; "Toolbox"        gettext("Package")        ];
+       fields_map = [ fields_map ; "Title"          gettext("Title")          ];
+       fields_map = [ fields_map ; "Summary"        gettext("Summary")        ];
+       fields_map = [ fields_map ; "Version"        gettext("Version")        ];
+       fields_map = [ fields_map ; "Depends"        gettext("Depend")         ];
+       fields_map = [ fields_map ; "Category"       gettext("Category(ies)")  ];
+       fields_map = [ fields_map ; "Maintainer"     gettext("Maintainer(s)")  ];
+       fields_map = [ fields_map ; "Entity"         gettext("Entity")         ];
+       fields_map = [ fields_map ; "WebSite"        gettext("WebSite")        ];
+       fields_map = [ fields_map ; "License"        gettext("License")        ];
+       fields_map = [ fields_map ; "ScilabVersion"  gettext("Scilab Version") ];
+       
+       fields_map = [ fields_map ; "Status"         gettext("Status")         ];
+       
+       if atomsIsInstalled(name,version) then
+               fields_map = [ fields_map ; "InstallAutomaticaly" gettext("Automaticaly Installed")];
+               fields_map = [ fields_map ; "installPath"         gettext("Install Directory")];
+       end
+       
+       fields_map = [ fields_map ; "Description"    gettext("Description")    ];
+       
+       // Show it
+       // =========================================================================
+       
+       max_field_len = max( length(fields_map(:,2)) );
+       
+       for i=1:size(fields_map(:,1),"*")
+               
+               value = "";
+               
+               //
+               // Status
+               // 
+               
+               if fields_map(i,1)=="Status" then
+                       if atomsIsInstalled(name,version) then
+                               value = "Installed";
+                       else
+                               value = "Not installed";
+                       end
+               end
+               
+               //
+               // Automaticaly Installed ?
+               // 
+               
+               if fields_map(i,1)=="InstallAutomaticaly" then
+                       if atomsGetInstalledStatus(name,version) == "A" then
+                               value = "yes";
+                       else
+                               value = "no";
+                       end
+               end
+               
+               //
+               // Scilab Version
+               // 
+               
+               if fields_map(i,1)=="ScilabVersion" then
+                       if regexp( details(fields_map(i,1)) , "/^~/" , "o" )<>[] then
+                               value = "any";
+                       else
+                               value = details(fields_map(i,1));
+                       end
+               end
+               
+               //
+               // Dependences
+               // 
+               
+               if fields_map(i,1)=="Depends" then
+                       value = dep2str(details(fields_map(i,1)));
+               end
+               
+               //
+               // Other
+               //
+               
+               if isempty(value) then
+                       value = details(fields_map(i,1));
+               end
+               
+               for j=1:size(value,"*")
+                       
+                       if j==1 then
+                               mprintf("% "+string(max_field_len)+"s : %s\n",fields_map(i,2),value(j))
+                               
+                       else
+                               mprintf("% "+string(max_field_len)+"s   %s\n","",value(j))
+                       end
+               end
+       end
+       
+endfunction
+
+// =============================================================================
+// string = dep2str(string)
+//
+// Convert a technical dependence string (For ex. : ">= toolbox_1 1.3") to a
+// display dependence string  (For ex. : "toolbox_1 (>= 1.3)" )
+// 
+// =============================================================================
+
+function str = dep2str(dep)
+       
+       str = [];
+       
+       if isempty(dep) then
+               return;
+       end
+       
+       for i=1:size(dep,"*")
+               
+               this_dep = dep(i);
+               
+               // direction part
+               this_dep         = stripblanks(this_dep);
+               direction_length = regexp(this_dep,"/\s/","o");
+               direction        = stripblanks(part(this_dep,1:direction_length-1));
+               
+               // name part 
+               this_dep         = stripblanks(part(this_dep,direction_length+1:length(this_dep)));
+               name_length      = regexp(this_dep,"/\s/","o");
+               name             = part(this_dep,1:name_length-1);
+               
+               // version part
+               version          = stripblanks(part(this_dep,name_length:length(this_dep)));
+               
+               this_str         = name+" ";
+               
+               if direction == "~" then
+                       this_str = this_str + "(Any version)";
+               else
+                       this_str = this_str + "("+direction+" "+version+")";
+               end
+               
+               str = [ str ; this_str ];
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atomsUpdate.sci b/scilab/modules/atoms/macros/atomsUpdate.sci
new file mode 100644 (file)
index 0000000..4b9545f
--- /dev/null
@@ -0,0 +1,128 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+// update of a toolbox
+
+function result = atomsUpdate(name,allusers)
+       
+       result = [];
+       
+       // Save the initial path
+       // =========================================================================
+       initialpath = pwd();
+       
+       // Verbose Mode ?
+       // =========================================================================
+       if strcmpi(atomsGetConfig("Verbose"),"True") == 0 then
+               VERBOSE = %T;
+       else
+               VERBOSE = %F;
+       end
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs = argn(2);
+       
+       if rhs > 1 then
+               error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"atomsUpdate",0,1))
+       end
+       
+       if (rhs>0) & (type(name)<>10) then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsUpdate",1));
+       end
+       
+       name = stripblanks(name);
+       
+       // Install for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 1 then
+               // By default, install for all users (if we have write access of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsInstall",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsInstall",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Check if all specified toolboxes are effectively installed
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               if ~ atomsIsInstalled(name(i)) then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: ''%s'' isn''t installed.\n"),"atomsUpdate",name(i)));
+               end
+       end
+       
+       // Get scilab version (needed for later)
+       // =========================================================================
+       sciversion = strcat(string(getversion('scilab')) + ".");
+       
+       // List all installed packages (needed for later)
+       // =========================================================================
+       package_installed = atomsGetInstalled();
+       
+       // Update all the Toolboxes
+       // =========================================================================
+       
+       if rhs==0 | name == "all" | isempty(name) then
+               package_installed = atomsGetInstalled();
+               name              = package_installed(:,1);
+       end
+       
+       // Loop on name
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               this_package_versions = atomsGetInstalledVers(name(i),allusers);
+               this_package_MRV_ins  = this_package_versions(1);   // Most Recent Version Installed
+               this_package_MRV_ava  = atomsGetMRVersion(name(i)); // Most Recent Version Available
+               
+               if atomsVersionCompare(this_package_MRV_ins,this_package_MRV_ava) == 0 then
+                       // The installed version is already the Most Recent Version Available
+                       if VERBOSE then
+                               mprintf("\t%s (%s) : The most recent version is already installed\n",name(i),this_package_MRV_ins);
+                       end
+                       
+                       continue;
+               end
+               
+               // Remove old toolboxes
+               atomsRemove(name(i),allusers);
+               
+               // Install the new toolbox
+               this_result = atomsInstall(name(i)+" "+this_package_MRV_ava,allusers);
+               
+               // Fill the output argument
+               result = [ result ; this_result ];
+       end
+       
+       // Go to the initial location
+       // =========================================================================
+       chdir(initialpath);
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsAUWriteAccess.sci b/scilab/modules/atoms/macros/atoms_internals/atomsAUWriteAccess.sci
new file mode 100644 (file)
index 0000000..cc11d3a
--- /dev/null
@@ -0,0 +1,23 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Add an URL to the list of repositories, and returns
+
+function res = atomsAUWriteAccess()
+       
+       res = %F;
+       
+       try
+               mputl("dummy",pathconvert(SCI+"/contrib/dummy",%F));
+               mdelete(pathconvert(SCI+"/contrib/dummy",%F));
+               res = %T;
+       catch
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsAddAutoload.sci b/scilab/modules/atoms/macros/atoms_internals/atomsAddAutoload.sci
new file mode 100644 (file)
index 0000000..b83a4ba
--- /dev/null
@@ -0,0 +1,113 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Add toolboxes to the list of packages that are automaticaly loaded at Scilab start
+// This function has an impact on the following files :
+//  -> ATOMSDIR/autoloaded
+
+function nbAdd = atomsAddAutoload(name,version,allusers)
+       
+       rhs            = argn(2);
+       nbAdd          = 0;
+       autoloaded     = []; // Column vector that contain autoloaded packages
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 2 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsAddAutoload",2,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsAddAutoload",1));
+       end
+       
+       if type(version) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsAddAutoload",2));
+       end
+       
+       // name and version must have the same size
+       // =========================================================================
+       
+       if or( size(name) <> size(version) ) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsAddAutoload",1,2));
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 2 then
+               // By default, The toolbox is autoloaded for all users (if we have write access of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsAddAutoload",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsAddAutoload",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Define the path of the file that will record the change according to
+       // the "allusers" value
+       // =========================================================================
+       
+       if allusers then
+               atoms_directory = pathconvert(SCI+"/.atoms");
+       else
+               atoms_directory = pathconvert(SCIHOME+"/atoms");
+       end
+       
+       // Does the atoms_directory exist, if not create it
+       // =========================================================================
+       
+       if ~ isdir(atoms_directory) then
+               mkdir(atoms_directory);
+       end
+       
+       // Does the SCIHOME/atoms/autoloaded exist, if yes load it
+       // =========================================================================
+       
+       if fileinfo(atoms_directory+"autoloaded") <> [] then
+               autoloaded = mgetl(atoms_directory+"autoloaded");
+       end
+       
+       // Loop on each URL specified as input argument
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               // Add the package only if it doesn't already exist
+               
+               if find(autoloaded == name(i)+" - "+version(i)) == [] then
+                       nbAdd      = nbAdd + 1;
+                       autoloaded = [ autoloaded ; name(i)+" - "+version(i) ];
+               end
+               
+       end
+       
+       // Apply changes
+       // =========================================================================
+       
+       if nbAdd > 0 then
+               mputl(autoloaded,atoms_directory+"autoloaded");
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsCatTree.sci b/scilab/modules/atoms/macros/atoms_internals/atomsCatTree.sci
new file mode 100644 (file)
index 0000000..d33d92c
--- /dev/null
@@ -0,0 +1,57 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// internal function
+
+// =============================================================================
+// tree_out = atomsCatTree( tree_in_1 , tree_in_2 )
+//
+// Date : 19/05/2009
+// =============================================================================
+
+function tree_out = atomsCatTree( tree_in_1 , tree_in_2 )
+       
+       rhs = argn(2);
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs <> 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsMergeTree",1));
+       end
+       
+       // Check input arguments type
+       // =========================================================================
+       
+       if type(tree_in_1) <> 17 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: matrix oriented typed list expected.\n"),"atomsMergeTree",1));
+       end
+       
+       if type(tree_in_2) <> 17 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: matrix oriented typed list expected.\n"),"atomsMergeTree",2));
+       end
+       
+       // tree_in_1 is the master tree :
+       // =========================================================================
+       
+       tree_out  = tree_in_1;
+       
+       // Loop on tree_in_2 fields
+       // =========================================================================
+       
+       fields = getfield(1,tree_in_2);
+       fields(1:2) = [];
+       
+       for i=1:size(fields,"*")
+               if ~ isfield(tree_out,fields(i)) then
+                       tree_out(fields(i)) = tree_in_2(fields(i));
+               end
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsCheckConflict.sci b/scilab/modules/atoms/macros/atoms_internals/atomsCheckConflict.sci
new file mode 100644 (file)
index 0000000..9c2207b
--- /dev/null
@@ -0,0 +1,112 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Building of the dependencies list 
+
+function listeDep = atomsCheckConflict(name, version, checkVersionScilab)
+  global conflictLocal
+  global conflictingList
+  global nomconflictLocal
+  global conflictVersion
+  // If there is no version
+  if argn(2) == 1
+    version = ""
+  end
+  clearglobal conflictingList
+  listeDep = checkDependencies(name, version)
+  [n, m] = size(listeDep)
+  for i=1:n-1
+    // We compare name
+    [name1, version1] = atomsSeparateVersionDep(listeDep(i))
+    [name2, version2] = atomsSeparateVersionDep(listeDep(i+1))
+    if name1 == name2
+      // If there are 2 possible versions, there is necessary a dependencies <=
+      // If there is, this maximum version must match with the authers dep
+      // We install in local, and if the conflictLocal tag is 1, there is a version conflict, else is ok
+      v1 = atomsDecoupVersion(version1)
+      v2 = atomsDecoupVersion(version2)
+      if atomsCompareVersion(v1, v2) == 1 | atomsCompareVersion(v1, v2) == 0
+        atomsDlInstall(name1, version2)
+      else
+        atomsDlInstall(name1, version1)
+      end
+      clearglobal conflictLocal
+      clearglobal conflictingList
+      clearglobal nomconflictLocal
+      clearglobal conflictVersion
+      listeDep2 = checkDependencies(name, version)
+      if conflictLocal == 1
+        conflictVersion = 1
+        rep = atomsToolboxDirectory()
+        rmdir(rep + name1, "s")
+      end
+    end
+  end
+endfunction
+
+function listeDep = checkDependencies(name, version)
+  // To avoid redundancies and loops
+  global conflictingList
+  global conflictLocal
+  global nomconflictLocal
+  global conflictVersion
+  // If there is no version
+  if argn(2) == 1
+    version = ""
+  end
+  // Reading of the description file
+  desc = atomsReadDesc(name)
+  // Selection of the position toolbox in the disponible list toolboxes.
+  position = atomsSelectPosition(desc, name, version, checkVersionScilab)
+  // Case where the the toolbox is not present
+  if position == 0
+    atomsDisplayMessage(sprintf(_("Toolbox %s not found."),name))
+    listeDep = ""
+    return listeDep
+  elseif position == 0.1
+    conflictLocal = 1
+    nomconflictLocal = name
+    listeDep = ""
+    return listeDep
+  end
+  // If the toolbox with this version have been already found, it's useless to build again the dependencies tree
+  if find(conflictingList == (desc("Toolbox")(position) + " (" + desc("Version")(position) + ")"))
+    resume
+  end
+  listeDep = desc("Toolbox")(position) + " (" + desc("Version")(position) + ")"
+  [a, b] = size(conflictingList)
+  conflictingList(a+1) = desc("Toolbox")(position) + " (" + desc("Version")(position) + ")"
+  // Recuperation of the dependencies
+  depends = atomsExtractValue("Depends", desc, position)
+  // If there is no dependencies
+  if depends == " " | depends == ""
+       return listeDep
+  end
+  // If there is many dependencies, we split it in many string
+  depends = atomsSplitValue(depends, ',')
+  // Addition in the toolboxes list to install
+  [n, m] = size(depends)
+  for i=1:n
+       [nb, x] = size(listeDep)
+       // Separation of the version and the dependencies
+       [depend, version] = atomsSeparateVersionDep(depends(i))
+       // Research of dependencies
+       deps = checkDependencies(depend, version)
+       [o, p] = size(deps)
+       for i=1:o
+      listeDep(nb+i)=deps(i)
+    end        
+  end
+  listeDep = unique(listeDep)
+  return listeDep
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsCompareVersion.sci b/scilab/modules/atoms/macros/atoms_internals/atomsCompareVersion.sci
new file mode 100644 (file)
index 0000000..b7afbe6
--- /dev/null
@@ -0,0 +1,29 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Compare two versions ; returns 0 on equality, 1 if the first is greater
+// than the second, -1 else
+
+function result = atomsCompareVersion(v1, v2)
+  if strtod(v1(1)) > strtod(v2(1))
+    result = 1
+  elseif strtod(v1(1)) < strtod(v2(1))
+    result = -1
+  else
+    if size(v1, 1) >= 2 & size(v2, 1) >= 2
+      result = atomsCompareVersion(v1(2:$), v2(2:$))
+    else
+      result = sign(size(v1, 1) - size(v2, 1))
+    end
+  end
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsCompatibleVersions.sci b/scilab/modules/atoms/macros/atoms_internals/atomsCompatibleVersions.sci
new file mode 100644 (file)
index 0000000..f213cf2
--- /dev/null
@@ -0,0 +1,62 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Return the sorted list of the versions compatible with this version of Scilab
+
+function versions = atomsCompatibleVersions(name)
+       
+       // Initialize
+       versions = [];
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs  = argn(2);
+       
+       if rhs <> 1  then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsCompatibleVersions",1));
+       end
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"atomsCompatibleVersions",1));
+       end
+       
+       // Get all package description
+       // =========================================================================
+       allpackages = atomsGetTOOLBOXES();
+       
+       // Check if it's a Atoms package
+       // =========================================================================
+       if ~ isfield(allpackages,name) then
+               error(msprintf(gettext("%s: Wrong value for input argument #%d: Must be a atoms package name.\n"),"atomsCompatibleVersions",1));
+       end
+       
+       // Get versions
+       // =========================================================================
+       package_versions          = allpackages(name);
+       package_versions_tab      = getfield(1,package_versions);
+       package_versions_tab(1:2) = [];
+       
+       // Loop on package_versions_tab
+       // =========================================================================
+       
+       for i=1:size(package_versions_tab,"*")
+               this_version = package_versions(package_versions_tab(i));
+               if atomsIsCompatible(this_version("ScilabVersion")) then
+                       versions = [ versions ; package_versions_tab(i) ];
+               end
+       end
+       
+       // Sort the version matrix
+       // =========================================================================
+       versions = atomsVersionSort(versions,"DESC");
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsConstant.sci b/scilab/modules/atoms/macros/atoms_internals/atomsConstant.sci
new file mode 100644 (file)
index 0000000..fa713d7
--- /dev/null
@@ -0,0 +1,22 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Recup of the basics informations
+
+// Fields present in the DESCRIPTION file
+function [mandatory, optional] = atomsConstant()
+  // Compulsory field
+  mandatory = ["Toolbox","Version","Title","Author","Maintainer","Description","License","Category","ScilabVersion"]
+  // Optionnal field
+  optional = ["Date","Depends","ExternalDepends","URL","Entity"]
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsDecoupVersion.sci b/scilab/modules/atoms/macros/atoms_internals/atomsDecoupVersion.sci
new file mode 100644 (file)
index 0000000..0bce563
--- /dev/null
@@ -0,0 +1,21 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Division of the version in 2 or 3 numbers
+
+function version = atomsDecoupVersion(version)
+  index = strindex(version, ".")
+  version = strsplit(version,index)
+  version = strsubst(version, ".", "")
+  version = strsubst(version, " ", "")
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsDelAutoload.sci b/scilab/modules/atoms/macros/atoms_internals/atomsDelAutoload.sci
new file mode 100644 (file)
index 0000000..d92d751
--- /dev/null
@@ -0,0 +1,108 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Remove toolboxes to the list of packages that are automaticaly loaded at Scilab start
+// This function has an impact on the following files :
+//  -> ATOMSDIR/autoloaded
+
+// Internal function
+
+function nbDel = atomsDelAutoload(name,version,allusers)
+       
+       rhs   = argn(2);
+       nbDel = 0;
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 2 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsDelAutoload",2,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsDelAutoload",1));
+       end
+       
+       if type(version) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsDelAutoload",2));
+       end
+       
+       // name and version must have the same size
+       // =========================================================================
+       
+       if or( size(name) <> size(version) ) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsDelAutoload",1,2));
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 2 then
+               // By default, add the repository for all users (if we have write access
+               // of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsDelAutoload",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsDelAutoload",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Define the path of the files that will record the change according to
+       // the "allusers" value and the existence of the latter
+       // =========================================================================
+       
+       atoms_files = [];
+       
+       if fileinfo( pathconvert(SCIHOME+"/atoms/autoloaded",%F) )<> [] then
+               atoms_files = [ atoms_files ; pathconvert(SCIHOME+"/atoms/autoloaded",%F) ];
+       end
+       
+       if allusers & (fileinfo( pathconvert(SCI+"/.atoms/autoloaded",%F) )<>[]) then
+               atoms_files = [ atoms_files ; pathconvert(SCI+"/.atoms/autoloaded",%F) ];
+       end
+       
+       // Loop on each installed file specified as first input argument
+       // =========================================================================
+       
+       for i=1:size(atoms_files,"*")
+               
+               // Get the installed package list in this file
+               autoloaded = mgetl(atoms_files(i));
+               
+               // Loop on each package specified as first input argument
+               for j=1:size(name,"*")
+                       if find(autoloaded == name(j)+" - "+version(j)) <> [] then
+                               nbDel = nbDel + 1;
+                               autoloaded( find(autoloaded == name(j)+" - "+version(j)) ) = [];
+                       end
+               end
+               
+               if autoloaded == [] then
+                       mdelete(atoms_files(i));
+               else
+                       // Apply changes on this file
+                       mputl(autoloaded,atoms_files(i));
+               end
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsDependencyTree.sci b/scilab/modules/atoms/macros/atoms_internals/atomsDependencyTree.sci
new file mode 100644 (file)
index 0000000..47fd909
--- /dev/null
@@ -0,0 +1,195 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// internal function
+
+// Input arguments :
+
+//   name : . technical name of the package
+//          . single string
+//          . mandatory
+
+//   version : . version of the package
+//             . single string
+//             . optional
+
+//   tree_in : . Tree that will be concatenated in the output tree
+//             . struct
+//             . optional
+
+
+// Output arguments :
+
+//   tree_out : . Dependency tree of the package
+//              . struct
+//              . mandatory
+//              . Example :
+//                   tree_out  = 
+//                   toolbox_5 - 1.0: [1x1 struct]
+//                   toolbox_4 - 1.0: [1x1 struct]
+//                   toolbox_2 - 1.3: [1x1 struct]
+//                   toolbox_1 - 1.9: [1x1 struct]
+
+//   version_out : . version of the package
+//                 . single string
+//                 . optional
+
+function [tree_out,version_out] = atomsDependencyTree(name,version,tree_in)
+       
+       lhs = argn(1);
+       rhs = argn(2);
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if (rhs < 1) | (rhs > 3) then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsDependencyTree",1,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsDependencyTree",1));
+       end
+       
+       if (rhs>=2) & (type(version) <> 10) then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsDependencyTree",2));
+       end
+       
+       if (rhs==3) & (type(tree_in) <> 17) then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: matrix oriented typed list expected.\n"),"atomsDependencyTree",3));
+       end
+       
+       // Check input parameters dimensions
+       // =========================================================================
+       
+       if size(name) <> 1 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsDependencyTree",1));
+       end
+       
+       if (rhs>=2) & (size(name)<>1) then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsDependencyTree",1));
+       end
+       
+       // If version not define, version is the list of version compatible with
+       // the current version of Scilab
+       // =========================================================================
+       
+       if (rhs<2) | ((rhs>=2) & (version=="")) then
+               version = atomsCompatibleVersions(name);
+       end
+       
+       // Define tree_in if not defined as input argument
+       // =========================================================================
+       
+       if rhs<3 then
+               tree_in = struct();
+       end
+       
+       // Loop on versions
+       // =========================================================================
+       
+       for i=1:size(version,"*")
+               
+               // Get dependencies of this toolbox
+               // =========================================================================
+               this_package_details = atomsToolboxDetails(name,version(i));
+               
+               // Check if the wanted version is compatible with the current scilab version.
+               // =========================================================================
+               
+               this_package_details = atomsToolboxDetails(name,version(i));
+               
+               if ~ atomsIsCompatible(this_package_details("ScilabVersion")) then
+                       tree_out = %F;
+                       return tree_out;
+               end
+               
+               tree_out(name+" - "+version(i)) = this_package_details;
+               
+               if lhs>1 then
+                       version_out = version(i);
+               end
+               
+               // Now, loop on dependencies
+               // =========================================================================
+               
+               if isfield(this_package_details,"Depends") & (this_package_details("Depends") ~= "") then
+                       dependencies = this_package_details("Depends");
+               else
+                       dependencies = [];
+               end
+               
+               for i=1:size(dependencies,"*")
+                       
+                       this_dependency_success = %F;
+                       
+                       // Split dependencies to get 
+                       //  - direction ("=", ">=", "<=", "~")
+                       //  - dependence name
+                       //  - dependence version (optional)
+                       
+                       this_dependency_tab     = stripblanks(strsplit(dependencies(i),regexp(stripblanks(dependencies(i)),"/\s/")));
+                       
+                       this_dependency_dir     = this_dependency_tab(1);
+                       this_dependency_name    = this_dependency_tab(2);
+                       this_dependency_version = this_dependency_tab(3);
+                       
+                       // List versions of the dependency we can test
+                       
+                       if this_dependency_dir     == "="  then
+                               this_dependency_list = this_dependency_version;
+                       
+                       elseif this_dependency_dir == "~"  then
+                               this_dependency_list = atomsGetVersions(this_dependency_name);
+                       
+                       elseif this_dependency_dir == ">=" then
+                               this_dependency_list = atomsGetVersions(this_dependency_name,this_dependency_version);
+                               
+                       elseif this_dependency_dir == "<=" then
+                               this_dependency_list = atomsGetVersions(this_dependency_name,"",this_dependency_version);
+                               
+                       end
+                       
+                       for j=1:size(this_dependency_list,"*")
+                               
+                               tree = atomsDependencyTree(this_dependency_name,this_dependency_list(j),tree_out);
+                               
+                               // Dependency Tree fails
+                               
+                               if (type(tree) == 4) & (~ tree) then
+                                       continue;
+                               end
+                               
+                               // Dependency Tree OK
+                               
+                               if type(tree) == 17 then
+                                       tree_out = atomsCatTree(tree_out,tree);
+                                       this_dependency_success = %T;
+                                       break;
+                               end
+                               
+                       end
+                       
+                       if ~  this_dependency_success then
+                               tree_out = %F;
+                               break;
+                       end
+                       
+               end
+               
+               
+               if type(tree_out)==17 then
+                       return;
+               end
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsDisplayMessage.sci b/scilab/modules/atoms/macros/atoms_internals/atomsDisplayMessage.sci
new file mode 100644 (file)
index 0000000..d291680
--- /dev/null
@@ -0,0 +1,22 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+function atomsDisplayMessage(mess)
+       // If Scilab is running in GUI mode
+       if (getscilabmode() == "STD")
+               result = messagebox(mess,"Information","info")
+       else
+               // In the shell
+               disp(mess)
+       end
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsExtractValue.sci b/scilab/modules/atoms/macros/atoms_internals/atomsExtractValue.sci
new file mode 100644 (file)
index 0000000..b2ca24b
--- /dev/null
@@ -0,0 +1,18 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Recup a particular field of the description for the toolbox
+
+function fieldValue = atomsExtractValue(field, listdDesc, position)
+  fieldValue = listdDesc(field)(position)
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetAutoload.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetAutoload.sci
new file mode 100644 (file)
index 0000000..3e514cc
--- /dev/null
@@ -0,0 +1,77 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// End user function
+
+function packages = atomsGetAutoload(allusers)
+       
+       rhs      = argn(2);
+       packages = [];
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs > 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: at most %d expected.\n"),"atomsGetAutoload",1));
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 0 then
+               allusers = %T;
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsGetAutoload",1));
+               end
+       end
+       
+       // Define the differents path of the file where are autoloaded
+       // =========================================================================
+       
+       autoloaded_files = [];
+       user_file        = pathconvert(SCIHOME+"/atoms/autoloaded",%F);
+       alluser_file     = pathconvert(SCI+"/.atoms/autoloaded"   ,%F);
+       
+       if fileinfo(user_file)<>[] then
+               autoloaded_files = [ autoloaded_files ; user_file "user" ];
+       end
+       
+       if allusers & (fileinfo(alluser_file)<>[]) then
+               autoloaded_files = [ autoloaded_files ; alluser_file "allusers"];
+       end
+       
+       // Loop on each "autoloaded" file specified as first input argument
+       // =========================================================================
+       
+       for i=1:size(autoloaded_files(:,1),"*")
+               
+               // Get the autoloaded package list in this file
+               autoloaded = mgetl(autoloaded_files(i,1));
+               
+               // Loop on each URL specified as first input argument
+               for j=1:size(autoloaded,"*")
+                       current_name_length  = regexp(autoloaded(j),"/\s-\s/","o");
+                       current_name         = part(autoloaded(j),1:current_name_length-1);
+                       current_version      = part(autoloaded(j),current_name_length+3:length(autoloaded(j)));
+                       
+                       if autoloaded_files(i,2) == "user" then
+                               // user
+                               current_path  = pathconvert(SCIHOME+"/atoms/"+current_name+"/"+current_version,%F); 
+                       else
+                               // all users
+                               current_path = pathconvert(SCI+"/contrib/"+current_name+"/"+current_version,%F);
+                       end
+                       
+                       packages = [ packages ; current_name current_version autoloaded_files(i,2) current_path];
+               end
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetConfig.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetConfig.sci
new file mode 100644 (file)
index 0000000..cc75aa5
--- /dev/null
@@ -0,0 +1,90 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Get the configuration of the atoms system
+
+function result = atomsGetConfig(field)
+       
+       rhs = argn(2);
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs > 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetConfig",0,1));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if  (rhs>0) & (type(field) <> 10) then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsGetConfig",1));
+       end
+       
+       // Check input parameters dimensions
+       // =========================================================================
+       
+       if (rhs>0) & (size(field,"*") <> 1) then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsGetConfig",1));
+       end
+       
+       // Define the default value of the result according to the number of input
+       // arguments
+       // =========================================================================
+       
+       if rhs==0 then
+               result = struct();
+       else
+               result = "";
+       end
+       
+       // Define the path of the file that will record the change
+       // =========================================================================
+       
+       atoms_directory = pathconvert(SCIHOME+"/atoms");
+               
+       // Does the SCIHOME/atoms/config exist, if yes load it
+       // =========================================================================
+       
+       if fileinfo(atoms_directory+"config") <> [] then
+               config_lines = mgetl(atoms_directory+"config");
+       else
+               return;
+       end
+       
+       // Loop on each URL specified as input argument
+       // =========================================================================
+       
+       for i=1:size(config_lines,"*")
+               
+               if isempty( stripblanks( config_lines(i) ) ) then
+                       continue;
+               end
+               
+               if regexp(config_lines(i),"/^[a-zA-Z0-9]*\s=\s/","o") == 1 then
+                       
+                       // process field
+                       current_field_length  = regexp(config_lines(i),"/\s=\s/","o")
+                       current_field         = part(config_lines(i),1:current_field_length-1);
+                       current_value         = part(config_lines(i),current_field_length+3:length(config_lines(i)));
+                       
+                       if (rhs==1) & (current_field==field) then
+                               result = current_value;
+                               return;
+                       elseif( rhs==0 )
+                               result(current_field) = current_value;
+                       end
+                       
+               else
+                       error(msprintf(gettext("%s: The config file ("+atoms_directory+"config) is not well formated at line %d\n"),"atomsGetConfig",i));
+               end
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetDepChilds.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetDepChilds.sci
new file mode 100644 (file)
index 0000000..5b7e6e5
--- /dev/null
@@ -0,0 +1,117 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Returns true if a package is installed, false otherwise
+
+function packages = atomsGetDepChilds(name,version,allusers)
+       
+       rhs      = argn(2);
+       packages = [];
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 2 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetDepChilds",2,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetDepChilds",1));
+       end
+       
+       if type(version)<>10  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetDepChilds",2));
+       end
+       
+       // Check input parameters dimensions
+       // =========================================================================
+       
+       if size(name,"*") <> 1 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsGetDepChilds",1));
+       end
+       
+       if size(version,"*")<>1  then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsGetDepChilds",2));
+       end
+       
+       // All user management
+       // =========================================================================
+       
+       if rhs == 2 then
+               allusers = %T;
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsGetDepChilds",3));
+               end
+       end
+       
+       // Define the differents path of the file where are installed
+       // =========================================================================
+       
+       installed_deps_files = [];
+       user_file            = pathconvert(SCIHOME+"/atoms/installed_deps",%F);
+       alluser_file         = pathconvert(SCI+"/.atoms/installed_deps",%F);
+       
+       if fileinfo(user_file)<>[] then
+               installed_deps_files = [ installed_deps_files ; user_file "user" ];
+       end
+       
+       if allusers & (fileinfo(alluser_file)<>[]) then
+               installed_deps_files = [ installed_deps_files ; alluser_file "allusers"];
+       end
+       
+       // Loop on each "installed_deps" file specified as first input argument
+       // =========================================================================
+       
+       found = 0;
+       
+       for i=1:size(installed_deps_files(:,1),"*")
+               
+               if found == 1 then
+                       break;
+               end
+               
+               // Get the installed package list in this file
+               installed_deps_lines = mgetl(installed_deps_files(i,1));
+               
+               // Loop on each lines
+               for j=1:size(installed_deps_lines,"*")
+                       
+                       // If this line is a "parent toolbox" or a blank line and the wanted toolbox is already found
+                       // Break the loop
+                       
+                       if (found == 1) & ..
+                               ( (regexp(installed_deps_lines(j),"/^\[(.)*\]$/","o") <> []) | isempty(installed_deps_lines(j)) ) then
+                               break;
+                       end
+                       
+                       // Yeah, the wanted toolbox has been found
+                       
+                       if installed_deps_lines(j) == "["+name+" - "+version+"]" then
+                               found = 1;
+                               continue;
+                       end
+                       
+                       // This line is a inevitably a toolbox
+                       if found == 1 then
+                               this_line           = stripblanks(installed_deps_lines(j));
+                               current_name_length = regexp(this_line,"/\s-\s/","o");
+                               current_name        = part(this_line,1:current_name_length-1);
+                               current_version     = part(this_line,current_name_length+3:length(this_line));
+                               packages            = [ packages ; current_name current_version];
+                       end
+                       
+               end
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetDepParents.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetDepParents.sci
new file mode 100644 (file)
index 0000000..b710bfc
--- /dev/null
@@ -0,0 +1,109 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Renvoie la liste des packages dont celui passé en argument est une dépendance
+
+function packages = atomsGetDepParents(name,version,allusers)
+       
+       rhs      = argn(2);
+       packages = [];
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 2 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetDepParents",2,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetDepParents",1));
+       end
+       
+       if type(version)<>10  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetDepParents",2));
+       end
+       
+       // Check input parameters dimensions
+       // =========================================================================
+       
+       if size(name,"*") <> 1 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsGetDepParents",1));
+       end
+       
+       if size(version,"*")<>1  then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsGetDepParents",2));
+       end
+       
+       // All user management
+       // =========================================================================
+       
+       if rhs == 2 then
+               allusers = %T;
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsGetDepParents",3));
+               end
+       end
+       
+       // Define the differents path of the file where are installed
+       // =========================================================================
+       
+       installed_deps_files = [];
+       user_file            = pathconvert(SCIHOME+"/atoms/installed_deps",%F);
+       alluser_file         = pathconvert(SCI+"/.atoms/installed_deps",%F);
+       
+       if fileinfo(user_file)<>[] then
+               installed_deps_files = [ installed_deps_files ; user_file "user" ];
+       end
+       
+       if allusers & (fileinfo(alluser_file)<>[]) then
+               installed_deps_files = [ installed_deps_files ; alluser_file "allusers"];
+       end
+       
+       // Loop on each "installed_deps" file specified as first input argument
+       // =========================================================================
+       
+       for i=1:size(installed_deps_files(:,1),"*")
+               
+               // Get the installed package list in this file
+               installed_deps_lines = mgetl(installed_deps_files(i,1));
+               
+               // Loop on each lines
+               for j=1:size(installed_deps_lines,"*")
+                       
+                       if regexp(installed_deps_lines(j),"/^\[(.)*\]$/","o") <> [] then
+                               
+                               // Remove leading and trailing whitespaces.
+                               this_line = stripblanks(installed_deps_lines(j));
+                               
+                               // Remove leading and trailing [ ]
+                               this_line = part(this_line,2:length(this_line)-1);
+                               
+                               current_name_length = regexp(this_line,"/\s-\s/","o");
+                               current_name        = part(this_line,1:current_name_length-1);
+                               current_version     = part(this_line,current_name_length+3:length(this_line));
+                               current_parent      = [current_name current_version];
+                               
+                               continue;
+                       end
+                       
+                       if stripblanks(installed_deps_lines(j)) == name+" - "+version then
+                               if ~ isempty(current_parent) then
+                                       packages = [ packages ; current_parent ];
+                               end
+                       end
+               end
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledDetails.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledDetails.sci
new file mode 100644 (file)
index 0000000..c5872ae
--- /dev/null
@@ -0,0 +1,65 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Renvoie les détails sur l'installation d'un package.
+
+function res = atomsGetInstalledDetails(name,version)
+       
+       rhs = argn(2);
+       res = [];
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 2 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetInstalledStatus",2,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsGetInstalledStatus",1));
+       end
+       
+       if type(version)<>10  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsGetInstalledStatus",2));
+       end
+       
+       // Check input parameters dimensions
+       // =========================================================================
+       
+       if or( size(name,"*") <> size(version,"*"))  then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsGetInstalledStatus",1,2));
+       end
+       
+       // Get the list of installed packages
+       // =========================================================================
+       packages = atomsGetInstalled();
+       
+       // Loop on name
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               // Filter on names
+               packages_filtered = packages( find(packages(:,1) == name(i)) , : );
+               
+               // Filter on versions
+               packages_filtered = packages_filtered( find(packages_filtered(:,2) == version(i)) , : );
+               
+               if ~ isempty(packages_filtered) then
+                       res = [ res ; packages_filtered ];
+               else
+                       res = [ res ; "" "" "" "" "" ];
+               end
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledPath.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledPath.sci
new file mode 100644 (file)
index 0000000..03dfe71
--- /dev/null
@@ -0,0 +1,82 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Add an URL to the list of repositories, and returns
+
+function res = atomsGetInstalledPath(name,version,allusers)
+       
+       rhs           = argn(2);
+       res           = [];
+       installed     = []; // Column vector that contain user repositories
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 2 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetInstalledPath",1,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetInstalledPath",1));
+       end
+       
+       if type(version)<>10  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetInstalledPath",2));
+       end
+       
+       // name and version must have the same size
+       // =========================================================================
+       
+       if or(size(name)<>size(version)) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsGetInstalledPath",1,2));
+       end
+       
+       // allusers management
+       // =========================================================================
+       
+       if rhs < 3 then
+               allusers = %T;
+       end
+       
+       // Get the list of installed packages
+       // =========================================================================
+       packages = atomsGetInstalled(allusers);
+       
+       // Loop on name
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               // Filter on names
+               this_packages = packages( find(packages(:,1) == name(i))     ,:);
+               
+               if this_packages == [] then
+                       res(i) = "";
+                       continue;
+               end
+               
+               // Filter on versions
+               this_packages = this_packages( find(this_packages(:,2) == version(i)) ,:);
+               
+               if this_packages == [] then
+                       res(i) = "";
+                       continue;
+               end
+               
+               res(i) = this_packages(4);
+       end
+       
+       // Reshape the matrix
+       // =========================================================================
+       res = matrix(res,size(name) );
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledStatus.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledStatus.sci
new file mode 100644 (file)
index 0000000..f29ef44
--- /dev/null
@@ -0,0 +1,64 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Liste des versions installée de la toolbox "name"
+
+function res = atomsGetInstalledStatus(name,version)
+       
+       rhs = argn(2);
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 1 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetInstalledStatus",2,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsGetInstalledStatus",1));
+       end
+       
+       if type(version)<>10  then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsGetInstalledStatus",2));
+       end
+       
+       // Check input parameters dimensions
+       // =========================================================================
+       
+       if or( size(name,"*") <> size(version,"*"))  then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsGetInstalledStatus",1,2));
+       end
+       
+       // Get the list of installed packages
+       // =========================================================================
+       packages = atomsGetInstalled();
+       
+       // Loop on name
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               // Filter on names
+               packages_filtered = packages( find(packages(:,1) == name(i)) , : );
+               
+               // Filter on versions
+               packages_filtered = packages_filtered( find(packages_filtered(:,2) == version(i)) , 5 );
+               
+               if ~ isempty(packages_filtered) then
+                       res(i) = packages_filtered(1);
+               else
+                       res(i) = "";
+               end
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledVers.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledVers.sci
new file mode 100644 (file)
index 0000000..0a4a80e
--- /dev/null
@@ -0,0 +1,53 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Liste des versions installée de la toolbox "name"
+
+function res = atomsGetInstalledVers(name,allusers)
+       
+       rhs = argn(2);
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetInstalledVers",1,2));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A Single String expected.\n"),"atomsGetInstalledVers",1));
+       end
+       
+       if size(name,"*") <> 1 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A Single String expected.\n"),"atomsGetInstalledVers",1));
+       end
+       
+       // allusers management
+       // =========================================================================
+       
+       if rhs < 2 then
+               allusers = %T;
+       end
+       
+       // Get the list of installed packages
+       // =========================================================================
+       packages = atomsGetInstalled(allusers);
+       
+       // Filter on names
+       // =========================================================================
+       res = packages(find(packages(:,1) == name),2);
+       
+       // Descending Sort 
+       // =========================================================================
+       res = atomsVersionSort( res , "DESC" );
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetMRVersion.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetMRVersion.sci
new file mode 100644 (file)
index 0000000..221f7f2
--- /dev/null
@@ -0,0 +1,56 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Return the most recent version of each package specified as first input argument
+
+function versions = atomsGetMRVersion(packages)
+       
+       // Initialize
+       versions = [];
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs  = argn(2);
+       
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: at most %d expected.\n"),"atomsGetMRVersion",1));
+       end
+       
+       if type(packages) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetMRVersion",1));
+       end
+       
+       // Get all package description
+       // =========================================================================
+       
+       allpackages = atomsGetTOOLBOXES();
+       
+       // Loop on packages
+       // =========================================================================
+       
+       for i=1:size(packages,"*")
+               
+               versions(i) = "-1";
+               
+               if ~ isfield(allpackages,packages(i)) then
+                       continue;
+               end
+               
+               package_versions          = allpackages(packages(i));
+               package_versions_tab      = getfield(1,package_versions);
+               package_versions_tab(1:2) = [];
+               package_versions_tab      = atomsVersionSort( package_versions_tab , "DESC" );
+               versions(i)               = package_versions_tab(1);
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetTOOLBOXES.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetTOOLBOXES.sci
new file mode 100644 (file)
index 0000000..f8c7d5c
--- /dev/null
@@ -0,0 +1,137 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Return the full packages of the TOOLBOXES present in the differents repositories
+
+function packages = atomsGetTOOLBOXES(update)
+       
+       // Initialize
+       packages = struct();
+       
+       // Operating system detection + archi
+       // =========================================================================
+       
+       // Operating system
+       
+       if ~MSDOS then
+               OSNAME = unix_g('uname');
+               MACOSX = (strcmpi(OSNAME,"darwin") == 0);
+               LINUX  = (strcmpi(OSNAME,"linux") == 0);
+       else
+               MACOSX = %F;
+               LINUX  = %F;
+       end
+       
+       if MSDOS then
+               OSNAME = "windows";
+       elseif LINUX then
+               OSNAME = "linux";
+       elseif MACOSX then
+               OSNAME = "macosx";
+       end
+       
+       // Architecture
+       [dynamic_info,static_info] = getdebuginfo();
+       arch_info  = static_info(grep(static_info,"/^Compiler Architecture:/","r"))
+       
+       if ~isempty(arch_info) & (regexp(arch_info,"/\sX64$/","o") <> []) then
+               ARCH = "64";
+       else
+               ARCH = "32";
+       end
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs  = argn(2);
+       
+       if rhs > 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: at most %d expected.\n"),"atomsGetTOOLBOXES",1));
+       end
+       
+       if (rhs == 1) & (type(update) <> 4) then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsGetTOOLBOXES",1));
+       end
+       
+       // packages file path definition
+       // =========================================================================
+       
+       packages_path      = pathconvert(SCIHOME+"/.atoms/packages",%F);
+       packages_path_info = fileinfo(packages_path);
+       
+       // If necessary, loop on available mirrors and download TOOLBOXES files
+       // =========================================================================
+       
+       if (packages_path_info == []) ..
+               | (getdate("s") - packages_path_info(7) > 3600) ..
+               | (rhs == 1 & update) then
+               
+               nb_TOOLBOXES = 0;
+               TOOLBOXES    = []; // Liste des paths des fichiers TOOLBOXES
+               
+               mirrors = atomsRepositories();
+               mirrors = mirrors(:,1);
+               
+               if ~isdir(pathconvert(TMPDIR+"/atoms")) then
+                       mkdir(pathconvert(TMPDIR+"/atoms"));
+               end
+               
+               for i=1:size(mirrors,"*")
+                       
+                       url            = mirrors(i)+"/TOOLBOXES/"+ARCH+"/"+OSNAME;
+                       file_out       = pathconvert(TMPDIR+"/atoms/"+sprintf("TOOLBOXES_%d",nb_TOOLBOXES),%f);
+                       
+                       if( fileinfo(file_out) <> [] ) then
+                               mdelete(file_out);
+                       end
+                       
+                       if MSDOS then
+                               download_cmd = """" + pathconvert(SCI+"/tools/curl/curl.exe",%F)+""" -s "+url + " -o " + file_out;
+                       else
+                               download_cmd = "wget "+url + " -O " + file_out;
+                       end
+                       
+                       [rep,stat,err] = unix_g(download_cmd)
+                       if stat == 0 then
+                               // Download successfull
+                               nb_TOOLBOXES = nb_TOOLBOXES + 1;
+                               TOOLBOXES    = [ TOOLBOXES ; file_out ];
+                       else
+                               disp(download_cmd);
+                               disp(err);
+                       end
+               end
+               
+               if nb_TOOLBOXES == 0 then
+                       error(msprintf(gettext("%s: Internal Error : No TOOLBOXES file has successfully been downloaded.\n"),"atomsGetTOOLBOXES"));
+               end
+               
+               for i=1:size(TOOLBOXES,"*")
+                       packages = atomsReadTOOLBOXES( TOOLBOXES(i) , packages );
+                       mdelete(TOOLBOXES(i));
+               end
+               
+               // Save the "packages" variable in a file
+               
+               if ~isdir(pathconvert(SCIHOME+"/.atoms")) then
+                       mkdir(pathconvert(SCIHOME+"/.atoms"));
+               end
+               
+               save(packages_path,packages)
+               
+       else
+               
+               // Just load from file
+               load(packages_path,"packages");
+       
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsGetVersions.sci b/scilab/modules/atoms/macros/atoms_internals/atomsGetVersions.sci
new file mode 100644 (file)
index 0000000..bddec78
--- /dev/null
@@ -0,0 +1,75 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Return the sorted version list of the package entered as input argument
+
+function versions = atomsGetVersions(name,min_version,max_version)
+       
+       // Initialize
+       versions = [];
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs  = argn(2);
+       
+       if rhs < 1 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetVersions",1,3));
+       end
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"atomsGetVersions",1));
+       end
+       
+       if (rhs>1) & (type(min_version)<>10) then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"atomsGetVersions",2));
+       end
+       
+       if (rhs>2) & (type(max_version)<>10) then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"atomsGetVersions",3));
+       end
+       
+       // Default values
+       // =========================================================================
+       
+       if (rhs<2) | ( (rhs>=2) & (min_version=="") ) then
+               min_version = "0";
+       end
+       
+       if (rhs<3) | ( (rhs>=3) & (max_version=="") ) then
+               max_version = "9999999";
+       end
+       
+       // Get all package description
+       // =========================================================================
+       allpackages = atomsGetTOOLBOXES();
+       
+       // Check if it's a Atoms package
+       // =========================================================================
+       if ~ isfield(allpackages,name) then
+               error(msprintf(gettext("%s: Wrong value for input argument #%d: Must be a atoms package name.\n"),"atomsGetVersions",1));
+       end
+       
+       // Get versions
+       // =========================================================================
+       package_versions          = allpackages(name);
+       package_versions_tab      = getfield(1,package_versions);
+       package_versions_tab(1:2) = [];
+       
+       // Delete out of bounds versions
+       // =========================================================================
+       package_versions_tab(find((atomsVersionCompare(package_versions_tab,max_version) > 0)|(atomsVersionCompare(package_versions_tab,min_version) < 0))) = [];
+       
+       // Sort the version matrix
+       // =========================================================================
+       versions = atomsVersionSort(package_versions_tab,"DESC");
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsInstallList.sci b/scilab/modules/atoms/macros/atoms_internals/atomsInstallList.sci
new file mode 100644 (file)
index 0000000..c371d8e
--- /dev/null
@@ -0,0 +1,169 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Output arguments :
+
+//   insList  : . List  of the changes caused by the installation of one or
+//                more packages
+//              . matrix ( n x 4 ) 
+//              . mandatory
+//              . example :
+//                 !~  U  toolbox_4  1.0  !
+//                 !                      !
+//                 !~     toolbox_2  1.3  !
+//                 !                      !
+//                 !~     toolbox_1  1.9  !
+//                 !                      !
+//                 !~  U  toolbox_5  1.0  !
+
+//   tree_out : . Dependency tree of the package (returned by atomsDependencyTree)
+//              . struct
+//              . mandatory
+//              . Example :
+//                   tree_out  = 
+//                   toolbox_5 - 1.0: [1x1 struct]
+//                   toolbox_4 - 1.0: [1x1 struct]
+//                   toolbox_2 - 1.3: [1x1 struct]
+//                   toolbox_1 - 1.9: [1x1 struct]
+
+function [insList,depTree] = atomsInstallList(packages)
+       
+       insList = [];
+       depTree = struct();
+       
+       // Save the initial path
+       // =========================================================================
+       initialpath = pwd();
+       
+       // Get scilab version (needed for later)
+       // =========================================================================
+       sciversion = strcat(string(getversion("scilab")) + ".");
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs = argn(2);
+       
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"atomsInstallList",1))
+       end
+       
+       if type(packages) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstallList",1));
+       end
+       
+       packages = stripblanks(packages);
+       
+       // Loop on packages and to build the dependency tree
+       // =========================================================================
+       
+       for i=1:size(packages,"*")
+               
+               package = packages(i);
+               
+               if size(regexp(package,"/\s/") ,"*" ) > 1 then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: it must contain at most one space.\n"),"atomsInstallList",1));
+               end
+               
+               if size(regexp(package,"/\s/") ,"*" ) == 0 then
+                       // install the most recent version of the package
+                       package_names(i)    = package;
+                       package_versions(i) = "";
+               else
+                       // A version is specified
+                       space               = regexp(package,"/\s/");
+                       package_names(i)    = part(package,[1:space-1]);
+                       package_versions(i) = part(package,[space+1:length(package)]);
+               end
+               
+               // Ok, The syntax is correct, Now check if it's a valid package
+               if ~ atomsIsPackage(package_names(i),package_versions(i)) then
+                       if isempty(package_versions(i)) then
+                               package_full_name = package_names(i);
+                       else
+                               package_full_name = package_names(i)+" - "+package_versions(i);
+                       end
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: The package %s is not available.\n"),"atomsInstallList",package_full_name));
+               end
+               
+               // Build the depencency tree
+               [tree,version_out]  = atomsDependencyTree(package_names(i),package_versions(i));
+               
+               if (type(tree) == 4) & (~ tree) then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: The dependency tree cannot be resolved.\n"),"atomsInstallList",1));
+               end
+               
+               // Update the  package_versions(i) with the version returned by
+               // atomsDependencyTree
+               package_versions(i) = version_out;
+               
+               // Concatenate the tree with the existing one
+               depTree = atomsCatTree( depTree , tree );
+       end
+       
+       // Add a field to detect later if it's the toolbox is automaticaly installed
+       // or if it's a user choice
+       // =========================================================================
+       
+       for i=1:size(package_names,"*")
+               this_package_details                                = depTree(package_names(i)+" - "+package_versions(i));
+               this_package_details("user_choice")                 = %T;
+               depTree(package_names(i)+" - "+package_versions(i)) = this_package_details;
+       end
+       
+       // Now we have the list of package that have to be installed
+       // We have to check if
+       //  - each package is already installed
+       //  - If yes, Is it the most recent version
+       // =========================================================================
+       
+       mandatory_packages      = getfield(1,depTree);
+       mandatory_packages(1:2) = [];
+       
+       for i=1:size(mandatory_packages,"*")
+               this_package_details = depTree(mandatory_packages(i));
+               
+               this_package_name    = this_package_details("Toolbox");
+               this_package_version = this_package_details("Version");
+               
+               if isfield(this_package_details,"user_choice") & this_package_details("user_choice") then
+                       this_package_user_choice = "U"; // stand for User Choice
+               else
+                       this_package_user_choice = ""; // stand for User Choice
+               end
+               
+               to_install = %F; 
+               
+               if atomsIsInstalled(this_package_name) then
+                       vers = atomsGetInstalledVers(mandatory_packages(i));
+                       if find( vers == this_package_version ) == [] then
+                               to_install = %T;
+                       end
+               else
+                       to_install = %T;
+               end
+               
+               if to_install then
+                       insList = [ insList ; "+" this_package_user_choice this_package_name this_package_version ];
+               else
+                       insList = [ insList ; "~" this_package_user_choice this_package_name this_package_version ];
+               end
+               
+       end
+       
+       // Go to the initial location
+       // =========================================================================
+       chdir(initialpath);
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsInstallRegister.sci b/scilab/modules/atoms/macros/atoms_internals/atomsInstallRegister.sci
new file mode 100644 (file)
index 0000000..cf9cd7c
--- /dev/null
@@ -0,0 +1,173 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Add toolboxes to the list of installed packages
+// This function has an impact on the following files :
+//  -> ATOMSDIR/installed
+//  -> ATOMSDIR/installed_deps
+
+function nbAdd = atomsInstallRegister(name,version,status,allusers)
+       
+       rhs            = argn(2);
+       nbAdd          = 0;
+       installed      = []; // Column vector that contain installed packages
+       installed_deps = []; // Column vector that contain installed dependencies
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 3 | rhs > 4 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsInstallRegister",3,4));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstallRegister",1));
+       end
+       
+       if type(version) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstallRegister",2));
+       end
+       
+       if type(status) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstallRegister",3));
+       end
+       
+       // status is a letter
+       // =========================================================================
+       
+       if ~ and((status == "A") | (status == "I"))  then
+               error(msprintf(gettext("%s: Wrong value for input argument #%d: Letters ''A'' or ''I'' expected.\n"),"atomsInstallRegister",3));
+       end
+       
+       // name,version and status must have the same size
+       // =========================================================================
+       
+       if or( size(name) <> size(version) ) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsInstallRegister",1,2));
+       end
+       
+       if or( size(name) <> size(status) ) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsInstallRegister",1,3));
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 3 then
+               // By default, The toolbox is installed for all users (if we have write access of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsInstallRegister",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsInstallRegister",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Define the path of the file that will record the change according to
+       // the "allusers" value
+       // =========================================================================
+       
+       if allusers then
+               atoms_directory = pathconvert(SCI+"/.atoms");
+       else
+               atoms_directory = pathconvert(SCIHOME+"/atoms");
+       end
+       
+       // Does the atoms_directory exist, if not create it
+       // =========================================================================
+       
+       if ~ isdir(atoms_directory) then
+               mkdir(atoms_directory);
+       end
+       
+       // Does the SCIHOME/atoms/installed exist, if yes load it
+       // =========================================================================
+       
+       if fileinfo(atoms_directory+"installed") <> [] then
+               installed = mgetl(atoms_directory+"installed");
+       end
+       
+       // Does the SCIHOME/atoms/installed_deps exist, if yes load it
+       // =========================================================================
+       
+       if fileinfo(atoms_directory+"installed_deps") <> [] then
+               installed_deps = mgetl(atoms_directory+"installed_deps");
+       end
+       
+       // Loop on each URL specified as input argument
+       // =========================================================================
+       
+       for i=1:size(name,"*")
+               
+               // Add the URL only if it doesn't already exist
+               if grep( installed ,"/^[AI]\s-\s"+name(i)+"\s-\s"+version(i)+"$/","r") == [] then
+                       
+                       nbAdd = nbAdd + 1;
+                       
+                       // installed file
+                       // =================================================================
+                       installed = [ installed ; status(i)+" - "+name(i)+" - "+version(i) ];
+                       
+                       // installed_deps file
+                       // =================================================================
+                       
+                       // Parent package
+                       // --------------
+                       this_package_str = ["["+name(i)+" - "+version(i)+"]"];
+                       
+                       // Get the depencency tree & and child package
+                       // -------------------------------------------
+                       tree              = atomsDependencyTree(name(i),version(i));
+                       dep_packages      = getfield(1,tree);
+                       dep_packages(1:2) = [];
+                       dep_packages(find(dep_packages == name(i))) = [];
+                       
+                       // loop on childs
+                       // -------------------------------------------
+                       for j=1:size(dep_packages,"*")
+                               this_dep_package_details = tree(dep_packages(j));
+                               this_package_str = [this_package_str;"    "+this_dep_package_details("Toolbox")+" - "+this_dep_package_details("Version")];
+                       end
+                       
+                       // Finalize the current packages string
+                       // ------------------------------------
+                       this_package_str  = [this_package_str;""];
+                       
+                       // Cat the current packages deps with all others
+                       // ---------------------------------------------
+                       installed_deps    = [installed_deps;this_package_str];
+                       
+               end
+               
+       end
+       
+       // Apply changes
+       // =========================================================================
+       
+       if nbAdd > 0 then
+               
+               mputl(installed     , atoms_directory+"installed");
+               mputl(installed_deps, atoms_directory+"installed_deps");
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsInstallUnregister.sci b/scilab/modules/atoms/macros/atoms_internals/atomsInstallUnregister.sci
new file mode 100644 (file)
index 0000000..25b1c08
--- /dev/null
@@ -0,0 +1,168 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Delete an atoms package from the list of available package
+// This function has an impact on the following files :
+//  -> ATOMSDIR/installed
+//  -> ATOMSDIR/installed_deps
+
+function nbDel = atomsInstallUnregister(name,version,allusers)
+       
+       rhs                  = argn(2);
+       nbDel                = 0;
+       
+       // Check number of input arguments
+       // =========================================================================
+       
+       if rhs < 2 | rhs > 3 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsInstallUnregister",2,3));
+       end
+       
+       // Check input parameters type
+       // =========================================================================
+       
+       if type(name) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstallUnregister",1));
+       end
+       
+       if type(version) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstallUnregister",2));
+       end
+       
+       // name and version must have the same size
+       // =========================================================================
+       
+       if or( size(name) <> size(version) ) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsInstallUnregister",1,2));
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 2 then
+               // By default, add the repository for all users (if we have write access
+               // of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsInstallUnregister",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsInstallUnregister",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Define the path of the files that will record the change according to
+       // the "allusers" value and the existence of the latter
+       // =========================================================================
+       
+       // installed files
+       
+       atoms_files = [];
+       
+       if fileinfo( pathconvert(SCIHOME+"/atoms/installed",%F) )<> [] then
+               atoms_files = [ atoms_files ; pathconvert(SCIHOME+"/atoms/installed",%F) ];
+       end
+       
+       if allusers & (fileinfo( pathconvert(SCI+"/.atoms/installed",%F) )<>[]) then
+               atoms_files = [ atoms_files ; pathconvert(SCI+"/.atoms/installed",%F) ];
+       end
+       
+       // installed_deps files
+       
+       atoms_files_deps = [];
+       
+       if fileinfo( pathconvert(SCIHOME+"/atoms/installed_deps",%F) )<> [] then
+               atoms_files_deps = [ atoms_files_deps ; pathconvert(SCIHOME+"/atoms/installed_deps",%F) ];
+       end
+       
+       if allusers & (fileinfo( pathconvert(SCI+"/.atoms/installed_deps",%F) )<>[]) then
+               atoms_files_deps = [ atoms_files_deps ; pathconvert(SCI+"/.atoms/installed_deps",%F) ];
+       end
+       
+       // Loop on each installed file specified as first input argument
+       // =========================================================================
+       
+       for i=1:size(atoms_files,"*")
+               
+               // Get the installed package list in this file
+               installed = mgetl(atoms_files(i));
+               
+               // Loop on each URL specified as first input argument
+               for j=1:size(name,"*")
+                       indice = grep(installed,"/^[AI]\s-\s"+name(j)+"\s-\s"+version(j)+"$/","r");
+                       
+                       if indice <> [] then
+                               nbDel = nbDel + 1;
+                               installed(indice) = [];
+                       end
+               end
+               
+               if installed == [] then
+                       mdelete(atoms_files(i));
+               else
+                       // Apply changes on this file
+                       mputl(installed,atoms_files(i));
+               end
+       end
+       
+       // Loop on each installed file specified as first input argument
+       // =========================================================================
+       
+       for i=1:size(atoms_files_deps,"*")
+               
+               found = 0;
+               
+               // Get the installed package list in this file
+               installed_deps_in  = mgetl(atoms_files_deps(i));
+               installed_deps_out = [];
+               
+               // Loop on each URL specified as first input argument
+               for j=1:size(name,"*")
+                       
+                       // Loop on each lines of the installed_deps file
+                       for k=1:size(installed_deps_in,"*")
+                               
+                               if installed_deps_in(k) == "["+name(j)+" - "+version(j)+"]" then
+                                       found = 1;
+                                       continue;
+                               end
+                               
+                               if regexp(installed_deps_in(k),"/^\[(.)*\]$/","o") <> [] then
+                                       found = 0;
+                               end
+                               
+                               if found == 1 then
+                                       continue;
+                               end
+                               
+                               if found == 0 then
+                                       installed_deps_out = [ installed_deps_out , installed_deps_in(k) ];
+                               end
+                       end
+                       
+               end
+               
+               if installed_deps_out == [] then
+                       mdelete(atoms_files_deps(i));
+               else
+                       // Apply changes on this file
+                       mputl(installed_deps_out,atoms_files_deps(i));
+               end
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsIsCompatible.sci b/scilab/modules/atoms/macros/atoms_internals/atomsIsCompatible.sci
new file mode 100644 (file)
index 0000000..20c3c7a
--- /dev/null
@@ -0,0 +1,102 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Returns True if the version string is compatible with the current scilab version
+// else, returns false
+
+function result = atomsIsCompatible(version_str)
+       
+       rhs = argn(0);
+       
+       // Check number of input arguments
+       // =========================================================================
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsIsCompatible",1));
+       end
+       
+       // Check input parameter type
+       // =========================================================================
+       if type(version_str) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A Single String expected.\n"),"atomsIsCompatible",1));
+       end
+       
+       // Check input parameter dimension
+       // =========================================================================
+       
+       if size(version_str,"*") <> 1 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: A Single String expected.\n"),"atomsIsCompatible",1));
+       end
+       
+       // If version_str == 'any', no need to continue
+       // =========================================================================
+       
+       if version_str == "any" then
+               result = %T;
+               return;
+       end
+       
+       // Check input parameters value
+       // =========================================================================
+       
+       if regexp(version_str,"/^(>=|<=|=|==|~)\s/","o") == [] then
+               error(msprintf(gettext("%s: Wrong value for input argument #%d: This is not a valid version/dependency.\n"),"atomsIsCompatible",1));
+       end
+       
+       // Get scilab version (Only the first digit)
+       // =========================================================================
+       sciversion = strcat(string(getversion("scilab")) + ".");
+       sciversion = strsubst(sciversion,"/\.$/","","r");
+       
+       // Get the dependency operator and version
+       // =========================================================================
+       operator_length  = regexp(version_str,"/\s/","o");
+       dep_operator     = part(version_str,1:operator_length-1);
+       if dep_operator == "~" then
+               result = %T;
+               return;
+       end
+       dep_version      = stripblanks(part(version_str,operator_length+1:length(version_str)));
+       
+       // Compare sciversion and the specified version
+       // =========================================================================
+       comparison       = atomsVersionCompare(dep_version,sciversion);
+       
+       // Verdict
+       // =========================================================================
+       
+       if (dep_operator == "==" | dep_operator == "=")  & comparison<>0 then
+               result = %F;
+               return;
+       end
+       
+       if (dep_operator == ">=") & comparison>0 then
+               result = %F;
+               return;
+       end
+       
+       if (dep_operator == "<=") & comparison<0 then
+               result = %F;
+               return;
+       end
+       
+       if (dep_operator == ">") & comparison>=0 then
+               result = %F;
+               return;
+       end
+       
+       if (dep_operator == "<") & comparison<=0 then
+               result = %F;
+               return;
+       end
+       
+       result = %T;
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsIsPackage.sci b/scilab/modules/atoms/macros/atoms_internals/atomsIsPackage.sci
new file mode 100644 (file)
index 0000000..42b4d95
--- /dev/null
@@ -0,0 +1,71 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Return true if the package is a valid package or not
+
+function result = atomsIsPackage(package_names,package_versions)
+       
+       // Initialize
+       // =========================================================================
+       result = [];
+       
+       // Check input parameters
+       // =========================================================================
+       rhs  = argn(2);
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsIsPackage",1,2));
+       end
+       
+       if type(package_names) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsIsPackage",1));
+       end
+       
+       if (rhs == 2) & type(package_versions) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsIsPackage",1));
+       end
+       
+       if (rhs == 2) & or( size(package_names) <> size(package_versions) ) then
+               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsIsPackage",1,2));
+       end
+       
+       // Get all package description
+       // =========================================================================
+       allpackages = atomsGetTOOLBOXES();
+       
+       // Loop on packages
+       // =========================================================================
+       
+       for i=1:size(package_names,"*")
+               
+               result(i) = %F;
+               
+               if rhs == 1 then
+                       version = "";
+               else
+                       version = package_versions(i);
+               end
+               
+               // 1st case : just test the name, not the version
+               if isempty(version) & isfield(allpackages,package_names(i)) then
+                       result(i) = %T;
+               
+               // 2nd case : Check a specific version
+               elseif isfield(allpackages,package_names(i)) then
+                       this_package = allpackages(package_names(i));
+                       if isfield(this_package,version) then
+                               result(i) = %T;
+                       end
+               end
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsListDescription.sci b/scilab/modules/atoms/macros/atoms_internals/atomsListDescription.sci
new file mode 100644 (file)
index 0000000..357519f
--- /dev/null
@@ -0,0 +1,26 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Creation of a list packaging the informations of the DESCRIPTION file
+
+function listDesc = atomsListDescription()
+  [listeObl, listeOpt] = atomsConstant()
+  [n, m] = size(listeObl)
+  for i=1:m
+    listDesc(listeObl(i))= []
+  end
+  [n, o] = size(listeOpt)
+  for i=1:o
+    listDesc(listeOpt(i))= []
+  end
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsNormalizeName.sci b/scilab/modules/atoms/macros/atoms_internals/atomsNormalizeName.sci
new file mode 100644 (file)
index 0000000..8a8de9a
--- /dev/null
@@ -0,0 +1,30 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Substitution of special characters in the toolbox's name
+
+function str = atomsNormalizeName(str)
+    str = strsubst(str, " ", "_")
+    str = strsubst(str, "é", "e")
+    str = strsubst(str, "è", "e")
+    str = strsubst(str, "ê", "e")
+    str = strsubst(str, "à", "a")
+    str = strsubst(str, "â", "a")
+    str = strsubst(str, "ù", "u")
+    str = strsubst(str, "ô", "o")
+    str = strsubst(str, "î", "i")
+    str = strsubst(str, "ç", "c")
+    str = strsubst(str, "/", "")
+    str = strsubst(str, "\", "")
+    return str
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsReadDesc.sci b/scilab/modules/atoms/macros/atoms_internals/atomsReadDesc.sci
new file mode 100644 (file)
index 0000000..04a7ae4
--- /dev/null
@@ -0,0 +1,74 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Parsing of the DESCRIPTION file
+
+// =============================================================================
+// description_out = atomsReadDesc(file_in,description_in)
+// Parse a DESCRIPTION file
+// 
+// Date : 20/03/2009
+// =============================================================================
+
+function description_out = atomsReadDesc(file_in,description_in)
+       
+       description_out = struct();
+       
+       rhs  = argn(2);
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsReadDesc",1,2));
+       end
+       
+       if regexp( file_in,"/DESCRIPTION$/") == [] then
+               error(msprintf(gettext("%s: Wrong value for input argument #%d: A string that end with DESCRIPTION expected.\n"),"atomsReadDesc",1));
+       end
+       
+       if rhs==2 & type(description_in)<>17 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: mlist expected.\n"),"atomsReadDesc",2));
+       end
+       
+       if rhs==2 then
+               description_out = description_in;
+       end
+       
+       tabDesc         = mgetl(file_in);
+       current_field   = "";
+       
+       for i=1:size(tabDesc,"*")
+               
+               // First case : new field
+               if regexp(tabDesc(i),"/^[a-zA-Z0-9]*:\s/","o") == 1 then
+                       current_field_length    = regexp(tabDesc(i),"/:\s/","o")
+                       current_field           = part(tabDesc(i),1:current_field_length-1);
+                       current_value           = part(tabDesc(i),current_field_length+2:length(tabDesc(i)));
+                       description_out(current_field) = current_value;
+                       continue;
+               end
+               
+               // Second case : Current field continuation
+               if regexp(tabDesc(i),"/^\s/","o") == 1 then
+                       current_value = part(tabDesc(i),2:length(tabDesc(i)));
+                       description_out(current_field) = [ description_out(current_field) ; current_value ];
+                       continue;
+               end
+               
+               // Third case : Blank line
+               if length(tabDesc(i)) == 0 then
+                       continue;
+               end
+               
+               // Else Error
+               error(msprintf(gettext("%s: The description is not well formated at line %d\n"),"atomsReadDesc",i));
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsReadDescFunctions.sci b/scilab/modules/atoms/macros/atoms_internals/atomsReadDescFunctions.sci
new file mode 100644 (file)
index 0000000..8b1847c
--- /dev/null
@@ -0,0 +1,98 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Parsing of the Description-Function file
+
+function descriptionFunctions = atomsReadDescFunctions(name)
+       
+       rhs  = argn(2);
+       
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsReadDescFunctions",1));
+       end
+       
+       DESCRIPTIONFUNCTIONS  = "";
+       
+       // First case, name = absolute/relative path of the DESCRIPTION-FUNCTIONS file
+       if regexp(name,"/\/DESCRIPTION-FUNCTIONS$/") <> [] then
+               if fileinfo(name) <> [] then
+                       DESCRIPTIONFUNCTIONS = pathconvert(name,%f);
+               else
+                       error(msprintf(gettext("%s: The description file you''ve enterer as input argument (%s) doesn''t exist.\n"),"atomsReadDescFunctions",name));
+               end
+       
+       // Second Case, name = absolute/relative path of the toolbox 
+       elseif isdir(name) then
+               check_file = pathconvert(name)+"DESCRIPTION-FUNCTIONS";
+               if fileinfo(check_file) <> [] then
+                       DESCRIPTIONFUNCTIONS = check_file;
+               end
+               
+       // third case, name = Just the name of the toobox, we have to search in the 
+       // atoms standard directory
+       else
+               atoms_directories = atomsToolboxDirectory();
+               
+               for k=1:size(atoms_directories,"*")
+                       check_file      = pathconvert(atoms_directories(k)+"/"+name)+"DESCRIPTION-FUNCTIONS";
+                       if fileinfo(check_file) <> [] then
+                               DESCRIPTIONFUNCTIONS = check_file;
+                               break;
+                       end
+               end
+               
+       end
+       
+       descriptionFunctions = dfTohash(DESCRIPTIONFUNCTIONS);
+       
+endfunction
+
+// =============================================================================
+// description_out = dfTohash(file_in,description_in)
+// Easy filling of the hash table (DESCRIPTION-FUNCTIONS file)
+// 
+// Date : 20/03/2009
+// =============================================================================
+
+function description_out = dfTohash(file_in)
+       
+       tabDesc         = mgetl(file_in);
+       current_field   = "";
+       
+       for i=1:size(tabDesc,"*")
+               
+               // First case : new field
+               if regexp(tabDesc(i),"/^[a-zA-Z0-9_]*\s-\s/","o") == 1 then
+                       current_field_length    = regexp(tabDesc(i),"/\s-\s/","o")
+                       current_field           = part(tabDesc(i),1:current_field_length-1);
+                       current_value           = part(tabDesc(i),current_field_length+3:length(tabDesc(i)));
+                       description_out(current_field) = current_value;
+                       continue;
+               end
+               
+               // Second case : Current field continuation
+               if regexp(tabDesc(i),"/^\s/","o") == 1 then
+                       current_value = part(tabDesc(i),2:length(tabDesc(i)));
+                       description_out(current_field) = [ description_out(current_field) ; current_value ];
+                       continue;
+               end
+               
+               // Third case : Blank line
+               if length(tabDesc(i)) == 0 then
+                       continue;
+               end
+               
+               // Else Error
+               error(msprintf(gettext("%s: The DESCRIPTION-FUNCTIONS file is not well formated at line %d\n"),"atomsReadDescFunctions",i));
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsReadFile.sci b/scilab/modules/atoms/macros/atoms_internals/atomsReadFile.sci
new file mode 100644 (file)
index 0000000..aa3bda8
--- /dev/null
@@ -0,0 +1,22 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Reading function file line to line
+
+function tab = atomsReadFile(nom)
+  // We verify the presence of the file before
+  // We must verify we have the read acces
+  fd = mopen(nom,"r")
+  [n, tab] = mfscanf(-1, fd, '%80[^\n]\n')
+  mclose(fd)
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsReadTOOLBOXES.sci b/scilab/modules/atoms/macros/atoms_internals/atomsReadTOOLBOXES.sci
new file mode 100644 (file)
index 0000000..de93225
--- /dev/null
@@ -0,0 +1,103 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Return the full description of the TOOLBOXES present in the differents repositories
+
+function description_out = atomsReadTOOLBOXES(file_in,description_in)
+       
+       description_out = struct();
+       
+       rhs  = argn(2);
+       
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsReadTOOLBOXES",1,2));
+       end
+       
+       if regexp( file_in,"/TOOLBOXES/") == [] then
+               error(msprintf(gettext("%s: Wrong value for input argument #%d: A string that contain TOOLBOXES expected.\n"),"atomsReadTOOLBOXES",1));
+       end
+       
+       if rhs==2 & type(description_in)<>17 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: mlist expected.\n"),"atomsReadTOOLBOXES",2));
+       end
+       
+       if rhs==2 then
+               description_out = description_in;
+       end
+       
+       TOOLBOXES        = mgetl(file_in);
+       
+       current_toolbox  = struct();
+       current_field    = "";
+       
+       for i=1:size(TOOLBOXES,"*")
+               
+               // First case : new field
+               if regexp(TOOLBOXES(i),"/^[a-zA-Z0-9]*:\s/","o") == 1 then
+                       
+                       // Start new version of toolbox
+                       if regexp(TOOLBOXES(i),"/^Toolbox:\s/","o") == 1 then
+                               
+                               if and(isfield(current_toolbox,["Toolbox";"Version"])) then
+                                       
+                                       if  ~ isfield(description_out,current_toolbox("Toolbox")) then
+                                               // Il s'agit de la première version de la toolbox trouvée
+                                               this_toolbox = struct();
+                                       else
+                                               // On récupère la liste des versions de cette toolbox
+                                               this_toolbox = description_out(current_toolbox("Toolbox"));
+                                       end
+                                       
+                                       this_toolbox(current_toolbox("Version")) = current_toolbox;
+                                       description_out(current_toolbox("Toolbox")) = this_toolbox;
+                               end
+                               
+                               // Reset the current_toolbox struct
+                               current_toolbox  = struct();
+                       end
+                       
+                       // process field
+                       current_field_length           = regexp(TOOLBOXES(i),"/:\s/","o")
+                       current_field                  = part(TOOLBOXES(i),1:current_field_length-1);
+                       current_value                  = part(TOOLBOXES(i),current_field_length+2:length(TOOLBOXES(i)));
+                       current_toolbox(current_field) = current_value;
+                       continue;
+               end
+               
+               // Second case : Current field continuation
+               if regexp(TOOLBOXES(i),"/^\s/","o") == 1 then
+                       current_value = part(TOOLBOXES(i),2:length(TOOLBOXES(i)));
+                       current_toolbox(current_field) = [ current_toolbox(current_field) ; current_value ];
+                       continue;
+               end
+               
+               // Last line of the file : register the latest toolbox
+               if i == size(TOOLBOXES,"*") then
+                       this_toolbox(current_toolbox("Version")) = current_toolbox;
+                       description_out(current_toolbox("Toolbox")) = this_toolbox;
+               end
+               
+               // Third case : Blank line
+               if length(TOOLBOXES(i)) == 0 then
+                       continue;
+               end
+               
+               // Fourth case : Delimiter
+               if regexp(TOOLBOXES(i),"/^\/\//","o") == 1 then
+                       continue;
+               end
+                               
+               // Else Error
+               error(msprintf(gettext("%s: The TOOLBOXES file ("+file_in+") is not well formated at line %d\n"),"atomsReadTOOLBOXES",i));
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsRegisterToolbox.sci b/scilab/modules/atoms/macros/atoms_internals/atomsRegisterToolbox.sci
new file mode 100644 (file)
index 0000000..b6a7a3c
--- /dev/null
@@ -0,0 +1,28 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Add a toolbox to the list of registered toolboxes
+
+function atomsRegisterToolbox(name,path)
+       
+       if fileinfo(TMPDIR+"/loaded_toolboxes") <> [] then
+               load(TMPDIR+"/loaded_toolboxes","loaded_toolboxes");
+       else
+               loaded_toolboxes = [];
+       end
+       
+       loaded_toolboxes = [ loaded_toolboxes ; name path ];
+
+       save(TMPDIR+"/loaded_toolboxes",loaded_toolboxes);
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsRemoveList.sci b/scilab/modules/atoms/macros/atoms_internals/atomsRemoveList.sci
new file mode 100644 (file)
index 0000000..f955bc2
--- /dev/null
@@ -0,0 +1,237 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Return a matrix that list the changes caused by the uninstallation of one or
+// more packages
+
+// -->A = atomsRemoveList('toolbox_2',%F)
+//  A  =
+//  
+// !-  U  toolbox_2  1.5  !
+// !                      !
+// !-  U  toolbox_2  1.3  !
+// !                      !
+// !-  B  toolbox_3  1.6  !
+// !                      !
+// !-  B  toolbox_5  1.0  !
+// !                      !
+// !-  B  toolbox_4  1.0  !
+
+// -  : The package will be removed
+// ~  : The package will be keeped
+
+// U  : The package is intentionnaly removed
+// P  : The package is a parent of one package
+// C  : The package is a child of one package
+// B  : The package will be broken (It's a parent but cannot be uninstall)
+
+function remList = atomsRemoveList(packages,allusers)
+       
+       remList = [];
+       
+       // Save the initial path
+       // =========================================================================
+       initialpath = pwd();
+       
+       // Check input parameters
+       // =========================================================================
+       
+       rhs = argn(2);
+       
+       if rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"atomsRemoveList",1,2))
+       end
+       
+       if type(packages) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsRemoveList",1));
+       end
+       
+       // Apply changes for all users or just for me ?
+       // =========================================================================
+       
+       if rhs == 1 then
+               // By default, uninstall the package (if we have write access
+               // of course !)
+               if atomsAUWriteAccess() then
+                       allusers = %T; 
+               else
+                       allusers = %F;
+               end
+       
+       else
+               // Just check if it's a boolean
+               if type(allusers) <> 4 then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean expected.\n"),"atomsRemoveList",2));
+               end
+               
+               // Check if we have the write access
+               if allusers & ~ atomsAUWriteAccess() then
+                       chdir(initialpath);
+                       error(msprintf(gettext("%s: You haven''t write access on this directory : %s.\n"),"atomsRemoveList",2,pathconvert(SCI+"/.atoms")));
+               end
+       end
+       
+       // Loop on packages and to build the list of package to uninstall
+       // =========================================================================
+       
+       packages = stripblanks(packages);
+       
+       // First step : List the packages wanted by the user
+       
+       for i=1:size(packages,"*")
+               
+               package = packages(i);
+               
+               if size(regexp(package,"/\s/") ,"*" ) > 1 then
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: it must contain at most one space.\n"),"atomsInstall",1));
+               end
+               
+               if size(regexp(package,"/\s/") ,"*" ) == 0 then
+                       // Just the toolbox name is specified
+                       package_names(i)    = package;
+                       package_versions(i) = "";
+               else
+                       // A version is specified
+                       space               = regexp(package,"/\s/");
+                       package_names(i)    = part(package,[1:space-1]);
+                       package_versions(i) = part(package,[space+1:length(package)]);
+               end
+               
+               // Ok, The syntax is correct, Now check if the package is really installed
+               if ~ atomsIsInstalled(package_names(i),package_versions(i)) then
+                       continue;
+               end
+               
+               // get the list of the versions of this package to uninstall
+               
+               if isempty(package_versions(i)) then
+                       // uninstall all version of this toolbox
+                       this_package_versions = atomsGetInstalledVers(package_names(i));
+               else
+                       // Just uninstall the specified version
+                       this_package_versions = package_versions(i);
+               end
+               
+               for j=1:size(this_package_versions,"*")
+                       remList = [ remList ; "-" "U" package_names(i) this_package_versions(j) ];
+               end
+               
+       end
+       
+       // Second Step : List the packages that depends of the uninstalled packages
+       // =========================================================================
+       
+       packages = remList;
+       for i=1:size(packages(:,1),"*")
+               
+               this_package_name    = packages(i,3);
+               this_package_version = packages(i,4);
+               
+               // Get the parents of this toolbox
+               // (inevitably removed, unless we have not the right)
+               // ----------------------------------------------------
+               
+               this_package_parents = atomsGetDepParents(this_package_name,this_package_version);
+               
+               for j=1:size(this_package_parents(:,1),"*")
+                       
+                       this_parent_name    = this_package_parents(j,1);
+                       this_parent_version = this_package_parents(j,2);
+                       
+                       // Check if we have the right to remove this package
+                       // If not, tag it as Broken (for later)
+                       if ~allusers then
+                               details = atomsGetInstalledDetails(this_parent_name,this_parent_version);
+                               if details(3) == "allusers" then
+                                       remList = [ remList ; "~" "B" this_parent_name this_parent_version ]; // B stands for "Broken"
+                                       continue
+                               end
+                       end
+                       
+                       // Add this parent to the list
+                       if find(remList(:,3)+" - "+remList(:,4) == this_parent_name+" - "+this_parent_version) == [] then
+                               remList = [ remList ; "-" "P" this_parent_name this_parent_version ];  // P stands for "Parent"
+                       end
+                       
+               end
+               
+               // Get the childs of this toolbox
+               // ----------------------------------------------
+               
+               this_package_childs = atomsGetDepChilds(this_package_name,this_package_version);
+               
+               for j=1:size(this_package_childs(:,1),"*")
+                       
+                       this_child_name    = this_package_childs(j,1);
+                       this_child_version = this_package_childs(j,2);
+                       
+                       // Check if we have the right to remove this package
+                       // If not, Do not add it to the list
+                       if ~allusers then
+                               details = atomsGetInstalledDetails(this_child_name,this_child_version);
+                               if details(3) == "allusers" then
+                                       continue
+                               end
+                       end
+                       
+                       if find(remList(:,3)+" - "+remList(:,4) == this_child_name+" - "+this_child_version) == [] then
+                               remList = [ remList ; "-" "C" this_child_name this_child_version ]; // C stands for "Child" 
+                       end
+                       
+               end
+               
+       end
+       
+       // Third Step : Loop on childs check if we uninstall it or not
+       // =========================================================================
+       
+       packages = remList(find(remList(:,2)=="C"),:);
+       
+       for i=1:size(remList(:,1),"*")
+               
+               // This is not a Child package :
+               // => continue
+               // ----------------------------------------------
+               
+               if remList(i,2) <> "C" then
+                       continue;
+               end
+               
+               this_package_name    = remList(i,3);
+               this_package_version = remList(i,4);
+               
+               // The package has been intentionnaly installed :
+               // => Do not install it
+               // ----------------------------------------------
+               
+               if atomsGetInstalledStatus(this_package_name,this_package_version) == "I" then
+                       remList(i,1) = "~";
+               end
+               
+               // Get the parents of this toolbox
+               // ----------------------------------------------
+               
+               this_package_parents = atomsGetDepParents(this_package_name,this_package_version);
+               
+               for j=1:size(this_package_parents(:,1),"*")
+                       
+                       if find(remList(:,3)+" - "+remList(:,4) == this_package_parents(j,1)+" - "+this_package_parents(j,2)) == [] then
+                               // One of the parent is not the remove list
+                               // => do not install it
+                               remList(i,1) = "~";
+                               continue;
+                       end
+               end
+               
+       end
+       
+endfunction
diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsSelectPosition.sci b/scilab/modules/atoms/macros/atoms_internals/atomsSelectPosition.sci
new file mode 100644 (file)
index 0000000..4d09871
--- /dev/null
@@ -0,0 +1,69 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Delphine GASC <delphine.gasc@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU <sylvestre.ledru@scilab.org>
+// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.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-en.txt
+
+// Internal function
+
+// Selection of the toolbox position in the available toolboxes list .
+
+function position = atomsSelectPosition(listDesc, nomToolbox, versionToolbox, checkVersionScilab)
+  [n, m] = size(listDesc("Toolbox"))
+  if versionToolbox <> ""
+    [signeToolbox, versionToolbox] = atomsSeparateSignVersion(versionToolbox)
+    versionToolbox = atomsDecoupVersion(versionToolbox)
+  end
+  for i=1:n
+    if (atomsVerifVersionScilab(listDesc("ScilabVersion")(i)) & checkVersionScilab) | ~checkVersionScilab
+      if versionToolbox == "" & listDesc("Toolbox")(i) == nomToolbox
+        position = i
+        // Research of a more recent version
+        for j=i+1:n
+          if (atomsVerifVersionScilab(listDesc("ScilabVersion")(j)) & checkVersionScilab) | ~checkVersionScilab
+            if listDesc("Toolbox")(j) == nomToolbox
+              vi = atomsDecoupVersion(listDesc("Version")(position))
+              vj = atomsDecoupVersion(listDesc("Version")(j))
+                     if atomsCompareVersion(vj, vi) == 1
+        &nb