Mercurial > hg > octave-nkf
annotate scripts/plot/util/gnuplot_binary.in @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 777f26aa8e3e |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
1 ## Copyright (C) 2008-2015 John W. Eaton |
7361 | 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 -*- | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
20 ## @deftypefn {Loadable Function} {[@var{prog}, @var{args}] =} gnuplot_binary () |
9467
49f890499ebc
fix typo in gnuplot_binary
Jaroslav Hajek <highegg@gmail.com>
parents:
9461
diff
changeset
|
21 ## @deftypefnx {Loadable Function} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog}, @var{arg1}, @dots{}) |
20383
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
22 ## Query or set the name of the program invoked by the plot command when the |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
23 ## graphics toolkit is set to "gnuplot". |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
24 ## |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
25 ## Additional arguments to pass to the external plotting program may also be |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
26 ## given. The default value is @qcode{"gnuplot"} with no additional arguments. |
12215
4ae2a74ed04c
Add fltk_gui_mode, fltk_mouse_wheel_zoom to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11563
diff
changeset
|
27 ## @xref{Installation}. |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
28 ## @seealso{graphics_toolkit} |
7361 | 29 ## @end deftypefn |
30 | |
31 ## Author: jwe | |
32 | |
9461
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
7361
diff
changeset
|
33 function [prog, args] = gnuplot_binary (new_prog, varargin) |
7361 | 34 |
35 persistent gp_binary = %OCTAVE_CONF_GNUPLOT%; | |
9461
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
7361
diff
changeset
|
36 persistent gp_args = {}; |
7361 | 37 |
38 if (nargout > 0 || nargin == 0) | |
9461
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
7361
diff
changeset
|
39 prog = gp_binary; |
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
7361
diff
changeset
|
40 args = gp_args; |
7361 | 41 endif |
42 | |
43 if (nargin == 1) | |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
44 if (! ischar (new_prog) || isempty (new_prog)) |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
45 error ("gnuplot_binary: NEW_PROG must be a non-empty string"); |
7361 | 46 endif |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
47 gp_binary = new_prog; |
9461
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
7361
diff
changeset
|
48 endif |
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
7361
diff
changeset
|
49 |
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
7361
diff
changeset
|
50 if (nargin > 1) |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
51 if (! iscellstr (varargin)) |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
52 error ("gnuplot_binary: arguments must be character strings"); |
9461
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
7361
diff
changeset
|
53 endif |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
54 gp_args = varargin; |
7361 | 55 endif |
56 | |
57 endfunction | |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
58 |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
59 |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
60 %!test |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
61 %! orig_val = gnuplot_binary (); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
62 %! old_val = gnuplot_binary ("X"); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
63 %! assert (orig_val, old_val); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
64 %! assert (gnuplot_binary (), "X"); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
65 %! gnuplot_binary (orig_val); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
66 %! assert (gnuplot_binary (), orig_val); |