]> Creatis software - CreaPhase.git/blob - octave_packages/m/plot/gnuplot_binary.m
update packages
[CreaPhase.git] / octave_packages / m / plot / gnuplot_binary.m
1 ## Copyright (C) 2008-2012 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 @code{"gnuplot"} without additional arguments.
26 ## @xref{Installation}.
27 ## @end deftypefn
28
29 ## Author: jwe
30
31 function [prog, args] = gnuplot_binary (new_prog, varargin)
32
33   persistent gp_binary = "gnuplot";
34   persistent gp_args = {};
35
36   if (nargout > 0 || nargin == 0)
37     prog = gp_binary;
38     args = gp_args;
39   endif
40
41   if (nargin == 1)
42     if (ischar (new_prog))
43       if (! isempty (new_prog))
44         gp_binary = new_prog;
45       else
46         error ("gnuplot_binary: value must not be empty");
47       endif
48     else
49       error ("gnuplot_binary: expecting program to be a character string");
50     endif
51   endif
52
53   if (nargin > 1)
54     if (iscellstr (varargin))
55       gp_args = varargin;
56     else
57       error ("gnuplot_binary: expecting arguments to be character strings");
58     endif
59   endif
60
61 endfunction