Diffstat (limited to 'noncore/tools/calc2/binary/binaryimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/tools/calc2/binary/binaryimpl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/tools/calc2/binary/binaryimpl.cpp b/noncore/tools/calc2/binary/binaryimpl.cpp index ffc56ad..ecbf232 100644 --- a/noncore/tools/calc2/binary/binaryimpl.cpp +++ b/noncore/tools/calc2/binary/binaryimpl.cpp | |||
@@ -1,110 +1,110 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "binaryimpl.h" | 21 | #include "binaryimpl.h" |
22 | #include <instruction.h> | 22 | #include "../instruction.h" |
23 | 23 | ||
24 | class iXOR : public Instruction { | 24 | class iXOR : public Instruction { |
25 | public: | 25 | public: |
26 | iXOR():Instruction(){}; | 26 | iXOR():Instruction(){}; |
27 | ~iXOR(){}; | 27 | ~iXOR(){}; |
28 | Data eval(Data num) { | 28 | Data eval(Data num) { |
29 | Data result; | 29 | Data result; |
30 | result.i = num.i ^ acc.i; | 30 | result.i = num.i ^ acc.i; |
31 | return result; | 31 | return result; |
32 | }; | 32 | }; |
33 | }; | 33 | }; |
34 | class iAND : public Instruction { | 34 | class iAND : public Instruction { |
35 | public: | 35 | public: |
36 | iAND():Instruction(){}; | 36 | iAND():Instruction(){}; |
37 | ~iAND(){}; | 37 | ~iAND(){}; |
38 | Data eval(Data num) { | 38 | Data eval(Data num) { |
39 | Data result; | 39 | Data result; |
40 | result.i = num.i & acc.i; | 40 | result.i = num.i & acc.i; |
41 | return result; | 41 | return result; |
42 | }; | 42 | }; |
43 | }; | 43 | }; |
44 | class iNOT : public Instruction { | 44 | class iNOT : public Instruction { |
45 | public: | 45 | public: |
46 | iNOT():Instruction(){}; | 46 | iNOT():Instruction(){}; |
47 | ~iNOT(){}; | 47 | ~iNOT(){}; |
48 | Data eval(Data num) { | 48 | Data eval(Data num) { |
49 | Data result; | 49 | Data result; |
50 | result.i = ~ num.i; | 50 | result.i = ~ num.i; |
51 | return result; | 51 | return result; |
52 | }; | 52 | }; |
53 | }; | 53 | }; |
54 | class iOR : public Instruction { | 54 | class iOR : public Instruction { |
55 | public: | 55 | public: |
56 | iOR():Instruction(){}; | 56 | iOR():Instruction(){}; |
57 | ~iOR(){}; | 57 | ~iOR(){}; |
58 | Data eval(Data num) { | 58 | Data eval(Data num) { |
59 | Data result; | 59 | Data result; |
60 | result.i = num.i | acc.i; | 60 | result.i = num.i | acc.i; |
61 | return result; | 61 | return result; |
62 | }; | 62 | }; |
63 | }; | 63 | }; |
64 | class iLSH : public Instruction { | 64 | class iLSH : public Instruction { |
65 | public: | 65 | public: |
66 | iLSH():Instruction(){}; | 66 | iLSH():Instruction(){}; |
67 | ~iLSH(){}; | 67 | ~iLSH(){}; |
68 | Data eval(Data num) { | 68 | Data eval(Data num) { |
69 | Data result; | 69 | Data result; |
70 | result.i = num.i << 1; | 70 | result.i = num.i << 1; |
71 | return result; | 71 | return result; |
72 | }; | 72 | }; |
73 | }; | 73 | }; |
74 | class iRSH : public Instruction { | 74 | class iRSH : public Instruction { |
75 | public: | 75 | public: |
76 | iRSH():Instruction(){}; | 76 | iRSH():Instruction(){}; |
77 | ~iRSH(){}; | 77 | ~iRSH(){}; |
78 | Data eval(Data num) { | 78 | Data eval(Data num) { |
79 | Data result; | 79 | Data result; |
80 | result.i = num.i >> 1; | 80 | result.i = num.i >> 1; |
81 | return result; | 81 | return result; |
82 | }; | 82 | }; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | void FormBinaryImpl::val0Clicked() { | 85 | void FormBinaryImpl::val0Clicked() { |
86 | engine->pushValue('0'); | 86 | engine->pushValue('0'); |
87 | } | 87 | } |
88 | 88 | ||
89 | void FormBinaryImpl::val1Clicked() { | 89 | void FormBinaryImpl::val1Clicked() { |
90 | engine->pushValue('1'); | 90 | engine->pushValue('1'); |
91 | } | 91 | } |
92 | 92 | ||
93 | void FormBinaryImpl::XORClicked() { | 93 | void FormBinaryImpl::XORClicked() { |
94 | engine->pushInstruction(new iXOR()); | 94 | engine->pushInstruction(new iXOR()); |
95 | } | 95 | } |
96 | void FormBinaryImpl::ANDClicked() { | 96 | void FormBinaryImpl::ANDClicked() { |
97 | engine->pushInstruction(new iAND()); | 97 | engine->pushInstruction(new iAND()); |
98 | } | 98 | } |
99 | void FormBinaryImpl::NOTClicked() { | 99 | void FormBinaryImpl::NOTClicked() { |
100 | engine->immediateInstruction(new iNOT()); | 100 | engine->immediateInstruction(new iNOT()); |
101 | } | 101 | } |
102 | void FormBinaryImpl::ORClicked() { | 102 | void FormBinaryImpl::ORClicked() { |
103 | engine->pushInstruction(new iOR()); | 103 | engine->pushInstruction(new iOR()); |
104 | } | 104 | } |
105 | void FormBinaryImpl::LSHClicked() { | 105 | void FormBinaryImpl::LSHClicked() { |
106 | engine->immediateInstruction(new iLSH()); | 106 | engine->immediateInstruction(new iLSH()); |
107 | } | 107 | } |
108 | void FormBinaryImpl::RSHClicked() { | 108 | void FormBinaryImpl::RSHClicked() { |
109 | engine->immediateInstruction(new iRSH()); | 109 | engine->immediateInstruction(new iRSH()); |
110 | } | 110 | } |