ATOMS: homogenize function's profile
Pierre MARECHAL [Wed, 21 Oct 2009 20:19:12 +0000 (22:19 +0200)]
36 files changed:
scilab/modules/atoms/help/en_US/atomsGetInstalled.xml
scilab/modules/atoms/help/en_US/atomsInstall.xml
scilab/modules/atoms/help/en_US/atomsIsInstalled.xml
scilab/modules/atoms/help/en_US/atomsLoad.xml
scilab/modules/atoms/macros/atomsAutoload.sci
scilab/modules/atoms/macros/atomsAutoloadAdd.sci
scilab/modules/atoms/macros/atomsDepTreeShow.sci
scilab/modules/atoms/macros/atomsGetLoaded.sci
scilab/modules/atoms/macros/atomsGetLoadedPath.sci
scilab/modules/atoms/macros/atomsInstall.sci
scilab/modules/atoms/macros/atomsIsInstalled.sci
scilab/modules/atoms/macros/atomsIsLoaded.sci
scilab/modules/atoms/macros/atomsList.sci
scilab/modules/atoms/macros/atomsLoad.sci
scilab/modules/atoms/macros/atomsRemove.sci
scilab/modules/atoms/macros/atomsSearch.sci
scilab/modules/atoms/macros/atomsShow.sci
scilab/modules/atoms/macros/atomsTest.sci
scilab/modules/atoms/macros/atomsUpdate.sci
scilab/modules/atoms/macros/atoms_internals/atomsAutoloadGet.sci
scilab/modules/atoms/macros/atoms_internals/atomsDepTreeExt.sci
scilab/modules/atoms/macros/atoms_internals/atomsDepTreeFlat.sci
scilab/modules/atoms/macros/atoms_internals/atomsGetDepChilds.sci
scilab/modules/atoms/macros/atoms_internals/atomsGetDepParents.sci
scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledDetails.sci
scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledPath.sci
scilab/modules/atoms/macros/atoms_internals/atomsGetInstalledStatus.sci
scilab/modules/atoms/macros/atoms_internals/atomsInstallList.sci
scilab/modules/atoms/macros/atoms_internals/atomsIsDirectChild.sci
scilab/modules/atoms/macros/atoms_internals/atomsIsPackage.sci
scilab/modules/atoms/macros/atoms_internals/atomsOrphanList.sci
scilab/modules/atoms/macros/atoms_internals/atomsPackageIsCompatible.sci
scilab/modules/atoms/macros/atoms_internals/atomsRemoveList.sci
scilab/modules/atoms/macros/atoms_internals/atomsToolboxDetails.sci
scilab/modules/atoms/macros/atoms_internals/atomsToremoveProcess.sci
scilab/modules/atoms/macros/atoms_internals/atomsUpdateDeps.sci

index f641160..10cebc1 100644 (file)
@@ -21,7 +21,7 @@
   <refsynopsisdiv>
     <title>Calling Sequence</title>
     <synopsis>
-                       installed = atomsGetInstalled(allusers)
+                       installed = atomsGetInstalled(section)
                </synopsis>
   </refsynopsisdiv>
   <!-- ===================================================================== -->
                                                        </para>
             </listitem>
             <listitem>
-              <para><literal>3rd column</literal> : allusers/user, this parameter tell if
+              <para>
+                                                               <literal>3rd column</literal> : allusers/user, this parameter tell if
                                                                the external module has been installed for all users or only for the
                                                                current user.
-                                                               </para>
+                                                       </para>
             </listitem>
             <listitem>
               <para>
       </varlistentry>
                        
                        <varlistentry>
-        <term>allusers</term>
-        <para>If this parameter is FALSE, only the list of modules installed in the "user" zone will be returned</para>
-      </varlistentry>
+        <term>section</term>
+        <listitem>
+          <para>
+                                               This argument filter the output list.
+                                       </para>
+          <para>
+                                               <literal>section</literal> is a single-string and its value should be :
+                                       </para>
+          <itemizedlist>
+            <listitem>
+              <para>
+                                                               <literal>"all"</literal>: atomsGetInstalled() lists external
+                                                               modules installed in both "user" and "allusers" sections.
+                                                       </para>
+            </listitem>
+            <listitem>
+              <para>
+                                                               <literal>"allusers"</literal>: atomsGetInstalled() only lists
+                                                               external modules        installed in the "allusers" section.
+                                                       </para>
+            </listitem>
+            <listitem>
+              <para>
+                                                               <literal>"user"</literal>: atomsGetInstalled() only lists
+                                                               external modules        installed in the "user" section.
+                                                       </para>
+            </listitem>
+          </itemizedlist>
+                                       <para>
+                                               The default value is "all".
+                                       </para>
+        </listitem>
+                       </varlistentry>
                        
     </variablelist>
   </refsection>
index 94a24ba..7a14c15 100644 (file)
@@ -24,7 +24,7 @@
   <refsynopsisdiv>
     <title>Calling Sequence</title>
     <synopsis>
-         result = atomsInstall(module[,allusers]])
+         result = atomsInstall(module[,section]])
        </synopsis>
   </refsynopsisdiv>
   <!-- ===================================================================== -->
   <refsection>
     <title>Parameters</title>
     <variablelist>
-      <varlistentry>
+      
+                       <varlistentry>
         <term>module</term>
         <listitem>
           <para>
-                                               Matrix of strings : External module name
+                                               Matrix of strings : External module name. this argument has to respect
+                                               the following format "name version". the version is not mandatory.
                                        </para>
         </listitem>
       </varlistentry>
-      <varlistentry>
-        <term>allusers</term>
+      
+                       <varlistentry>
+        <term>section</term>
+                               
         <listitem>
           <para>
-                                               A boolean : if this parameter is equal to TRUE (%T), the external module
-                                               is installed for all users of the computer and is located in
-                                               SCI/contrib ("allusers zone").
-                                               
-                                               If allusers is set to TRUE (%T) and the directory SCI/contrib/ is not
-                                               write accessible, atomsInstall returns an error.
-                                               
-                                               if this parameter is equal to FALSE (%F), the external module is only
-                                               installed for the current user and is located in SCIHOME/atoms ("user zone").
+                                               This argument controls where the external module is installed.
+                                       </para>
+          <para>
+                                               <literal>section</literal> is a single-string and its value should be :
+                                       </para>
+          <itemizedlist>
+            <listitem>
+              <para>
+                                                               <literal>"allusers"</literal>: the external module
+                                                               is installed for all users of the computer and is located in
+                                                               SCI/contrib ("allusers zone").
+                                                       </para>
+            </listitem>
+            <listitem>
+              <para><literal>"user"</literal>: the external module is only
+                                                               installed for the current user and is located in SCIHOME/atoms
+                                                               ("user zone").
+                                                       </para>
+            </listitem>
+          </itemizedlist>
+                                       <para>
+                                               If SCI/contrib is write accessible, "allusers" is the default value.
+                                               Otherwise, the default value is "user".
                                        </para>
         </listitem>
-      </varlistentry>
+                       </varlistentry>
+                       
       <varlistentry>
         <term>result</term>
         <listitem>
       </varlistentry>
     </variablelist>
   </refsection>
+       
   <!-- ===================================================================== -->
   <!-- Description -->
   <!-- ===================================================================== -->
     <title>Description</title>
     <para><literal>atomsInstall</literal> install one or more external modules.
        </para>
+       
   </refsection>
   <!-- ===================================================================== -->
   <!-- Examples -->
 atomsSetConfig("Verbose","True");
 atomsRepositoryAdd("http://scene1.test.atoms.scilab.org");
 
-atomsInstall("toolbox_5 1.0");
-atomsInstall("toolbox_6");
+atomsInstall(["toolbox_5 1.0"]);
+atomsInstall("toolbox_6","user");
+
+atomsGetInstalled();
 
 atomsRemove("toolbox_5");
 atomsRemove("toolbox_6");
index 916eb92..d695975 100644 (file)
@@ -21,7 +21,7 @@
   <refsynopsisdiv>
     <title>Calling Sequence</title>
     <synopsis>
-         res = atomsIsInstalled(name[,version,allusers])
+         res = atomsIsInstalled(name[,version,section])
        </synopsis>
   </refsynopsisdiv>
   <!-- ===================================================================== -->
                                        </para>
         </listitem>
       </varlistentry>
-      <varlistentry>
-        <term>allusers</term>
+                       
+                       <varlistentry>
+        <term>section</term>
         <listitem>
           <para>
-                                               A boolean : If this parameter is False, the  
+                                               This argument controls the list of searched modules.
+                                       </para>
+          <para>
+                                               <literal>section</literal> is a single-string and its value should be :
+                                       </para>
+          <itemizedlist>
+            <listitem>
+              <para>
+                                                               <literal>"all"</literal>: atomsIsInstalled() searchs external
+                                                               modules installed in both "user" and "allusers" sections.
+                                                       </para>
+            </listitem>
+            <listitem>
+              <para>
+                                                               <literal>"allusers"</literal>: atomsIsInstalled() searchs external
+                                                               modules installed in the "allusers" section.
+                                                       </para>
+            </listitem>
+            <listitem>
+              <para>
+                                                               <literal>"user"</literal>: atomsIsInstalled() searchs external
+                                                               modules installed in the "user" section.
+                                                       </para>
+            </listitem>
+          </itemizedlist>
+                                       <para>
+                                               The default value is "all".
                                        </para>
         </listitem>
-      </varlistentry>
+                       </varlistentry>
+                       
       <varlistentry>
         <term>res</term>
         <listitem>
