annotate libinterp/dldfcn/__init_gnuplot__.cc @ 21966:112b20240c87

move docstrings in C++ files out of C strings and into comments * __contourc__.cc, __dispatch__.cc, __dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __luinc__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc, cellfun.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, defaults.cc, det.cc, dirfns.cc, dlmread.cc, dot.cc, eig.cc, ellipj.cc, error.cc, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, graphics.cc, hash.cc, help.cc, hess.cc, hex2num.cc, input.cc, inv.cc, kron.cc, load-path.cc, load-save.cc, lookup.cc, ls-oct-text.cc, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mgorth.cc, nproc.cc, oct-hist.cc, octave-link.cc, ordschur.cc, pager.cc, pinv.cc, pr-output.cc, profiler.cc, psi.cc, pt-jit.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc, sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symtab.cc, syscalls.cc, sysdep.cc, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc, convhulln.cc, dmperm.cc, fftw.cc, qr.cc, symbfact.cc, symrcm.cc, ov-base.cc, ov-bool-mat.cc, ov-cell.cc, ov-class.cc, ov-classdef.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-java.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-range.cc, ov-re-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-usr-fcn.cc, ov.cc, octave.cc, pt-arg-list.cc, pt-binop.cc, pt-eval.cc, pt-mat.cc, lex.ll, oct-parse.in.yy: Docstrings are now comments instead of C strings. * build-aux/mk-opts.pl: Emit docstrings as comments instead of C strings. * DASPK-opts.in, LSODE-opts.in: Don't quote " in docstring fragments. * builtins.h: Include builtin-defun-decls.h unconditionally. * defun.h (DEFUN, DEFUNX, DEFCONSTFUN): Simply emit declaration. (DEFALIAS): Always expand to nothing. * defun-dld.h: No special macro expansions for MAKE_BUILTINS. (DEFUN_DLD): Use FORWARD_DECLARE_FUN. (DEFUNX_DLD): Use FORWARD_DECLARE_FUNX. * defun-int.h: No special macro expansions for MAKE_BUILTINS. (FORWARD_DECLARE_FUN, FORWARD_DECLARE_FUNX): New macros. (DEFINE_FUN_INSTALLER_FUN): If compiling an Octave source file, pass "external-doc" to DEFINE_FUNX_INSTALLER_FUN. (DEFUN_INTERNAL, DEFCONSTFUN_INTERNAL, DEFUNX_INTERNAL, DEFALIAS_INTERNAL): Delete. * common.mk (move_if_change_rule): New macro. (simple_move_if_change_rule): Define using move_if_change_rule. * find-defun-files.sh (DEFUN_PATTERN): Update. Don't transform file name extension to ".df". * libinterp/mk-pkg-add, gendoc.pl: Operate directly on source files. * mkbuiltins: New argument, SRCDIR. Operate directly on source files. * mkdefs: Delete. * libinterp/module.mk (BUILT_SOURCES): Update list to contain only files included in other source files. (GENERATED_MAKE_BUILTINS_INCS, DEF_FILES): Delete. (LIBINTERP_BUILT_DISTFILES): Include $(OPT_HANDLERS) here. (LIBINTERP_BUILT_NODISTFILES): Not here. Remove $(ALL_DEF_FILES from the list. (libinterp_EXTRA_DIST): Remove mkdefs from the list. (FOUND_DEFUN_FILES): Rename from SRC_DEF_FILES. (DLDFCN_DEFUN_FILES): Rename from DLDFCN_DEF_FILES. (SRC_DEFUN_FILES): Rename from SRC_DEF_FILES. (ALL_DEFUN_FILES): Rename from ALL_DEF_FILES. (%.df: %.cc): Delete pattern rule. (libinterp/build-env-features.cc, libinterp/builtins.cc, libinterp/dldfcn/PKG_ADD): Use mv instead of move-if-change. (libinterp/builtins.cc, libinterp/builtin-defun-decls.h): Update mkbuiltins command. ($(srcdir)/libinterp/DOCSTRINGS): Update gendoc.pl command. * liboctave/module.mk (BUILT_SOURCES): Don't include liboctave-build-info.cc in the list.
author John W. Eaton <jwe@octave.org>
date Tue, 21 Jun 2016 16:07:51 -0400
parents 241d39c66e8f
children b8f92ea626e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21604
d7a268e68e69 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21575
diff changeset
1 /*
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19649
diff changeset
3 Copyright (C) 2007-2015 John W. Eaton
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 This file is part of Octave.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 option) any later version.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 for more details.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 /*
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 To initialize:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 graphics_toolkit ("gnuplot");
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 plot (randn (1e3, 1));
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 */
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21699
diff changeset
32 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21220
diff changeset
33 # include "config.h"
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #endif
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35
21220
d78e45987d6a rename octave::build_env namespace from octave::config
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
36 #include "build-env.h"
15423
53d073233fa4 call more built-in functions directly
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
37 #include "builtins.h"
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 #include "defun-dld.h"
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 #include "error.h"
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
40 #include "file-stat.h"
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 #include "graphics.h"
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
42 #include "oct-env.h"
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 #include "parse.h"
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
44 #include "utils.h"
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 #include "variables.h"
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
47 // PKG_ADD: if (__have_gnuplot__ ()) register_graphics_toolkit ("gnuplot"); endif
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 static bool toolkit_loaded = false;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 class gnuplot_graphics_toolkit : public base_graphics_toolkit
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 public:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 gnuplot_graphics_toolkit (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
55 : base_graphics_toolkit ("gnuplot") { }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 ~gnuplot_graphics_toolkit (void) { }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 bool is_valid (void) const { return true; }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 bool initialize (const graphics_object& go)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
62 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
63 return go.isa ("figure");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
64 }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 void finalize (const graphics_object& go)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
67 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
68 if (go.isa ("figure"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
69 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
70 const figure::properties& props =
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
71 dynamic_cast<const figure::properties&> (go.get_properties ());
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
73 send_quit (props.get___plot_stream__ ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
74 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
75 }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 void update (const graphics_object& go, int id)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
78 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
79 if (go.isa ("figure"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
80 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
81 graphics_object obj (go);
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
83 figure::properties& props =
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
84 dynamic_cast<figure::properties&> (obj.get_properties ());
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
86 switch (id)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
87 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
88 case base_properties::ID_VISIBLE:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
89 if (! props.is_visible ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
90 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
91 send_quit (props.get___plot_stream__ ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
92 props.set___plot_stream__ (Matrix ());
21948
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21878
diff changeset
93 props.set_graphicssmoothing (false);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
94 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
95 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
96 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
97 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
98 }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 void redraw_figure (const graphics_object& go) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
101 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
102 octave_value_list args;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
103 args(0) = go.get_handle ().as_octave_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
104 feval ("__gnuplot_drawnow__", args);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
105 }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 void print_figure (const graphics_object& go, const std::string& term,
21699
21fdab18f857 Remove reference to drawnow 'mono' throughout scripts and code, update args test
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 21634
diff changeset
108 const std::string& file,
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 const std::string& debug_file) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
110 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
111 octave_value_list args;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
112 if (! debug_file.empty ())
21699
21fdab18f857 Remove reference to drawnow 'mono' throughout scripts and code, update args test
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 21634
diff changeset
113 args(3) = debug_file;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
114 args(2) = file;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
115 args(1) = term;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
116 args(0) = go.get_handle ().as_octave_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
117 feval ("__gnuplot_drawnow__", args);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
118 }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 Matrix get_canvas_size (const graphics_handle&) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
121 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
122 Matrix sz (1, 2, 0.0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
123 return sz;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
124 }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 double get_screen_resolution (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
127 { return 72.0; }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129 Matrix get_screen_size (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
130 { return Matrix (1, 2, 0.0); }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132 void close (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134 if (toolkit_loaded)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136 munlock ("__init_gnuplot__");
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
138 gtk_manager::unload_toolkit ("gnuplot");
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 toolkit_loaded = false;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
144 private:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146 void send_quit (const octave_value& pstream) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
147 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
148 if (! pstream.is_empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
149 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
150 octave_value_list args;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
151 Matrix fids = pstream.matrix_value ();
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
152
21634
96518f623c91 Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents: 21633
diff changeset
153 Ffputs (ovl (fids(0), "\nquit;\n"));
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
154
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
155 Ffflush (ovl (fids(0)));
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
156 Fpclose (ovl (fids(0)));
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
158 if (fids.numel () > 1)
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
159 {
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
160 Fpclose (ovl (fids(1)));
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
162 if (fids.numel () > 2)
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
163 Fwaitpid (ovl (fids(2)));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
164 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
165 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
166 }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
167 };
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
169 static bool
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
170 have_gnuplot_binary (void)
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
171 {
21220
d78e45987d6a rename octave::build_env namespace from octave::config
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
172 const std::string exeext = octave::build_env::EXEEXT;
21732
6a1eded90355 use namespace for system env class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
173 const std::string path = octave::sys::env::getenv ("PATH");
21878
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
174 bool retval = false;
19649
830c8457295a Check for gnuplot binary with executable file extension if needed
Mike Miller <mtmiller@ieee.org>
parents: 19646
diff changeset
175
21878
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
176 try
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
177 {
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
178 octave_value_list tmp = feval ("gnuplot_binary", octave_value_list ());
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
179
21878
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
180 if (tmp(0).is_string ())
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
181 {
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
182 std::string gnuplot_binary = tmp(0).string_value ();
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
183
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
184 string_vector args (gnuplot_binary);
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
185 std::string gnuplot_path = search_path_for_file (path, args);
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
186
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
187 octave::sys::file_stat fs (gnuplot_path);
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
188
21878
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
189 if (! fs.exists () && ! exeext.empty ())
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
190 {
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
191 args[0] += exeext;
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
192
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
193 gnuplot_path = search_path_for_file (path, args);
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
194
21878
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
195 fs = octave::sys::file_stat (gnuplot_path);
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
196 }
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
197
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
198 retval = fs.exists ();
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
199 }
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
200 }
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
201 catch (octave_execution_exception&)
19649
830c8457295a Check for gnuplot binary with executable file extension if needed
Mike Miller <mtmiller@ieee.org>
parents: 19646
diff changeset
202 {
830c8457295a Check for gnuplot binary with executable file extension if needed
Mike Miller <mtmiller@ieee.org>
parents: 19646
diff changeset
203 }
830c8457295a Check for gnuplot binary with executable file extension if needed
Mike Miller <mtmiller@ieee.org>
parents: 19646
diff changeset
204
21878
67e51c889f34 Silence errors from __have_gnuplot__ when gnuplot_binary is not found
Mike Miller <mtmiller@octave.org>
parents: 21736
diff changeset
205 return retval;
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
206 }
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
207
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
208 // Initialize the gnuplot graphics toolkit.
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
210 DEFUN_DLD (__init_gnuplot__, , ,
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
211 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
212 @deftypefn {} {} __init_gnuplot__ ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
213 Undocumented internal function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
214 @end deftypefn */)
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216 octave_value retval;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
217
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
218 if (! have_gnuplot_binary ())
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
219 error ("__init_gnuplot__: the gnuplot program is not available, see 'gnuplot_binary'");
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
220 else if (! toolkit_loaded)
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222 mlock ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224 graphics_toolkit tk (new gnuplot_graphics_toolkit ());
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
225 gtk_manager::load_toolkit (tk);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227 toolkit_loaded = true;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
230 return retval;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
232
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
233 DEFUN_DLD (__have_gnuplot__, , ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
234 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
235 @deftypefn {} {@var{gnuplot_available} =} __have_gnuplot__ ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
236 Undocumented internal function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21948
diff changeset
237 @end deftypefn */)
19646
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
238 {
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
239 octave_value retval;
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
240
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
241 retval = have_gnuplot_binary ();
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
242
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
243 return retval;
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
244 }
408361a8c72f Don't register gnuplot toolkit if gnuplot is not available (bug #35391)
Mike Miller <mtmiller@ieee.org>
parents: 17787
diff changeset
245
21575
bc9aa534bc29 maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents: 21301
diff changeset
246 /*
bc9aa534bc29 maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents: 21301
diff changeset
247 ## No test needed for internal helper function.
bc9aa534bc29 maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents: 21301
diff changeset
248 %!assert (1)
bc9aa534bc29 maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents: 21301
diff changeset
249 */