Oh GACK! src-clean doesn't quite work that easily since cleandist rebuilds the
[unix-history] / gnu / lib / libg++ / libg++ / PlotFile.cc
CommitLineData
15637ed4
RG
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4 written by Doug Lea (dl@rocky.oswego.edu)
5
6This file is part of GNU CC.
7
8GNU CC is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY. No author or distributor
10accepts responsibility to anyone for the consequences of using it
11or for whether it serves any particular purpose or works at all,
12unless he says so in writing. Refer to the GNU CC General Public
13License for full details.
14
15Everyone is granted permission to copy, modify and redistribute
16GNU CC, but only under the conditions described in the
17GNU CC General Public License. A copy of this license is
18supposed to have been given to you along with GNU CC so you
19can know your rights and responsibilities. It should be in a
20file named COPYING. Among other things, the copyright notice
21and this notice must be preserved on all copies.
22*/
23
24#ifdef __GNUG__
25#pragma implementation
26#endif
27#include <PlotFile.h>
28
29/*
30 PlotFile implementation module
31*/
32
33
34PlotFile:: PlotFile() {}
35PlotFile::~PlotFile() {}
36
37
38PlotFile::PlotFile(const char* filename, io_mode m, access_mode a)
39:(filename, m, a) {}
40
41PlotFile::PlotFile(const char* filename, const char* m)
42:(filename, m) {}
43
44PlotFile::PlotFile(int filedesc, const io_mode m)
45:(filedesc, m) {}
46
47PlotFile::PlotFile(FILE* fileptr)
48:(fileptr) {}
49
50PlotFile::operator void*()
51{
52 return (state & (_bad|_fail))? 0 : this ;
53}
54
55
56PlotFile& PlotFile::open(const char* filename,
57 io_mode m, access_mode a)
58{
59 File::open(filename, m, a); return *this;
60}
61
62PlotFile& PlotFile::open(const char* filename, const char* m)
63{
64 File::open(filename, m); return *this;
65}
66
67PlotFile& PlotFile::open(int filedesc, io_mode m)
68{
69 File::open(filedesc, m); return *this;
70}
71
72PlotFile& PlotFile::open(FILE* fileptr)
73{
74 File::open(fileptr); return *this;
75}
76
77PlotFile& PlotFile::setbuf(const int buffer_kind)
78{
79 File::setbuf(buffer_kind); return *this;
80}
81
82PlotFile& PlotFile::setbuf(const int size, char* buf)
83{
84 File::setbuf(size, buf); return *this;
85}
86
87
88PlotFile& PlotFile:: cmd(char c)
89{
90 File::put(c);
91 return *this;
92}
93
94PlotFile& PlotFile:: operator<<(const int x)
95{
96#if defined(convex)
97 File::put((char)(x>>8));
98 File::put((char)(x&0377));
99#else
100 File::put((char)(x&0377));
101 File::put((char)(x>>8));
102#endif
103 return *this;
104}
105
106PlotFile& PlotFile:: operator<<(const char *s)
107{
108 File::put(s);
109 return *this;
110}
111
112
113PlotFile& PlotFile:: arc(const int xi, const int yi,
114 const int x0, const int y0,
115 const int x1, const int y1)
116{
117 return cmd('a') << xi << yi << x0 << y0 << x1 << y1;
118}
119
120
121PlotFile& PlotFile:: box(const int x0, const int y0,
122 const int x1, const int y1)
123{
124 line(x0, y0, x0, y1);
125 line(x0, y1, x1, y1);
126 line(x1, y1, x1, y0);
127 return line(x1, y0, x0, y0);
128}
129
130PlotFile& PlotFile:: circle(const int x, const int y, const int r)
131{
132 return cmd('c') << x << y << r;
133}
134
135PlotFile& PlotFile:: cont(const int xi, const int yi)
136{
137 return cmd('n') << xi << yi;
138}
139
140PlotFile& PlotFile:: dot(const int xi, const int yi, const int dx,
141 int n, const int* pat)
142{
143 cmd('d') << xi << yi << dx << n;
144 while (n-- > 0) *this << *pat++;
145 return *this;
146}
147
148PlotFile& PlotFile:: erase()
149{
150 return cmd('e');
151}
152
153PlotFile& PlotFile:: label(const char* s)
154{
155 return cmd('t') << s << "\n";
156}
157
158PlotFile& PlotFile:: line(const int x0, const int y0,
159 const int x1, const int y1)
160{
161 return cmd('l') << x0 << y0 << x1 << y1;
162}
163
164PlotFile& PlotFile:: linemod(const char* s)
165{
166 return cmd('f') << s << "\n";
167}
168
169PlotFile& PlotFile:: move(const int xi, const int yi)
170{
171 return cmd('m') << xi << yi;
172}
173
174PlotFile& PlotFile:: point(const int xi, const int yi)
175{
176 return cmd('p') << xi << yi;
177}
178
179PlotFile& PlotFile:: space(const int x0, const int y0,
180 const int x1, const int y1)
181{
182 return cmd('s') << x0 << y0 << x1 << y1;
183}