@@ -83,7 +111,7 @@ atomsSetConfig("Verbose","True");
 atomsRepositoryAdd("http://scene1.test.atoms.scilab.org");
 atomsInstall("toolbox_5");
 atomsIsInstalled(["toolbox_5" "toolbox_4"])
-atomsIsInstalled(["toolbox_5" "toolbox_4"],["1.0" "1.0"])
+atomsIsInstalled(["toolbox_5" "1.0" ; "toolbox_4" "1.0"])
 atomsIsInstalled("toolbox_5");
 atomsRemove("toolbox_5");
 ]]>
index 00a19af..518a8eb 100644 (file)
     <programlisting role="example"><![CDATA[ 
 atomsSetConfig("Verbose","True");
 atomsRepositoryAdd("http://scene1.test.atoms.scilab.org");
-atomsInstall("toolbox_2 1.0");
-atomsInstall("toolbox_2 2.0");
+atomsInstall(["toolbox_2" "1.0"]);
+atomsInstall(["toolbox_2" "2.0"]);
 
-atomsLoad("toolbox_2","1.0");
+atomsLoad(["toolbox_2" "1.0"]);
 t2_version()
 t2_function1()
 
index d1ba805..60f7345 100644 (file)
@@ -48,7 +48,7 @@ function result = atomsAutoload()
        
        // Load the wanted packages
        // =========================================================================
-       result = atomsLoad(packages(:,1),packages(:,2));
+       result = atomsLoad([packages(:,1) packages(:,2)]);
        
        // Get the list of lib [after]
        // =====================================================================
index 8f21683..2a4d10b 100644 (file)
@@ -114,10 +114,10 @@ function nbAdd = atomsAutoloadAdd(name,version,section)
        // Check if all input modules are installed
        // =========================================================================
        
-       if ~ and(atomsIsInstalled(name,version)) then
+       if ~ and(atomsIsInstalled([name version])) then
                mprintf(gettext("%s: The following modules are not installed:\n"),"atomsAutoloadAdd");
                for i=1:size(name,"*")
-                       if ~ atomsIsInstalled(name(i),version(i)) then
+                       if ~ atomsIsInstalled([name(i) version(i)]) then
                                mprintf(gettext("\t - ''%s - %s''\n"),name(i),version(i));
                        end
                end
@@ -127,10 +127,10 @@ function nbAdd = atomsAutoloadAdd(name,version,section)
        // A module installed in the user section cannot be add in the "autoload" list 
        // of all users
        
-       if (rhs>=3) & (section=="allusers") & (~ atomsIsInstalled(name,version,"allusers")) then
+       if (rhs>=3) & (section=="allusers") & (~ atomsIsInstalled([name version],"allusers")) then
                mprintf(gettext("%s: The following modules are installed in the user section, you cannot add them in the ""autoload"" list for all users:\n"),"atomsAutoloadAdd");
                for i=1:size(name,"*")
-                       if ~ atomsIsInstalled(name(i),version(i),"allusers") then
+                       if ~ atomsIsInstalled([name(i) version(i)],"allusers") then
                                mprintf(gettext("\t - ''%s - %s''\n"),name(i),version(i));
                        end
                end
index e298ee8..d159c03 100644 (file)
@@ -21,7 +21,7 @@
 
 // Output arguments :
 
-function atomsDepTreeShow(name,version)
+function atomsDepTreeShow(package)
        
        // Load Atoms Internals lib if it's not already loaded
        // =========================================================================
@@ -29,45 +29,33 @@ function atomsDepTreeShow(name,version)
                load("SCI/modules/atoms/macros/atoms_internals/lib");
        end
        
-       lhs = argn(1);
        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"),"atomsDepTreeShow",1,2));
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsDepTreeShow",1));
        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"),"atomsDepTreeShow",1));
+       if type(package) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetLoadedPath",1));
        end
        
-       if (rhs>=2) & (type(version) <> 10) then
-               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsDepTreeShow",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"),"atomsDepTreeShow",1));
-       end
-       
-       if (rhs>=2) & (size(name)<>1) then
-               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsDepTreeShow",1));
+       if size(package(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: 1x1 or 1x2 string matrix expected.\n"),"atomsGetLoadedPath",1));
        end
        
        // Get the dependency tree
        // =========================================================================
        
-       if rhs>1 then
-               tree = atomsDepTreeExt(name,version)
+       if size(package(1,:),"*") == 2 then
+               tree = atomsDepTreeExt(package(1),package(2));
        else
-               tree = atomsDepTreeExt(name)
+               tree = atomsDepTreeExt(package(1));
        end
        
        situation = struct();
index b9eab3f..44d4da3 100644 (file)
@@ -48,7 +48,7 @@ function packages = atomsGetLoaded()
                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) ];
+               packages = [ packages ; atomsGetInstalledDetails([current_name current_version]) ];
        end
        
 endfunction
index fbbaa13..763adaf 100644 (file)
@@ -16,7 +16,7 @@
 //          . Matrix of string (n x 1)
 //          . mandatory
 
-function path = atomsGetLoadedPath(name,version)
+function path = atomsGetLoadedPath(packages)
        
        // Load Atoms Internals lib if it's not already loaded
        // =========================================================================
@@ -32,66 +32,58 @@ function path = atomsGetLoadedPath(name,version)
        // 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"),"atomsGetLoadedPath",1,2));
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsGetLoadedPath",1));
        end
        
        // Check input parameters type
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(packages) <> 10 then
                error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsGetLoadedPath",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"),"atomsGetLoadedPath",2));
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix expected.\n"),"atomsGetLoadedPath",1));
        end
        
-       // name and version must have the same size
+       // If packages is mx1 matrix, add a 2nd column with empty versions
        // =========================================================================
        
-       if rhs>1 & version<>[] & or(size(name)<>size(version)) then
-               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsGetLoadedPath",1,2));
-       end
-       
-       // Value of version if not precised
-       // =========================================================================
-       
-       if rhs < 2 then
-               version = [];
+       if size(packages(1,:),"*") == 1 then
+               packages = [ packages emptystr(size(packages(:,1),"*"),1) ];
        end
        
        // Get the list of installed packages
        // =========================================================================
-       packages = atomsGetLoaded();
+       loadedpackages = atomsGetLoaded();
        
        // Loop on name
        // =========================================================================
        
-       for i=1:size(name,"*")
+       for i=1:size(packages(:,1),"*")
+               
+               name    = packages(i,1);
+               version = packages(i,2);
                
                if isempty(version) then
                        // Just check the name
-                       res(i) = or(packages(:,1) == name(i));
+                       res(i) = or(loadedpackages(:,1) == name);
                        
                else
                        // Filter on names
-                       packages_version = packages( find(packages(:,1) == name(i)) , 2 );
+                       packages_version = loadedpackages( find(loadedpackages(:,1) == name) , 2 );
                        
-                       // Check if the wanted version is present$
-                       res(i) = or(packages_version == version(i) );
+                       // Check if the wanted version is present
+                       res(i) = or(packages_version == version);
                end
                
                if res(i) then
-                       path(i) = packages( find(packages(:,1) == name(i)) , 4 )
+                       path(i) = loadedpackages( find(loadedpackages(:,1) == name) , 4 )
                else
                        path(i) = "";
                end
                
        end
        
-       // Reshape the matrix [path]
-       // =========================================================================
-       path = matrix(path,size(name));
-       
 endfunction
index d811b28..24f6158 100644 (file)
@@ -16,7 +16,7 @@ function result = atomsInstall(packages,section)
        // Load Atoms Internals lib if it's not already loaded
        // =========================================================================
        if ~ exists("atomsinternalslib") then
-               load("SCI/modules/atoms/macros/atoms_internals/lib");
+               load("SCI/packages/atoms/macros/atoms_internals/lib");
        end
        
        result = [];
@@ -42,6 +42,12 @@ function result = atomsInstall(packages,section)
                error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstall",1));
        end
        
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix expected.\n"),"atomsInstall",1));
+       end
+       
+       // Remove leading and trailing whitespace
+       // =========================================================================
        packages = stripblanks(packages);
        
        // Operating system detection
@@ -86,11 +92,11 @@ function result = atomsInstall(packages,section)
        
        // Allusers/user management
        //   - If Allusers is equal to "allusers", packages will installed in the "allusers" section :
-       //       → SCI/contrib    : location of the modules
+       //       → SCI/contrib    : location of the packages
        //       → SCI/.atoms     : ATOMS system files
        //   - Otherwise, packages will installed in the "user" section :
-       //       → SCIHOME/atoms  : location of the modules
-       //       → SCIHOME/.atoms : location of the modules & ATOMS system files
+       //       → SCIHOME/atoms  : location of the packages
+       //       → SCIHOME/.atoms : location of the packages & ATOMS system files
        // =========================================================================
        
        if rhs <= 1 then
@@ -167,9 +173,9 @@ function result = atomsInstall(packages,section)
        // "Archive" installation
        // =========================================================================
        
-       for i=1:size(packages,"*")
+       for i=1:size(packages(:,1),"*")
                
-               this_package = packages(i);
+               this_package = packages(i,1);
                
                if ~ isempty(regexp(this_package,"/(\.tar\.gz|\.tgz|\.zip)$/","o")) then
                        
@@ -233,8 +239,7 @@ function result = atomsInstall(packages,section)
                        
                        // change the packages var
                        // -----------------------------------------------------------------
-                       packages(i) = this_package_name+" "+this_package_version;
-                       
+                       packages(i,:) = [ this_package_name this_package_version ];
                        
                end
                
@@ -377,7 +382,7 @@ function result = atomsInstall(packages,section)
                
                // Fill the result matrix
                // =====================================================================
