annotate scripts/pkg/private/describe.m @ 21615:9ccd64201b4d

pkg: remove excessive number of private function files. pkg() makes use of many subfunctions, themselves with several subfunctions. They used to all be in a single file which became difficult to hack so it was split into one file per function (even though they all remained private). This change merges some of those functions back together so that only the functions used by pkg itself, as well as subfunctions used by more than one of those, remain as separate files. * copy_built_files.m, copy_files.m, create_pkgadddel.m, extract_pkg.m, finish_installation.m, generate_lookfor_cache.m, prepare_installation.m, verify_directory.m: merged this functions into install.m since they are only used by it. * fix_depends.m, fix_version.m: merged this functions into get_description.m since they are only used by it. * getarchprefix.m: merged into create_pkgadddel.m which then got merged into install.m. * is_architecture_dependent.m: merged into copy_built_files.m which then got merged into install.m. * load_package_dirs.m: merged into load_packages_and_dependencies.m * packinfo_copy_file.m, write_index.m: merged into copy_files.m which then then got merged into install.m. * parse_pkg_idx, print_package_description.m: merged into describe.m * shell.m: merged into configure_make.m * pkg/module.mk: update with removed files.
author Carnë Draug <carandraug@octave.org>
date Tue, 12 Apr 2016 17:46:20 +0100
parents 516bb87ea72e
children dcf8922b724b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
1 ## Copyright (C) 2005-2015 Søren Hauberg
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
2 ## Copyright (C) 2010 VZLU Prague, a.s.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
3 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
4 ## This file is part of Octave.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
5 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
7 ## under the terms of the GNU General Public License as published by
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
9 ## your option) any later version.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
10 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
14 ## General Public License for more details.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
15 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
18 ## <http://www.gnu.org/licenses/>.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
19
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
20 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
21 ## @deftypefn {} {[@var{pkg_desc_list}, @var{flag}] =} describe (@var{pkgnames}, @var{verbose}, @var{local_list}, @var{global_list})
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
22 ## Undocumented internal function.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
23 ## @end deftypefn
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
24
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
25 function [pkg_desc_list, flag] = describe (pkgnames, verbose,
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
26 local_list, global_list)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
27
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
28 ## Get the list of installed packages.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
29 installed_pkgs_lst = installed_packages(local_list, global_list);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
30 num_packages = length (installed_pkgs_lst);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
31
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
32 describe_all = false;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
33 if (any (strcmp ("all", pkgnames)))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
34 describe_all = true;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
35 flag(1:num_packages) = {"Not Loaded"};
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
36 num_pkgnames = num_packages;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
37 else
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
38 num_pkgnames = length (pkgnames);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
39 flag(1:num_pkgnames) = {"Not installed"};
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
40 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
41
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
42 for i = 1:num_packages
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
43 curr_name = installed_pkgs_lst{i}.name;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
44 if (describe_all)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
45 name_pos = i;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
46 else
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14479
diff changeset
47 name_pos = find (strcmp (curr_name, pkgnames));
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
48 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
49
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
50 if (! isempty (name_pos))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
51 if (installed_pkgs_lst{i}.loaded)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
52 flag{name_pos} = "Loaded";
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
53 else
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
54 flag{name_pos} = "Not loaded";
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
55 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
56
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
57 pkg_desc_list{name_pos}.name = installed_pkgs_lst{i}.name;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
58 pkg_desc_list{name_pos}.version = installed_pkgs_lst{i}.version;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
59 pkg_desc_list{name_pos}.description = installed_pkgs_lst{i}.description;
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
60 pkg_desc_list{name_pos}.provides = parse_pkg_idx (installed_pkgs_lst{i}.dir);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
61
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
62 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
63 endfor
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
64
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
65 non_inst = find (strcmp (flag, "Not installed"));
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
66 if (! isempty (non_inst))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
67 if (nargout < 2)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
68 non_inst_str = sprintf (" %s ", pkgnames{non_inst});
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
69 error ("some packages are not installed: %s", non_inst_str);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
70 else
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
71 pkg_desc_list{non_inst} = struct ("name", {}, "description",
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
72 {}, "provides", {});
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
73 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
74 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
75
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
76 if (nargout == 0)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
77 for i = 1:num_pkgnames
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
78 print_package_description (pkg_desc_list{i}.name,
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
79 pkg_desc_list{i}.version,
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
80 pkg_desc_list{i}.provides,
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
81 pkg_desc_list{i}.description,
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
82 flag{i}, verbose);
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
83 endfor
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
84 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
85 endfunction
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 17176
diff changeset
86
21615
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
87
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
88 ## Read an INDEX file.
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
89 function pkg_idx_struct = parse_pkg_idx (packdir)
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
90
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
91 index_file = fullfile (packdir, "packinfo", "INDEX");
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
92
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
93 if (! exist (index_file, "file"))
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
94 error ("could not find any INDEX file in directory %s, try 'pkg rebuild all' to generate missing INDEX files", packdir);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
95 endif
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
96
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
97
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
98 [fid, msg] = fopen (index_file, "r");
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
99 if (fid == -1)
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
100 error ("the INDEX file %s could not be read: %s",
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
101 index_file, msg);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
102 endif
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
103
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
104 cat_num = 1;
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
105 pkg_idx_struct{1}.category = "Uncategorized";
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
106 pkg_idx_struct{1}.functions = {};
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
107
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
108 line = fgetl (fid);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
109 while (isempty (strfind (line, ">>")) && ! feof (fid))
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
110 line = fgetl (fid);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
111 endwhile
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
112
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
113 while (! feof (fid) || line != -1)
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
114 if (! any (! isspace (line)) || line(1) == "#" || any (line == "="))
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
115 ## Comments, blank lines or comments about unimplemented
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
116 ## functions: do nothing
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
117 ## FIXME: probably comments and pointers to external functions
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
118 ## could be treated better when printing to screen?
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
119 elseif (! isempty (strfind (line, ">>")))
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
120 ## Skip package name and description as they are in DESCRIPTION
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
121 ## already.
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
122 elseif (! isspace (line(1)))
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
123 ## Category.
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
124 if (! isempty (pkg_idx_struct{cat_num}.functions))
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
125 pkg_idx_struct{++cat_num}.functions = {};
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
126 endif
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
127 pkg_idx_struct{cat_num}.category = deblank (line);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
128 else
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
129 ## Function names.
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
130 while (any (! isspace (line)))
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
131 [fun_name, line] = strtok (line);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
132 pkg_idx_struct{cat_num}.functions{end+1} = deblank (fun_name);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
133 endwhile
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
134 endif
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
135 line = fgetl (fid);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
136 endwhile
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
137 fclose (fid);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
138 endfunction
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
139
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
140
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
141 function print_package_description (pkg_name, pkg_ver, pkg_idx_struct,
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
142 pkg_desc, status, verbose)
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
143 printf ("---\nPackage name:\n\t%s\n", pkg_name);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
144 printf ("Version:\n\t%s\n", pkg_ver);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
145 printf ("Short description:\n\t%s\n", pkg_desc);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
146 printf ("Status:\n\t%s\n", status);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
147 if (verbose)
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
148 printf ("---\nProvides:\n");
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
149 for i = 1:length (pkg_idx_struct)
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
150 if (! isempty (pkg_idx_struct{i}.functions))
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
151 printf ("%s\n", pkg_idx_struct{i}.category);
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
152 for j = 1:length (pkg_idx_struct{i}.functions)
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
153 printf ("\t%s\n", pkg_idx_struct{i}.functions{j});
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
154 endfor
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
155 endif
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
156 endfor
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
157 endif
9ccd64201b4d pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents: 20852
diff changeset
158 endfunction