comparison scripts/plot/util/gnuplot_binary.in @ 19705:bf27e21f0bfb

maint: Merge default to temporary audio-gsoc branch.
author John W. Eaton <jwe@octave.org>
date Wed, 31 Dec 2014 14:59:42 -0500
parents d63878346099
children 4197fc428c7d
comparison
equal deleted inserted replaced
19704:dac3191a5301 19705:bf27e21f0bfb
1 ## Copyright (C) 2008-2013 John W. Eaton
2 ##
3 ## This file is part of Octave.
4 ##
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
9 ##
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
18
19 ## -*- texinfo -*-
20 ## @deftypefn {Loadable Function} {[@var{prog}, @var{args}] =} gnuplot_binary ()
21 ## @deftypefnx {Loadable Function} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog}, @var{arg1}, @dots{})
22 ## Query or set the name of the program invoked by the plot command
23 ## when the graphics toolkit is set to "gnuplot". Additional arguments to
24 ## pass to the external plotting program may also be given.
25 ## The default value is @qcode{"gnuplot"} with no additional arguments.
26 ## @xref{Installation}.
27 ## @seealso{graphics_toolkit}
28 ## @end deftypefn
29
30 ## Author: jwe
31
32 function [prog, args] = gnuplot_binary (new_prog, varargin)
33
34 persistent gp_binary = %OCTAVE_CONF_GNUPLOT%;
35 persistent gp_args = {};
36
37 if (nargout > 0 || nargin == 0)
38 prog = gp_binary;
39 args = gp_args;
40 endif
41
42 if (nargin == 1)
43 if (! ischar (new_prog) || isempty (new_prog))
44 error ("gnuplot_binary: NEW_PROG must be a non-empty string");
45 endif
46 gp_binary = new_prog;
47 endif
48
49 if (nargin > 1)
50 if (! iscellstr (varargin))
51 error ("gnuplot_binary: arguments must be character strings");
52 endif
53 gp_args = varargin;
54 endif
55
56 endfunction
57
58
59 %!test
60 %! orig_val = gnuplot_binary ();
61 %! old_val = gnuplot_binary ("X");
62 %! assert (orig_val, old_val);
63 %! assert (gnuplot_binary (), "X");
64 %! gnuplot_binary (orig_val);
65 %! assert (gnuplot_binary (), orig_val);