-               result = [ result ; atomsGetInstalledDetails(this_package_name,this_package_version) ];
+               result = [ result ; atomsGetInstalledDetails([this_package_name this_package_version]) ];
                
                // "archive" installation : Save the description
                // =====================================================================
@@ -417,7 +422,7 @@ function result = atomsInstall(packages,section)
        
        for i=1:size( result(:,1) , "*" )
                
-               packages_out = atomsUpdateDeps(result(i,1),result(i,2),section);
+               packages_out = atomsUpdateDeps([result(i,1) result(i,2)],section);
                
                if ATOMSVERBOSE then
                        for j=1:size(packages_out(:,1),"*")
@@ -431,8 +436,8 @@ function result = atomsInstall(packages,section)
        // =========================================================================
        
        orphan_list = atomsOrphanList(section);
-       for i=1:size( orphan_list(:,1) , "*" )
-               atomsRemove( orphan_list(i,1) + " " + orphan_list(i,2) );
+       if ~ isempty(orphan_list) then
+               atomsRemove( [ orphan_list(:,1) orphan_list(:,2) ] );
        end
        
        // Go to the initial location
index 6dd645f..e166b2e 100644 (file)
@@ -19,7 +19,7 @@
 // Output parameters :
 //   res      : matrix of boolean
 
-function res = atomsIsInstalled(name,version,section)
+function res = atomsIsInstalled(packages,section)
        
        // Load Atoms Internals lib if it's not already loaded
        // =========================================================================
@@ -34,76 +34,70 @@ function res = atomsIsInstalled(name,version,section)
        // 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));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsIsInstalled",1,2));
        end
        
        // Check input parameters type
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(packages) <> 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));
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix expected.\n"),"atomsIsInstalled",1));
        end
        
-       // name and version must have the same size
+       // Remove leadind & trailing whitespaces
        // =========================================================================
+       packages = stripblanks(packages);
        
-       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 packages is mx1 matrix, add a 2nd column with empty versions
        // =========================================================================
-       
-       if rhs < 2 then
-               version = [];
+       if size(packages(1,:),"*") == 1 then
+               packages = [ packages emptystr(size(packages(:,1),"*"),1) ];
        end
        
        // "all", "user" section or "allusers" section packages ?
        // =========================================================================
        
-       if rhs < 3 then
+       if rhs < 2 then
                section = "all"
+               
        else
                // Just check if it's a boolean
                if type(section) <> 10 then
-                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A single-string expected.\n"),"atomsIsInstalled",1));
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A single-string expected.\n"),"atomsIsInstalled",2));
                end
-       end
-       
-       if (rhs>=3) & (and(section<>["user","allusers","all"])) then
-               error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''all'' expected.\n"),"atomsIsInstalled",1));
+               
+               if and(section<>["user","allusers","all"]) then
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''all'' expected.\n"),"atomsIsInstalled",2));
+               end
+               
        end
        
        // Get the list of installed packages
        // =========================================================================
-       packages = atomsGetInstalled(section);
+       installedpackages = atomsGetInstalled(section);
        
-       // Loop on name
+       // Loop on packages
        // =========================================================================
        
-       for i=1:size(name,"*")
+       for i=1:size(packages(:,1),"*")
                
-               if isempty(version) then
+               if isempty(packages(i,2)) then
                        // Just check the name
-                       res(i) = or(packages(:,1) == name(i));
+                       res(i) = or(packages(i,1) == installedpackages(:,1));
                
                else
                        // Filter on names
-                       packages_version = packages( find(packages(:,1) == name(i)) , 2 );
+                       packages_version = installedpackages( find(packages(i,1) == installedpackages(:,1)) , 2 );
                        
                        // Check if the wnated version is present$
-                       res(i) = or(packages_version == version(i) );
+                       res(i) = or(packages_version == packages(i,2));
                end
                
        end
        
-       // Reshape the matrix
-       // =========================================================================
-       res = matrix(res,size(name) );
-       
 endfunction
index 86f0f1d..9ab1219 100644 (file)
@@ -21,7 +21,7 @@
 //                 . Matrix of string (n x 1)
 //                 . mandatory
 
-function [res,version_out] = atomsIsLoaded(name,version)
+function [res,version_out] = atomsIsLoaded(packages)
        
        // Load Atoms Internals lib if it's not already loaded
        // =========================================================================
@@ -37,59 +37,55 @@ function [res,version_out] = atomsIsLoaded(name,version)
        // 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));
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsIsLoaded",1));
        end
        
        // Check input parameters type
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(packages) <> 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));
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix expected.\n"),"atomsIsLoaded",1));
        end
        
-       // name and version must have the same size
+       // If packages is mx1 matrix, add a 2nd column with empty versions
        // =========================================================================
        
-       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 = [];
+       if size(packages(1,:),"*") == 1 then
+               packages = [ packages emptystr(size(packages(:,1),"*"),1) ];
        end
        
        // Get the list of installed packages
        // =========================================================================
-       packages = atomsGetLoaded();
+       loadedpackages = atomsGetLoaded();
        
        // Loop on name
        // =========================================================================
        
-       for i=1:size(name,"*")
+       for i=1:size(packages(:,1),"*")
+               
+               name    = packages(i,1);
+               version = packages(i,2);
                
                if isempty(version) then
                        // Just check the name
-                       res(i) = or(packages(:,1) == name(i));
+                       res(i) = or(loadedpackages(:,1) == name);
                        
                else
                        // Filter on names
-                       packages_version = packages( find(packages(:,1) == name(i)) , 2 );
+                       packages_version = loadedpackages( find(loadedpackages(:,1) == name) , 2 );
                        
-                       // Check if the wanted version is present$
-                       res(i) = or(packages_version == version(i) );
+                       // Check if the wanted version is present
+                       res(i) = or(packages_version == version);
                end
                
                if lhs>1 then
                        if res(i) then
-                               version_out(i) = packages( find(packages(:,1) == name(i)) , 2 )
+                               version_out(i) = loadedpackages( find(loadedpackages(:,1) == name) , 2 )
                        else
                                version_out(i) = "";
                        end
@@ -97,14 +93,4 @@ function [res,version_out] = atomsIsLoaded(name,version)
                
        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
index 985149f..9c75a2d 100644 (file)
@@ -56,7 +56,7 @@ function atomsList()
                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_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 ];
index a2d0c6a..f7ac3ca 100644 (file)
@@ -9,7 +9,7 @@
 
 // Load one or several toolboxes
 
-function result = atomsLoad(name,version,section)
+function result = atomsLoad(packages,section)
        
        // Load Atoms Internals lib if it's not already loaded
        // =========================================================================
@@ -21,36 +21,29 @@ function result = atomsLoad(name,version,section)
        // =========================================================================
        result = [];
        
-       // Check number of input arguments
+       // 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"),"atomsLoad",1,3));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"atomsLoad",1,2))
        end
        
-       // Check input parameters type
-       // =========================================================================
-       
-       if type(name) <> 10 then
+       if type(packages) <> 10 then
                error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsLoad",1));
        end
        
-       if (rhs>1) & (type(version) <> 10) then
-               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsLoad",2));
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix expected.\n"),"atomsLoad",1));
        end
        
-       // name and version must have the same size
-       // =========================================================================
-       
-       if (rhs>1) & (or( size(name) <> size(version) )) then
-               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsLoad",1,2));
-       end
+       packages = stripblanks(packages);
        
        // Allusers/user management
        // =========================================================================
        
-       if rhs < 3 then
+       if rhs < 2 then
                section = "all";
        
        else
@@ -59,49 +52,50 @@ function result = atomsLoad(name,version,section)
                // Allusers can be a boolean or equal to "user" or "allusers"
                
                if type(section) <> 10 then
-                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsLoad",3));
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsLoad",2));
                end
                
                if and(section<>["user","allusers","all"]) then
-                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsLoad",3));
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsLoad",2));
                end
                
        end
        
+       // If package is a mx1 matrix, add a 2nd column with empty versions
+       // =========================================================================
+       
+       if size(packages(1,:),"*") == 1 then
+               packages = [ packages emptystr(size(packages(:,1),"*"),1) ];
+       end
+       
        // If only one input argument, define the version (The Most Recent Version)
        // =========================================================================
        
-       if (rhs<2) | (rhs>=2 & isempty(version)) then
+       
+       for i=1:size(packages(:,1),"*")
                
-               for i=1:size(name,"*")
+               if isempty(packages(i,2)) then
                        
-                       this_module_versions = atomsGetInstalledVers(name(i),section);
+                       this_module_versions = atomsGetInstalledVers(packages(i,1),section);
                        
                        if isempty(this_module_versions) then
-                               error(msprintf(gettext("%s: No version of the module ''%s'' is installed.\n"),"atomsLoad",name(i)));
+                               error(msprintf(gettext("%s: No version of the module ''%s'' is installed.\n"),"atomsLoad",packages(i,1)));
                        else
-                               version(i) = this_module_versions(1);
+                               packages(i,2) = this_module_versions(1);
                        end
-                       
-               end
                
-       else
-       
-       // Check if the packages to load are installed
-       // =========================================================================
-       
-               if or( ~ atomsIsInstalled(name,version,section) ) then
-                       for i=1:size(name,"*")
-                               if ~atomsIsInstalled(name(i),version(i),section) then
-                                       error(msprintf(gettext("%s: the module ''%s - %s'' is not installed.\n"),"atomsLoad",name(i),version(i)));
-                               end
+               else
+                       if ~atomsIsInstalled([packages(i,1) packages(i,2)],section) then
+                               error(msprintf(gettext("%s: the module ''%s - %s'' is not installed.\n"),"atomsLoad",packages(i,1),packages(i,2)));
                        end
