This file is indexed.

/usr/share/octave/packages/parallel-2.2.0/bw_retrieve.m is in octave-parallel 2.2.0-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
## Copyright (C) 2009 Olaf Till <i7tiol@t-online.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn {Function File} {} bw_retrieve (@var{f}, @var{args}, @var{fn}, [@var{matlab}])
## Retrieve results of computations started with @code{bw_start ()}.
## Computation need not be finished for all arguments. @var{f}, @var{args}:
## function name and filename of arguments given to @code{bw_start ()}. @var{fn}:
## path to file to save results in. @var{matlab}: if given and true, results
## are stored in Matlab compatible binary format; otherwise the binary
## format of Octave is used.
##
## Three variables are saved, "results" is a cell-array of results (empty
## entry if no result), one for each argument set, "errors" a vector
## with non-zero elements for each argument set which caused an error,
## and "messages" is a cell-array of the respective error messages, or
## empty values if there was none.
## @seealso {bw_start, bw_list, bw_clear}
## @end deftypefn

function bw_retrieve (varargin)

  if ((nargs = length (varargin)) < 3 || nargs > 4)
    error ("bw_retrieve: incorrect number of arguments");
  endif
  for id = 1:3
    if (! ischar (varargin{id}) || size (varargin{id}, 1) > 1)
      error ("bw_retrieve: argument %i not a (single) string", id);
    endif
  endfor
  if (nargs == 4 && varargin{4})
    matlab = true;
  else
    matlab = false;
  endif

  ## default directories
  data_dir = tilde_expand ("~/bw-data/");
  state_dir = tilde_expand ("~/.bw-state/");

  ## configuration files
  systemrc = fullfile (OCTAVE_HOME (), "share/octave/site/m/startup/bwrc");
  userrc = "~/.bwrc";

  ## Read system-wide configuration.
  source (systemrc);

  ## Read per-user configuration.
  if (! isempty (stat (userrc)))
    source (userrc);
  endif
  data_dir = tilde_expand (data_dir);
  state_dir = tilde_expand (state_dir);

  if (isempty (stat (state_dir)))
    error ("bw_list: configured state directory %s does not exist", ...
           state_dir);
  endif

  path = fullfile (state_dir, ...
                   sprintf ("%s-%s.state", ...
                            varargin{1}, varargin{2}));
  if (isempty (stat (path)))
    error ("bw_retrieve: no state-file found for function %s and argumentfile %s", ...
           varargin{1}, varargin{2});
  endif
  tp = __bw_load_variable__ (path);
  results = tp.results;
  errors = tp.error;
  messages = tp.msg;

  if (matlab)
    save ("-matl", varargin{3}, "results", "errors", "messages");
  else
    save ("-binary", varargin{3}, "results", "errors", "messages");
  endif

endfunction