* natCollator.cc: New file.
[official-gcc.git] / libio / PlotFile.cc
blob98b2d839555dd4715dd843d8875c737a8fb11dc3
1 /*
2 Copyright (C) 1993 Free Software Foundation
4 This file is part of the GNU IO Library. This library is free
5 software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option)
8 any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this library; see the file COPYING. If not, write to the Free
17 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 As a special exception, if you link this library with files
20 compiled with a GNU compiler to produce an executable, this does not cause
21 the resulting executable to be covered by the GNU General Public License.
22 This exception does not however invalidate any other reasons why
23 the executable file might be covered by the GNU General Public License. */
25 // This may look like C code, but it is really -*- C++ -*-
26 /*
27 Copyright (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)
31 This file is part of the GNU IO Library. This library is free
32 software; you can redistribute it and/or modify it under the
33 terms of the GNU General Public License as published by the
34 Free Software Foundation; either version 2, or (at your option)
35 any later version.
37 This library is distributed in the hope that it will be useful,
38 but WITHOUT ANY WARRANTY; without even the implied warranty of
39 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 GNU General Public License for more details.
42 You should have received a copy of the GNU General Public License
43 along with this library; see the file COPYING. If not, write to the Free
44 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
46 As a special exception, if you link this library with files
47 compiled with GCC to produce an executable, this does not cause
48 the resulting executable to be covered by the GNU General Public License.
49 This exception does not however invalidate any other reasons why
50 the executable file might be covered by the GNU General Public License. */
52 #ifdef __GNUG__
53 #pragma implementation
54 #endif
55 #include <PlotFile.h>
58 PlotFile implementation module
62 PlotFile& PlotFile:: cmd(char c)
64 ofstream::put(c);
65 return *this;
68 PlotFile& PlotFile:: operator<<(const int x)
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;
80 PlotFile& PlotFile:: operator<<(const char *s)
82 *(ofstream*)this << s;
83 return *this;
87 PlotFile& PlotFile:: arc(const int xi, const int yi,
88 const int x0, const int y0,
89 const int x1, const int y1)
91 return cmd('a') << xi << yi << x0 << y0 << x1 << y1;
95 PlotFile& PlotFile:: box(const int x0, const int y0,
96 const int x1, const int y1)
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);
104 PlotFile& PlotFile:: circle(const int x, const int y, const int r)
106 return cmd('c') << x << y << r;
109 PlotFile& PlotFile:: cont(const int xi, const int yi)
111 return cmd('n') << xi << yi;
114 PlotFile& PlotFile:: dot(const int xi, const int yi, const int dx,
115 int n, const int* pat)
117 cmd('d') << xi << yi << dx << n;
118 while (n-- > 0) *this << *pat++;
119 return *this;
122 PlotFile& PlotFile:: erase()
124 return cmd('e');
127 PlotFile& PlotFile:: label(const char* s)
129 return cmd('t') << s << "\n";
132 PlotFile& PlotFile:: line(const int x0, const int y0,
133 const int x1, const int y1)
135 return cmd('l') << x0 << y0 << x1 << y1;
138 PlotFile& PlotFile:: linemod(const char* s)
140 return cmd('f') << s << "\n";
143 PlotFile& PlotFile:: move(const int xi, const int yi)
145 return cmd('m') << xi << yi;
148 PlotFile& PlotFile:: point(const int xi, const int yi)
150 return cmd('p') << xi << yi;
153 PlotFile& PlotFile:: space(const int x0, const int y0,
154 const int x1, const int y1)
156 return cmd('s') << x0 << y0 << x1 << y1;