+               
                end
+               
        end
        
        // Get path of the toolboxes
        // =========================================================================
-       path = atomsGetInstalledPath(name,version);
+       path = atomsGetInstalledPath(packages);
        
        // Create the TMPDIR/atoms directory
        // =========================================================================
@@ -143,18 +137,22 @@ function result = atomsLoad(name,version,section)
        mandatory_packages_name = struct();
        mandatory_packages_mat  = [];
        
-       for i=1:size(name,"*")
+       for i=1:size(packages(:,1),"*")
                
+               this_package_name    = packages(i,1);
+               this_package_version = packages(i,2);
+               this_package_path    = path(i);
+       
                // 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 ) );
+               if size( find( this_package_name == packages(:,1) ) > 1 ) then
+                       this_versions = packages( find( this_package_name == packages(:,1) ) , 2 );
                        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(gettext("%s: Several versions of a package (%s) cannot be loaded at the same scilab session :\n"),"atomsLoad",this_package_name);
+                                       mprintf(gettext("\t - You''ve asked ''%s - %s''\n"),this_package_name,this_versions(1));
+                                       mprintf(gettext("\t - You''ve asked ''%s - %s''\n"),this_package_name,this_versions(j));
                                        mprintf("\n");
                                        error("");
                                end
@@ -163,37 +161,37 @@ function result = atomsLoad(name,version,section)
                
                // Check if this toolbox is already loaded
                // =====================================================================
-               if atomsIsLoaded(name(i),version(i)) then
-                       atomsDisp(msprintf("\tThe package %s (%s) is already loaded\n\n",name(i),version(i)));
+               if atomsIsLoaded(packages(i,:)) then
+                       atomsDisp(msprintf("\tThe package %s (%s) is already loaded\n\n",this_package_name,this_package_version));
                        continue;
                end
                
                // Check if another version of this toolbox is already loaded
                // =====================================================================
-               [is_loaded,loaded_version] =  atomsIsLoaded(name(i));
+               [is_loaded,loaded_version] =  atomsIsLoaded(this_package_name);
                if is_loaded then
-                       error(msprintf(gettext("%s: Another version of the package %s is already loaded : %s\n"),"atomsLoad",name(i),loaded_version));
+                       error(msprintf(gettext("%s: Another version of the package %s is already loaded : %s\n"),"atomsLoad",this_package_name,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) ];
+               mandatory_packages(this_package_name+" - "+this_package_version) = "asked_by_user";
+               mandatory_packages_name(this_package_name) = this_package_version;
+               mandatory_packages_mat = [ mandatory_packages_mat ; this_package_name this_package_version this_package_path ];
                
        end
        
        // Fill the list of package to load
        // =========================================================================
        
-       for i=1:size(name,"*")
+       for i=1:size(packages(:,1),"*")
                
-               childs = atomsGetDepChilds(name(i),version(i));
+               childs = atomsGetDepChilds(packages(i,:));
                
                for j=1:size( childs(:,1) , "*")
                        
                        // Check if it is already loaded
                        // -------------------------------------------------------
-                       if atomsIsLoaded( childs(j,1) , childs(j,2) ) then
+                       if atomsIsLoaded(childs(j,:)) then
                                continue;
                        end
                        
@@ -203,7 +201,7 @@ function result = atomsLoad(name,version,section)
                        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(gettext("\t - ''%s - %s'' is needed by ''%s - %s''\n"),childs(j,1),childs(j,2),packages(i,1),packages(i,2));
                                mprintf("\n");
                                error("");
                        end
@@ -222,7 +220,7 @@ function result = atomsLoad(name,version,section)
                                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));
+                                       mprintf(gettext("\t - ''%s - %s'' is needed by ''%s - %s''\n"),childs(j,1),childs(j,2),packages(i,1),packages(i,2));
                                        
                                        // 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
@@ -246,9 +244,9 @@ function result = atomsLoad(name,version,section)
                        // packages to load
                        // -------------------------------------------------------
                        
-                       mandatory_packages(childs(j,1)+" - "+childs(j,2)) = name(i)+" - "+version(i);
+                       mandatory_packages(childs(j,1)+" - "+childs(j,2)) = packages(i,1)+" - "+packages(i,2);
                        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),section) ];
+                       mandatory_packages_mat = [ mandatory_packages_mat ; childs(j,1) childs(j,2) atomsGetInstalledPath(childs(j,:),section) ];
                        
                end
        end
index 75bfea3..16e7d47 100644 (file)
@@ -42,8 +42,18 @@ function result = atomsRemove(packages,section)
                error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsRemove",1));
        end
        
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix expected.\n"),"atomsInstall",1));
+       end
+       
        packages = stripblanks(packages);
        
+       // If mx1 matrix, add a 2nd column with empty versions
+       // =========================================================================
+       if size(packages(1,:),"*") == 1 then
+               packages = [ packages emptystr(size(packages(:,1),"*"),1) ];
+       end
+       
        // Operating system detection
        // =========================================================================
        
@@ -119,28 +129,13 @@ function result = atomsRemove(packages,section)
        // Some checking on packages variable
        // =========================================================================
        
-       for i=1:size(packages,"*")
-               
-               package = packages(i);
+       for i=1:size(packages(:,1),"*")
                
-               if size(regexp(package,"/\s/") ,"*" ) > 1 then
-                       error(msprintf(gettext("%s: Wrong value for input argument #%d: package name must contain at most one space (to split name and version).\n"),"atomsRemove",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
+               package_names(i)    = packages(i,1);
+               package_versions(i) = packages(i,2);
                
                // Check if this package is installed
-               
-               if ~ atomsIsInstalled(package_names(i),package_versions(i),section) then
+               if ~ atomsIsInstalled([package_names(i) package_versions(i)],section) then
                        
                        // Print a warning if the package isn't installed
                        
@@ -155,7 +150,7 @@ function result = atomsRemove(packages,section)
                        // The package is installed, now check if we have the right to
                        // uninstall it
                        
-                       installed_details = atomsGetInstalledDetails(package_names(i),package_versions(i),section);
+                       installed_details = atomsGetInstalledDetails(packages(i,:),section);
                        
                        if installed_details(3) == "allusers" then
                                error(msprintf(gettext("%s: You have not enought rights to remove the package %s (%s).\n"),"atomsRemove",package_names(i),package_versions(i)));
@@ -175,10 +170,8 @@ function result = atomsRemove(packages,section)
        
        // Build the list of package to Uninstall
        // =========================================================================
-       
        remove_package_list = atomsRemoveList(packages,section);
        
-       
        // Loop on remList to print if a package has to be remove
        // or not
        // =========================================================================
@@ -205,15 +198,15 @@ function result = atomsRemove(packages,section)
                this_package_name      = remove_package_list(i,3);
                this_package_version   = remove_package_list(i,4);
                this_package_section   = remove_package_list(i,5);
-               this_package_details   = atomsToolboxDetails(this_package_name,this_package_version);
-               this_package_insdet    = atomsGetInstalledDetails(this_package_name,this_package_version,section);
+               this_package_details   = atomsToolboxDetails([this_package_name this_package_version]);
+               this_package_insdet    = atomsGetInstalledDetails([this_package_name this_package_version],section);
                this_package_directory = this_package_insdet(4);
                
                // Add the package to list of package to remove
                atomsToremoveRegister(this_package_name,this_package_version,this_package_section);
                
                // Check if the package is loaded or not
-               if atomsIsLoaded(this_package_name,this_package_version) then
+               if atomsIsLoaded([this_package_name this_package_version]) then
                        mprintf( "\tthe package %s (%s) is currently loaded, It will removed at next Scilab restart\n\n" , this_package_name , this_package_version );
                        continue;
                end
index dac5981..fc5b76a 100644 (file)
@@ -78,7 +78,7 @@ function packages_disp = atomsSearch( search , fields )
                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_details = atomsToolboxDetails([this_package_name,this_package_version]);
                this_package_summary = this_package_details("Summary");
                
                if grep( convstr(this_package_name,"l") , search ) <> [] then
index 1f949b8..87f4931 100644 (file)
@@ -9,7 +9,7 @@
 
 // Show information on a package
 
-function atomsShow(name,version)
+function atomsShow(package)
        
        // Load Atoms Internals lib if it's not already loaded
        // =========================================================================
@@ -22,43 +22,44 @@ function atomsShow(name,version)
        // 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));
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsShow",1));
        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));
+       if type(package) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array 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));
+       if size(package(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: 1x1 or 1x2 string matrix expected.\n"),"atomsShow",1));
        end
        
-       // Check input parameters dimensions
+       // Remove leading and trailing parameters
        // =========================================================================
+       package = stripblanks(package);
        
-       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));
+       // If version is not defined, the Most Recent Version is used
+       // =========================================================================
+       if size(package(1,:),"*") == 1 then
+               package(1,2) = atomsGetMRVersion(package(1));
        end
        
        
-       // If version is not defined, the Most Recent Version is used
+       // Check if it's a valid package
        // =========================================================================
-       if rhs<2 then
-               version = atomsGetMRVersion(name);
+       if size(package(1,:),"*") == 1 then
+               package(1,2) = atomsGetMRVersion(package(1));
        end
        
+       
+       
        // Get the details of this package
        // =========================================================================
        
-       details = atomsToolboxDetails(name,version);
+       details = atomsToolboxDetails(package);
        
        fields_map = [];
        fields_map = [ fields_map ; "Toolbox"        gettext("Package")        ];
@@ -76,7 +77,7 @@ function atomsShow(name,version)
        
        fields_map = [ fields_map ; "Status"         gettext("Status")         ];
        
