annotate scripts/plot/print.m @ 5625:f88f2e35ad6e

[project @ 2006-02-15 18:42:22 by jwe]
author jwe
date Wed, 15 Feb 2006 18:42:22 +0000
parents 9d45e5bfdaff
children 960f4b9a26af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
1 ## Copyright (C) 1999 Daniel Heiserer
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
2 ## Copyright (C) 2001 Laurent Mazet
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
3 ##
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
4 ## This file is part of Octave.
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
5 ##
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
7 ## under the terms of the GNU General Public License as published by
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
8 ## the Free Software Foundation; either version 2, or (at your option)
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
9 ## any later version.
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
10 ##
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
14 ## General Public License for more details.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
15 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
17 ## along with Octave; see the file COPYING. If not, write to the Free
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
18 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
19 ## 02110-1301, USA.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
20
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
21 ## -*- texinfo -*-
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
22 ## @deftypefn {Function File} {} print (@var{filename}, @var{options})
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
23 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
24 ## Print a graph, or save it to a file
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
25 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
26 ## @var{filename} defines the file name of the output file. If no
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
27 ## filename is specified, output is sent to the printer.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
28 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
29 ## @var{options}:
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
30 ## @table @code
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
31 ## @item -P@var{printer}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
32 ## Set the @var{printer} name to which the graph is sent if no
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
33 ## @var{filename} is specified.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
34 ## @item -color
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
35 ## @itemx -mono
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
36 ## Monochrome or colour lines.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
37 ## @item -solid
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
38 ## @itemx -dashed
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
39 ## Solid or dashed lines.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
40 ## @item -portrait
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
41 ## @itemx -landscape
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
42 ## Plot orientation, as returned by "orient".
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
43 ## @item -d@var{device}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
44 ## Output device, where @var{device} is one of:
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
45 ## @table @code
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
46 ## @item ps
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
47 ## @itemx ps2
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
48 ## @itemx psc
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
49 ## @itemx psc2
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
50 ## Postscript (level 1 and 2, mono and color)
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
51 ## @item eps
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
52 ## @itemx eps2
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
53 ## @itemx epsc
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
54 ## @itemx epsc2
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
55 ## Encapsulated postscript (level 1 and 2, mono and color)
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
56 ## @item ill
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
57 ## @itemx aifm
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
58 ## Adobe Illustrator
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
59 ## @item cdr
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
60 ## @itemx corel
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
61 ## CorelDraw
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
62 ## @item hpgl
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
63 ## HP plotter language
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
64 ## @item fig
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
65 ## XFig
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
66 ## @item dxf
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
67 ## AutoCAD
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
68 ## @item mf
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
69 ## Metafont
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
70 ## @item png
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
71 ## Portable network graphics
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
72 ## @item pbm
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
73 ## PBMplus
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
74 ## @end table
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
75 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
76 ## Other devices are supported by "convert" from ImageMagick. Type
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
77 ## system("convert") to see what formats are available.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
78 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
79 ## If the device is omitted, it is inferred from the file extension,
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
80 ## or if there is no filename it is sent to the printer as postscript.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
81 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
82 ## @item -F@var{fontname}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
83 ## @itemx -F@var{fontname}:@var{size}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
84 ## @itemx -F:@var{size}
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
85 ## @var{fontname} set the postscript font (for use with postscript,
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
86 ## aifm, corel and fig). By default, 'Helvetica' is set for PS/Aifm,
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
87 ## and 'SwitzerlandLight' for Corel. It can also be 'Times-Roman'.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
88 ## @var{size} is given in points. @var{fontname} is ignored for the
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
89 ## fig device.
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
90 ## @end table
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
91 ##
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
92 ## The filename and options can be given in any order.
5521
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
93 ##
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
94 ## @strong{Note}, the print function does not work with gnuplot's
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
95 ## muplitplot mode. This problem is a known bug, and it will be fixed
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
96 ## in a future version of Octave, but there is no simple fix (or it
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
97 ## would have been fixed long ago). You can work around the bug by
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
98 ## setting the terminal type and output yourself, then executing the
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
99 ## multiplot plotting commands. For example
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
100 ##
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
101 ## @example
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
102 ## @group
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
103 ## __gnuplot_set__ terminal postscript
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
104 ## __gnuplot_set__ output "foo.ps"
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
105 ## subplot (2, 1, 1);
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
106 ## sombrero (21);
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
107 ## subplot (2, 1, 2);
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
108 ## sombrero (41);
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
109 ## oneplot
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
110 ## __gnuplot_set__ terminal x11
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
111 ## __gnuplot_set__ output
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
112 ## @end group
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
113 ## @end example
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
114 ##
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
115 ## will save both figures on a single page in the PostScript file
9d45e5bfdaff [project @ 2005-10-30 16:21:26 by jwe]
jwe
parents: 5443
diff changeset
116 ## @file{foo.ps}.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
117 ## @end deftypefn
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
118
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
119 ## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
120 ## Adapted-By: jwe
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
121
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
122 ## PKG_ADD: mark_as_command print
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
123
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
124 function print (varargin)
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
125
5365
c9c773d8333f [project @ 2005-05-23 20:05:15 by jwe]
jwe
parents: 5363
diff changeset
126 orientation = orient ();
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
127 use_color = 0; # 0=default, -1=mono, +1=color
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
128 force_solid = 0; # 0=default, -1=dashed, +1=solid
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
129 fontsize = "";
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
130 font = "";
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
131 name = "";
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
132 devopt = "";
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
133 printer = "";
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
134
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
135 for i = 1:nargin
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
136 arg = varargin{i};
5443
ec8c33dcd1bf [project @ 2005-09-08 01:40:57 by jwe]
jwe
parents: 5368
diff changeset
137 if (ischar (arg))
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
138 if (strcmp (arg, "-color"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
139 use_color = 1;
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
140 elseif (strcmp (arg, "-mono"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
141 use_color = -1;
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
142 elseif (strcmp (arg, "-solid"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
143 force_solid = 1;
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
144 elseif (strcmp (arg, "-dashed"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
145 force_solid = -1;
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
146 elseif (strcmp (arg, "-portrait"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
147 orientation = "portrait";
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
148 elseif (strcmp (arg, "-landscape"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
149 orientation = "landscape";
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
150 elseif (length (arg) > 2 && arg(1:2) == "-d")
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
151 devopt = arg(3:length(arg));
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
152 elseif (length (arg) > 2 && arg(1:2) == "-P")
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
153 printer = arg;
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
154 elseif (length (arg) > 2 && arg(1:2) == "-F")
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
155 idx = rindex(arg, ":");
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
156 if (idx)
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
157 font = arg(3:idx-1);
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
158 fontsize = arg(idx+1:length(arg));
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
159 else
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
160 font = arg(3:length(arg));
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
161 endif
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
162 elseif (length (arg) >= 1 && arg(1) == "-")
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
163 error ("print: unknown option `%s'", arg);
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
164 elseif (length (arg) > 0)
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
165 name = arg;
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
166 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
167 else
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
168 error ("print: expects string options");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
169 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
170 endfor
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
171
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
172 doprint = isempty (name);
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
173 if (doprint)
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
174 if (isempty (devopt))
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
175 printname = strcat (tmpnam, ".ps");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
176 else
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
177 printname = strcat (tmpnam, ".", devopt);
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
178 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
179 name = printname;
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
180 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
181
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
182 if (isempty (devopt))
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
183 dot = rindex (name, ".");
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
184 if (dot == 0)
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
185 error ("print: no format specified");
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
186 else
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
187 dev = tolower (name(dot+1:end));
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
188 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
189 else
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
190 dev = devopt;
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
191 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
192
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
193 if (strcmp (dev, "ill"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
194 dev = "aifm";
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
195 elseif (strcmp (dev, "cdr"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
196 dev = "corel";
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
197 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
198
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
199 ## check if we have to use convert
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
200 dev_list = {"aifm" "corel" "fig" "png" "pbm" "dxf" "mf" "hpgl", ...
5625
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
201 "ps" "ps2" "psc" "psc2" "eps" "eps2" "epsc" "epsc2" "emf"};
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
202 convertname = "";
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
203 idx = cellidx (dev_list, dev);
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
204 if (! idx)
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
205 if (! isempty (devopt))
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
206 convertname = strcat (devopt, ":", name);
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
207 else
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
208 convertname = name;
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
209 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
210 dev = "epsc";
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
211 name = strcat (tmpnam, ".eps");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
212 endif
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
213
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
214 unwind_protect
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
215
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
216 if (strcmp (dev, "ps") || strcmp (dev, "ps2") ...
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
217 || strcmp (dev, "psc") || strcmp (dev, "psc2")
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
218 || strcmp (dev, "epsc") || strcmp (dev, "epsc2")
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
219 || strcmp (dev, "eps") || strcmp (dev, "eps2"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
220 ## Various postscript options
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
221 if (dev(1) == "e")
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
222 options = "eps ";
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
223 else
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
224 options = strcat (orientation, " ");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
225 endif
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
226 options = strcat (options, "enhanced ");
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
227
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
228 if (any (dev == "c") || use_color > 0)
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
229 if (force_solid < 0)
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
230 options = strcat (options, "color dashed ");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
231 else
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
232 options = strcat (options, "color solid ");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
233 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
234 else
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
235 if (force_solid > 0)
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
236 options = strcat (options, "mono solid ");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
237 else
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
238 options = strcat (options, "mono dashed ");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
239 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
240 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
241
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
242 if (! isempty (font))
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
243 options = strcat (options, "\"", font, "\" ");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
244 endif
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
245 if (! isempty (fontsize))
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
246 options = strcat (options, " ", fontsize);
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
247 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
248
5368
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
249 __gnuplot_raw__ ("set terminal push;\n");
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
250 __gnuplot_raw__ (sprintf ("set terminal postscript %s;\n", options));
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
251
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
252
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
253 elseif (strcmp (dev, "aifm") || strcmp (dev, "corel"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
254 ## Adobe Illustrator, CorelDraw
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
255 if (use_color >= 0)
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
256 options = " color";
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
257 else
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
258 options = " mono";
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
259 endif
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
260 if (! isempty (font))
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
261 options = strcat (options, " \"", font, "\"");
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
262 endif
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
263 if (! isempty (fontsize))
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
264 options = strcat (options, " ", fontsize);
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
265 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
266
5368
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
267 __gnuplot_raw__ ("set terminal push;\n");
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
268 __gnuplot_raw__ (sprintf ("set terminal %s %s;\n", dev, options));
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
269
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
270 elseif (strcmp (dev, "fig"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
271 ## XFig
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
272 options = orientation;
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
273 if (use_color >= 0)
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
274 options = " color";
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
275 else
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
276 options = " mono";
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
277 endif
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
278 if (! isempty (fontsize))
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
279 options = strcat (options, " fontsize ", fontsize);
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
280 endif
5368
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
281 __gnuplot_raw__ ("set terminal push;\n");
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
282 __gnuplot_raw__ (sprintf ("set terminal fig %s;\n", options));
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
283
5625
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
284 elseif (strcmp (dev, "emf"))
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
285 ## Enhanced Metafile format
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
286 options = " ";
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
287 if (use_color >= 0)
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
288 options = " color";
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
289 else
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
290 options = " mono";
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
291 endif
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
292 if (force_solid >= 0)
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
293 options = strcat (options, " solid");
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
294 endif
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
295 if (! isempty (font))
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
296 options = strcat (options, " \"", font, "\"");
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
297 endif
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
298 if (! isempty (fontsize))
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
299 options = strcat (options, " ", fontsize);
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
300 endif
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
301 __gnuplot_raw__ ("set terminal push;\n");
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
302 __gnuplot_raw__ (sprintf ("set terminal emf %s;\n", options));
f88f2e35ad6e [project @ 2006-02-15 18:42:22 by jwe]
jwe
parents: 5521
diff changeset
303
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
304 elseif (strcmp (dev, "png") || strcmp (dev, "pbm"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
305 ## Portable network graphics, PBMplus
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
306
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
307 ## XXX FIXME XXX -- New PNG interface takes color as "xRRGGBB"
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
308 ## where x is the literal character 'x' and 'RRGGBB' are the red,
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
309 ## green and blue components in hex. For now we just ignore it
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
310 ## and use default. The png terminal now is so rich with options,
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
311 ## that one perhaps has to write a separate printpng.m function.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
312 ## DAS
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
313
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
314 ## if (use_color >= 0)
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
315 ## eval (sprintf ("__gnuplot_set__ term %s color medium", dev));
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
316 ##else
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
317 ##eval (sprintf ("__gnuplot_set__ term %s mono medium", dev));
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
318 ##endif
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
319
5368
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
320 __gnuplot_raw__ ("set terminal push;\n");
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
321 __gnuplot_raw__ ("set terminal png large;\n")
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
322
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
323 elseif (strcmp (dev, "dxf") || strcmp (dev, "mf") || strcmp (dev, "hpgl"))
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
324 ## AutoCad DXF, METAFONT, HPGL
5368
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
325 __gnuplot_raw__ ("set terminal push;\n");
720dc7f7a75e [project @ 2005-05-23 20:41:22 by jwe]
jwe
parents: 5367
diff changeset
326 __gnuplot_raw__ (sprintf ("set terminal %s;\n", dev));
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
327 endif
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
328
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
329 ## Gnuplot expects " around output file name
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
330
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
331 __gnuplot_raw__ (sprintf ("set output \"%s\";\n", name));
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
332 __gnuplot_replot__
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
333
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
334 unwind_protect_cleanup
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
335
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
336 ## Restore init state
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
337 __gnuplot_raw__ ("set terminal pop;\n");
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
338 __gnuplot_raw__ ("set output;\n")
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
339 __gnuplot_replot__
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
340
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
341 end_unwind_protect
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
342
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
343 if (! isempty (convertname))
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
344 command = sprintf ("convert '%s' '%s'", name, convertname);
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
345 [output, errcode] = system (command);
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
346 unlink (name);
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
347 if (errcode)
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
348 error ("print: could not convert");
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
349 endif
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
350 endif
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
351
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
352 ## XXX FIXME XXX -- This looks like a dirty, Unix-specific hack.
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
353 ## DAS
5362
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
354 if (doprint)
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
355 system (sprintf ("lpr %s '%s'", printer, printname));
ef053d682e42 [project @ 2005-05-23 19:21:54 by jwe]
jwe
parents: 5361
diff changeset
356 unlink (printname);
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
357 endif
5363
37f62a7778c2 [project @ 2005-05-23 19:52:15 by jwe]
jwe
parents: 5362
diff changeset
358
5361
0ac38aea9f76 [project @ 2005-05-23 19:08:36 by jwe]
jwe
parents:
diff changeset
359 endfunction