author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /noncore/tools/calc2/binary | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
-rw-r--r-- | noncore/tools/calc2/binary/Makefile | 146 | ||||
-rw-r--r-- | noncore/tools/calc2/binary/README | 1 | ||||
-rw-r--r-- | noncore/tools/calc2/binary/binary.pro | 16 | ||||
-rw-r--r-- | noncore/tools/calc2/binary/binary.ui | 177 | ||||
-rw-r--r-- | noncore/tools/calc2/binary/binaryfactory.cpp | 51 | ||||
-rw-r--r-- | noncore/tools/calc2/binary/binaryfactory.h | 46 | ||||
-rw-r--r-- | noncore/tools/calc2/binary/binaryimpl.cpp | 110 | ||||
-rw-r--r-- | noncore/tools/calc2/binary/binaryimpl.h | 50 |
8 files changed, 597 insertions, 0 deletions
diff --git a/noncore/tools/calc2/binary/Makefile b/noncore/tools/calc2/binary/Makefile new file mode 100644 index 0000000..93cc0d5 --- a/dev/null +++ b/noncore/tools/calc2/binary/Makefile | |||
@@ -0,0 +1,146 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libbinary.so.1.0.0 | ||
3 | # Generated by tmake at 12:03, 2001/11/22 | ||
4 | # Project: binary | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc | ||
11 | CXX =g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-I$(QPEDIR)/include -I$(QPEDIR)/calc2 -I$(QTDIR)/include | ||
15 | LINK =gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libbinary.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =binaryimpl.h \ | ||
29 | binaryfactory.h | ||
30 | SOURCES =binaryimpl.cpp \ | ||
31 | binaryfactory.cpp | ||
32 | OBJECTS =binaryimpl.o \ | ||
33 | binaryfactory.o \ | ||
34 | binary.o | ||
35 | INTERFACES =binary.ui | ||
36 | UICDECLS =binary.h | ||
37 | UICIMPLS =binary.cpp | ||
38 | SRCMOC =moc_binaryimpl.cpp \ | ||
39 | moc_binary.cpp | ||
40 | OBJMOC =moc_binaryimpl.o \ | ||
41 | moc_binary.o | ||
42 | DIST = | ||
43 | TARGET =libbinary.so.1.0.0 | ||
44 | TARGETA =$(QPEDIR)/plugins/calculator/libbinary.a | ||
45 | TARGETD =libbinary.so.1.0.0 | ||
46 | TARGET0 =libbinary.so | ||
47 | TARGET1 =libbinary.so.1 | ||
48 | TARGET2 =libbinary.so.1.0 | ||
49 | INTERFACE_DECL_PATH = . | ||
50 | |||
51 | ####### Implicit rules | ||
52 | |||
53 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
54 | |||
55 | .cpp.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .cxx.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .cc.o: | ||
62 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | .C.o: | ||
65 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
66 | |||
67 | .c.o: | ||
68 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
69 | |||
70 | ####### Build rules | ||
71 | |||
72 | |||
73 | all: $(QPEDIR)/plugins/calculator/libbinary.so.1.0.0 | ||
74 | |||
75 | $(QPEDIR)/plugins/calculator/libbinary.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
76 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
77 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
78 | -ln -s $(TARGET) $(TARGET0) | ||
79 | -ln -s $(TARGET) $(TARGET1) | ||
80 | -ln -s $(TARGET) $(TARGET2) | ||
81 | -rm -f $(QPEDIR)/plugins/calculator/$(TARGET) | ||
82 | -rm -f $(QPEDIR)/plugins/calculator/$(TARGET0) | ||
83 | -rm -f $(QPEDIR)/plugins/calculator/$(TARGET1) | ||
84 | -rm -f $(QPEDIR)/plugins/calculator/$(TARGET2) | ||
85 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QPEDIR)/plugins/calculator/ | ||
86 | |||
87 | staticlib: $(TARGETA) | ||
88 | |||
89 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
90 | -rm -f $(TARGETA) | ||
91 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
92 | |||
93 | moc: $(SRCMOC) | ||
94 | |||
95 | tmake: | ||
96 | tmake binary.pro | ||
97 | |||
98 | dist: | ||
99 | $(TAR) binary.tar binary.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
100 | $(GZIP) binary.tar | ||
101 | |||
102 | clean: | ||
103 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
104 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
105 | -rm -f *~ core | ||
106 | |||
107 | ####### Sub-libraries | ||
108 | |||
109 | |||
110 | ###### Combined headers | ||
111 | |||
112 | |||
113 | ####### Compile | ||
114 | |||
115 | binaryimpl.o: binaryimpl.cpp \ | ||
116 | binaryimpl.h \ | ||
117 | binary.h | ||
118 | |||
119 | binaryfactory.o: binaryfactory.cpp \ | ||
120 | binaryfactory.h \ | ||
121 | binaryimpl.h \ | ||
122 | binary.h | ||
123 | |||
124 | binary.h: binary.ui | ||
125 | $(UIC) binary.ui -o $(INTERFACE_DECL_PATH)/binary.h | ||
126 | |||
127 | binary.cpp: binary.ui | ||
128 | $(UIC) binary.ui -i binary.h -o binary.cpp | ||
129 | |||
130 | binary.o: binary.cpp \ | ||
131 | binary.h \ | ||
132 | binary.ui | ||
133 | |||
134 | moc_binaryimpl.o: moc_binaryimpl.cpp \ | ||
135 | binaryimpl.h \ | ||
136 | binary.h | ||
137 | |||
138 | moc_binary.o: moc_binary.cpp \ | ||
139 | binary.h | ||
140 | |||
141 | moc_binaryimpl.cpp: binaryimpl.h | ||
142 | $(MOC) binaryimpl.h -o moc_binaryimpl.cpp | ||
143 | |||
144 | moc_binary.cpp: binary.h | ||
145 | $(MOC) binary.h -o moc_binary.cpp | ||
146 | |||
diff --git a/noncore/tools/calc2/binary/README b/noncore/tools/calc2/binary/README new file mode 100644 index 0000000..4937038 --- a/dev/null +++ b/noncore/tools/calc2/binary/README | |||
@@ -0,0 +1 @@ | |||
A binary interface with bitwise operations | |||
diff --git a/noncore/tools/calc2/binary/binary.pro b/noncore/tools/calc2/binary/binary.pro new file mode 100644 index 0000000..01ba6a4 --- a/dev/null +++ b/noncore/tools/calc2/binary/binary.pro | |||
@@ -0,0 +1,16 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG -= moc | ||
3 | CONFIG += qt release | ||
4 | |||
5 | # Input | ||
6 | INTERFACES += binary.ui | ||
7 | HEADERS = binaryimpl.h \ | ||
8 | binaryfactory.h | ||
9 | SOURCES = binaryimpl.cpp \ | ||
10 | binaryfactory.cpp | ||
11 | |||
12 | INCLUDEPATH += $(QPEDIR)/include \ | ||
13 | $(QPEDIR)/calc2 | ||
14 | DEPENDPATH += $(QPEDIR)/include | ||
15 | |||
16 | DESTDIR = $(QPEDIR)/plugins/calculator | ||
diff --git a/noncore/tools/calc2/binary/binary.ui b/noncore/tools/calc2/binary/binary.ui new file mode 100644 index 0000000..26064d1 --- a/dev/null +++ b/noncore/tools/calc2/binary/binary.ui | |||
@@ -0,0 +1,177 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>FormBinary</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>FormBinary</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>332</width> | ||
15 | <height>114</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Binary</string> | ||
21 | </property> | ||
22 | <grid> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>0</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>0</number> | ||
30 | </property> | ||
31 | <widget row="1" column="0" > | ||
32 | <class>QPushButton</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>PB0</cstring> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>maximumSize</name> | ||
39 | <size> | ||
40 | <width>80</width> | ||
41 | <height>80</height> | ||
42 | </size> | ||
43 | </property> | ||
44 | <property stdset="1"> | ||
45 | <name>text</name> | ||
46 | <string>0</string> | ||
47 | </property> | ||
48 | </widget> | ||
49 | <widget row="1" column="1" > | ||
50 | <class>QPushButton</class> | ||
51 | <property stdset="1"> | ||
52 | <name>name</name> | ||
53 | <cstring>PB1</cstring> | ||
54 | </property> | ||
55 | <property stdset="1"> | ||
56 | <name>maximumSize</name> | ||
57 | <size> | ||
58 | <width>80</width> | ||
59 | <height>80</height> | ||
60 | </size> | ||
61 | </property> | ||
62 | <property stdset="1"> | ||
63 | <name>text</name> | ||
64 | <string>1</string> | ||
65 | </property> | ||
66 | </widget> | ||
67 | <widget row="0" column="0" > | ||
68 | <class>QPushButton</class> | ||
69 | <property stdset="1"> | ||
70 | <name>name</name> | ||
71 | <cstring>PBAnd</cstring> | ||
72 | </property> | ||
73 | <property stdset="1"> | ||
74 | <name>maximumSize</name> | ||
75 | <size> | ||
76 | <width>80</width> | ||
77 | <height>80</height> | ||
78 | </size> | ||
79 | </property> | ||
80 | <property stdset="1"> | ||
81 | <name>text</name> | ||
82 | <string>AND</string> | ||
83 | </property> | ||
84 | </widget> | ||
85 | <widget row="0" column="1" > | ||
86 | <class>QPushButton</class> | ||
87 | <property stdset="1"> | ||
88 | <name>name</name> | ||
89 | <cstring>PBOr</cstring> | ||
90 | </property> | ||
91 | <property stdset="1"> | ||
92 | <name>maximumSize</name> | ||
93 | <size> | ||
94 | <width>80</width> | ||
95 | <height>80</height> | ||
96 | </size> | ||
97 | </property> | ||
98 | <property stdset="1"> | ||
99 | <name>text</name> | ||
100 | <string>OR</string> | ||
101 | </property> | ||
102 | </widget> | ||
103 | <widget row="0" column="2" > | ||
104 | <class>QPushButton</class> | ||
105 | <property stdset="1"> | ||
106 | <name>name</name> | ||
107 | <cstring>PBNot</cstring> | ||
108 | </property> | ||
109 | <property stdset="1"> | ||
110 | <name>maximumSize</name> | ||
111 | <size> | ||
112 | <width>80</width> | ||
113 | <height>80</height> | ||
114 | </size> | ||
115 | </property> | ||
116 | <property stdset="1"> | ||
117 | <name>text</name> | ||
118 | <string>NOT</string> | ||
119 | </property> | ||
120 | </widget> | ||
121 | <widget row="1" column="2" > | ||
122 | <class>QPushButton</class> | ||
123 | <property stdset="1"> | ||
124 | <name>name</name> | ||
125 | <cstring>PBSHL</cstring> | ||
126 | </property> | ||
127 | <property stdset="1"> | ||
128 | <name>maximumSize</name> | ||
129 | <size> | ||
130 | <width>80</width> | ||
131 | <height>80</height> | ||
132 | </size> | ||
133 | </property> | ||
134 | <property stdset="1"> | ||
135 | <name>text</name> | ||
136 | <string><-</string> | ||
137 | </property> | ||
138 | </widget> | ||
139 | <widget row="0" column="3" > | ||
140 | <class>QPushButton</class> | ||
141 | <property stdset="1"> | ||
142 | <name>name</name> | ||
143 | <cstring>PBXor</cstring> | ||
144 | </property> | ||
145 | <property stdset="1"> | ||
146 | <name>maximumSize</name> | ||
147 | <size> | ||
148 | <width>80</width> | ||
149 | <height>80</height> | ||
150 | </size> | ||
151 | </property> | ||
152 | <property stdset="1"> | ||
153 | <name>text</name> | ||
154 | <string>XOR</string> | ||
155 | </property> | ||
156 | </widget> | ||
157 | <widget row="1" column="3" > | ||
158 | <class>QPushButton</class> | ||
159 | <property stdset="1"> | ||
160 | <name>name</name> | ||
161 | <cstring>PBSHR</cstring> | ||
162 | </property> | ||
163 | <property stdset="1"> | ||
164 | <name>maximumSize</name> | ||
165 | <size> | ||
166 | <width>80</width> | ||
167 | <height>80</height> | ||
168 | </size> | ||
169 | </property> | ||
170 | <property stdset="1"> | ||
171 | <name>text</name> | ||
172 | <string>-></string> | ||
173 | </property> | ||
174 | </widget> | ||
175 | </grid> | ||
176 | </widget> | ||
177 | </UI> | ||
diff --git a/noncore/tools/calc2/binary/binaryfactory.cpp b/noncore/tools/calc2/binary/binaryfactory.cpp new file mode 100644 index 0000000..110334f --- a/dev/null +++ b/noncore/tools/calc2/binary/binaryfactory.cpp | |||
@@ -0,0 +1,51 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** GNU General Public License version 2 as published by the Free Software | ||
10 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
11 | ** packaging of this file. | ||
12 | ** | ||
13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
15 | ** | ||
16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
17 | ** | ||
18 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
19 | ** not clear to you. | ||
20 | ** | ||
21 | **********************************************************************/ | ||
22 | |||
23 | #include "binaryfactory.h" | ||
24 | #include "binaryimpl.h" | ||
25 | #include <engine.h> | ||
26 | |||
27 | QWidget *BinaryInterface::getPlugin ( Engine *e, QWidget *parent ) { | ||
28 | if ( !input ) | ||
29 | input = new FormBinaryImpl ( e, parent ); | ||
30 | return input; | ||
31 | } | ||
32 | |||
33 | #ifndef QT_NO_COMPONENT | ||
34 | QRESULT BinaryInterface::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
35 | { | ||
36 | *iface = 0; | ||
37 | if ( uuid == IID_QUnknown ) | ||
38 | *iface = this; | ||
39 | else if ( uuid == IID_Calc ) | ||
40 | *iface = this; | ||
41 | |||
42 | if ( *iface ) | ||
43 | (*iface)->addRef(); | ||
44 | return QS_OK; | ||
45 | } | ||
46 | |||
47 | Q_EXPORT_INTERFACE() | ||
48 | { | ||
49 | Q_CREATE_INSTANCE( BinaryInterface ) | ||
50 | } | ||
51 | #endif | ||
diff --git a/noncore/tools/calc2/binary/binaryfactory.h b/noncore/tools/calc2/binary/binaryfactory.h new file mode 100644 index 0000000..e015384 --- a/dev/null +++ b/noncore/tools/calc2/binary/binaryfactory.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #ifndef BINARYIMPL_H | ||
22 | #define BINARYIMPL_H | ||
23 | |||
24 | #include "binaryimpl.h" | ||
25 | #include <plugininterface.h> | ||
26 | #include <engine.h> | ||
27 | |||
28 | class BinaryInterface : public CalcInterface | ||
29 | { | ||
30 | public: | ||
31 | BinaryInterface(){input = 0;}; | ||
32 | virtual ~BinaryInterface(){}; | ||
33 | |||
34 | #ifndef QT_NO_COMPONENT | ||
35 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
36 | Q_REFCOUNT | ||
37 | #endif | ||
38 | |||
39 | QWidget *getPlugin( Engine *, QWidget *parent ); | ||
40 | |||
41 | private: | ||
42 | FormBinaryImpl *input; | ||
43 | ulong ref; | ||
44 | }; | ||
45 | |||
46 | #endif | ||
diff --git a/noncore/tools/calc2/binary/binaryimpl.cpp b/noncore/tools/calc2/binary/binaryimpl.cpp new file mode 100644 index 0000000..ffc56ad --- a/dev/null +++ b/noncore/tools/calc2/binary/binaryimpl.cpp | |||
@@ -0,0 +1,110 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include "binaryimpl.h" | ||
22 | #include <instruction.h> | ||
23 | |||
24 | class iXOR : public Instruction { | ||
25 | public: | ||
26 | iXOR():Instruction(){}; | ||
27 | ~iXOR(){}; | ||
28 | Data eval(Data num) { | ||
29 | Data result; | ||
30 | result.i = num.i ^ acc.i; | ||
31 | return result; | ||
32 | }; | ||
33 | }; | ||
34 | class iAND : public Instruction { | ||
35 | public: | ||
36 | iAND():Instruction(){}; | ||
37 | ~iAND(){}; | ||
38 | Data eval(Data num) { | ||
39 | Data result; | ||
40 | result.i = num.i & acc.i; | ||
41 | return result; | ||
42 | }; | ||
43 | }; | ||
44 | class iNOT : public Instruction { | ||
45 | public: | ||
46 | iNOT():Instruction(){}; | ||
47 | ~iNOT(){}; | ||
48 | Data eval(Data num) { | ||
49 | Data result; | ||
50 | result.i = ~ num.i; | ||
51 | return result; | ||
52 | }; | ||
53 | }; | ||
54 | class iOR : public Instruction { | ||
55 | public: | ||
56 | iOR():Instruction(){}; | ||
57 | ~iOR(){}; | ||
58 | Data eval(Data num) { | ||
59 | Data result; | ||
60 | result.i = num.i | acc.i; | ||
61 | return result; | ||
62 | }; | ||
63 | }; | ||
64 | class iLSH : public Instruction { | ||
65 | public: | ||
66 | iLSH():Instruction(){}; | ||
67 | ~iLSH(){}; | ||
68 | Data eval(Data num) { | ||
69 | Data result; | ||
70 | result.i = num.i << 1; | ||
71 | return result; | ||
72 | }; | ||
73 | }; | ||
74 | class iRSH : public Instruction { | ||
75 | public: | ||
76 | iRSH():Instruction(){}; | ||
77 | ~iRSH(){}; | ||
78 | Data eval(Data num) { | ||
79 | Data result; | ||
80 | result.i = num.i >> 1; | ||
81 | return result; | ||
82 | }; | ||
83 | }; | ||
84 | |||
85 | void FormBinaryImpl::val0Clicked() { | ||
86 | engine->pushValue('0'); | ||
87 | } | ||
88 | |||
89 | void FormBinaryImpl::val1Clicked() { | ||
90 | engine->pushValue('1'); | ||
91 | } | ||
92 | |||
93 | void FormBinaryImpl::XORClicked() { | ||
94 | engine->pushInstruction(new iXOR()); | ||
95 | } | ||
96 | void FormBinaryImpl::ANDClicked() { | ||
97 | engine->pushInstruction(new iAND()); | ||
98 | } | ||
99 | void FormBinaryImpl::NOTClicked() { | ||
100 | engine->immediateInstruction(new iNOT()); | ||
101 | } | ||
102 | void FormBinaryImpl::ORClicked() { | ||
103 | engine->pushInstruction(new iOR()); | ||
104 | } | ||
105 | void FormBinaryImpl::LSHClicked() { | ||
106 | engine->immediateInstruction(new iLSH()); | ||
107 | } | ||
108 | void FormBinaryImpl::RSHClicked() { | ||
109 | engine->immediateInstruction(new iRSH()); | ||
110 | } | ||
diff --git a/noncore/tools/calc2/binary/binaryimpl.h b/noncore/tools/calc2/binary/binaryimpl.h new file mode 100644 index 0000000..bf9e3a7 --- a/dev/null +++ b/noncore/tools/calc2/binary/binaryimpl.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef FORMBINARYINPUTIMPL | ||
21 | #define FORMBINARYINPUTIMPL | ||
22 | |||
23 | #include "binary.h" | ||
24 | #include <engine.h> | ||
25 | |||
26 | class FormBinaryImpl : public FormBinary { | ||
27 | Q_OBJECT | ||
28 | public: | ||
29 | FormBinaryImpl(Engine *e,QWidget *p) : FormBinary (p,"Binary") { | ||
30 | engine = e; | ||
31 | engine->setRepresentation(rBin); | ||
32 | }; | ||
33 | ~FormBinaryImpl(){}; | ||
34 | private: | ||
35 | Engine *engine; | ||
36 | |||
37 | private slots: | ||
38 | void val0Clicked(); | ||
39 | void val1Clicked(); | ||
40 | |||
41 | void XORClicked(); | ||
42 | void ANDClicked(); | ||
43 | void NOTClicked(); | ||
44 | void ORClicked(); | ||
45 | |||
46 | void LSHClicked(); | ||
47 | void RSHClicked(); | ||
48 | }; | ||
49 | |||
50 | #endif | ||