-       if atomsIsInstalled(name,version) then
+       if atomsIsInstalled(package) then
                fields_map = [ fields_map ; "InstallAutomaticaly" gettext("Automaticaly Installed")];
                fields_map = [ fields_map ; "installPath"         gettext("Install Directory")];
        end
@@ -97,7 +98,7 @@ function atomsShow(name,version)
                // 
                
                if fields_map(i,1)=="Status" then
-                       if atomsIsInstalled(name,version) then
+                       if atomsIsInstalled(package) then
                                value = "Installed";
                        else
                                value = "Not installed";
@@ -109,7 +110,7 @@ function atomsShow(name,version)
                // 
                
                if fields_map(i,1)=="InstallAutomaticaly" then
-                       if atomsGetInstalledStatus(name,version) == "A" then
+                       if atomsGetInstalledStatus(package) == "A" then
                                value = "yes";
                        else
                                value = "no";
index 6c9a0f0..51574d9 100644 (file)
@@ -66,9 +66,9 @@ function path = atomsTest(name,version)
                        end
                end
        else
-               if ~ and(atomsIsInstalled(name,version)) then
+               if ~ and(atomsIsInstalled([name version])) then
                        for i=1:size(name,"*")
-                               if ~ atomsIsInstalled(name(i),version(i)) then
+                               if ~ atomsIsInstalled([name(i) version(i)]) then
                                        error(msprintf(gettext("%s: The version ''%s'' of The module ''%s'' is not installed.\n"),"atomsTest",version(i),name(i)));
                                end
                        end
index e0c2824..a3ffb04 100644 (file)
@@ -97,7 +97,8 @@ function result = atomsUpdate(name,section)
        if (rhs==0) | isempty(name) then
                
                name               = [];
-               package_installed = atomsGetInstalled(section);
+               package_installed  = atomsGetInstalled(section);
+               package_installed  = package_installed( find( package_installed(:,5) == "I") , : );
                
                for i=1:size(package_installed(:,1),"*")
                        if find( name == package_installed(i,1) ) == [] then
@@ -111,22 +112,39 @@ function result = atomsUpdate(name,section)
        
        for i=1:size(name,"*")
                
-               this_package_versions = atomsGetInstalledVers(name(i),section);
-               this_package_MRV_ins  = this_package_versions(1);   // Most Recent Version Installed
-               this_package_MRV_ava  = atomsGetMRVersion(name(i)); // Most Recent Version Available
+               this_package_versions    = atomsGetInstalledVers(name(i),section);
+               this_package_MRV_ins     = this_package_versions(1);   // Most Recent Version Installed
+               this_package_MRV_ava     = atomsGetMRVersion(name(i)); // Most Recent Version Available
+               this_package_ins_details = atomsGetInstalledDetails([name(i) this_package_MRV_ins],section);
+               this_package_ins_section = this_package_ins_details(3);
                
                if (this_package_MRV_ava == -1) | ..
                                ( atomsVersionCompare(this_package_MRV_ins,this_package_MRV_ava) == 0 ) then
                        // The installed version is already the Most Recent Version Available
                        atomsDisp(msprintf("\t%s (%s) : The most recent version is already installed\n\n",name(i),this_package_MRV_ins));
-                       continue;
+               else
+                       // Install the new toolbox
+                       this_result = atomsInstall([name(i) this_package_MRV_ava],this_package_ins_section);
+                       
+                       // Fill the output argument
+                       result = [ result ; this_result ];
                end
                
-               // Install the new toolbox
-               this_result = atomsInstall(name(i)+" "+this_package_MRV_ava,section);
+               // Now check if it's dependencies are up-to-date
+               dependencies = atomsInstallList([name(i) this_package_MRV_ins],this_package_ins_section);
+               
+               for j=1:size(dependencies(:,1),"*")
+                       
+                       if ~atomsIsInstalled([dependencies(j,3) dependencies(j,4)],this_package_ins_section) then
+                               // Install the new toolbox
+                               this_result = atomsInstall([dependencies(j,3) dependencies(j,4)],this_package_ins_section);
+                               
+                               // Fill the output argument
+                               result = [ result ; this_result ];
+                       end
+                       
+               end
                
-               // Fill the output argument
-               result = [ result ; this_result ];
        end
        
        // Go to the initial location
index df9e1eb..fbad508 100644 (file)
@@ -89,7 +89,7 @@ function packages = atomsAutoloadGet(section)
                        current_name         = part(autoloaded(j),1:current_name_length-1);
                        current_version      = part(autoloaded(j),current_name_length+3:length(autoloaded(j)));
                        
-                       if atomsIsInstalled(current_name,current_version,"user") then
+                       if atomsIsInstalled([current_name current_version],"user") then
                                current_path = pathconvert(atomsPath("install","user")+current_name+"/"+current_version,%F);
                        else
                                current_path = pathconvert(atomsPath("install","allusers")+current_name+"/"+current_version,%F);
index 4f4e16f..386878e 100644 (file)
@@ -87,7 +87,7 @@ function [tree_out,version_out] = atomsDepTreeExt(name,version)
        
        for i=1:size(version,"*")
                
-               this_package_details = atomsToolboxDetails(name,version(i));
+               this_package_details = atomsToolboxDetails([name,version(i)]);
                tree_out(name+" - "+version(i)) = this_package_details;
                
                if lhs>1 then
index fc46a54..2be6f01 100644 (file)
@@ -98,7 +98,7 @@ function [tree_out,version_out] = atomsDepTreeFlat(name,version,tree_in)
        
        for i=1:size(version,"*")
                
-               this_package_details = atomsToolboxDetails(name,version(i));
+               this_package_details = atomsToolboxDetails([name,version(i)]);
                tree_out(name+" - "+version(i)) = this_package_details;
                
                if lhs>1 then
index a4f002d..910d32d 100644 (file)
@@ -9,7 +9,7 @@
 
 // Give the list of packages needed by this package (identified by its name and version)
 
-function packages = atomsGetDepChilds(name,version,section)
+function packages = atomsGetDepChilds(package,section)
        
        rhs      = argn(2);
        packages = [];
@@ -17,50 +17,39 @@ function packages = atomsGetDepChilds(name,version,section)
        // 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));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetDepChilds",1,2));
        end
        
        // Check input parameters type
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(package) <> 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));
+       if or(size(package) <> [1 2]) then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: 1x2 string matrix expected.\n"),"atomsGetDepChilds",1));
        end
        
        // All user management
        // =========================================================================
        
-       if rhs < 3 then
+       if rhs < 2 then
                section = "all";
        
        else
                
                if type(section) <> 10 then
-                       error(msprintf(gettext("%s: Wrong type for input argument #%d: Single string expected.\n"),"atomsGetDepChilds",3));
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: Single string expected.\n"),"atomsGetDepChilds",2));
                end
                
                if size(section,"*")<>1 then
-                       error(msprintf(gettext("%s: Wrong size for input argument #%d: Single string expected.\n"),"atomsGetDepChilds",3));
+                       error(msprintf(gettext("%s: Wrong size for input argument #%d: Single string expected.\n"),"atomsGetDepChilds",2));
                end
                
                if and(section<>["user","allusers","all"]) then
-                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''all'' expected.\n"),"atomsGetDepChilds",3));
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''all'' expected.\n"),"atomsGetDepChilds",2));
                end
                
        end
@@ -72,14 +61,14 @@ function packages = atomsGetDepChilds(name,version,section)
        // If name - version is not a field of the struct, the job is done
        // =========================================================================
        
-       if ~ isfield(installed_deps,name+" - "+version) then
+       if ~ isfield(installed_deps,package(1)+" - "+package(2)) then
                return;
        end
        
        // Return the matrix associated with the wanted package (name - version)
        // =========================================================================
        
-       packages_list = installed_deps(name+" - "+version);
+       packages_list = installed_deps(package(1)+" - "+package(2));
        
        for i=1:size(packages_list,"*")
                this_package_name    = part(packages_list(i),1:regexp(packages_list(i),"/\s-\s/","o")-1);
index 62a7e6c..2339913 100644 (file)
@@ -9,7 +9,7 @@
 
 // Give the list of packages that use this package (identified by its name and version)
 
-function packages = atomsGetDepParents(name,version,section)
+function packages = atomsGetDepParents(package,section)
        
        rhs      = argn(2);
        packages = [];
@@ -17,48 +17,41 @@ function packages = atomsGetDepParents(name,version,section)
        // 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));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetDepParents",1,2));
        end
        
        // Check input parameters type
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(package) <> 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));
+       if or(size(package) <> [1 2]) then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: 1x2 string matrix expected.\n"),"atomsGetDepParents",1));
        end
        
        // All user management
        // =========================================================================
        
-       if rhs <= 1 then
-               section = "all"; 
-               
+       if rhs < 2 then
+               section = "all";
+       
        else
-               // Process the 2nd input argument : section
-               // Allusers can be equal to "user" or "allusers"
+               
                if type(section) <> 10 then
-                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A single-string expected.\n"),"atomsGetDepParents",3));
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: Single string expected.\n"),"atomsGetDepParents",2));
+               end
+               
+               if size(section,"*")<>1 then
+                       error(msprintf(gettext("%s: Wrong size for input argument #%d: Single string expected.\n"),"atomsGetDepParents",2));
                end
                
                if and(section<>["user","allusers","all"]) then
-                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsGetDepParents",3));
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''all'' expected.\n"),"atomsGetDepParents",2));
                end
+               
        end
        
        // Load the installed_deps struct
