1 /* This test script is part of GDB, the GNU debugger.
3 Copyright 1999, 2002, 2003, 2004, 2005
4 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 friend ostream
& operator<<(ostream
& outs
, A1 one
);
44 A1
operator+=(int value
);
45 A1
operator+(const A1
&);
46 A1
operator-(const A1
&);
47 A1
operator%(const A1
&);
48 int operator==(const A1
&);
49 int operator!=(const A1
&);
50 int operator&&(const A1
&);
51 int operator||(const A1
&);
54 A1
operator|(const A1
&);
55 A1
operator^(const A1
&);
56 A1
operator&(const A1
&);
57 int operator<(const A1
&);
58 int operator<=(const A1
&);
59 int operator>=(const A1
&);
60 int operator>(const A1
&);
61 A1
operator*(const A1
&);
62 A1
operator/(const A1
&);
63 A1
operator=(const A1
&);
77 A1
A1::operator+(const A1
& second
)
86 A1
A1::operator*(const A1
& second
)
89 product
.x
= this->x
* second
.x
;
90 product
.y
= this->y
* second
.y
;
95 A1
A1::operator-(const A1
& second
)
98 diff
.x
= x
- second
.x
;
99 diff
.y
= y
- second
.y
;
104 A1
A1::operator/(const A1
& second
)
107 div
.x
= x
/ second
.x
;
108 div
.y
= y
/ second
.y
;
113 A1
A1::operator%(const A1
& second
)
116 rem
.x
= x
% second
.x
;
117 rem
.y
= y
% second
.y
;
122 int A1::operator==(const A1
& second
)
124 int a
= (x
== second
.x
);
125 int b
= (y
== second
.y
);
130 int A1::operator!=(const A1
& second
)
132 int a
= (x
!= second
.x
);
133 int b
= (y
!= second
.y
);
138 int A1::operator&&(const A1
& second
)
140 return ( x
&& second
.x
);
143 int A1::operator||(const A1
& second
)
145 return ( x
|| second
.x
);
148 A1
A1::operator<<(int value
)
151 lshft
.x
= x
<< value
;
152 lshft
.y
= y
<< value
;
157 A1
A1::operator>>(int value
)
160 rshft
.x
= x
>> value
;
161 rshft
.y
= y
>> value
;
166 A1
A1::operator|(const A1
& second
)
169 abitor
.x
= x
| second
.x
;
170 abitor
.y
= y
| second
.y
;
175 A1
A1::operator^(const A1
& second
)
178 axor
.x
= x
^ second
.x
;
179 axor
.y
= y
^ second
.y
;
184 A1
A1::operator&(const A1
& second
)
187 abitand
.x
= x
& second
.x
;
188 abitand
.y
= y
& second
.y
;
193 int A1::operator<(const A1
& second
)
197 return (x
< second
.x
);
200 int A1::operator<=(const A1
& second
)
202 return (x
<= second
.x
);
205 int A1::operator>=(const A1
& second
)
207 return (x
>= second
.x
);
210 int A1::operator>(const A1
& second
)
212 return (x
> second
.x
);
215 int A1::operator!(void)
220 A1
A1::operator-(void)
229 A1
A1::operator+(void)
238 A1
A1::operator~(void)
247 A1
A1::operator++() // pre increment
254 A1
A1::operator++(int) // post increment
261 A1
A1::operator--() // pre decrement
268 A1
A1::operator--(int) // post decrement
276 A1
A1::operator=(const A1
& second
)
285 A1
A1::operator+=(int value
)
294 ostream
& operator<<(ostream
& outs
, A1 one
)
296 return (outs
<< endl
<< "x = " << one
.x
<< endl
<< "y = " << one
.y
<< endl
<< "-------" << endl
);
317 marker1(); // marker1-returns-here
318 cout
<< one
; // marker1-returns-here
321 cout
<< "+ " << three
;
323 cout
<< "- " << three
;
325 cout
<<"* " << three
;
327 cout
<< "/ " << three
;
329 cout
<< "% " << three
;
331 cout
<< "| " <<three
;
333 cout
<< "^ " <<three
;
335 cout
<< "& "<< three
;
338 cout
<< "&& " << val
<< endl
<< "-----"<<endl
;
340 cout
<< "|| " << val
<< endl
<< "-----"<<endl
;
342 cout
<< " == " << val
<< endl
<< "-----"<<endl
;
344 cout
<< "!= " << val
<< endl
<< "-----"<<endl
;
346 cout
<< ">= " << val
<< endl
<< "-----"<<endl
;
348 cout
<< "<= " << val
<< endl
<< "-----"<<endl
;
350 cout
<< "< " << val
<< endl
<< "-----"<<endl
;
352 cout
<< "> " << val
<< endl
<< "-----"<<endl
;
355 cout
<< "lsh " << three
;
357 cout
<< "rsh " << three
;
360 cout
<< " = "<< three
;
362 cout
<< " += "<< three
;
365 cout
<< "! " << val
<< endl
<< "-----"<<endl
;
367 cout
<< "+ " << three
;
369 cout
<< "- " << three
;
371 cout
<< " ~" << three
;
373 cout
<< "postinc " << three
;
375 cout
<< "postdec " << three
;
378 cout
<< "predec " << three
;
380 cout
<< "preinc " << three
;