]> gcc.gnu.org Git - gcc.git/blame - libio/PlotFile.cc
configure.in (EXEEXT): Define.
[gcc.git] / libio / PlotFile.cc
CommitLineData
6599da04
JM
1/*
2Copyright (C) 1993 Free Software Foundation
3
4This file is part of the GNU IO Library. This library is free
5software; you can redistribute it and/or modify it under the
6terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option)
8any later version.
9
10This library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this library; see the file COPYING. If not, write to the Free
17Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19As a special exception, if you link this library with files
20compiled with a GNU compiler to produce an executable, this does not cause
21the resulting executable to be covered by the GNU General Public License.
22This exception does not however invalidate any other reasons why
23the executable file might be covered by the GNU General Public License. */
24
25// This may look like C code, but it is really -*- C++ -*-
26/*
27Copyright (C) 1988, 1992, 1993 Free Software Foundation
28 written by Doug Lea (dl@rocky.oswego.edu)
29 converted to use iostream library by Per Bothner (bothner@cygnus.com)
30
31This file is part of the GNU IO Library. This library is free
32software; you can redistribute it and/or modify it under the
33terms of the GNU General Public License as published by the
34Free Software Foundation; either version 2, or (at your option)
35any later version.
36
37This library is distributed in the hope that it will be useful,
38but WITHOUT ANY WARRANTY; without even the implied warranty of
39MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40GNU General Public License for more details.
41
42You should have received a copy of the GNU General Public License
43along with this library; see the file COPYING. If not, write to the Free
44Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
45
46As a special exception, if you link this library with files
47compiled with GCC to produce an executable, this does not cause
48the resulting executable to be covered by the GNU General Public License.
49This exception does not however invalidate any other reasons why
50the executable file might be covered by the GNU General Public License. */
51
52#ifdef __GNUG__
53#pragma implementation
54#endif
55#include <PlotFile.h>
56
57/*
58 PlotFile implementation module
59*/
60
61
62PlotFile& PlotFile:: cmd(char c)
63{
64 ofstream::put(c);
65 return *this;
66}
67
68PlotFile& PlotFile:: operator<<(const int x)
69{
70#if defined(convex)
71 ofstream::put((char)(x>>8));
72 ofstream::put((char)(x&0377));
73#else
74 ofstream::put((char)(x&0377));
75 ofstream::put((char)(x>>8));
76#endif
77 return *this;
78}
79
80PlotFile& PlotFile:: operator<<(const char *s)
81{
82 *(ofstream*)this << s;
83 return *this;
84}
85
86
87PlotFile& PlotFile:: arc(const int xi, const int yi,
88 const int x0, const int y0,
89 const int x1, const int y1)
90{
91 return cmd('a') << xi << yi << x0 << y0 << x1 << y1;
92}
93
94
95PlotFile& PlotFile:: box(const int x0, const int y0,
96 const int x1, const int y1)
97{
98 line(x0, y0, x0, y1);
99 line(x0, y1, x1, y1);
100 line(x1, y1, x1, y0);
101 return line(x1, y0, x0, y0);
102}
103
104PlotFile& PlotFile:: circle(const int x, const int y, const int r)
105{
106 return cmd('c') << x << y << r;
107}
108
109PlotFile& PlotFile:: cont(const int xi, const int yi)
110{
111 return cmd('n') << xi << yi;
112}
113
114PlotFile& PlotFile:: dot(const int xi, const int yi, const int dx,
115 int n, const int* pat)
116{
117 cmd('d') << xi << yi << dx << n;
118 while (n-- > 0) *this << *pat++;
119 return *this;
120}
121
122PlotFile& PlotFile:: erase()
123{
124 return cmd('e');
125}
126
127PlotFile& PlotFile:: label(const char* s)
128{
129 return cmd('t') << s << "\n";
130}
131
132PlotFile& PlotFile:: line(const int x0, const int y0,
133 const int x1, const int y1)
134{
135 return cmd('l') << x0 << y0 << x1 << y1;
136}
137
138PlotFile& PlotFile:: linemod(const char* s)
139{
140 return cmd('f') << s << "\n";
141}
142
143PlotFile& PlotFile:: move(const int xi, const int yi)
144{
145 return cmd('m') << xi << yi;
146}
147
148PlotFile& PlotFile:: point(const int xi, const int yi)
149{
150 return cmd('p') << xi << yi;
151}
152
153PlotFile& PlotFile:: space(const int x0, const int y0,
154 const int x1, const int y1)
155{
156 return cmd('s') << x0 << y0 << x1 << y1;
157}
This page took 0.104648 seconds and 5 git commands to generate.