@@ -68,14 +61,14 @@ function packages = atomsGetDepParents(name,version,section)
        // If name - version is not a field of the struct, the job is done
        // =========================================================================
        
-       if ~ isfield(parent_deps,name+" - "+version) then
+       if ~ isfield(parent_deps,package(1)+" - "+package(2)) then
                return;
        end
        
        // Return the matrix associated with the wanted package (name - version)
        // =========================================================================
        
-       packages_list = parent_deps(name+" - "+version);
+       packages_list = parent_deps(package(1)+" - "+package(2));
        
        for i=1:size(packages_list,"*")
                this_package_name    = part(packages_list(i),1:regexp(packages_list(i),"/\s-\s/","o")-1);
index 3dd9ffd..c923f6e 100644 (file)
@@ -9,7 +9,7 @@
 
 // Renvoie les détails sur l'installation d'un package.
 
-function res = atomsGetInstalledDetails(name,version,section)
+function res = atomsGetInstalledDetails(packages,section)
        
        rhs = argn(2);
        res = [];
@@ -17,32 +17,25 @@ function res = atomsGetInstalledDetails(name,version,section)
        // 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"),"atomsGetInstalledDetails",2,3));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetInstalledDetails",1,2));
        end
        
        // Check input parameters type
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(packages) <> 10 then
                error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsGetInstalledDetails",1));
        end
        
-       if type(version)<>10  then
-               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsGetInstalledDetails",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"),"atomsGetInstalledDetails",1,2));
+       if size(packages(1,:),"*") <> 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx2 string matrix expected.\n"),"atomsGetInstalledDetails",1));
        end
        
        // Allusers/user management
        // =========================================================================
        
-       if rhs < 3 then
+       if rhs < 2 then
                section = "all";
        
        else
@@ -51,29 +44,29 @@ function res = atomsGetInstalledDetails(name,version,section)
                // Allusers can be a boolean or equal to "user" or "allusers"
                
                if type(section) <> 10 then
-                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsGetInstalledDetails",3));
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsGetInstalledDetails",2));
                end
                
-               if (type(section) == 10) & and(section<>["user","allusers","all"]) then
-                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsGetInstalledDetails",3));
+               if and(section<>["user","allusers","all"]) then
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsGetInstalledDetails",2));
                end
                
        end
        
        // Get the list of installed packages
        // =========================================================================
-       packages = atomsGetInstalled(section);
+       installedpackages = atomsGetInstalled(section);
        
        // Loop on name
        // =========================================================================
        
-       for i=1:size(name,"*")
+       for i=1:size(packages(:,1),"*")
                
                // Filter on names
-               packages_filtered = packages( find(packages(:,1) == name(i)) , : );
+               packages_filtered = installedpackages( find(installedpackages(:,1) == packages(i,1)) , : );
                
                // Filter on versions
-               packages_filtered = packages_filtered( find(packages_filtered(:,2) == version(i)) , : );
+               packages_filtered = packages_filtered( find(packages_filtered(:,2) == packages(i,2)) , : );
                
                if ~ isempty(packages_filtered) then
                        res = [ res ; packages_filtered(1,:) ];
index 2b90142..318cd23 100644 (file)
@@ -9,7 +9,7 @@
 
 // Add an URL to the list of repositories, and returns
 
-function res = atomsGetInstalledPath(name,version,section)
+function res = atomsGetInstalledPath(packages,section)
        
        rhs           = argn(2);
        res           = [];
@@ -18,32 +18,27 @@ function res = atomsGetInstalledPath(name,version,section)
        // 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));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetInstalledPath",1,2));
        end
        
        // Check input parameters type
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(packages) <> 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));
+       if size(packages(1,:),"*") <> 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx2 string matrix expected.\n"),"atomsGetInstalledPath",1));
        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
+       packages = stripblanks(packages);
        
        // Allusers/user management
        // =========================================================================
        
-       if rhs < 3 then
+       if rhs < 2 then
                section = "all";
        
        else
@@ -52,26 +47,26 @@ function res = atomsGetInstalledPath(name,version,section)
                // Allusers can be equal to "user" or "allusers"
                
                if type(section) <> 10 then
-                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsGetInstalledPath",3));
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsGetInstalledPath",2));
                end
                
                if (type(section) == 10) & and(section<>["user","allusers","all"]) then
-                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsGetInstalledPath",3));
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsGetInstalledPath",2));
                end
                
        end
        
        // Get the list of installed packages
        // =========================================================================
-       packages = atomsGetInstalled(section);
+       installedpackages = atomsGetInstalled(section);
        
        // Loop on name
        // =========================================================================
        
-       for i=1:size(name,"*")
+       for i=1:size(packages(:,1),"*")
                
                // Filter on names
-               this_packages = packages( find(packages(:,1) == name(i))     ,:);
+               this_packages = installedpackages( find(installedpackages(:,1) == packages(i,1))     ,:);
                
                if this_packages == [] then
                        res(i) = "";
@@ -79,7 +74,7 @@ function res = atomsGetInstalledPath(name,version,section)
                end
                
                // Filter on versions
-               this_packages = this_packages( find(this_packages(:,2) == version(i)) ,:);
+               this_packages = this_packages( find(this_packages(:,2) == packages(i,2)) ,:);
                
                if this_packages == [] then
                        res(i) = "";
@@ -89,8 +84,4 @@ function res = atomsGetInstalledPath(name,version,section)
                res(i) = this_packages(1,4);
        end
        
-       // Reshape the matrix
-       // =========================================================================
-       res = matrix(res,size(name) );
-       
 endfunction
index f24a7d5..835c61a 100644 (file)
@@ -9,33 +9,27 @@
 
 // Liste des versions installée de la toolbox "name"
 
-function res = atomsGetInstalledStatus(name,version,section)
+function res = atomsGetInstalledStatus(packages,section)
        
        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));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsGetInstalledStatus",1,2));
        end
        
        // Check input parameters type
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(packages) <> 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));
+       if size(packages(1,:),"*") <> 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx2 string matrix expected.\n"),"atomsGetInstalledStatus",1));
        end
        
        // Allusers/user management
@@ -50,29 +44,29 @@ function res = atomsGetInstalledStatus(name,version,section)
                // Allusers can be a boolean or equal to "user" or "allusers"
                
                if type(section) <> 10 then
-                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsGetInstalledDetails",3));
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsGetInstalledStatus",2));
                end
                
                if and(section<>["user","allusers","all"]) then
-                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsGetInstalledDetails",3));
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'' or ''allusers'' or ''all'' expected.\n"),"atomsGetInstalledStatus",2));
                end
                
        end
        
        // Get the list of installed packages
        // =========================================================================
-       packages = atomsGetInstalled(section);
+       installedpackages = atomsGetInstalled(section);
        
        // Loop on name
        // =========================================================================
        
-       for i=1:size(name,"*")
+       for i=1:size(packages(:,1),"*")
                
                // Filter on names
-               packages_filtered = packages( find(packages(:,1) == name(i)) , : );
+               packages_filtered = installedpackages( find(installedpackages(:,1) == packages(i,1)) , : );
                
                // Filter on versions
-               packages_filtered = packages_filtered( find(packages_filtered(:,2) == version(i)) , : );
+               packages_filtered = packages_filtered( find(packages_filtered(:,2) == packages(i,2)) , : );
                
                if ~ isempty(packages_filtered) then
                        res(i) = packages_filtered(1,5);
index be3a7e0..a033591 100644 (file)
@@ -62,6 +62,10 @@ function [insList,depTree] = atomsInstallList(packages,section)
                error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsInstallList",1));
        end
        
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix expected.\n"),"atomsInstall",1));
+       end
+       
        packages = stripblanks(packages);
        
        // 2nd input input argument, section management :
@@ -89,42 +93,33 @@ function [insList,depTree] = atomsInstallList(packages,section)
                
        end
        
+       // If mx1 matrix, add a 2nd column with empty versions
+       // =========================================================================
+       if size(packages(1,:),"*") == 1 then
+               packages = [ packages emptystr(size(packages(:,1),"*"),1) ];
+       end
+       
        // Loop on packages and to build the dependency tree
        // =========================================================================
        
-       for i=1:size(packages,"*")
-               
-               package = packages(i);
+       for i=1:size(packages(:,1),"*")
                
-               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
+               this_package_name    = packages(i,1);
+               this_package_version = packages(i,2);
                
-               // 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);
+               // Now check if it's a valid package
+               if ~ atomsIsPackage(packages(i,:)) then
+                       if isempty(this_package_version) then
+                               module_full_name = this_package_name;
                        else
-                               package_full_name = package_names(i)+" - "+package_versions(i);
+                               module_full_name = this_package_name+" - "+this_package_version;
                        end
                        chdir(initialpath);
-                       error(msprintf(gettext("%s: The package %s is not available.\n"),"atomsInstallList",package_full_name));
+                       error(msprintf(gettext("%s: The package %s is not available.\n"),"atomsInstallList",module_full_name));
                end
                
                // Build the depencency tree
-               [tree,version_out]  = atomsDepTreeFlat(package_names(i),package_versions(i));
+               [tree,version_out]  = atomsDepTreeFlat(this_package_name,this_package_version);
                
                if (type(tree) == 4) & (~ tree) then
                        chdir(initialpath);
@@ -133,7 +128,7 @@ function [insList,depTree] = atomsInstallList(packages,section)
                
                // Update the  package_versions(i) with the version returned by
                // atomsDepTreeFlat
-               package_versions(i) = version_out;
+               packages(i,2) = version_out;
                
                // Concatenate the tree with the existing one
                depTree = atomsCatTree( depTree , tree );
