1
## Copyright (C) 2005-2013 Søren Hauberg
2
## Copyright (C) 2010 VZLU Prague, a.s.
4
## This file is part of Octave.
6
## Octave is free software; you can redistribute it and/or modify it
7
## under the terms of the GNU General Public License as published by
8
## the Free Software Foundation; either version 3 of the License, or (at
9
## your option) any later version.
11
## Octave is distributed in the hope that it will be useful, but
12
## WITHOUT ANY WARRANTY; without even the implied warranty of
13
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
## General Public License for more details.
16
## You should have received a copy of the GNU General Public License
17
## along with Octave; see the file COPYING. If not, see
18
## <http://www.gnu.org/licenses/>.
21
## @deftypefn {Function File} {@var{newdesc} =} save_order (@var{desc})
22
## Undocumented internal function.
25
function newdesc = save_order (desc)
27
for i = 1 : length (desc)
28
deps = desc{i}.depends;
30
|| (length (deps) == 1 && strcmp (deps{1}.package, "octave")))
31
newdesc {end + 1} = desc{i};
34
for k = 1 : length (deps)
35
for j = 1 : length (desc)
36
if (strcmp (desc{j}.name, deps{k}.package))
37
tmpdesc{end+1} = desc{j};
42
if (! isempty (tmpdesc))
43
newdesc = {newdesc{:}, save_order(tmpdesc){:}, desc{i}};
45
newdesc{end+1} = desc{i};
49
## Eliminate the duplicates.
51
for i = 1 : length (newdesc)
52
for j = (i + 1) : length (newdesc)
53
if (strcmp (newdesc{i}.name, newdesc{j}.name))