annotate scripts/plot/__gnuplot_open_stream__.m @ 11104:2c356a35d7f5

fix copyright notices
author John W. Eaton <jwe@octave.org>
date Sun, 17 Oct 2010 23:43:42 -0400
parents c60a9e1a0372
children 1740012184f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9113
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
1 ## Copyright (C) 2009 Ben Abbott
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
2 ##
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
3 ## This file is part of Octave.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
4 ##
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
6 ## under the terms of the GNU General Public License as published by
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
8 ## your option) any later version.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
9 ##
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
13 ## General Public License for more details.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 9561
diff changeset
14 ##
9113
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
18
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
19 ## -*- texinfo -*-
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
20 ## @deftypefn {Function File} {@var{stream}} __gnuplot_open_stream__ (@var{npipes}, @var{h})
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
21 ## Undocumented internal function.
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
22 ## @end deftypefn
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
23
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
24 ## Author: Ben Abbott <bpabbott@mac.com>
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
25 ## Created: 2009-04-11
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
26
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
27 function plot_stream = __gnuplot_open_stream__ (npipes, h)
9461
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 9113
diff changeset
28 [prog, args] = gnuplot_binary ();
9113
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
29 if (npipes > 1)
9461
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 9113
diff changeset
30 [plot_stream(1), plot_stream(2), pid] = popen2 (prog, args{:});
9113
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
31 if (pid < 0)
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
32 error ("__gnuplot_open_stream__: failed to open connection to gnuplot.");
9561
c60a9e1a0372 try to avoid gnuplot zombies
John W. Eaton <jwe@octave.org>
parents: 9461
diff changeset
33 else
c60a9e1a0372 try to avoid gnuplot zombies
John W. Eaton <jwe@octave.org>
parents: 9461
diff changeset
34 plot_stream(3) = pid;
9113
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
35 endif
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
36 else
9461
ff8d7f3ad203 gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents: 9113
diff changeset
37 plot_stream = popen (sprintf ("%s ", prog, args{:}), "w");
9113
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
38 if (plot_stream < 0)
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
39 error ("__gnuplot_open_stream__: failed to open connection to gnuplot.");
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
40 endif
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
41 endif
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
42 if (nargin > 1)
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
43 set (h, "__plot_stream__", plot_stream);
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
44 endif
4bb94a71913b __gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
45 endfunction