@@ -143,10 +138,10 @@ function [insList,depTree] = atomsInstallList(packages,section)
        // 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;
+       for i=1:size(packages(:,1),"*")
+               this_package_details                     = depTree(packages(i,1)+" - "+packages(i,2));
+               this_package_details("user_choice")      = %T;
+               depTree(packages(i,1)+" - "+packages(i,2)) = this_package_details;
        end
        
        // Now we have the list of package that have to be installed
@@ -181,7 +176,7 @@ function [insList,depTree] = atomsInstallList(packages,section)
                //   - 3rd case: section is equal to "allusers", module is only searched
                //               in the "allusers" section"
                
-               if atomsIsInstalled(this_package_name,[],section) then
+               if atomsIsInstalled(this_package_name,section) then
                        vers = atomsGetInstalledVers(this_package_name,section);
                        if find( vers == this_package_version ) == [] then
                                to_install = %T;
index f209ef4..936e1fb 100644 (file)
 //
 //   result : . Boolean Array
 
-function result = atomsIsDirectChild(parent_name,parent_version,child_name)
+function result = atomsIsDirectChild(parent_packages,child_name)
        
        rhs    = argn(2);
        result = [];
        
        // Check number of input arguments
        // =========================================================================
-       if rhs <> 3 then
-               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsIsDirectChild",4));
+       if rhs <> 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsIsDirectChild",2));
        end
        
        // Check input parameter type
        // =========================================================================
        
-       if type(parent_name) <> 10 then
-               error(msprintf(gettext("%s: Wrong type for input argument #%d: A Single String expected.\n"),"atomsIsDirectChild",1));
+       if type(parent_packages) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsIsDirectChild",1));
        end
        
-       if type(parent_version) <> 10 then
-               error(msprintf(gettext("%s: Wrong type for input argument #%d: A Single String expected.\n"),"atomsIsDirectChild",2));
+       if size(parent_packages(1,:),"*") <> 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx2 string matrix expected.\n"),"atomsIsDirectChild",1));
        end
        
        if type(child_name) <> 10 then
-               error(msprintf(gettext("%s: Wrong type for input argument #%d: A Single String expected.\n"),"atomsIsDirectChild",3));
-       end
-       
-       // Check input parameter dimension
-       // =========================================================================
-       
-       if size(parent_name,"*") <> size(parent_version,"*") then
-               error(msprintf(gettext("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"atomsIsDirectChild",1,2));
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: A Single String expected.\n"),"atomsIsDirectChild",2));
        end
        
        if size(child_name,"*") <> 1 then
@@ -69,13 +62,9 @@ function result = atomsIsDirectChild(parent_name,parent_version,child_name)
        // Loop on parents
        // =========================================================================
        
-       for i=1:size(parent_name,"*")
-               parent_deps = atomsToolboxDetails(parent_name(i),parent_version(i),"Depends");
+       for i=1:size(parent_packages(:,1),"*")
+               parent_deps = atomsToolboxDetails([parent_packages(i,:)],"Depends");
                result = [ result ; grep(parent_deps,"/\s"+child_name+"\s/","r") <> [] ];
        end
        
-       // reshape the matrix
-       // =========================================================================
-       result = matrix(result,size(parent_name) );
-       
 endfunction
index 42b4d95..5e8dae5 100644 (file)
@@ -11,7 +11,7 @@
 
 // Return true if the package is a valid package or not
 
-function result = atomsIsPackage(package_names,package_versions)
+function result = atomsIsPackage(packages)
        
        // Initialize
        // =========================================================================
@@ -21,20 +21,22 @@ function result = atomsIsPackage(package_names,package_versions)
        // =========================================================================
        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));
+       if rhs <> 1 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d expected.\n"),"atomsIsPackage",1));
        end
        
-       if type(package_names) <> 10 then
+       if type(packages) <> 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));
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix 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));
+       // If packages is mx1 matrix, add a 2nd column with empty versions
+       // =========================================================================
+       if size(packages(1,:),"*") == 1 then
+               packages = [ packages emptystr(size(packages(:,1),"*"),1) ];
        end
        
        // Get all package description
@@ -44,26 +46,19 @@ function result = atomsIsPackage(package_names,package_versions)
        // Loop on packages
        // =========================================================================
        
-       for i=1:size(package_names,"*")
+       for i=1:size(packages(:,1),"*")
                
-               result(i) = %F;
-               
-               if rhs == 1 then
-                       version = "";
-               else
-                       version = package_versions(i);
-               end
+               result(i) = %F,
+               name      = packages(i,1);
+               version   = packages(i,2);
                
                // 1st case : just test the name, not the version
-               if isempty(version) & isfield(allpackages,package_names(i)) then
+               if isempty(version) & isfield(allpackages,name) 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
+               elseif isfield(allpackages,name) then
+                       result(i) = isfield(allpackages(name),version);
                end
                
        end
index c385d8e..4e15a9c 100644 (file)
@@ -41,8 +41,8 @@ function packages = atomsOrphanList(section)
        installed_list = atomsGetInstalled(section);
        
        for i=1:size(installed_list(:,1),"*")
-               if isempty( atomsGetDepParents(installed_list(i,1),installed_list(i,2)) ) ..
-                       & (atomsGetInstalledStatus(installed_list(i,1),installed_list(i,2)) == "A") then
+               if isempty( atomsGetDepParents([installed_list(i,1) installed_list(i,2)]) ) ..
+                       & (atomsGetInstalledStatus([installed_list(i,1) installed_list(i,2)]) == "A") then
                        packages = [ packages ; installed_list(i,:) ];
                end
        end
index 8f24011..a41c81d 100644 (file)
@@ -85,7 +85,7 @@ function result = atomsPackageIsCompatible(parent_name,parent_version,child_name
                // Get the dependency field of this package
                // =========================================================================
                
-               parent_deps = atomsToolboxDetails(parent_name(i),parent_version(i),"Depends");
+               parent_deps = atomsToolboxDetails([parent_name(i),parent_version(i)],"Depends");
                
                if isempty(parent_deps)
                        result = [ result ; %F ];
index 2b98209..1975327 100644 (file)
@@ -43,19 +43,28 @@ function remList = atomsRemoveList(packages,section)
        
        // Check input parameters
        // =========================================================================
-       
        rhs = argn(2);
        
+       // Input argument number
+       // =========================================================================
+       
        if rhs <> 2 then
                error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"atomsRemoveList",2))
        end
        
+       // 1st input argument
+       // =========================================================================
+       
        if type(packages) <> 10 then
                error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsRemoveList",1));
        end
        
-       // Process the 2nd input argument : section
-       // Allusers can be equal to "user" or "allusers"
+       if size(packages(1,:),"*") > 2 then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: mx1 or mx2 string matrix expected.\n"),"atomsRemoveList",1));
+       end
+       
+       // 2nd input argument
+       // =========================================================================
        
        if type(section) <> 10 then
                error(msprintf(gettext("%s: Wrong type for input argument #%d: A boolean or a single string expected.\n"),"atomsRemoveList",2));
@@ -65,27 +74,25 @@ function remList = atomsRemoveList(packages,section)
                error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''all'' expected.\n"),"atomsRemoveList",2));
        end
        
-       // Loop on packages and to build the list of package to uninstall
+       // Remove leading and trailing whitespace
        // =========================================================================
-       
        packages = stripblanks(packages);
        
+       // If mx1 matrix, add a 2nd column with empty versions
+       // =========================================================================
+       if size(packages(1,:),"*") == 1 then
+               packages = [ packages emptystr(size(packages(:,1),"*"),1) ];
+       end
+       
+       // Loop on packages and to build the list of package to remove
+       // =========================================================================
+       
        // First step : List the packages wanted by the user
        
-       for i=1:size(packages,"*")
-               
-               package = packages(i);
+       for i=1:size(packages(:,1),"*")
                
-               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
+               package_names(i)    = packages(i,1);
+               package_versions(i) = packages(i,2);
                
                // get the list of the versions of this package to uninstall
                
@@ -101,10 +108,10 @@ function remList = atomsRemoveList(packages,section)
                for j=1:size(this_package_versions,"*")
                        
                        if section == "all" then
-                               if atomsIsInstalled(package_names(i),this_package_versions(j),"allusers") then
+                               if atomsIsInstalled([package_names(i) this_package_versions(j)],"allusers") then
                                        remList = [ remList ; "-" "U" package_names(i) this_package_versions(j) "allusers" ];
                                end
-                               if atomsIsInstalled(package_names(i),this_package_versions(j),"user") then
+                               if atomsIsInstalled([package_names(i) this_package_versions(j)],"user") then
                                        remList = [ remList ; "-" "U" package_names(i) this_package_versions(j) "user" ];
                                end
                        else
@@ -129,7 +136,7 @@ function remList = atomsRemoveList(packages,section)
                // (inevitably removed, unless we have not the right)
                // ----------------------------------------------------
                
-               this_package_parents = atomsGetDepParents(this_package_name,this_package_version);
+               this_package_parents = atomsGetDepParents([this_package_name this_package_version]);
                
                for j=1:size(this_package_parents(:,1),"*")
                        
@@ -139,7 +146,7 @@ function remList = atomsRemoveList(packages,section)
                        // Check if we have the right to remove this package
                        // If not, tag it as Broken (for later)
                        if section=="user" then
-                               details = atomsGetInstalledDetails(this_parent_name,this_parent_version,section);
+                               details = atomsGetInstalledDetails(this_package_parents(j,:),section);
                                if details(1,3) == "allusers" then
                                        remList = [ remList ; "~" "B" this_parent_name this_parent_version this_package_section ]; // B stands for "Broken"
                                        continue
@@ -156,7 +163,7 @@ function remList = atomsRemoveList(packages,section)
                // Get the childs of this toolbox
                // ----------------------------------------------
                
-               this_package_childs = atomsGetDepChilds(this_package_name,this_package_version);
+               this_package_childs = atomsGetDepChilds([this_package_name this_package_version]);
                
                for j=1:size(this_package_childs(:,1),"*")
                        
@@ -166,7 +173,7 @@ function remList = atomsRemoveList(packages,section)
                        // Check if we have the right to remove this package
                        // If not, Do not add it to the list
                        if section=="user" then
-                               details = atomsGetInstalledDetails(this_child_name,this_child_version,section);
+                               details = atomsGetInstalledDetails(this_package_childs(j,:),section);
                                if details(3) == "allusers" then
                                        continue
                                end
@@ -202,14 +209,14 @@ function remList = atomsRemoveList(packages,section)
                // => Do not install it
                // ----------------------------------------------
                
-               if atomsGetInstalledStatus(this_package_name,this_package_version,section) == "I" then
+               if atomsGetInstalledStatus([this_package_name this_package_version],section) == "I" then
                        remList(i,1) = "~";
                end
                
                // Get the parents of this toolbox
                // ----------------------------------------------
                
-               this_package_parents = atomsGetDepParents(this_package_name,this_package_version);
+               this_package_parents = atomsGetDepParents([this_package_name this_package_version]);
                
                for j=1:size(this_package_parents(:,1),"*")
                        
index 84cf0aa..ff3529b 100644 (file)
@@ -9,64 +9,59 @@
 
 // Return the mlist associated with the wanted toolbox
 
-function details = atomsToolboxDetails(name,version,field)
+function details = atomsToolboxDetails(package,field)
        
        rhs = argn(2);
        
        // 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"),"atomsToolboxDetails",2,3));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsToolboxDetails",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"),"atomsToolboxDetails",1));
+       if type(package) <> 10 then
+               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsToolboxDetails",1));
        end
        
-       if type(version)<>10  then
+       if rhs>1 & type(field)<>10 then
                error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsToolboxDetails",2));
        end
        
-       if rhs>2 & type(field)<>10 then
-               error(msprintf(gettext("%s: Wrong type for input argument #%d: A single string expected.\n"),"atomsToolboxDetails",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"),"atomsToolboxDetails",1));
+       if or(size(package) <> [1 2]) then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: 1x2 string matrix expected.\n"),"atomsToolboxDetails",1));
        end
        
-       if size(version,"*") <> 1 then
+       if rhs>1 & size(field,"*") <> 1 then
                error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsToolboxDetails",2));
        end
        
-       if rhs>2 & size(field,"*") <> 1 then
-               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsToolboxDetails",3));
-       end
-       
-       // Get the list of installed packages
+       // Get the full list of packages
        // =========================================================================
-       packages = atomsGetTOOLBOXES();
+       repositorypackages = atomsGetTOOLBOXES();
+       
+       name    = package(1);
+       version = package(2);
        
-       if ~ isfield(packages,name) then
-               if ~ atomsIsInstalled(name,version) then
+       if ~ isfield(repositorypackages,name) then
+               if ~ atomsIsInstalled(package) then
                        // The module is not (or no more) present on the repository and not installed
                        // => in a nutshell, unknown
                        error(msprintf(gettext("%s: the package ''%s'' doesn''t exist.\n"),"atomsToolboxDetails",name));
                else
                        // The module has been removed from the repository but it's still 
                        // installed
-                       packages = atomsDESCRIPTIONread(atomsGetInstalledPath(name,version)+filesep()+"DESCRIPTION");
+                       repositorypackages = atomsDESCRIPTIONread(atomsGetInstalledPath(package)+filesep()+"DESCRIPTION");
                end
        end
        
-       package_versions = packages(name);
+       package_versions = repositorypackages(name);
        
        if ~ isfield(package_versions,version) then
                error(msprintf(gettext("%s: the package ''%s'' doesn''t exist.\n"),"atomsToolboxDetails",name+" - "+version));
@@ -77,7 +72,7 @@ function details = atomsToolboxDetails(name,version,field)
        // A field is gived :
        // =========================================================================
        
-       if rhs>2 then
+       if rhs>=2 then
                
                if ~ isfield(details,field) then
                        error(msprintf(gettext("%s: the package ''%s'' doesn''t contain the field ''%s''.\n"),"atomsToolboxDetails",name+" - "+version,field));
@@ -91,9 +86,9 @@ function details = atomsToolboxDetails(name,version,field)
        // Check if this version is installed
        // =========================================================================
        
-       if atomsIsInstalled(name,version) then
+       if atomsIsInstalled([name version]) then
                
-               installedDetails = atomsGetInstalledDetails(name,version);
+               installedDetails = atomsGetInstalledDetails(package);
                details("installAlluser") = installedDetails(3);
                details("installPath")    = installedDetails(4);
                details("installStatus")  = installedDetails(5);
index 10c7a75..10a604f 100644 (file)
@@ -70,8 +70,8 @@ function atomsToremoveProcess(section)
        // And now action
        // =========================================================================
        for i=1:size(toremove,:)
-               if atomsIsInstalled(toremove(i,1),toremove(i,2)) then
-                       atomsRemove(toremove(i,1)+" "+toremove(i,2),section);
+               if atomsIsInstalled([toremove(i,1) toremove(i,2)]) then
+                       atomsRemove([toremove(i,1) toremove(i,2)],section);
                end
        end
        
index 196f192..38fba1e 100644 (file)
@@ -9,7 +9,7 @@
 
 // Update the dependencies with the installation of this new package
 
-function packages_out = atomsUpdateDeps(name,version,section)
+function packages_out = atomsUpdateDeps(package,section)
        
        rhs          = argn(2);
        packages_out = [];
@@ -17,50 +17,39 @@ function packages_out = atomsUpdateDeps(name,version,section)
        // 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"),"atomsUpdateDeps",2,3));
+       if rhs < 1 | rhs > 2 then
+               error(msprintf(gettext("%s: Wrong number of input argument: %d to %d expected.\n"),"atomsUpdateDeps",1,2));
        end
        
-       // Check input parameters type
+       // Check input parameters
        // =========================================================================
        
-       if type(name) <> 10 then
+       if type(package) <> 10 then
                error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsUpdateDeps",1));
        end
        
-       if type(version)<>10  then
-               error(msprintf(gettext("%s: Wrong type for input argument #%d: String array expected.\n"),"atomsUpdateDeps",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"),"atomsUpdateDeps",1));
-       end
-       
-       if size(version,"*")<>1  then
-               error(msprintf(gettext("%s: Wrong size for input argument #%d: A single string expected.\n"),"atomsUpdateDeps",2));
+       if or( size(package) <> [1 2]) then
+               error(msprintf(gettext("%s: Wrong size for input argument #%d: 1x2 string matrix expected.\n"),"atomsUpdateDeps",1));
        end
        
        // All user management
        // =========================================================================
        
-       if rhs < 3 then
+       if rhs < 2 then
                section = "all";
        
        else
        
                if type(section) <> 10 then
-                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A single-string expected.\n"),"atomsUpdateDeps",3));
+                       error(msprintf(gettext("%s: Wrong type for input argument #%d: A single-string expected.\n"),"atomsUpdateDeps",2));
                end
                
                if size(section,"*")<>1 then
-                       error(msprintf(gettext("%s: Wrong size for input argument #%d: A single-string expected.\n"),"atomsUpdateDeps",3));
+                       error(msprintf(gettext("%s: Wrong size for input argument #%d: A single-string expected.\n"),"atomsUpdateDeps",2));
                end
                
                if and(section<>["user","allusers","all"]) then
-                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''all'' expected.\n"),"atomsUpdateDeps",3));
+                       error(msprintf(gettext("%s: Wrong value for input argument #%d: ''user'',''allusers'' or ''all'' expected.\n"),"atomsUpdateDeps",2));
                end
                
        end
@@ -68,8 +57,8 @@ function packages_out = atomsUpdateDeps(name,version,section)
        // The package designed by "name - version" must be installed
        // =========================================================================
        
-       if ~ atomsIsInstalled(name,version) then
-               error(msprintf(gettext("%s: %s (%s) isn''t installed.\n"),"atomsUpdateDeps",name,version));
+       if ~ atomsIsInstalled(package) then
+               error(msprintf(gettext("%s: %s (%s) isn''t installed.\n"),"atomsUpdateDeps",package(1),package(2)));
        end
        
        // If alluser, process the 2 list (allusers and user)
@@ -81,6 +70,9 @@ function packages_out = atomsUpdateDeps(name,version,section)
                allusers_mat = [ allusers_mat ; "allusers" ];
        end
        
+       name    = package(1);
+       version = package(2);
+       
        for i=1:size(allusers_mat,"*")
                
                // Load the struct
@@ -107,8 +99,8 @@ function packages_out = atomsUpdateDeps(name,version,section)
                        // Premier tri : on ne garde que les packages dont le package "<name>"
                        // est un enfant direct 
                        
-                       concerned_names_filt    = concerned_names(    atomsIsDirectChild(concerned_names,concerned_versions,name));
-                       concerned_versions_filt = concerned_versions( atomsIsDirectChild(concerned_names,concerned_versions,name));
+                       concerned_names_filt    = concerned_names(    atomsIsDirectChild([concerned_names concerned_versions],name));
+                       concerned_versions_filt = concerned_versions( atomsIsDirectChild([concerned_names concerned_versions],name));
                        
                        // if "name" is not the direct child of packages(j) or of one of the child
                        // of packages(j) :