[Pkg-wmaker-commits] [wmcalc] 23/65: wmcalc: Add version 0.4 to repository.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Sun Aug 23 13:54:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmcalc.
commit 5dcf550cb3967c743c363eba4df346f8ab4c43d3
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Sat Jan 10 10:59:41 2015 -0600
wmcalc: Add version 0.4 to repository.
Source obtained from:
ftp://ftp.afterstep.org/stable/rpms/misc-tarballs/wmcalc-0.4.tar.gz
---
.wmcalc | 35 +++
.wmcalc.bk | 35 +++
.wmcalc.bkp | 35 +++
COPYING | 339 ++++++++++++++++++++
Makefile | 28 ++
README | 212 +++++++++++++
backdrop.xpm | 126 ++++++++
calcbuttons.xpm | 47 +++
charmap-colors.xpm | 79 +++++
charmap.xpm | 71 +++++
charmap_old.xpm | 70 +++++
main.xpm | 73 +++++
mask.xbm | 67 ++++
readln.c | 59 ++++
wmcalc.c | 909 +++++++++++++++++++++++++++++++++++++++++++++++++++++
wmcalc.conf | 35 +++
wmcalc1.xpm | 137 ++++++++
wmcalc2.xpm | 131 ++++++++
wmcalc3.xpm | 131 ++++++++
wmcalc_c.h | 38 +++
wmcalc_err.h | 31 ++
wmcalc_f.h | 80 +++++
wmcalc_g.h | 73 +++++
wmcalc_t.h | 54 ++++
wmcalc_x.h | 30 ++
wmcalcfunc.c | 525 +++++++++++++++++++++++++++++++
wmcalcscr.xpm | 128 ++++++++
wmcalcscr2.gif | Bin 0 -> 2307 bytes
wmcalcscr2.xpm | 128 ++++++++
wmcalcsrc.jpg | Bin 0 -> 2520 bytes
wmcalcswitch.c | 605 +++++++++++++++++++++++++++++++++++
31 files changed, 4311 insertions(+)
diff --git a/.wmcalc b/.wmcalc
new file mode 100644
index 0000000..d6f110d
--- /dev/null
+++ b/.wmcalc
@@ -0,0 +1,35 @@
+# wmcalc Configuration File
+# Last Manual Update: 10/29/00
+
+# General Notes:
+# * There must be a tab character '\t' between the variable name and
+# the value, not a series of spaces.
+# * wmcalc is case sensitive when reading these variables. Examine the
+# wmcalc_g.h file for currently defined variables.
+
+#Calculator Memory Locations
+#Note: These must all exist, though they may be in any order
+Mem0 0.000000
+Mem1 0.000000
+MEM2 2.718282
+MEM3 3.141593
+Mem4 0.000000
+Mem5 0.000000
+Mem6 0.000000
+Mem7 0.000000
+Mem8 0.000000
+Mem9 0.000000
+
+# The CalcStart variable is intended to allow the user to start a larger
+# calculator for more complicated needs. Everything after the tab '\t'
+# character is sent unmodified in a system() call, so anything you can type
+# at the command prompt may be put here.
+#CalcStart xterm -T "Basic Calculator" -e bc &
+#CalcStart xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
+CalcStart xcalc &
+
+# The ImagChar variable allows the user to choose between 'i' and 'j' to
+# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
+# rather than 'i.')
+#ImagChar i
+ImagChar j
diff --git a/.wmcalc.bk b/.wmcalc.bk
new file mode 100644
index 0000000..235f5c7
--- /dev/null
+++ b/.wmcalc.bk
@@ -0,0 +1,35 @@
+# wmcalc Configuration File
+# Last Manual Update: 10/29/00
+
+# General Notes:
+# * There must be a tab character '\t' between the variable name and
+# the value, not a series of spaces.
+# * wmcalc is case sensitive when reading these variables. Examine the
+# wmcalc_g.h file for currently defined variables.
+
+#Calculator Memory Locations
+#Note: These must all exist, though they may be in any order
+Mem0 0.000000
+Mem1 0.000000
+MEM2 2.718282
+MEM3 3.1415926535
+Mem4 0.000000
+Mem5 0.000000
+Mem6 0.000000
+Mem7 0.000000
+Mem8 0.000000
+Mem9 0.000000
+
+# The CalcStart variable is intended to allow the user to start a larger
+# calculator for more complicated needs. Everything after the tab '\t'
+# character is sent unmodified in a system() call, so anything you can type
+# at the command prompt may be put here.
+#CalcStart xterm -T "Basic Calculator" -e bc &
+#CalcStart xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
+CalcStart xcalc &
+
+# The ImagChar variable allows the user to choose between 'i' and 'j' to
+# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
+# rather than 'i.')
+#ImagChar i
+ImagChar j
diff --git a/.wmcalc.bkp b/.wmcalc.bkp
new file mode 100644
index 0000000..235f5c7
--- /dev/null
+++ b/.wmcalc.bkp
@@ -0,0 +1,35 @@
+# wmcalc Configuration File
+# Last Manual Update: 10/29/00
+
+# General Notes:
+# * There must be a tab character '\t' between the variable name and
+# the value, not a series of spaces.
+# * wmcalc is case sensitive when reading these variables. Examine the
+# wmcalc_g.h file for currently defined variables.
+
+#Calculator Memory Locations
+#Note: These must all exist, though they may be in any order
+Mem0 0.000000
+Mem1 0.000000
+MEM2 2.718282
+MEM3 3.1415926535
+Mem4 0.000000
+Mem5 0.000000
+Mem6 0.000000
+Mem7 0.000000
+Mem8 0.000000
+Mem9 0.000000
+
+# The CalcStart variable is intended to allow the user to start a larger
+# calculator for more complicated needs. Everything after the tab '\t'
+# character is sent unmodified in a system() call, so anything you can type
+# at the command prompt may be put here.
+#CalcStart xterm -T "Basic Calculator" -e bc &
+#CalcStart xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
+CalcStart xcalc &
+
+# The ImagChar variable allows the user to choose between 'i' and 'j' to
+# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
+# rather than 'i.')
+#ImagChar i
+ImagChar j
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ccc305a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+INCLUDES =-I/usr/X11R6/include/X11 -I/usr/local/include
+LIBINC =-L/usr/X11R6/lib
+LIBS = -lX11 -lXpm -lXext -lm
+
+TARGET = wmcalc
+OBJECTS = wmcalc.o readln.o wmcalcswitch.o wmcalcfunc.o
+DESTDIR =
+PREFIX = /usr/local
+BINDIR = ${PREFIX}/bin
+MANDIR = ${PREFIX}/share/man
+CONF = /etc
+INSTALL = /usr/bin/install
+INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
+INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644
+
+.c.o:
+ gcc -O2 -c -Wall ${INCLUDES} ${FLAGS} $< -o $*.o
+
+${TARGET}: ${OBJECTS}
+ gcc -O2 -o ${TARGET} ${OBJECTS} ${LIBINC} ${LIBS}
+
+clean::
+ for i in ${OBJECTS}; do if [ -e $$i ] ; then rm $$i; fi; done
+ if [ -e ${TARGET} ] ; then rm ${TARGET}; fi
+
+install::
+ ${INSTALL_PROGRAM} wmcalc ${DESTDIR}${BINDIR}
+ ${INSTALL_FILE} wmcalc.conf ${DESTDIR}${CONF}
diff --git a/README b/README
new file mode 100644
index 0000000..e4f7ecd
--- /dev/null
+++ b/README
@@ -0,0 +1,212 @@
+wmcalc Ver. 0 Rel 4
+-------------------------------------------------------------
+ Code is loosely based on wmppp, wmload, wmtime, wmcp, and asbutton
+ Original Author: Edward H. Flora <ehflora at access1.net>
+ Current Maintainer: Gordon Fraser <gordon at debian.org>
+ Ver 0 Rel 4 May 25, 2002
+
+DESCRIPTION:
+------------
+wmcalc is a program designed to act as a simple four-function
+calculator. It is different from other calculator programs, however
+in that it is designed to take up very little desktop space. As such,
+it can be left running on the desktop at all times. It is intended to
+placed in the WindowMaker dock, or in Wharf under Afterstep, though it
+should run as well under any window manager.
+
+LICENSING:
+----------
+This program is released under the GPL license. A copy (in case you
+don't already have hundreds of them floating around) can be found in
+this distribution in the file COPYING.
+
+CONTRIBUTORS:
+-------------
+Co-Developers:
+ Rick Stuart <stuart at xnet.com>
+ Philippe Trbich <philippe.trbich at free.fr>
+Original Web Page Designs:
+ Jon Bruno <bruno at ksu.edu>
+Thanks to:
+ Ben Cohen <buddog at aztec.asu.edu>
+ original author of wmcp (et al.)
+The contributors listed above are not involved with the development of
+wmcalc. I'm listing them here as thanks for helping out, catching
+bugs in the code, etc.
+
+INSTALLATION:
+-------------
+ Untar the file:
+ tar xvzf wmcalc-0.3.tar.gz
+
+ CD to source directory:
+ cd wmcalc-0.3
+
+ Compile it:
+ make clean; make
+
+ Copy the config file:
+ cp .wmcalc ~
+
+ Put the executable somewhere in your path:
+ mv wmcalc /usr/local/bin (or anyhere in your path)
+
+ Run it:
+ wmcalc &
+
+ Grab the appicon and move it to the dock.
+ Change the settings to start with Windowmaker
+
+ Afterstep Wharf 1.6.??: (I don't use Afterstep anymore, so...)
+ *Wharf wmcalc -Swallow "wmcalc" wmcalc &
+
+ ***Note***:
+ The appicon only has a two pixel border where you can grab
+ and move it. It is easiest to grab along the bottom edge.
+
+ If make doesn't work, you may need to fiddle with the settings in
+ the Makefile.
+
+ Tested on: (Well, it runs, I don't know if 'Tested' is quite right...)
+ WindowMaker-0.62.1
+ X Clients: Red Hat 6.0, Kernel 2.2.8
+
+USAGE:
+------
+usage: wmcalc [-g geometry] [-d dpy] [-v] [-f configfilename] [-h]
+
+-g <geometry> Window Geometry - ie: 64x64+10+10
+-d <display> Display - ie: 127.0.0.1:0.0
+-v Verbose Mode.
+-h Help. This message.
+-f <filename> Full path to configuration file to use.
+
+Buttons are defined as:
+ ____________________
+| x00 | where: x = 1 for Left Mouse Button
+| 0 1 2 3 4 5 6 7 8 9| x = 2 for Middle Mouse Button
+|--------------------| x = 3 for Right Mouse Button
+|x01 x02 x03 x04 x05 |
+|x06 x07 x08 x09 x10 | Note: the numbers 0..9 are the indicators
+|x11 x12 x13 x14 x15 | for memory cells 0..9 respectively
+|x16 x17 x18 x19 x20 |
+ --------------------
+
+Button Functions:
+ 100 Reinitialize the calculator, and both Registers
+ (Clear All)
+ 200 Clear all the memory registers (0..10)
+ 300 Clear the current number being entered only
+ x11 Start a program defined by CalcStart variable in config file
+ 1yy Perform function shown on button
+ 2yy Recall number from memory location [0-9] to display
+ for calculation
+ if yy = 2,3,4, 7,8,9, 12, 13, 14, 17
+ otherwise, can run a user-defined function (not implemented)
+ 3yy Store Displayed number in memory location [0-9]
+ if yy = 2,3,4, 7,8,9, 12,13,14, 17
+ otherwise, can run a user-defined function (not implemented)
+ 1xx Hopefully the other functions are obvious from their
+ button graphics.
+
+
+NOTES:
+------
+I am sure that there are better ways to do some of the things that are
+done in wmcalc. In fact, wmcalc is basically a series of hacks, but appears
+to be stable...
+
+The configuration file (.wmcalc) is written by wmcalc whenever the user
+requests to store a number to memory. As a part of this process, a file
+is written to /tmp. If /tmp is not accessible, it tries in the user's home
+directory, as defined by the environment variable HOME. This file is
+erased as soon as it is written over the main configuration file.
+
+Changes made to the configuration file (other than memory stores) will not
+take effect until the next time wmcalc is started.
+
+Although one can only "Clear" all unlocked memory locations, one may clear the
+display and then "store" a '0' in the memory location, providing the
+ability to clear individual cells.
+
+The fonts are stored in charmap.xpm. This file may be edited to
+change colors or fonts, but the app must be recompiled for the changes
+to take effect. The buttons are located in calcbuttons.xpm. This
+file may be edited, though the borders should stay where they are
+unless you want to change the button regions that are hard coded.
+The background border is defined in backdrop.xpm.
+
+"C code. C code run. Run, code, run.
+ PLEASE!?!?!?!?!?!?"
+
+CHANGE LOG:
+-----------
+0.3 Added "Locked" memory capabilities via config file
+ General Code clean-up
+ Keyboard Support - may not be platform independent
+
+0.21 Added Display of memory locations containing non-zero data
+
+0.2 First psuedo-major enhancements
+ Added Memories, Config File, CalcStart button
+ Bug Fix - Squared imaginary number is now negative
+
+0.1 First real version.
+ Limited functionality.
+
+0.0 Original version. Very limited distribution, as it was not a
+ functional calculator, but just tested the display. It was more
+ of a proof of concept.
+
+TODO:
+-----
+These are partially a dream list. I don't know when they'll get done,
+as I'm pretty busy at work. Anyone want to tackle these??
+
+* Re-implement the register/display design to allow full double precision.
+
+* Add keyboard support (I've tried to do this, with no luck. Probably a
+ 'focus' problem.
+
+* Add button press animation.
+
+* Add a log file, either as a paper tape implementation, or a file
+ that one can intentionally write data to. (This could grow to a pipe to
+ plotting programs, etc, though this is a bit extreme...)
+
+RPN:
+ I have no intention at this time to add in an RPN format, as I
+ personally do not like it. It should be noted that I have NOT used it
+ extensively, and I've heard that I would like it. But, until then...
+
+BUGS:
+-----
+Remember, they're just undocumented FEATURES!!!
+
+* The display can lose the last digit of a three character exponential
+ notation number.
+
+* Due to an implementation fault, at every step of calculations, precision
+ is lost, as the number is only as accurate at that displayed.
+
+* Order of operations: 1 + 2 * 5 = 15, not 11, as it should.
+
+* Changing sign when the display is blank results in "-0". Further entry
+ yields "-05...," but this does not affect calculations.
+
+* Changes to the configuration file do not take effect until wmcalc is
+ restarted. (Note that file is written whenever a "store memory
+ location" is requested)
+
+Probably many more. Send comments (preferably with fixes) to
+ <ehflora at access1.net>
+I will happily include your name in the documentation for the program
+if you send me a bug report and the correction. This can be in the
+form of a patch file, or ASCII text to exchange, or an equivalent.
+Note, this program is written in C. Not C++. I'm not a computer
+science person, I don't do objects. Therefore, bug fixes that convert
+this to C++ don't count, since I would no longer be able to support
+the program. Of course, you can modify the code and release a new
+application.
+
+Thanks, and Good Luck.
diff --git a/backdrop.xpm b/backdrop.xpm
new file mode 100644
index 0000000..728f451
--- /dev/null
+++ b/backdrop.xpm
@@ -0,0 +1,126 @@
+/* XPM */
+static char * backdrop_xpm[] = {
+"64 64 59 1",
+" c None",
+". c #F3F3F3",
+"+ c #000000",
+"@ c #E0E0E0",
+"# c #516161",
+"$ c #A2A2B2",
+"% c #A2A2A2",
+"& c #A292B2",
+"* c #92A2A2",
+"= c #A292A2",
+"- c #9292A2",
+"; c #929292",
+"> c #9282A2",
+", c #829292",
+"' c #928292",
+") c #828292",
+"! c #828282",
+"~ c #827192",
+"{ c #615161",
+"] c #92A2B2",
+"^ c #9292B2",
+"/ c #8292A2",
+"( c #8282A2",
+"_ c #718292",
+": c #718282",
+"< c #C7C7C7",
+"[ c #003F18",
+"} c #C7C3C7",
+"| c #717182",
+"1 c #514151",
+"2 c #415151",
+"3 c #717171",
+"4 c #414151",
+"5 c #617182",
+"6 c #415141",
+"7 c #716182",
+"8 c #414141",
+"9 c #617171",
+"0 c #413041",
+"a c #304141",
+"b c #716171",
+"c c #616171",
+"d c #616182",
+"e c #303030",
+"f c #616161",
+"g c #303041",
+"h c #516171",
+"i c #304130",
+"j c #615171",
+"k c #203030",
+"l c #302030",
+"m c #515171",
+"n c #515161",
+"o c #827182",
+"p c #202030",
+"q c #717192",
+"r c #202020",
+"s c #515151",
+"t c #413051",
+"...............................................................+",
+".@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#+",
+".@$%$%&%&%&%&*=-&*=-=-=---=--;>;>;>;>,>,>,')',')')'))!)))!~!~!{+",
+".@$$*$]$*$*$*&*&*^*-*-*-*-*-/---,-,-,>,>,(,>,(,),),)))))_)_):)#+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+<+",
+".+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+<+",
+".+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+<+",
+".+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+<+",
+".+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+<+",
+".+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+<+",
+".+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+<+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".++[[[+++[[[+++[[[+++[[[+++[[[+++[[[+++[[[+++[[[+++[[[+++[[[++<+",
+".+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+[[[[[+<+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+",
+".@=<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}||1+",
+".@*<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}||2+",
+".@=<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}|31+",
+". at -<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}||4+",
+".@=<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}|31+",
+".@*<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}5|6+",
+". at -<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}734+",
+". at -<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}5|8+",
+".@><+++++++++++++++++++++++++++++++++++++++++++++++++++++++}790+",
+". at -<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}978+",
+". at -<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}738+",
+".@,<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}97a+",
+".@><+++++++++++++++++++++++++++++++++++++++++++++++++++++++}790+",
+".@,<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}97a+",
+".@><+++++++++++++++++++++++++++++++++++++++++++++++++++++++}b90+",
+".@,<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}97a+",
+".@'<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}7c0+",
+".@,<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}9da+",
+".@><+++++++++++++++++++++++++++++++++++++++++++++++++++++++}bc0+",
+".@,<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}9ca+",
+".@'<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}cc0+",
+".@,<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}9ca+",
+".@'<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}bc0+",
+".@,<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}cce+",
+".@'<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}cfg+",
+".@,<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}hci+",
+".@'<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}jfg+",
+".@)<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}cck+",
+".@)<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}jfl+",
+".@)<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}#ck+",
+".@)<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}jfe+",
+".@)<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}hck+",
+".@~<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}j#l+",
+". at _<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}#jk+",
+".@)<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}jfl+",
+".@:<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}#jk+",
+".@~<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}j#l+",
+".@:<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}#mk+",
+".@~<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}{nl+",
+".@:<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}#jk+",
+".@~<+++++++++++++++++++++++++++++++++++++++++++++++++++++++}{nl+",
+".@:<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<}#mk+",
+".@~:o|o|o|o|o||373|373797379b9b9bcbcbccfcccfjfjfjfj#j#j#{n{n{np+",
+".@:q:~:q:|||||||||9|5|979797979d9ccc9ccccchchc#jhj#j#j#m#mnm#nr+",
+".@{snsnsns1s12121614181848t848080a0a0i0egegegelelelelklplrlrprp+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"};
diff --git a/calcbuttons.xpm b/calcbuttons.xpm
new file mode 100644
index 0000000..39fe476
--- /dev/null
+++ b/calcbuttons.xpm
@@ -0,0 +1,47 @@
+/* XPM */
+static char * calcbuttons_xpm[] = {
+"53 40 4 1",
+" c None",
+". c #FFFFFF",
+"+ c #D5D6D5",
+"@ c #000000",
+"...........+.........+.........+.........+..........+",
+".++++++++++ at .++++++++@.++++++++ at .++++++++@++++++ at +++@",
+".++++@@@@++ at .+@@@@@++ at .++@@@+++ at .++@@@+++ at ++++++@+++@",
+".++++ at +++++@.+++++ at ++@.+ at +++@++ at .+@+++ at ++@+++++ at ++++@",
+".++++ at +++++@.++++ at +++@.++@@@+++ at .+@+++ at ++@++++ at +++++@",
+".++ at +@+++++ at .+++@++++ at .+@+++ at ++@.++@@@@++ at +++@++++++@",
+".+++@@+++++ at .+++@++++ at .+@+++ at ++@.+++++ at ++@++ at +++++++@",
+".++++ at +++++@.+++ at ++++@.++@@@+++ at .++@@@+++ at ++@+++++++@",
+".++++++++++ at .++++++++@.++++++++ at .++++++++@++++++++++@",
+"+@@@@@@@@@@@+@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@",
+"...........+.........+.........+.........+..........+",
+".++++++++++ at .++++++++@.++++++++ at .++++++++@++++++++++@",
+".++++++ at +++@.++++ at +++@.+@@@@@++ at .++@@@+++ at ++@+++ at +++@",
+".+++++++ at ++@.+ at ++@+++ at .+@++++++ at .+@++++++ at +++@+ at ++++@",
+".++++++ at +++@.+ at ++@+++ at .+@@@@+++ at .+@@@@+++ at ++++@+++++@",
+".++ at +@+@@++ at .+@@@@@++ at .+++++@++ at .+@+++ at ++@+++ at +@++++@",
+".+++ at ++++++@.++++ at +++@.+ at +++@++ at .+@+++ at ++@++ at +++@+++@",
+".++ at +@+++++ at .++++@+++ at .++@@@+++ at .++@@@+++ at ++++++++++@",
+".++++++++++ at .++++++++@.++++++++ at .++++++++@++++++++++@",
+"+@@@@@@@@@@@+@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@",
+"...........+.........+.........+.........+..........+",
+".++++++++++ at .++++++++@.++++++++ at .++++++++@++++++++++@",
+".+@@@@@@@@+ at .++++@+++ at .++@@@+++ at .+@@@@+++ at ++++++++++@",
+".+ at ++++++@+ at .+++@@+++ at .+@+++ at ++@.+++++ at ++@++++++++++@",
+".+@@@@@@@@+ at .++++@+++ at .+++++@++ at .++@@@+++ at ++@@@@@+++@",
+".+ at +@+ at +@@+ at .++++@+++ at .++@@@+++ at .+++++@++ at ++++++++++@",
+".+@@+ at +@+ at +@.++++ at +++@.+ at ++++++@.+ at +++@++ at ++++++++++@",
+".+@@@@@@@@+ at .+++@@@++ at .+@@@@@++ at .++@@@+++ at ++++++++++@",
+".++++++++++ at .++++++++@.++++++++ at .++++++++@++++++++++@",
+"+@@@@@@@@@@@+@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@",
+"...........+.........+.........+.........+..........+",
+".++++++++++ at .++++++++@.++++++++ at .++++++++@++++++++++@",
+".+++ at +++@++ at .++@@@+++ at .++++++++@.++++++++ at ++++@+++++@",
+".++@@@+ at +++@.+ at +++@++ at .++++++++@.++@@@@++ at ++++@+++++@",
+".+++ at +@++++ at .+@+++ at ++@.++++++++ at .++++++++@++@@@@@+++@",
+".++++ at +++++@.+ at +++@++ at .++++++++@.++@@@@++ at ++++@+++++@",
+".+++ at ++++++@.+ at +++@++ at .+++@@+++ at .++++++++@++++ at +++++@",
+".++ at ++@@@++ at .++@@@+++ at .+++@@+++ at .++++++++@++++++++++@",
+".++++++++++ at .++++++++@.++++++++ at .++++++++@++++++++++@",
+"+@@@@@@@@@@@+@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@"};
diff --git a/charmap-colors.xpm b/charmap-colors.xpm
new file mode 100644
index 0000000..64d064c
--- /dev/null
+++ b/charmap-colors.xpm
@@ -0,0 +1,79 @@
+/* XPM */
+static char * charmap_colors_xpm[] = {
+"61 64 12 1",
+" c None",
+". c #000000",
+"+ c #003F18",
+"@ c #00FF00",
+"# c #481814",
+"$ c #FF0000",
+"% c #000064",
+"& c #0048FC",
+"* c #474700",
+"= c #FFFF00",
+"- c #38184C",
+"; c #BA55D3",
+".............................................................",
+".+@@@+.++ at ++.+@@@+.@@@@@.+++ at +.@@@@@.++@@+.@@@@@.+@@@+.+@@@+.",
+". at +++@.+@@++. at +++@.+++ at +.++@@+. at ++++.+@+++.++++ at .@+++ at .@+++ at .",
+". at +++@.++ at ++.++++@.++ at ++.+@+ at +.@@@@+. at ++++.+++@+. at +++@. at +++@.",
+". at +++@.++ at ++.+++@+.+++ at +.@++ at +.++++@.@@@@+.++ at ++.+@@@+.+@@@@.",
+". at +++@.++ at ++.++@++.++++ at .@@@@@.++++ at .@+++ at .+@+++. at +++@.++++ at .",
+". at +++@.++ at ++.+@+++. at +++@.+++ at +.@+++ at .@+++ at .+@+++. at +++@.+++ at +.",
+".+@@@+.+@@@+.@@@@@.+@@@+.+++ at +.+@@@+.+@@@+.+ at +++.+@@@+.+@@++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+@@@+.@@@@+.+@@@+.@@@@+.@@@@@.@@@@@.+@@@+. at +++@.",
+".+++++.+++++. at +++@. at +++@. at +++@. at +++@. at ++++.@++++. at +++@. at +++@.",
+".+++++.+++++. at +++@. at +++@. at ++++.@+++ at .@++++. at ++++.@++++. at +++@.",
+".+++++.+++++.@@@@@.@@@@+. at ++++.@+++ at .@@@@+.@@@@+. at +@@@.@@@@@.",
+".+++++.+++++. at +++@. at +++@. at ++++.@+++ at .@++++. at ++++.@+++ at .@+++ at .",
+".+++++.++@@+. at +++@. at +++@. at +++@. at +++@. at ++++.@++++. at +++@. at +++@.",
+".+++++.++@@+. at +++@.@@@@+.+@@@+.@@@@+.@@@@@. at ++++.+@@@@. at +++@.",
+".............................................................",
+".............................................................",
+".+@@@+.++@@@. at +++@. at ++++.@+++ at .@+++ at .++@++.@@@@+.+@@@+.@@@@+.",
+".++ at ++.+++@+. at ++@+. at ++++.@@+@@. at +++@.+ at +@+. at +++@. at +++@. at +++@.",
+".++ at ++.+++@+. at +@++. at ++++.@+ at +@.@@++ at .@+++ at .@+++ at .@+++ at .@+++ at .",
+".++ at ++.+++@+.@@+++. at ++++.@+ at +@. at +@+ at .@+++ at .@@@@+. at +++@.@@@@+.",
+".++ at ++.+++@+. at +@++. at ++++.@+++ at .@++@@. at +++@. at ++++.@+ at +@. at +@++.",
+".++ at ++.@++ at +.@++ at +.@++++. at +++@. at +++@.+ at +@+. at ++++.@++ at +.@++ at +.",
+".+@@@+.+@@++. at +++@.@@@@@. at +++@. at +++@.++ at ++.@++++.+@@+ at .@+++ at .",
+".............................................................",
+".............................................................",
+".+@@@@.@@@@@. at +++@. at +++@. at +++@. at +++@. at +++@.@@@@@.+++++.+++++.",
+". at ++++.++@++. at +++@. at +++@. at +++@. at +++@. at +++@.++++ at .+++++.++@++.",
+". at ++++.++@++. at +++@. at +++@. at +++@.+ at +@+. at +++@.+++ at +.+++++.++@++.",
+".+@@@+.++ at ++.@+++ at .@+++ at .@+ at +@.++ at ++.+@+ at +.++@++.@@@@@.@@@@@.",
+".++++ at .++@++. at +++@. at +++@. at +@+ at .+@+ at +.++@++.+ at +++.+++++.++@++.",
+".++++ at .++@++. at +++@.+ at +@+. at +@+ at .@+++ at .++@++. at ++++.+++++.++@++.",
+".@@@@+.++ at ++.+@@@+.++ at ++.+@+ at +.@+++ at .++@++.@@@@@.+++++.+++++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+++ at +.+++++.+++++.++@@+.+++++.+++++.+++++.+++++.",
+".+++++.++ at ++.+++++.+++++.+++++.+@++ at .+++++.+++++.+++++.+++++.",
+".+@@@@.+++++.++@@+. at +@@+.+@@@+.+ at +++.+++++.+++++.+++++.+++++.",
+".+ at +++.+@@++.+++ at +.@@++ at .++++@.@@@++.+++++.+++++.+++++.+++++.",
+".+@@@+.++ at ++.+++@+. at +++@.+@@@@.+ at +++.+++++.+++++.+++++.+++++.",
+".+ at +++.++@++. at ++@+. at +++@. at +++@.+ at +++.+++++.+++++.+++++.+++++.",
+".+@@@@.+@@@+.+@@++. at +++@.+@@@@.+ at +++.+++++.+++++.+++++.+++++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".............................................................",
+".............................................................",
+".#$$$#.%&&&%.*===*.+@@@+.-;;;-.+++++.+++++.+++++.+++++.......",
+".$###$.&%%%&.=***=. at +++@.;---;.+++++.+++++.+++++.+++++..@@@..",
+".$###$.&%%%&.=***=. at +++@.;---;.+++++.+++++.+++++.+++++.@@@@@.",
+".#$$$#.%&&&%.*===*.+@@@+.-;;;-.+++++.+++++.+++++.+++++.......",
+".$###$.&%%%&.=***=. at +++@.;---;.+++++.+++++.+++++.+++++..+++..",
+".$###$.&%%%&.=***=. at +++@.;---;.+++++.+++++.+++++.+++++.+++++.",
+".#$$$#.%&&&%.*===*.+@@@+.-;;;-.+++++.+++++.+++++.+++++.......",
+".............................................................",
+".$$$$$.&&&&&.=====.@@@@@.;;;;;.#####.%%%%%.*****.+++++.------"};
diff --git a/charmap.xpm b/charmap.xpm
new file mode 100644
index 0000000..57e79cd
--- /dev/null
+++ b/charmap.xpm
@@ -0,0 +1,71 @@
+/* XPM */
+static char * charmap_xpm[] = {
+"61 63 5 1",
+" c None",
+". c #000000",
+"+ c #003F18",
+"@ c #00FF00",
+"# c #D30000",
+".............................................................",
+".+@@@+.++ at ++.+@@@+.@@@@@.+++ at +.@@@@@.++@@+.@@@@@.+@@@+.+@@@+.",
+". at +++@.+@@++. at +++@.+++ at +.++@@+. at ++++.+@+++.++++ at .@+++ at .@+++ at .",
+". at +++@.++ at ++.++++@.++ at ++.+@+ at +.@@@@+. at ++++.+++@+. at +++@. at +++@.",
+". at +++@.++ at ++.+++@+.+++ at +.@++ at +.++++@.@@@@+.++ at ++.+@@@+.+@@@@.",
+". at +++@.++ at ++.++@++.++++ at .@@@@@.++++ at .@+++ at .+@+++. at +++@.++++ at .",
+". at +++@.++ at ++.+@+++. at +++@.+++ at +.@+++ at .@+++ at .+@+++. at +++@.+++ at +.",
+".+@@@+.+@@@+.@@@@@.+@@@+.+++ at +.+@@@+.+@@@+.+ at +++.+@@@+.+@@++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+@@@+.@@@@+.+@@@+.@@@@+.@@@@@.@@@@@.+@@@+. at +++@.",
+".+++++.+++++. at +++@. at +++@. at +++@. at +++@. at ++++.@++++. at +++@. at +++@.",
+".+++++.+++++. at +++@. at +++@. at ++++.@+++ at .@++++. at ++++.@++++. at +++@.",
+".+++++.+++++.@@@@@.@@@@+. at ++++.@+++ at .@@@@+.@@@@+. at +@@@.@@@@@.",
+".+++++.+++++. at +++@. at +++@. at ++++.@+++ at .@++++. at ++++.@+++ at .@+++ at .",
+".+++++.++@@+. at +++@. at +++@. at +++@. at +++@. at ++++.@++++. at +++@. at +++@.",
+".+++++.++@@+. at +++@.@@@@+.+@@@+.@@@@+.@@@@@. at ++++.+@@@@. at +++@.",
+".............................................................",
+".............................................................",
+".+@@@+.++@@@. at +++@. at ++++.@+++ at .@+++ at .++@++.@@@@+.+@@@+.@@@@+.",
+".++ at ++.+++@+. at ++@+. at ++++.@@+@@. at +++@.+ at +@+. at +++@. at +++@. at +++@.",
+".++ at ++.+++@+. at +@++. at ++++.@+ at +@.@@++ at .@+++ at .@+++ at .@+++ at .@+++ at .",
+".++ at ++.+++@+.@@+++. at ++++.@+ at +@. at +@+ at .@+++ at .@@@@+. at +++@.@@@@+.",
+".++ at ++.+++@+. at +@++. at ++++.@+++ at .@++@@. at +++@. at ++++.@+ at +@. at +@++.",
+".++ at ++.@++ at +.@++ at +.@++++. at +++@. at +++@.+ at +@+. at ++++.@++ at +.@++ at +.",
+".+@@@+.+@@++. at +++@.@@@@@. at +++@. at +++@.++ at ++.@++++.+@@+ at .@+++ at .",
+".............................................................",
+".............................................................",
+".+@@@@.@@@@@. at +++@. at +++@. at +++@. at +++@. at +++@.@@@@@.+++++.+++++.",
+". at ++++.++@++. at +++@. at +++@. at +++@. at +++@. at +++@.++++ at .+++++.++@++.",
+". at ++++.++@++. at +++@. at +++@. at +++@.+ at +@+. at +++@.+++ at +.+++++.++@++.",
+".+@@@+.++ at ++.@+++ at .@+++ at .@+ at +@.++ at ++.+@+ at +.++@++.@@@@@.@@@@@.",
+".++++ at .++@++. at +++@. at +++@. at +@+ at .+@+ at +.++@++.+ at +++.+++++.++@++.",
+".++++ at .++@++. at +++@.+ at +@+. at +@+ at .@+++ at .++@++. at ++++.+++++.++@++.",
+".@@@@+.++ at ++.+@@@+.++ at ++.+@+ at +.@+++ at .++@++.@@@@@.+++++.+++++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+++ at +.+++++.+++++.++@@+.+++++.+++++.+++++.+++++.",
+".+++++.++ at ++.+++++.+++++.+++++.+@++ at .+++++.+++++.+++++.+++++.",
+".+@@@@.+++++.++@@+. at +@@+.+@@@+.+ at +++.+++++.+++++.+++++.+++++.",
+".+ at +++.+@@++.+++ at +.@@++ at .++++@.@@@++.+++++.+++++.+++++.+++++.",
+".+@@@+.++ at ++.+++@+. at +++@.+@@@@.+ at +++.+++++.+++++.+++++.+++++.",
+".+ at +++.++@++. at ++@+. at +++@. at +++@.+ at +++.+++++.+++++.+++++.+++++.",
+".+@@@@.+@@@+.+@@++. at +++@.+@@@@.+ at +++.+++++.+++++.+++++.+++++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++..@@@..",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.@@@@@.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++..###..",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.#####.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.......",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++..@@@..",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.@@@@@.",
+"............................................................."};
diff --git a/charmap_old.xpm b/charmap_old.xpm
new file mode 100644
index 0000000..5ece27f
--- /dev/null
+++ b/charmap_old.xpm
@@ -0,0 +1,70 @@
+/* XPM */
+static char * charmap_xpm[] = {
+"61 63 4 1",
+" c None",
+". c #000000",
+"+ c #003F18",
+"@ c #00FF00",
+".............................................................",
+".+@@@+.++ at ++.+@@@+.@@@@@.+++ at +.@@@@@.++@@+.@@@@@.+@@@+.+@@@+.",
+". at +++@.+@@++. at +++@.+++ at +.++@@+. at ++++.+@+++.++++ at .@+++ at .@+++ at .",
+". at +++@.++ at ++.++++@.++ at ++.+@+ at +.@@@@+. at ++++.+++@+. at +++@. at +++@.",
+". at +++@.++ at ++.+++@+.+++ at +.@++ at +.++++@.@@@@+.++ at ++.+@@@+.+@@@@.",
+". at +++@.++ at ++.++@++.++++ at .@@@@@.++++ at .@+++ at .+@+++. at +++@.++++ at .",
+". at +++@.++ at ++.+@+++. at +++@.+++ at +.@+++ at .@+++ at .+@+++. at +++@.+++ at +.",
+".+@@@+.+@@@+.@@@@@.+@@@+.+++ at +.+@@@+.+@@@+.+ at +++.+@@@+.+@@++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+@@@+.@@@@+.+@@@+.@@@@+.@@@@@.@@@@@.+@@@+. at +++@.",
+".+++++.+++++. at +++@. at +++@. at +++@. at +++@. at ++++.@++++. at +++@. at +++@.",
+".+++++.+++++. at +++@. at +++@. at ++++.@+++ at .@++++. at ++++.@++++. at +++@.",
+".+++++.+++++.@@@@@.@@@@+. at ++++.@+++ at .@@@@+.@@@@+. at +@@@.@@@@@.",
+".+++++.+++++. at +++@. at +++@. at ++++.@+++ at .@++++. at ++++.@+++ at .@+++ at .",
+".+++++.++@@+. at +++@. at +++@. at +++@. at +++@. at ++++.@++++. at +++@. at +++@.",
+".+++++.++@@+. at +++@.@@@@+.+@@@+.@@@@+.@@@@@. at ++++.+@@@@. at +++@.",
+".............................................................",
+".............................................................",
+".+@@@+.++@@@. at +++@. at ++++.@+++ at .@+++ at .++@++.@@@@+.+@@@+.@@@@+.",
+".++ at ++.+++@+. at ++@+. at ++++.@@+@@. at +++@.+ at +@+. at +++@. at +++@. at +++@.",
+".++ at ++.+++@+. at +@++. at ++++.@+ at +@.@@++ at .@+++ at .@+++ at .@+++ at .@+++ at .",
+".++ at ++.+++@+.@@+++. at ++++.@+ at +@. at +@+ at .@+++ at .@@@@+. at +++@.@@@@+.",
+".++ at ++.+++@+. at +@++. at ++++.@+++ at .@++@@. at +++@. at ++++.@+ at +@. at +@++.",
+".++ at ++.@++ at +.@++ at +.@++++. at +++@. at +++@.+ at +@+. at ++++.@++ at +.@++ at +.",
+".+@@@+.+@@++. at +++@.@@@@@. at +++@. at +++@.++ at ++.@++++.+@@+ at .@+++ at .",
+".............................................................",
+".............................................................",
+".+@@@@.@@@@@. at +++@. at +++@. at +++@. at +++@. at +++@.@@@@@.+++++.+++++.",
+". at ++++.++@++. at +++@. at +++@. at +++@. at +++@. at +++@.++++ at .+++++.++@++.",
+". at ++++.++@++. at +++@. at +++@. at +++@.+ at +@+. at +++@.+++ at +.+++++.++@++.",
+".+@@@+.++ at ++.@+++ at .@+++ at .@+ at +@.++ at ++.+@+ at +.++@++.@@@@@.@@@@@.",
+".++++ at .++@++. at +++@. at +++@. at +@+ at .+@+ at +.++@++.+ at +++.+++++.++@++.",
+".++++ at .++@++. at +++@.+ at +@+. at +@+ at .@+++ at .++@++. at ++++.+++++.++@++.",
+".@@@@+.++ at ++.+@@@+.++ at ++.+@+ at +.@+++ at .++@++.@@@@@.+++++.+++++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+++ at +.+++++.+++++.++@@+.+++++.+++++.+++++.+++++.",
+".+++++.++ at ++.+++++.+++++.+++++.+@++ at .+++++.+++++.+++++.+++++.",
+".+@@@@.+++++.++@@+. at +@@+.+@@@+.+ at +++.+++++.+++++.+++++.+++++.",
+".+ at +++.+@@++.+++ at +.@@++ at .++++@.@@@++.+++++.+++++.+++++.+++++.",
+".+@@@+.++ at ++.+++@+. at +++@.+@@@@.+ at +++.+++++.+++++.+++++.+++++.",
+".+ at +++.++@++. at ++@+. at +++@. at +++@.+ at +++.+++++.+++++.+++++.+++++.",
+".+@@@@.+@@@+.+@@++. at +++@.+@@@@.+ at +++.+++++.+++++.+++++.+++++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".............................................................",
+".............................................................",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.......",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++..@@@..",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.@@@@@.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.......",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++..+++..",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.",
+".+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.+++++.......",
+"............................................................."};
diff --git a/main.xpm b/main.xpm
new file mode 100644
index 0000000..f34db30
--- /dev/null
+++ b/main.xpm
@@ -0,0 +1,73 @@
+/* XPM */
+static char * main_xpm[] = {
+"64 64 6 1",
+" c None",
+". c #000000",
+"+ c #C7C7C7",
+"@ c #003F18",
+"# c #FFFFFF",
+"$ c #D5D6D5",
+" ",
+" ",
+" ",
+" ",
+" ..............................................................",
+" .............................................................+",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+",
+" .............................................................+",
+" ..@@@...@@@...@@@...@@@...@@@...@@@...@@@...@@@...@@@...@@@..+",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+",
+" .............................................................+",
+" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+" .###########$#########$#########$#########$##########$.+ ",
+" .#$$$$$$$$$$.#$$$$$$$$.#$$$$$$$$.#$$$$$$$$.$$$$$$.$$$..+ ",
+" .#$$$$....$$.#$.....$$.#$$...$$$.#$$...$$$.$$$$$$.$$$..+ ",
+" .#$$$$.$$$$$.#$$$$$.$$.#$.$$$.$$.#$.$$$.$$.$$$$$.$$$$..+ ",
+" .#$$$$.$$$$$.#$$$$.$$$.#$$...$$$.#$.$$$.$$.$$$$.$$$$$..+ ",
+" .#$$.$.$$$$$.#$$$.$$$$.#$.$$$.$$.#$$....$$.$$$.$$$$$$..+ ",
+" .#$$$..$$$$$.#$$$.$$$$.#$.$$$.$$.#$$$$$.$$.$$.$$$$$$$..+ ",
+" .#$$$$.$$$$$.#$$$.$$$$.#$$...$$$.#$$...$$$.$$.$$$$$$$..+ ",
+" .#$$$$$$$$$$.#$$$$$$$$.#$$$$$$$$.#$$$$$$$$.$$$$$$$$$$..+ ",
+" .$...........$.........$.........$.....................+ ",
+" .###########$#########$#########$#########$##########$.+ ",
+" .#$$$$$$$$$$.#$$$$$$$$.#$$$$$$$$.#$$$$$$$$.$$$$$$$$$$..+ ",
+" .#$$$$$$.$$$.#$$$$.$$$.#$.....$$.#$$...$$$.$$.$$$.$$$..+ ",
+" .#$$$$$$$.$$.#$.$$.$$$.#$.$$$$$$.#$.$$$$$$.$$$.$.$$$$..+ ",
+" .#$$$$$$.$$$.#$.$$.$$$.#$....$$$.#$....$$$.$$$$.$$$$$..+ ",
+" .#$$.$.$..$$.#$.....$$.#$$$$$.$$.#$.$$$.$$.$$$.$.$$$$..+ ",
+" .#$$$.$$$$$$.#$$$$.$$$.#$.$$$.$$.#$.$$$.$$.$$.$$$.$$$..+ ",
+" .#$$.$.$$$$$.#$$$$.$$$.#$$...$$$.#$$...$$$.$$$$$$$$$$..+ ",
+" .#$$$$$$$$$$.#$$$$$$$$.#$$$$$$$$.#$$$$$$$$.$$$$$$$$$$..+ ",
+" .$...........$.........$.........$.....................+ ",
+" .###########$#########$#########$#########$##########$.+ ",
+" .#$$$$$$$$$$.#$$$$$$$$.#$$$$$$$$.#$$$$$$$$.$$$$$$$$$$..+ ",
+" .#$$$$$$$$$$.#$$$$.$$$.#$$...$$$.#$....$$$.$$$$$$$$$$..+ ",
+" .#$$....$$$$.#$$$..$$$.#$.$$$.$$.#$$$$$.$$.$$$$$$$$$$..+ ",
+" .#$$.$$$$$$$.#$$$$.$$$.#$$$$$.$$.#$$...$$$.$$.....$$$..+ ",
+" .#$$...$$$$$.#$$$$.$$$.#$$...$$$.#$$$$$.$$.$$$$$$$$$$..+ ",
+" .#$$.$$$$$$$.#$$$$.$$$.#$.$$$$$$.#$.$$$.$$.$$$$$$$$$$..+ ",
+" .#$$....$$$$.#$$$...$$.#$.....$$.#$$...$$$.$$$$$$$$$$..+ ",
+" .#$$$$$$$$$$.#$$$$$$$$.#$$$$$$$$.#$$$$$$$$.$$$$$$$$$$..+ ",
+" .$...........$.........$.........$.....................+ ",
+" .###########$#########$#########$#########$##########$.+ ",
+" .#$$$$$$$$$$.#$$$$$$$$.#$$$$$$$$.#$$$$$$$$.$$$$$$$$$$..+ ",
+" .#$$$.$$$.$$.#$$...$$$.#$$$$$$$$.#$$$$$$$$.$$$$.$$$$$..+ ",
+" .#$$...$.$$$.#$.$$$.$$.#$$$$$$$$.#$$....$$.$$$$.$$$$$..+ ",
+" .#$$$.$.$$$$.#$.$$$.$$.#$$$$$$$$.#$$$$$$$$.$$.....$$$..+ ",
+" .#$$$$.$$$$$.#$.$$$.$$.#$$$$$$$$.#$$....$$.$$$$.$$$$$..+ ",
+" .#$$$.$$$$$$.#$.$$$.$$.#$$$..$$$.#$$$$$$$$.$$$$.$$$$$..+ ",
+" .#$$.$$...$$.#$$...$$$.#$$$..$$$.#$$$$$$$$.$$$$$$$$$$..+ ",
+" .#$$$$$$$$$$.#$$$$$$$$.#$$$$$$$$.#$$$$$$$$.$$$$$$$$$$..+ ",
+" .$...........$.........$.........$.....................+ ",
+" .......................................................+ ",
+" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
+" ",
+" ",
+" ",
+" "};
diff --git a/mask.xbm b/mask.xbm
new file mode 100644
index 0000000..ef7f31a
--- /dev/null
+++ b/mask.xbm
@@ -0,0 +1,67 @@
+#define mask_width 64
+#define mask_height 64
+
+static char mask_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
diff --git a/readln.c b/readln.c
new file mode 100644
index 0000000..23447e4
--- /dev/null
+++ b/readln.c
@@ -0,0 +1,59 @@
+/* readln.c - Edward H. Flora - ehflora at ksu.edu */
+/* Last Modified: 2/24/98 */
+/*
+ * This function reads a string from a file pointed to by fp until a
+ * new line (EOLN) or an end of file is encountered. It returns a pointer
+ * to the string. The new line character is included in the string returned
+ * by the function.
+ */
+
+/* EXTERNALS:
+ ******************
+ * Functions Called:
+ * Standard Libraries.
+ *
+ * Header Files Included:
+ * Standard Includes only.
+ */
+
+/* PORTABILITY:
+ ******************
+ * Coded in ANSI C, using ANSI prototypes.
+ */
+
+/****** Include Files *************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define EOLN '\n' /* Defines the new line character */
+#define SIZE1 10 /* Defines the increment to increase the */
+ /* string by until a newline of EOF is found */
+
+/****** Function to Read a Line from fp *******************************/
+char *readln(FILE *fp){
+ char *tmp, *t1, *t2;
+ int count = 0, s1 = SIZE1;
+
+ if((tmp = malloc(SIZE1*sizeof(char))) == NULL)return NULL;
+ /* If cannot allocate memory */
+ if((t1 = fgets(tmp, SIZE1, fp)) == NULL){
+ free(tmp);
+ return NULL;
+ } /* If there is no string to be read */
+ while(strchr(t1,EOLN) == NULL){ /* Loop while EOLN is not in the string */
+ count += strlen(t1);
+ if((s1 - count) > 1)break;
+ s1 +=SIZE1;
+ if((t2 = realloc(tmp, s1*sizeof(char))) == NULL){
+ free(tmp);
+ return NULL;
+ } /* If cannot allocate more memory */
+ else tmp = t2;
+ if((t1 = fgets((tmp+count),((s1 - count)),fp)) == NULL)break;
+ } /* End of While Loop */
+ if((t2 = realloc(tmp,strlen(tmp)+1)) == NULL)free(tmp);
+ return (t2);
+}
+/****** End of Function readln ****************************************/
+
diff --git a/wmcalc.c b/wmcalc.c
new file mode 100644
index 0000000..19990a6
--- /dev/null
+++ b/wmcalc.c
@@ -0,0 +1,909 @@
+/****************************************************************
+ * File: wmcalc.c
+ * Version: 0.3
+ * Date: January 17, 2001
+ * Author: Edward H. Flora <ehflora at access1.net>
+ *
+ * This file is a part of the wmcalc application. As such, this
+ * file is licensed under the GNU General Public License, version 2.
+ * A copy of this license may be found in the file COPYING that should
+ * have been distributed with this file. If not, please refer to
+ * http://www.gnu.org/copyleft/gpl.html for details.
+ *
+ ****************************************************************
+ Description:
+ This file contains the main program code for the wmcalc
+ application. Wmcalc is a dockapp designed for the WindowMaker or
+ Afterstep window managers (although it should run well in most
+ others.) wmcalc is a four-function (and more) calculator that
+ has a small enough footprint that you may leave it open on your
+ desktop at all times, for convenient use.
+
+
+ Change History:
+ Date Modification
+ 01/17/01 Updated to use XLookupString
+ 12/10/00 Revised includes, extracting X libs to wmcalc_x.h
+ 11/09/00 Added "locked" memory capabilities
+ 11/08/00 Added Code to Support Keyboard / focus
+ 10/29/00 Implemented memory use, configuration files, and a
+ quickstart button for a larger calculator. Also
+ abstracted some of the macros, global vars, function
+ prototypes, etc out to independent header files, to
+ eliminate some dependency issues between source files.
+ 02/10/00 Added keyboard event code, without success
+ 12/21/99 Original product release, version 0.1
+ 11/26/99 Original file creation
+
+ ****************************************************************/
+
+#include "wmcalc_x.h"
+#include <XKBlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "wmcalc_c.h"
+#include "wmcalc_err.h"
+#include "wmcalc_t.h"
+#include "wmcalc_g.h"
+#include "wmcalc_f.h"
+
+#include "backdrop.xpm" // background graphic
+#include "calcbuttons.xpm" // graphic of buttons
+#include "charmap.xpm" // pixmap of characters
+#include "mask.xbm"
+
+/* Global Variables */
+/* Ok, so I didn't get them all extracted. Should look into this
+ further */
+int N = 1; /* Button number pressed to goto app # */
+int border = 0;
+int Verbose = 0; /* Debug flag */
+int mmouse = 1; /* flag to enable middle mouse (hold
+ over from wmbutton */
+int button_pressed = -1; /* button to be drawn pressed */
+char PlusMinusFlag = '+'; /* flag for sign of number in display */
+char OpFlag = ' '; /* Operation requested */
+int ExpFlag = 0; /* Flag if in scientific notation */
+int DecFlag = 0; /* Flag if a decimal is in display */
+int ImgFlag = 0; /* Flag if a number is imaginary */
+int StrCnt = 0;
+double RegisterA = 0.0; /* Main working register, displayed */
+double RegisterB = 0.0; /* Second register to add to, etc */
+char DispString[DISPSIZE+1]; /* Pointer to string of display */
+ButtonArea button_region[NUM_BUTTONS]; /* Array of buttons */
+
+char *app_name = "wmcalc"; /* Name of app, for window management */
+
+/****************************************************************
+ * Function: main
+ ****************************************************************
+ Description:
+ This is the main Program control function for wmcalc. It
+ contains all the X11 windows function calls, as well as other
+ general operations.
+
+ Change History:
+ Date Modification
+ 01/17/01 Updated to use XLookupString to get KeySym
+ 11/09/00 Added Events for focus and keyboard work.
+ 11/01/00 File Header Added
+ 21/09/01 Added global configfile by Gordon Fraser
+ ****************************************************************/
+int main( int argc, char **argv ) {
+ XEvent report;
+ XGCValues xgcValues;
+ XTextProperty app_name_atom;
+ int err_code = OKAY;
+ int dummy = 0;
+ int i;
+ char Geometry_str[64] = "64x64+0+0";
+ char Display_str[64] = "";
+ int KeywithMask = NO_BUTTON;
+ KeySym ksym;
+ XComposeStatus compose;
+ char buffer[20];
+ int bufsize = 20;
+ int chcnt = 0;
+
+
+ strcpy(configfile, getenv("HOME")); // Added to wmbutton by Casey Harkin, 3/6/99
+ strcat(configfile, CONFFILENAME); // Fixed Bug - didn't look in home directory
+ // but startup directory
+ strcat(tempfile, CONFTEMPFILE); // Setup name for temp file
+
+ /* Clear the Calculator Display */
+ for(i=0; i<11; i++) DispString[i] = ' ';
+ DispString[11] = '\0';
+
+ /* Parse Command Line Arguments */
+ for ( i=1; i < argc; i++ ) {
+ if ( *argv[i] == '-' ) {
+ switch ( *(argv[i]+1) ) {
+ case 'v': // Turn on Verbose (debugging) Mode
+ Verbose = 1;
+ break;
+ case 'g': // Set Geometry Options
+ if ( ++i >= argc ) show_usage();
+ sscanf(argv[i], "%s", Geometry_str);
+ if ( Verbose ) printf("Geometry is: %s\n", Geometry_str);
+ break;
+ case 'd': // Set display
+ if ( ++i >= argc ) show_usage();
+ sscanf(argv[i], "%s", Display_str);
+ if ( Verbose ) printf("Display is: %s\n", Display_str);
+ break;
+ case 'h': // Show Help Message
+ show_usage();
+ break;
+ case 'f': // use config file <filename>
+ if ( ++i >= argc ) show_usage();
+ sscanf(argv[i], "%s", configfile);
+ if ( Verbose ) printf("Using Config File: %s\n", configfile);
+ break;
+ default: // other, unknown, parameters
+ show_usage();
+ break;
+ }
+ }
+ } /* End of loop to process command line options */
+
+ /* Open display on requested X server */
+ if ( (display = XOpenDisplay(Display_str)) == NULL ) {
+ error_handler(ERR_X_DISPLAY, Display_str);
+ }
+
+ screen = DefaultScreen(display);
+ rootwin = RootWindow(display,screen);
+ depth = DefaultDepth(display, screen);
+
+ bg_pixel = WhitePixel(display, screen );
+ fg_pixel = BlackPixel(display, screen );
+
+ xsizehints.flags = USSize | USPosition;
+ xsizehints.width = APP_WIDTH;
+ xsizehints.height = APP_HEIGHT;
+
+ /* Parse Geometry string and fill in sizehints fields */
+ XWMGeometry(display, screen,
+ Geometry_str,
+ NULL,
+ border,
+ &xsizehints,
+ &xsizehints.x,
+ &xsizehints.y,
+ &xsizehints.width,
+ &xsizehints.height,
+ &dummy);
+
+ if ( (win = XCreateSimpleWindow(display,
+ rootwin,
+ xsizehints.x,
+ xsizehints.y,
+ xsizehints.width,
+ xsizehints.height,
+ border,
+ fg_pixel, bg_pixel) ) == 0 ) {
+ error_handler(ERR_X_CREATE_WINDOW, NULL);
+ }
+
+ if ( (iconwin = XCreateSimpleWindow(display,
+ win,
+ xsizehints.x,
+ xsizehints.y,
+ xsizehints.width,
+ xsizehints.height,
+ border,
+ fg_pixel, bg_pixel) ) == 0 ) {
+ error_handler(ERR_X_CREATE_WINDOW, NULL);
+ }
+
+ /* Set up shaped windows */
+ /*Gives the appicon a border so you can grab and move it. */
+
+ if ( ( pixmask = XCreateBitmapFromData(display,
+ win,
+ mask_bits,
+ mask_width,
+ mask_height) ) == 0 ) {
+ error_handler(ERR_X_CREATE_BITMAP, NULL);
+ }
+
+ XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet );
+ XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
+
+ /* Convert in pixmaps from .xpm includes. */
+ getPixmaps();
+
+ /* Interclient Communication stuff */
+ /* Appicons don't work with out this stuff */
+ xwmhints = XAllocWMHints();
+ xwmhints->flags = WindowGroupHint | IconWindowHint | StateHint;
+ xwmhints->icon_window = iconwin;
+ xwmhints->window_group = win;
+ xwmhints->initial_state = WithdrawnState;
+ XSetWMHints( display, win, xwmhints );
+
+ xclasshint.res_name = app_name;
+ xclasshint.res_class = app_name;
+ XSetClassHint( display, win, &xclasshint );
+
+ XSetWMNormalHints( display, win, &xsizehints );
+
+ /* Tell window manager what the title bar name is. We never see */
+ /* this anyways in the WithdrawnState */
+ if ( XStringListToTextProperty(&app_name, 1, &app_name_atom) == 0 ) {
+ error_handler(ERR_SETUP_WINDOW_NAME, app_name);
+ }
+ XSetWMName( display, win, &app_name_atom );
+
+ /* Create Graphic Context */
+ if (( gc = XCreateGC(display, win,(GCForeground | GCBackground), &xgcValues))
+ == NULL ) {
+ error_handler(ERR_CREATE_GC, NULL);
+ }
+
+ /* XEvent Masks. We want both windows to process X events */
+ XSelectInput(display, win,
+ ExposureMask |
+ ButtonPressMask |
+ ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/
+ PointerMotionMask |
+ FocusChangeMask |
+ LeaveWindowMask |
+ KeyPressMask | /* Try this to get keyboard working */
+ StructureNotifyMask |
+ EnterWindowMask );
+ XSelectInput(display, iconwin,
+ ExposureMask |
+ ButtonPressMask |
+ ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/
+ PointerMotionMask |
+ FocusChangeMask |
+ LeaveWindowMask |
+ KeyPressMask | /* Try this to get keyboard working */
+ StructureNotifyMask |
+ EnterWindowMask );
+
+ /* Store the 'state' of the application for restarting */
+ XSetCommand( display, win, argv, argc );
+
+ /* Window won't ever show up until it is mapped.. then drawn after a */
+ /* ConfigureNotify */
+ XMapWindow( display, win );
+
+ /* Read Configuration File */
+ err_code = read_config();
+ if (err_code) {
+ error_handler(err_code, configfile);
+ }
+
+ /* X Event Loop */
+ while (1) {
+ XNextEvent(display, &report );
+ switch (report.type) {
+ case Expose:
+ if (report.xexpose.count != 0) {
+ break;
+ }
+ if ( Verbose ) printf("Event: Expose\n");
+ redraw();
+ break;
+ case ConfigureNotify:
+ if ( Verbose ) printf("Event: ConfigureNotify\n");
+ // redraw();
+ break;
+
+ case KeyPress:
+ if (Verbose) printf("Event: Key state: 0x%x Key: 0x%x\n",
+ report.xkey.state, report.xkey.keycode);
+
+ // ksym = XLookupKeysym(&(report.xkey), report.xkey.state);
+ /* KeywithMask - this allows Left, middle, and right button functions
+ to be implemented via keyboard */
+ chcnt = XLookupString(&(report.xkey), buffer, bufsize, &ksym, &compose);
+ if (Verbose) printf("Keysym is: 0x%x\n", (int) ksym);
+ KeywithMask = whichKey(ksym);
+ ExecFunc( KeywithMask );
+ redraw();
+ break;
+
+ case ButtonPress: /* draw button pressed, don't launch *charkins*/
+ switch (report.xbutton.button) {
+ case Button1:
+ N = whichButton(report.xbutton.x, report.xbutton.y );
+ if ( (N >= 0) && (N <= NUM_BUTTONS) ) {
+ button_pressed = N + LMASK;
+ // redraw();
+ }
+ if ( Verbose )
+ printf("Button 1:x=%d y=%d N=%d\n",
+ report.xbutton.x, report.xbutton.y, N+LMASK);
+ break;
+ case Button2:
+ if (mmouse) {
+ N = whichButton(report.xbutton.x, report.xbutton.y );
+ if ( (N >= 0) && (N <= NUM_BUTTONS) ) {
+ button_pressed = N + MMASK;
+ // redraw();
+ }
+ if ( Verbose )
+ printf("Button 2:x=%d y=%d N=%d\n",
+ report.xbutton.x, report.xbutton.y, N+MMASK);
+ }
+ break;
+ case Button3:
+ N = whichButton(report.xbutton.x, report.xbutton.y );
+ if ( (N >= 0) && (N <= NUM_BUTTONS) ) {
+ button_pressed = N + RMASK;
+ // redraw();
+ }
+ if ( Verbose )
+ printf("Button 3:x=%d y=%d N=%d\n",
+ report.xbutton.x, report.xbutton.y, N+RMASK);
+ break;
+ }
+ break;
+ case ButtonRelease: /* If still over button, it was a real button press */
+ switch (report.xbutton.button) {
+ case Button1:
+ N = whichButton(report.xbutton.x, report.xbutton.y );
+ if ( (N >= 0) && (N <= NUM_BUTTONS) && (N == button_pressed - LMASK))
+ ExecFunc(N + LMASK);
+ button_pressed=-1;
+ redraw();
+ if ( Verbose )
+ printf("Button 1:x=%d y=%d N=%d\n",
+ report.xbutton.x, report.xbutton.y, N+LMASK);
+ break;
+ case Button2:
+ if (mmouse) {
+ N = whichButton(report.xbutton.x, report.xbutton.y );
+ if ( (N >= 0) && (N <= NUM_BUTTONS) && (N == button_pressed - MMASK))
+ ExecFunc( N + MMASK);
+ button_pressed=-1;
+ redraw();
+ if ( Verbose )
+ printf("Button 2:x=%d y=%d N=%d\n",
+ report.xbutton.x, report.xbutton.y, N+MMASK);
+ }
+ break;
+ case Button3:
+ N = whichButton(report.xbutton.x, report.xbutton.y );
+ if ( (N >= 0) && (N <= NUM_BUTTONS) && (N == button_pressed - RMASK))
+ ExecFunc( N + RMASK);
+ button_pressed=-1;
+ redraw();
+ if ( Verbose )
+ printf("Button 3:x=%d y=%d N=%d\n",
+ report.xbutton.x, report.xbutton.y, N+RMASK);
+ break;
+ }
+ break;
+ case DestroyNotify:
+ if ( Verbose ) printf("Requested Program Quit.\n");
+ XFreeGC(display, gc);
+ XDestroyWindow(display,win);
+ XDestroyWindow(display,iconwin);
+ XCloseDisplay(display);
+ exit(OKAY);
+ break;
+ case EnterNotify:
+ case LeaveNotify:
+ XSetInputFocus(display, PointerRoot, RevertToParent, CurrentTime);
+ if (Verbose) printf("Focus Change\n");
+ break;
+ }
+ }
+ return (OKAY);
+} /***** End of main program ***********************************/
+
+/****************************************************************
+ * Function: redraw
+ ****************************************************************
+ Description:
+ This function maintains the appearance of the application
+ by copying the "visible" pixmap to the two windows (the withdrawn
+ main window, and the icon window which is the main windows's icon
+ image).
+
+ Change History:
+ Date Modification
+ 11/1/00 Function Header updated
+ ****************************************************************/
+void redraw() {
+
+ XCopyArea(display, template.pixmap, visible.pixmap, gc, 0, 0,
+ template.attributes.width, template.attributes.height, 0, 0 );
+
+ defineButtonRegions();
+
+ /* Copy button to icon */
+ XCopyArea(display, buttons.pixmap, visible.pixmap, gc,
+ 1, 1, 53, 40, 6, 20);
+
+ flush_expose( win );
+ XCopyArea(display, visible.pixmap, win, gc, 0, 0,
+ visible.attributes.width, visible.attributes.height, 0, 0 );
+ flush_expose( iconwin );
+ XCopyArea(display, visible.pixmap, iconwin, gc, 0, 0,
+ visible.attributes.width, visible.attributes.height, 0, 0 );
+ // if ( Verbose ) printf("In Redraw()\n");
+ displaystr();
+} /***** End of function redraw() ********************************/
+
+/****************************************************************
+ * Function: whichButton
+ ****************************************************************
+ Description:
+ Return the button at the x,y coordinates. The button need not
+ be visible ( drawn ). Return -1 if no button match.
+
+ Change History:
+ Date Modification
+ 11/1/00 Function Header Updated
+ ****************************************************************/
+int whichButton( int x, int y ) {
+ int index;
+
+ for ( index=0; index < NUM_BUTTONS; index++ ) {
+ if ( (x >= button_region[index].x) && (x <= button_region[index].i) &&
+ (y >= button_region[index].y) && (y <= button_region[index].j) ) {
+ return(index);
+ }
+ }
+ return(NO_BUTTON);
+} /***** End of function whichButton() **************************/
+
+/****************************************************************
+ * Function: whichKey
+ ****************************************************************
+ Description:
+ This function decodes the keycode passed in and converts this to
+ a function number to execute. This is not simply the Button number,
+ but also contains the LMASK, MMASK, or RMASK to pass into ExecFunc to
+ handle expanded functions.
+
+ Change History:
+ Date Modification
+ 01/17/01 Updated to take a KeySym, rather than a KeyCode
+ 11/09/00 Original Function creation
+ ****************************************************************/
+int whichKey (KeySym keysym) {
+ extern int Verbose;
+ int func = NO_BUTTON;
+
+ if (Verbose) printf("KeySym 0x%x received, decoding...\n", (int) keysym);
+
+ switch(keysym) {
+ case XK_Escape:
+ case XK_space:
+ case XK_KP_Space:
+ func = LMASK + 0;
+ break;
+ case XK_Delete:
+ func = MMASK + 0;
+ break;
+ case XK_BackSpace:
+ func = RMASK + 0;
+ break;
+ case XK_Return:
+ case XK_KP_Equal:
+ case XK_KP_Enter:
+ case XK_equal:
+ func = LMASK + 19;
+ break;
+ case XK_KP_0:
+ case XK_0:
+ func = LMASK + 17;
+ break;
+ case XK_KP_1:
+ case XK_1:
+ func = LMASK + 12;
+ break;
+ case XK_KP_2:
+ case XK_2:
+ func = LMASK + 13;
+ break;
+ case XK_KP_3:
+ case XK_3:
+ func = LMASK + 14;
+ break;
+ case XK_KP_4:
+ case XK_4:
+ func = LMASK + 7;
+ break;
+ case XK_KP_5:
+ case XK_5:
+ func = LMASK + 8;
+ break;
+ case XK_KP_6:
+ case XK_6:
+ func = LMASK + 9;
+ break;
+ case XK_KP_7:
+ case XK_7:
+ func = LMASK + 2;
+ break;
+ case XK_KP_8:
+ case XK_8:
+ func = LMASK + 3;
+ break;
+ case XK_KP_9:
+ case XK_9:
+ func = LMASK + 4;
+ break;
+ case XK_KP_Decimal:
+ case XK_period:
+ func = LMASK + 18;
+ break;
+ case XK_KP_Divide:
+ case XK_slash:
+ func = LMASK + 5;
+ break;
+ case XK_KP_Subtract:
+ case XK_minus:
+ func = LMASK + 15;
+ break;
+ case XK_KP_Multiply:
+ case XK_asterisk:
+ func = LMASK + 10;
+ break;
+ case XK_KP_Add:
+ case XK_plus:
+ func = LMASK + 20;
+ break;
+ case XK_R:
+ case XK_r:
+ func = LMASK + 1;
+ break;
+ case XK_asciicircum:
+ func = LMASK + 6;
+ break;
+ case XK_C:
+ case XK_c:
+ func = LMASK + 11;
+ break;
+ case XK_N:
+ case XK_n:
+ func = LMASK + 16;
+ break;
+ case XK_F1:
+ func = MMASK + 12;
+ break;
+ case XK_F2:
+ func = MMASK + 13;
+ break;
+ case XK_F3:
+ func = MMASK + 14;
+ break;
+ case XK_F4:
+ func = MMASK + 7;
+ break;
+ case XK_F5:
+ func = MMASK + 8;
+ break;
+ case XK_F6:
+ func = MMASK + 9;
+ break;
+ case XK_F7:
+ func = MMASK + 2;
+ break;
+ case XK_F8:
+ func = MMASK + 3;
+ break;
+ case XK_F9:
+ func = MMASK + 4;
+ break;
+ case XK_F10:
+ func = MMASK + 17;
+ break;
+ default:
+ if (Verbose) printf("Unknown Keysym, ignoring.\n");
+ func = NO_BUTTON;
+ break;
+ }
+ return(func);
+} /***** End of function whichKey() ****************************/
+
+/****************************************************************
+ * Function: getPixmaps
+ ****************************************************************
+ Description:
+ Load XPM data into X Pixmaps.
+
+ * Pixmap 'template' contains the untouched window backdrop image.
+ * Pixmap 'visible' is the template pixmap with buttons drawn on it.
+ -- what is seen by the user.
+ * Pixmap 'buttons' holds the images for individual buttons that are
+ later copied onto Pixmap visible.
+ * Pixmap 'charmap' holds the character map for the characters in
+ the display.
+
+ Change History:
+ Date Modification
+ 11/1/00 Function Header Updated
+ ****************************************************************/
+void getPixmaps() {
+ template.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+ visible.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+ buttons.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+ charmap.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+
+ /* Template Pixmap. Never Drawn To. */
+ if ( XpmCreatePixmapFromData( display, rootwin, backdrop_xpm,
+ &template.pixmap, &template.mask,
+ &template.attributes) != XpmSuccess ) {
+ error_handler(ERR_CREATE_PIXMAP, "template");
+ }
+
+ /* Visible Pixmap. Copied from template Pixmap and then drawn to. */
+ if ( XpmCreatePixmapFromData( display, rootwin, backdrop_xpm,
+ &visible.pixmap, &visible.mask,
+ &visible.attributes) != XpmSuccess ) {
+ error_handler(ERR_CREATE_PIXMAP, "visible");
+ }
+
+ /* Button Pixmap. */
+ if ( XpmCreatePixmapFromData( display, rootwin, calcbuttons_xpm,
+ &buttons.pixmap, &buttons.mask,
+ &buttons.attributes) != XpmSuccess ) {
+ error_handler(ERR_CREATE_PIXMAP, "buttons");
+ }
+
+ /* Character Map Pixmap. */
+ if ( XpmCreatePixmapFromData( display, rootwin, charmap_xpm,
+ &charmap.pixmap, &charmap.mask,
+ &charmap.attributes) != XpmSuccess ) {
+ error_handler(ERR_CREATE_PIXMAP, "charmap");
+ }
+} /***** End of function getPixmaps() *****************************/
+
+/****************************************************************
+ * Function: flush_expose
+ ****************************************************************
+ Description:
+ This function is a hold-over from previous programs (wmcp).
+ The use of this function is not well understood.
+
+ Change History:
+ Date Modification
+ 11/1/00 Function header updated.
+ ****************************************************************/
+int flush_expose(Window w) {
+ XEvent dummy;
+ int i=0;
+
+ while (XCheckTypedWindowEvent(display, w, Expose, &dummy)) i++;
+ return(i);
+} /***** End of function flush_expose() *************************/
+
+/****************************************************************
+ * Function: defineButtonRegion
+ ****************************************************************
+ Description:
+ This function defines the start and end x and y coordinates for
+ the various buttons used in wmcalc.
+
+ There should be a better way to do this, as right now, changing
+ the pixmap calcbuttons.xpm may require the modification of these
+ magic numbers.
+
+ Change History:
+ Date Modification
+ 11/1/00 Function header updated
+ ****************************************************************/
+void defineButtonRegions(void) {
+ int ndx = 0; /* button index */
+
+ button_region[0].x = 1; // Define display region button
+ button_region[0].i = 62;
+ button_region[0].y = 6;
+ button_region[0].j = 17;
+
+ for (ndx = 1; ndx <= 5; ndx++) { // Define y coord's for top row
+ button_region[ndx].y = 20;
+ button_region[ndx].j = 29;
+ }
+ for (ndx = 6; ndx <= 10; ndx++) { // Define y coord's for 2nd row
+ button_region[ndx].y = 30;
+ button_region[ndx].j = 39;
+ }
+ for (ndx = 11; ndx <= 15; ndx++) { // Define y coord's for 3rd row
+ button_region[ndx].y = 40;
+ button_region[ndx].j = 49;
+ }
+ for (ndx = 16; ndx <= 20; ndx++) { // Define y coord's for bottom row
+ button_region[ndx].y = 50;
+ button_region[ndx].j = 59;
+ }
+ for (ndx = 1; ndx <= 16; ndx+=5) { // Define x coord's for Left column
+ button_region[ndx].x = 5;
+ button_region[ndx].i = 16;
+ }
+ for (ndx = 2; ndx <= 17; ndx+=5) { // Define x coord's for 2nd Left column
+ button_region[ndx].x = 17;
+ button_region[ndx].i = 26;
+ }
+ for (ndx = 3; ndx <= 18; ndx+=5) { // Define x coord's for middle column
+ button_region[ndx].x = 27;
+ button_region[ndx].i = 36;
+ }
+ for (ndx = 4; ndx <= 19; ndx+=5) { // Define x coord's for 2nd right column
+ button_region[ndx].x = 37;
+ button_region[ndx].i = 46;
+ }
+ for (ndx = 5; ndx <= 20; ndx+=5) { // Define x coord's for 2nd right column
+ button_region[ndx].x = 47;
+ button_region[ndx].i = 57;
+ }
+} /***** End of function defineButtonRgions() *************************/
+
+/****************************************************************
+ * Function: displaychar
+ ****************************************************************
+ Description:
+ This function displays individual characters to the "display".
+ This function should only be called from displaystr().
+
+ Change History:
+ Date Modification
+ 11/09/00 Added "Locked" character and capabilities
+ 11/01/00 Function header updated
+ 10/30/00 Updated to include the memory indicators as well.
+ ****************************************************************/
+void displaychar(char ch, int location) {
+ ButtonArea dispchar;
+ int locatx, locaty;
+
+ dispchar = getboundaries(ch); /* Get the region of the charmap
+ containing the character to
+ display */
+
+ locaty = 6;
+ locatx = 2 + location * 6;
+
+ /* If the character is a memory display character, use the memory
+ location display region. Valid Characters are:
+ '_' - No data in Memory Location
+ '=' - Value in Memory Location, Not Locked
+ '#' - Constant in Memory Location, Locked
+ */
+ if ((ch == '=') || (ch == '_') || ch == '#') {
+ locaty = 15;
+ }
+
+ XCopyArea(display, charmap.pixmap, win, gc,
+ dispchar.x, dispchar.y,
+ dispchar.i-dispchar.x, dispchar.j-dispchar.y,
+ locatx, locaty);
+ XCopyArea(display, charmap.pixmap, iconwin, gc,
+ dispchar.x, dispchar.y,
+ dispchar.i-dispchar.x, dispchar.j-dispchar.y,
+ locatx, locaty);
+
+} /***** End of Function displaychar() **************************/
+
+/****************************************************************
+ * Function: displaystr
+ ****************************************************************
+ Description:
+
+ Change History:
+ Date Modification
+ 11/09/00 Added Capabilities for "Locked" memories
+ 11/01/00 Function header updated
+ 10/30/00 Added memory location indicators
+ ****************************************************************/
+void displaystr(void) {
+ extern char DispString[];
+ extern int MemLock[];
+ extern double MemArray[];
+ extern int Verbose;
+ int i;
+
+ if (Verbose) printf("Displaystr %s\n", DispString);
+
+ /* Update the alphanumeric display */
+ for (i = 0; i < DISPSIZE; i++)
+ displaychar(DispString[i], i);
+
+ /* Update the memory location indicators */
+ for (i = 0; i < NUM_MEM_CELLS; i++) {
+ if (MemArray[i] == 0.0)
+ displaychar('_', i); /* Value NOT stored here */
+ else if (MemLock[i] == 0)
+ displaychar('=', i); /* Value IS stored here */
+ else
+ displaychar('#', i); /* Constant IS stored here */
+
+ }
+
+} /***** End of function displaystr() ***************************/
+
+/****************************************************************
+ * Function: show_usage
+ ****************************************************************
+ Description:
+ This function prints a brief usage message to stdout,
+ and exits.
+
+ Change History:
+ Date Modification
+ 11/01/00 Function header updated
+ ****************************************************************/
+void show_usage(void) {
+
+ printf("\n");
+ printf(" %s: Ver %d Rel %d\n",app_name, VER, REL);
+ printf("\n");
+ printf("usage: %s [-g geometry] [-d display] [-f <filename>] [-v] [-h] \n",
+ app_name);
+ printf("\n");
+ printf("-g <geometry> Window Geometry - ie: 64x64+10+10\n");
+ printf("-d <display> Display - ie: 127.0.0.1:0.0\n");
+ printf("-f <filename> Name of Config file - ie: /home/user/.wmcalc\n");
+ printf("-v Verbose Mode. \n");
+ printf("-h Help. This message.\n");
+ printf("\n");
+ exit(OKAY);
+} /***** End of function show_usage() ***************************/
+
+/****************************************************************
+ * Function: error_handler
+ ****************************************************************
+ Description:
+ This function will handle all fatal error conditions that exist.
+ Error condition codes are kept in wmcalc_err.h
+
+ Change History:
+ Date Modification
+ 11/1/00 Function created
+ ****************************************************************/
+void error_handler (int err_code, char *err_string) {
+ extern char tempfile[];
+
+ if (err_code == OKAY) {
+ /* This case should never happen.
+ If it does, somebody screwed up (probably me),
+ but don't kill the program!! */
+ return;
+ }
+ else {
+ fprintf(stderr, "Error Code %d: ", err_code);
+ switch (err_code) {
+ case ERR_FILE_NOT_FOUND:
+ fprintf(stderr, "Could not open file %s\n",configfile);
+ break;
+ case ERR_TMP_FILE_FAILED:
+ fprintf(stderr, "Could not open temporary file %s\n", tempfile);
+ break;
+ case ERR_X_CREATE_WINDOW:
+ fprintf(stderr, "Could not create simple window\n");
+ break;
+ case ERR_X_CREATE_BITMAP:
+ fprintf(stderr, "Could not create bitmap from data\n");
+ break;
+ case ERR_SETUP_WINDOW_NAME:
+ fprintf(stderr, "Could not setup window name %s\n", err_string);
+ break;
+ case ERR_CREATE_GC:
+ fprintf(stderr, "XCreateGC\n");
+ break;
+ case ERR_X_DISPLAY:
+ fprintf(stderr, "Could not open display on %s\n", err_string);
+ break;
+ case ERR_CREATE_PIXMAP:
+ fprintf(stderr, "Can't Create %s Pixmap\n", err_string);
+ break;
+ /* case : */
+ /* break; */
+ default:
+ fprintf(stderr, "Unknown Error\n");
+ break;
+ }
+ }
+ exit(err_code);
+} /***** End of Function error_handler **************************/
diff --git a/wmcalc.conf b/wmcalc.conf
new file mode 100644
index 0000000..d6f110d
--- /dev/null
+++ b/wmcalc.conf
@@ -0,0 +1,35 @@
+# wmcalc Configuration File
+# Last Manual Update: 10/29/00
+
+# General Notes:
+# * There must be a tab character '\t' between the variable name and
+# the value, not a series of spaces.
+# * wmcalc is case sensitive when reading these variables. Examine the
+# wmcalc_g.h file for currently defined variables.
+
+#Calculator Memory Locations
+#Note: These must all exist, though they may be in any order
+Mem0 0.000000
+Mem1 0.000000
+MEM2 2.718282
+MEM3 3.141593
+Mem4 0.000000
+Mem5 0.000000
+Mem6 0.000000
+Mem7 0.000000
+Mem8 0.000000
+Mem9 0.000000
+
+# The CalcStart variable is intended to allow the user to start a larger
+# calculator for more complicated needs. Everything after the tab '\t'
+# character is sent unmodified in a system() call, so anything you can type
+# at the command prompt may be put here.
+#CalcStart xterm -T "Basic Calculator" -e bc &
+#CalcStart xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
+CalcStart xcalc &
+
+# The ImagChar variable allows the user to choose between 'i' and 'j' to
+# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
+# rather than 'i.')
+#ImagChar i
+ImagChar j
diff --git a/wmcalc1.xpm b/wmcalc1.xpm
new file mode 100644
index 0000000..0f3e7a3
--- /dev/null
+++ b/wmcalc1.xpm
@@ -0,0 +1,137 @@
+/* XPM */
+static char * wmcalc1_xpm[] = {
+"128 120 14 1",
+" c None",
+". c #000000",
+"+ c #C7C7C7",
+"@ c #003F18",
+"# c #00FF00",
+"$ c #FFFFFF",
+"% c #D5D6D5",
+"& c #EDFF00",
+"* c #FF0015",
+"= c #0019FF",
+"- c #FA00FF",
+"; c #FFA500",
+"> c #9B6603",
+", c #2AE0B5",
+" . ",
+" . ",
+" . ",
+" . ",
+" ........................................................ . .......................................................+ ",
+" .......................................................+ . .......................................................+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ . .@@@@@.@@@@@.#####.####@.####@.@@#@@.####@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ . .@@@@@.@@@@@.#@@@@.#@@@#.#@@@#.@#@#@.#@@@#.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ . .@@@@@.@@@@@.#@@@@.#@@@#.#@@@#.#@@@#.#@@@#.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ . .@@@@@.@@@@@.####@.####@.####@.#@@@#.####@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ . .@@@@@.@@@@@.#@@@@.#@#@@.#@#@@.#@@@#.#@#@@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ . .@@@@@.@@@@@.#@@@@.#@@#@.#@@#@.@#@#@.#@@#@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ . .@@@@@.@@@@@.#####.#@@@#.#@@@#.@@#@@.#@@@#.@@@@@.@@@@@.+ ",
+" .......................................................+ . .......................................................+ ",
+" ..@@@@.@@@@.@@@@.@@@@.@@@@.@@@@.@@@@.@@@@.@@@@.@@@@....+ . .......................................................+ ",
+" .......................................................+ . ",
+" .+++++++++++++++++++++++++++++++++++++++++++++++++++++++ . .......................................................+ ",
+" .$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$$$$%.+ . .......................................................+ ",
+" .$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%.%%%..+ . .@@@@@.#####.@@@@@.@@#@@.@@@#@.@@#@@.#####.@###@.#####.+ ",
+" .$%%%....%.$%.....%%.$%%...%%%.$%%%..%%%.$%%%%%%%.%%%..+ . .@@@@@.@@@#@.@@@@@.@##@@.@@##@.@##@@.#@@@@.#@@@#.@@@#@.+ ",
+" .$%%%.%%%%.$%%%%%.%%.$%.%%%.%%.$%%.%%.%%.$%%%%%%.%%%%..+ . .@@@@@.@@#@@.@@@@@.@@#@@.@#@#@.@@#@@.####@.#@@@#.@@#@@.+ ",
+" .$%%%.%%%%.$%%%%.%%%.$%%...%%%.$%%.%%.%%.$%%%%%.%%%%%..+ . .#####.@@@#@.@@@@@.@@#@@.#@@#@.@@#@@.@@@@#.@####.@@@#@.+ ",
+" .$%.%.%%%%.$%%%.%%%%.$%.%%%.%%.$%%%...%%.$%%%%.%%%%%%..+ . .@@@@@.@@@@#.@@@@@.@@#@@.#####.@@#@@.@@@@#.@@@@#.@@@@#.+ ",
+" .$%%..%%%%.$%%%.%%%%.$%.%%%.%%.$%%%%%.%%.$%%%.%%%%%%%..+ . .@@@@@.#@@@#.@@##@.@@#@@.@@@#@.@@#@@.#@@@#.@@@#@.#@@@#.+ ",
+" .$%%%.%%%%.$%%%.%%%%.$%%...%%%.$%%%..%%%.$%%%.%%%%%%%..+ . .@@@@@.@###@.@@##@.@###@.@@@#@.@###@.@###@.@##@@.@###@.+ ",
+" .$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .......................................................+ ",
+" .%.........%.........%.........%.........%.............+ . .......................................................+ ",
+" .$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$$$$%.+ . ",
+" .$%%%%%.%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .......................................................+ ",
+" .$%%%%%%.%.$%%%%.%%%.$%%....%%.$%%%..%%%.$%%%.%%%.%%%..+ . .......................................................+ ",
+" .$%%%%%.%%.$%.%%.%%%.$%%.%%%%%.$%%.%%%%%.$%%%%.%.%%%%..+ . .#@@@#.#@@@#.@###@.@###@.#@@@@.@###@.@@@@@.@@@@@.@@#@@.+ ",
+" .$%%%%%..%.$%.%%.%%%.$%%...%%%.$%%...%%%.$%%%%%.%%%%%..+ . .#@@@#.##@##.#@@@#.#@@@#.#@@@@.#@@@#.@@@@@.@@@@@.@##@@.+ ",
+" .$%.%.%%%%.$%.....%%.$%%%%%.%%.$%%.%%.%%.$%%%%.%.%%%%..+ . .#@@@#.#@#@#.#@@@@.#@@@#.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" .$%%.%%%%%.$%%%%.%%%.$%%.%%.%%.$%%.%%.%%.$%%%.%%%.%%%..+ . .#@#@#.#@#@#.#@@@@.#####.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" .$%.%.%%%%.$%%%%.%%%.$%%%..%%%.$%%%..%%%.$%%%%%%%%%%%..+ . .#@#@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" .$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .#@#@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@#.@@@@@.@@##@.@@#@@.+ ",
+" .%.........%.........%.........%.........%.............+ . .@#@#@.#@@@#.@###@.#@@@#.#####.@###@.@@@@@.@@##@.@###@.+ ",
+" .$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$$$$%.+ . .......................................................+ ",
+" .$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .......................................................+ ",
+" .$%%%%%%%%.$%%%%.%%%.$%%%..%%%.$%%...%%%.$%%%%%%%%%%%..+ . ",
+" .$%%....%%.$%%%..%%%.$%%.%%.%%.$%%%%%.%%.$%%%%%%%%%%%..+ . .......................................................+ ",
+" .$%%.%%%%%.$%%%%.%%%.$%%%%%.%%.$%%%..%%%.$%%%.....%%%..+ . .......................................................+ ",
+" .$%%...%%%.$%%%%.%%%.$%%%..%%%.$%%%%%.%%.$%%%%%%%%%%%..+ . .@@##@.@@@@@.@###@.@###@.@###@.@@@@@.@@@@@.@###@.#####.+ ",
+" .$%%.%%%%%.$%%%%.%%%.$%%.%%%%%.$%%%%%.%%.$%%%%%%%%%%%..+ . .@#@@@.@@@@@.#@@@#.#@@@#.#@@@#.@@@@@.@@#@@.#@@@#.@@@#@.+ ",
+" .$%%....%%.$%%%...%%.$%%....%%.$%%...%%%.$%%%%%%%%%%%..+ . .#@@@@.@@@@@.#@@@#.@@@@#.@@@@#.@####.@@#@@.@@@@#.@@#@@.+ ",
+" .$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .####@.@@@@@.#@@@#.@@@#@.@@@#@.@#@@@.#####.@@@#@.@@@#@.+ ",
+" .%.........%.........%.........%.........%.............+ . .#@@@#.@@@@@.#@@@#.@@#@@.@@#@@.@###@.@@#@@.@@#@@.@@@@#.+ ",
+" .$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$$$$%.+ . .#@@@#.@@##@.#@@@#.@#@@@.@#@@@.@#@@@.@@#@@.@#@@@.#@@@#.+ ",
+" .$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .@###@.@@##@.@###@.#####.#####.@####.@@@@@.#####.@###@.+ ",
+" .$%%.%%%%%.$%%...%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .......................................................+ ",
+" .$%...%%.%.$%.%%%.%%.$%%%%%%%%.$%%%%%%%%.$%%%%%.%%%%%..+ . .......................................................+ ",
+" .$%%.%%.%%.$%.%%%.%%.$%%%%%%%%.$%%....%%.$%%%%%.%%%%%..+ . ",
+" .$%%%%.%%%.$%.%%%.%%.$%%%%%%%%.$%%%%%%%%.$%%%.....%%%..+ . ",
+" .$%%%.%%%%.$%.%%%.%%.$%%%%%%%%.$%%....%%.$%%%%%.%%%%%..+ . .......................................................+ ",
+" .$%%.%%..%.$%.%%%.%%.$%%%..%%%.$%%%%%%%%.$%%%%%.%%%%%..+ . .......................................................+ ",
+" .$%%%%%%%%.$%%...%%%.$%%%..%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .@#@@@.##@@###@@@@#@@####@@##@.####@.##@@@##@@@##@@@@@.+ ",
+" .$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%%%%..+ . .##@@@#@@#@@.@#@#@#@@#@@.@#@@@.@@@#@#@@#@#.@#@#@.#@@@@.+ ",
+" .%.........%.........%.........%.........%.............+ . .@#@@@.@@#@@.@#@#@#@@###.@#@@@.@@@#@#@@#@#.@#@#@.#@@@@.+ ",
+" .......................................................+ . .@#@@@@@#@@@##@@#@#@@@@@#@###@.@@#@@@##@@@###@#@.#@###.+ ",
+" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ . .@#@@@@#@@@@.@#@####@@@@#@#@@#.@#@@@#@@#@@.@#@#@.#@@@@.+ ",
+" . .@#@@@#@@@@@.@#@@@#@@#@@#@#@@#.@#@@@#@@#@@.@#@#@.#@@@@.+ ",
+" . .###@@####@###@@@@#@@@##.@@##@.@#@@@.##@@@##@@@##@@@@@.+ ",
+" . .......................................................+ ",
+" . .......................................................+ ",
+"................................................................. ",
+" ",
+" ............................................................. .......................................................+ ",
+" .@@@@@.@###@.@@#@@.@###@.#####.@@@#@.#####.@@##@.#####.@###@. .......................................................+ ",
+" .@@@@@.#@@@#.@##@@.#@@@#.@@@#@.@@##@.#@@@@.@#@@@.@@@@#.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@@@@.#@@@#.@@#@@.@@@@#.@@#@@.@#@#@.####@.#@@@@.@@@#@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@@@@.#@@@#.@@#@@.@@@#@.@@@#@.#@@#@.@@@@#.####@.@@#@@.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@@@@.#@@@#.@@#@@.@@#@@.@@@@#.#####.@@@@#.#@@@#.@#@@@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@##@.#@@@#.@@#@@.@#@@@.#@@@#.@@@#@.#@@@#.#@@@#.@#@@@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@##@.@###@.@###@.#####.@###@.@@@#@.@###@.@###@.@#@@@.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" ............................................................. .......................................................+ ",
+" .@###@.@@@@@.@###@.####@.@###@.####@.#####.#####.@###@.#@@@#. .......................................................+ ",
+" .#@@@#.@@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. ",
+" .#@@@#.@@@@@.#@@@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.#@@@@.#@@@#. ",
+" .@####.#####.#####.####@.#@@@@.#@@@#.####@.####@.#@###.#####. ",
+" .@@@@#.@@@@@.#@@@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. .......................................................+ ",
+" .@@@#@.@@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. .......................................................+ ",
+" .@##@@.@@@@@.#@@@#.####@.@###@.####@.#####.#@@@@.@####.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@###@.@@###.#@@@#.#@@@@.#@@@#.#@@@#.@@#@@.####@.@###@.####@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@#@@.@@@#@.#@@#@.#@@@@.##@##.#@@@#.@#@#@.#@@@#.#@@@#.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@#@@.@@@#@.#@#@@.#@@@@.#@#@#.##@@#.#@@@#.#@@@#.#@@@#.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@#@@.@@@#@.##@@@.#@@@@.#@#@#.#@#@#.#@@@#.####@.#@@@#.####@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@#@@.@@@#@.#@#@@.#@@@@.#@@@#.#@@##.#@@@#.#@@@@.#@#@#.#@#@@. .......................................................+ ",
+" .@@#@@.#@@#@.#@@#@.#@@@@.#@@@#.#@@@#.@#@#@.#@@@@.#@@#@.#@@#@. .......................................................+ ",
+" .@###@.@##@@.#@@@#.#####.#@@@#.#@@@#.@@#@@.#@@@@.@##@#.#@@@#. ",
+" ............................................................. ",
+" ............................................................. ",
+" .@###@.#####.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.#####.@@@@@.@@#@@. .......................................................+ ",
+" .#@@@#.@@#@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.@@@@#.@@@@@.@@@@@. .......................................................+ ",
+" .#@@@@.@@#@@.#@@@#.#@@@#.#@@@#.@#@#@.#@@@#.@@@#@.@####.@##@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@###@.@@#@@.#@@@#.#@@@#.#@#@#.@@#@@.@#@#@.@@#@@.@#@@@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@@@#.@@#@@.#@@@#.#@@@#.#@#@#.@#@#@.@@#@@.@#@@@.@###@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .#@@@#.@@#@@.#@@@#.@#@#@.#@#@#.#@@@#.@@#@@.#@@@@.@#@@@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@###@.@@#@@.@###@.@@#@@.@#@#@.#@@@#.@@#@@.#####.@####.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. .......................................................+ ",
+" .@@#@@.@@#@@.@##@@.@##@@.@#@#@.@###@.@@#@@.@###@.@@#@@.@@#@@. .......................................................+ ",
+" .@@#@@.@##@@.@@@#@.@@@#@.@#@#@.@#@@@.@#@@@.@@@#@.@#@#@.@#@#@. ",
+" .#####.@@#@@.@@#@@.@@#@@.@###@.@##@@.@##@@.@@#@@.@@#@@.@@##@. ",
+" .@@#@@.@@#@@.@#@@@.@@@#@.@@@#@.@@@#@.@#@#@.@@#@@.@#@#@.@@@#@. ....................................................... ",
+" .@@#@@.@###@.@###@.@##@@.@@@#@.@##@@.@@#@@.@@#@@.@@#@@.@@#@@. ..@@@@.####.&&&&.****.====.----.;;;;.>>>>.$$$$.,,,,.... ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ....................................................... ",
+" ............................................................. ",
+" ............................................................. ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@#@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@#@@.@@#@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" ............................................................. "};
diff --git a/wmcalc2.xpm b/wmcalc2.xpm
new file mode 100644
index 0000000..52b8526
--- /dev/null
+++ b/wmcalc2.xpm
@@ -0,0 +1,131 @@
+/* XPM */
+static char * wmcalc2_xpm[] = {
+"128 120 8 1",
+" c None",
+". c #000000",
+"+ c #C7C7C7",
+"@ c #003F18",
+"# c #00FF00",
+"$ c #FFFFFF",
+"% c #D5D6D5",
+"& c #000100",
+" . ",
+" . ",
+" . ",
+" . ",
+" ............................................................... .......................................................+ ",
+" .............................................................+. .......................................................+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+. .@@@@@.@@@@@.#####.####@.####@.@@#@@.####@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+. .@@@@@.@@@@@.#@@@@.#@@@#.#@@@#.@#@#@.#@@@#.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+. .@@@@@.@@@@@.#@@@@.#@@@#.#@@@#.#@@@#.#@@@#.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+. .@@@@@.@@@@@.####@.####@.####@.#@@@#.####@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+. .@@@@@.@@@@@.#@@@@.#@#@@.#@#@@.#@@@#.#@#@@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+. .@@@@@.@@@@@.#@@@@.#@@#@.#@@#@.@#@#@.#@@#@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+. .@@@@@.@@@@@.#####.#@@@#.#@@@#.@@#@@.#@@@#.@@@@@.@@@@@.+ ",
+" .............................................................+. .......................................................+ ",
+" ..@@@...@@@...@@@...@@@...@@@...@@@...@@@...@@@...@@@...@@@..+. .......................................................+ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.+. ",
+" .............................................................+. .......................................................+ ",
+" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++. .......................................................+ ",
+" .$$$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$$%.+ . .@@@@@.#####.@@@@@.@@#@@.@@@#@.@@#@@.#####.@###@.#####.+ ",
+" .$%%%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.%%%%%%.%%%..+ . .@@@@@.@@@#@.@@@@@.@##@@.@@##@.@##@@.#@@@@.#@@@#.@@@#@.+ ",
+" .$%%%%....%%.$%.....%%.$%%...%%%.$%%...%%%.%%%%%%.%%%..+ . .@@@@@.@@#@@.@@@@@.@@#@@.@#@#@.@@#@@.####@.#@@@#.@@#@@.+ ",
+" .$%%%%.%%%%%.$%%%%%.%%.$%.%%%.%%.$%.%%%.%%.%%%%%.%%%%..+ . .#####.@@@#@.@@@@@.@@#@@.#@@#@.@@#@@.@@@@#.@####.@@@#@.+ ",
+" .$%%%%.%%%%%.$%%%%.%%%.$%%...%%%.$%.%%%.%%.%%%%.%%%%%..+ . .@@@@@.@@@@#.@@@@@.@@#@@.#####.@@#@@.@@@@#.@@@@#.@@@@#.+ ",
+" .$%%.%.%%%%%.$%%%.%%%%.$%.%%%.%%.$%%....%%.%%%.%%%%%%..+ . .@@@@@.#@@@#.@@##@.@@#@@.@@@#@.@@#@@.#@@@#.@@@#@.#@@@#.+ ",
+" .$%%%..%%%%%.$%%%.%%%%.$%.%%%.%%.$%%%%%.%%.%%.%%%%%%%..+ . .@@@@@.@###@.@@##@.@###@.@@@#@.@###@.@###@.@##@@.@###@.+ ",
+" .$%%%%.%%%%%.$%%%.%%%%.$%%...%%%.$%%...%%%.%%.%%%%%%%..+ . .......................................................+ ",
+" .$%%%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.%%%%%%%%%%..+ . .......................................................+ ",
+" .%...........%.........%.........%.....................+ . ",
+" .$$$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$$%.+ . .......................................................+ ",
+" .$%%%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.%%%%%%%%%%..+ . .......................................................+ ",
+" .$%%%%%%.%%%.$%%%%.%%%.$%.....%%.$%%...%%%.%%.%%%.%%%..+ . .#@@@#.#@@@#.@###@.@###@.#@@@@.@###@.@@@@@.@@@@@.@@#@@.+ ",
+" .$%%%%%%%.%%.$%.%%.%%%.$%.%%%%%%.$%.%%%%%%.%%%.%.%%%%..+ . .#@@@#.##@##.#@@@#.#@@@#.#@@@@.#@@@#.@@@@@.@@@@@.@##@@.+ ",
+" .$%%%%%%.%%%.$%.%%.%%%.$%....%%%.$%....%%%.%%%%.%%%%%..+ . .#@@@#.#@#@#.#@@@@.#@@@#.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" .$%%.%.%..%%.$%.....%%.$%%%%%.%%.$%.%%%.%%.%%%.%.%%%%..+ . .#@#@#.#@#@#.#@@@@.#####.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" .$%%%.%%%%%%.$%%%%.%%%.$%.%%%.%%.$%.%%%.%%.%%.%%%.%%%..+ . .#@#@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" .$%%.%.%%%%%.$%%%%.%%%.$%%...%%%.$%%...%%%.%%%%%%%%%%..+ . .#@#@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@#.@@@@@.@@##@.@@#@@.+ ",
+" .$%%%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.%%%%%%%%%%..+ . .@#@#@.#@@@#.@###@.#@@@#.#####.@###@.@@@@@.@@##@.@###@.+ ",
+" .%...........%.........%.........%.....................+ . .......................................................+ ",
+" .$$$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$$%.+ . .......................................................+ ",
+" .$%%%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.%%%%%%%%%%..+ . ",
+" .$%%%%%%%%%%.$%%%%.%%%.$%%...%%%.$%....%%%.%%%%%%%%%%..+ . .......................................................+ ",
+" .$%%....%%%%.$%%%..%%%.$%.%%%.%%.$%%%%%.%%.%%%%%%%%%%..+ . .......................................................+ ",
+" .$%%.%%%%%%%.$%%%%.%%%.$%%%%%.%%.$%%...%%%.%%.....%%%..+ . .@@##@.@@@@@.@###@.@###@.@###@.@@@@@.@@@@@.@###@.#####.+ ",
+" .$%%...%%%%%.$%%%%.%%%.$%%...%%%.$%%%%%.%%.%%%%%%%%%%..+ . .@#@@@.@@@@@.#@@@#.#@@@#.#@@@#.@@@@@.@@#@@.#@@@#.@@@#@.+ ",
+" .$%%.%%%%%%%.$%%%%.%%%.$%.%%%%%%.$%.%%%.%%.%%%%%%%%%%..+ . .#@@@@.@@@@@.#@@@#.@@@@#.@@@@#.@####.@@#@@.@@@@#.@@#@@.+ ",
+" .$%%....%%%%.$%%%...%%.$%.....%%.$%%...%%%.%%%%%%%%%%..+ . .####@.@@@@@.#@@@#.@@@#@.@@@#@.@#@@@.#####.@@@#@.@@@#@.+ ",
+" .$%%%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.%%%%%%%%%%..+ . .#@@@#.@@@@@.#@@@#.@@#@@.@@#@@.@###@.@@#@@.@@#@@.@@@@#.+ ",
+" .%...........%.........%.........%.....................+ . .#@@@#.@@##@.#@@@#.@#@@@.@#@@@.@#@@@.@@#@@.@#@@@.#@@@#.+ ",
+" .$$$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$$%.+ . .@###@.@@##@.@###@.#####.#####.@####.@@@@@.#####.@###@.+ ",
+" .$%%%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.%%%%%%%%%%..+ . .......................................................+ ",
+" .$%%%.%%%.%%.$%%...%%%.$%%%%%%%%.$%%%%%%%%.%%%%.%%%%%..+ . .......................................................+ ",
+" .$%%...%.%%%.$%.%%%.%%.$%%%%%%%%.$%%....%%.%%%%.%%%%%..+ . ",
+" .$%%%.%.%%%%.$%.%%%.%%.$%%%%%%%%.$%%%%%%%%.%%.....%%%..+ . ",
+" .$%%%%.%%%%%.$%.%%%.%%.$%%%%%%%%.$%%....%%.%%%%.%%%%%..+ . .......................................................+ ",
+" .$%%%.%%%%%%.$%.%%%.%%.$%%%..%%%.$%%%%%%%%.%%%%.%%%%%..+ . .......................................................+ ",
+" .$%%.%%...%%.$%%...%%%.$%%%..%%%.$%%%%%%%%.%%%%%%%%%%..+ . .@@#@.@##@.###@.@@#@.####.@##@.####.@##@.@##@.@##@.@@@.+ ",
+" .$%%%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.%%%%%%%%%%..+ . .@##@.#@@#.@@@#.#@#@.#@@@.#@@@.@@@#.#@@#.#@@#.#@@#.@@@.+ ",
+" .%...........%.........%.........%.....................+ . .@@#@.@@@#.@@@#.#@#@.###@.#@@@.@@@#.#@@#.#@@#.#@@#.@@@.+ ",
+" .......................................................+ . .@@#@.@@#@.@##@.#@#@.@@@#@###@.@@#@.@##@.@###.#@@#.###.+ ",
+" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ . .@@#@.@#@@.@@@#.####.@@@#@#@@#.@#@@.#@@#.@@@#.#@@#.@@@.+ ",
+" . .@@#@.#@@@.@@@#.@@#@.#@@#@#@@#.@#@@.#@@#.@@@#.#@@#.@@@.+ ",
+" . .@###.####.###@.@@#@.@##..@##@.@#@@.@##@.@##@.@##@.@@@.+ ",
+" . .......................................................+ ",
+" . .......................................................+ ",
+"................................................................. ",
+" ",
+" ............................................................. ",
+" .@@@@@.@###@.@@#@@.@###@.#####.@@@#@.#####.@@##@.#####.@###@. ............................................................. ",
+" .@@@@@.#@@@#.@##@@.#@@@#.@@@#@.@@##@.#@@@@.@#@@@.@@@@#.#@@@#. ............................................................. ",
+" .@@@@@.#@@@#.@@#@@.@@@@#.@@#@@.@#@#@.####@.#@@@@.@@@#@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@@@@.#@@@#.@@#@@.@@@#@.@@@#@.#@@#@.@@@@#.####@.@@#@@.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@@@@.#@@@#.@@#@@.@@#@@.@@@@#.#####.@@@@#.#@@@#.@#@@@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@##@.#@@@#.@@#@@.@#@@@.#@@@#.@@@#@.#@@@#.#@@@#.@#@@@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@##@.@###@.@###@.#####.@###@.@@@#@.@###@.@###@.@#@@@.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@###@.@@@@@.@###@.####@.@###@.####@.#####.#####.@###@.#@@@#. ............................................................. ",
+" .#@@@#.@@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .#@@@#.@@@@@.#@@@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.#@@@@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@####.#####.#####.####@.#@@@@.#@@@#.####@.####@.#@###.#####. ............................................................. ",
+" .@@@@#.@@@@@.#@@@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. ",
+" .@@@#@.@@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. ............................................................. ",
+" .@##@@.@@@@@.#@@@#.####@.@###@.####@.#####.#@@@@.@####.#@@@#. .....................................................@#@.@#@. ",
+" ............................................................. .@@#@@.@@@@@.@@##@.@###@.@###@.@###@.@###@.@###@.....##@.#@#. ",
+" ............................................................. .@##@@.@@@@@.@#@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.###.@#@.@##. ",
+" .@###@.@@###.#@@@#.#@@@@.#@@@#.#@@@#.@@#@@.####@.@###@.####@. .@@#@@.@@@@@.#@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.....@#@.@@#. ",
+" .@@#@@.@@@#@.#@@#@.#@@@@.##@##.#@@@#.@#@#@.#@@@#.#@@@#.#@@@#. .@@#@@.@@@@@.####@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.....###.@#@. ",
+" .@@#@@.@@@#@.#@#@@.#@@@@.#@#@#.##@@#.#@@@#.#@@@#.#@@@#.#@@@#. .@@#@@.@@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#...........&& ",
+" .@@#@@.@@@#@.##@@@.#@@@@.#@#@#.#@#@#.#@@@#.####@.#@@@#.####@. .@@#@@.@@##@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.@@###@@###@& ",
+" .@@#@@.@@@#@.#@#@@.#@@@@.#@@@#.#@@##.#@@@#.#@@@@.#@#@#.#@#@@. .@###@.@@##@.@###@.@###@.@###@.@###@.@###@.@###@.@#@@@@#@@@@. ",
+" .@@#@@.#@@#@.#@@#@.#@@@@.#@@@#.#@@@#.@#@#@.#@@@@.#@@#@.#@@#@. .................................................@@##@@#@@@@. ",
+" .@###@.@##@@.#@@@#.#####.#@@@#.#@@@#.@@#@@.#@@@@.@##@#.#@@@#. ..###...@@@...###...@@@...###...###...@@@...@@@..@@@@#@#@@@@. ",
+" ............................................................. .#####.@@@@@.#####.@@@@@.#####.#####.@@@@@.@@@@@.@###@@@###@. ",
+" ............................................................. ............................................................. ",
+" .@###@.#####.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.#####.@@@@@.@@#@@. ",
+" .#@@@#.@@#@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.@@@@#.@@@@@.@@@@@. ............................................................. ",
+" .#@@@@.@@#@@.#@@@#.#@@@#.#@@@#.@#@#@.#@@@#.@@@#@.@####.@##@@. .....................................................@@@.@@@. ",
+" .@###@.@@#@@.#@@@#.#@@@#.#@#@#.@@#@@.@#@#@.@@#@@.@#@@@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.....@@@.@@@. ",
+" .@@@@#.@@#@@.#@@@#.#@@@#.#@#@#.@#@#@.@@#@@.@#@@@.@###@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@.@@@.@@@. ",
+" .#@@@#.@@#@@.#@@@#.@#@#@.#@#@#.#@@@#.@@#@@.#@@@@.@#@@@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.....@@@.@@@. ",
+" .@###@.@@#@@.@###@.@@#@@.@#@#@.#@@@#.@@#@@.#####.@####.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.....@@@.@@@. ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@............. ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@@@@@@@. ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@@@@@@@. ",
+" .@@#@@.@@#@@.@##@@.@##@@.@#@#@.@###@.@@#@@.@###@.@@#@@.@@#@@. .................................................@@@@@@@@@@@. ",
+" .@@#@@.@##@@.@@@#@.@@@#@.@#@#@.@#@@@.@#@@@.@@@#@.@#@#@.@#@#@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@@@@@@@. ",
+" .#####.@@#@@.@@#@@.@@#@@.@###@.@##@@.@##@@.@@#@@.@@#@@.@@##@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@@@@@@@. ",
+" .@@#@@.@@#@@.@#@@@.@@@#@.@@@#@.@@@#@.@#@#@.@@#@@.@#@#@.@@@#@. ............................................................. ",
+" .@@#@@.@###@.@###@.@##@@.@@@#@.@##@@.@@#@@.@@#@@.@@#@@.@@#@@. ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. @@###@@###@ @####@#@@@@ @####@#@@#@ @@@@@@@@@@@ ",
+" ............................................................. @#@@@@#@@@@ @#@@@@#@@@@ @#@@@@##@#@ @@@@@@@@@@@ ",
+" ............................................................. @@##@@#@@@@ @###@@#@@@@ @###@@####@ @@@@@@@@@@@ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. @@@@#@#@@@@ @#@@@@#@@@@ @#@@@@#@##@ @@@@@@@@@@@ ",
+" .@@#@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. @###@@@###@ @#@@@@####@ @####@#@@#@ @@@@@@@@@@@ ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@#@@.@@#@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" ............................................................. "};
diff --git a/wmcalc3.xpm b/wmcalc3.xpm
new file mode 100644
index 0000000..4ae16bc
--- /dev/null
+++ b/wmcalc3.xpm
@@ -0,0 +1,131 @@
+/* XPM */
+static char * wmcalc3_xpm[] = {
+"128 120 8 1",
+" c None",
+". c #000000",
+"+ c #C7C7C7",
+"@ c #003F18",
+"# c #00FF00",
+"$ c #FFFFFF",
+"% c #D5D6D5",
+"& c #000100",
+" . ",
+" . ",
+" .............................................................+ . ",
+" .@@@@@.@@##@.@@@@@.@###@.@###@.@###@.@@@@@.@@@@@.@###@.#####.+ . ",
+" .@@@@@.@#@@@.@@@@@.#@@@#.#@@@#.#@@@#.@@@@@.@@#@@.#@@@#.@@@#@.+ . .......................................................+ ",
+" .@@@@@.#@@@@.@@@@@.#@@@#.@@@@#.@@@@#.@####.@@#@@.@@@@#.@@#@@.+ . .......................................................+ ",
+" .@@@@@.####@.@@@@@.#@@@#.@@@#@.@@@#@.@#@@@.#####.@@@#@.@@@#@.+ . .@@@@@.@@@@@.#####.####@.####@.@@#@@.####@.@@@@@.@@@@@.+ ",
+" .@@@@@.#@@@#.@@@@@.#@@@#.@@#@@.@@#@@.@###@.@@#@@.@@#@@.@@@@#.+ . .@@@@@.@@@@@.#@@@@.#@@@#.#@@@#.@#@#@.#@@@#.@@@@@.@@@@@.+ ",
+" .@@@@@.#@@@#.@@##@.#@@@#.@#@@@.@#@@@.@#@@@.@@#@@.@#@@@.#@@@#.+ . .@@@@@.@@@@@.#@@@@.#@@@#.#@@@#.#@@@#.#@@@#.@@@@@.@@@@@.+ ",
+" .@@@@@.@###@.@@##@.@###@.#####.#####.@####.@@@@@.#####.@###@.+ . .@@@@@.@@@@@.####@.####@.####@.#@@@#.####@.@@@@@.@@@@@.+ ",
+" .............................................................+ . .@@@@@.@@@@@.#@@@@.#@#@@.#@#@@.#@@@#.#@#@@.@@@@@.@@@@@.+ ",
+" .@@@@@.#####.@@@@@.@@#@@.@@@#@.@@#@@.#####.@###@.@###@.#####.+ . .@@@@@.@@@@@.#@@@@.#@@#@.#@@#@.@#@#@.#@@#@.@@@@@.@@@@@.+ ",
+" .@@@@@.@@@#@.@@@@@.@##@@.@@##@.@##@@.#@@@@.#@@@#.#@@@#.@@@@#.+ . .@@@@@.@@@@@.#####.#@@@#.#@@@#.@@#@@.#@@@#.@@@@@.@@@@@.+ ",
+" .@@@@@.@@#@@.@@@@@.@@#@@.@#@#@.@@#@@.####@.#@@@#.@@@@#.@@@#@.+ . .......................................................+ ",
+" .#####.@@@#@.@@@@@.@@#@@.#@@#@.@@#@@.@@@@#.@####.@@@#@.@@#@@.+ . .......................................................+ ",
+" .@@@@@.@@@@#.@@@@@.@@#@@.#####.@@#@@.@@@@#.@@@@#.@@#@@.@#@@@.+ . ",
+" .@@@@@.#@@@#.@@##@.@@#@@.@@@#@.@@#@@.#@@@#.@@@#@.@#@@@.@#@@@.+ . .......................................................+ ",
+" .@@@@@.@###@.@@##@.@###@.@@@#@.@###@.@###@.@##@@.#####.@#@@@.+ . .......................................................+ ",
+" .............................................................+ . .@@@@@.#####.@@@@@.@@#@@.@@@#@.@@#@@.#####.@###@.#####.+ ",
+" ..###...@@@...@@@...###...###...@@@...@@@...###...@@@...###..+ . .@@@@@.@@@#@.@@@@@.@##@@.@@##@.@##@@.#@@@@.#@@@#.@@@#@.+ ",
+" .............................................................+ . .@@@@@.@@#@@.@@@@@.@@#@@.@#@#@.@@#@@.####@.#@@@#.@@#@@.+ ",
+" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ . .#####.@@@#@.@@@@@.@@#@@.#@@#@.@@#@@.@@@@#.@####.@@@#@.+ ",
+" $$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$% . .@@@@@.@@@@#.@@@@@.@@#@@.#####.@@#@@.@@@@#.@@@@#.@@@@#.+ ",
+" $%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .@@@@@.#@@@#.@@##@.@@#@@.@@@#@.@@#@@.#@@@#.@@@#@.#@@@#.+ ",
+" $%%%%%%%%.$%%%....%.$%.....%%.$%%...%%%.$%%...%%%.$%%%%%.%%. . .@@@@@.@###@.@@##@.@###@.@@@#@.@###@.@###@.@##@@.@###@.+ ",
+" $%......%.$%%%.%%%%.$%%%%%.%%.$%.%%%.%%.$%.%%%.%%.$%%%%%.%%. . .......................................................+ ",
+" $%%.%%.%%.$%%%.%%%%.$%%%%.%%%.$%%...%%%.$%.%%%.%%.$%%%%.%%%. . .......................................................+ ",
+" $%%.%%.%%.$%.%.%%%%.$%%%.%%%%.$%.%%%.%%.$%%....%%.$%%%.%%%%. . ",
+" $%%.%%.%%.$%%..%%%%.$%%%.%%%%.$%.%%%.%%.$%%%%%.%%.$%%.%%%%%. . .......................................................+ ",
+" $%%.%%.%%.$%%%.%%%%.$%%%.%%%%.$%%...%%%.$%%...%%%.$%%.%%%%%. . .......................................................+ ",
+" $%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .#@@@#.#@@@#.@###@.@###@.#@@@@.@###@.@@@@@.@@@@@.@@#@@.+ ",
+" %.........%.........%.........%.........%.........%......... . .#@@@#.##@##.#@@@#.#@@@#.#@@@@.#@@@#.@@@@@.@@@@@.@##@@.+ ",
+" $$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$% . .#@@@#.#@#@#.#@@@@.#@@@#.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" $%%%%%%%%.$%%%%..%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .#@#@#.#@#@#.#@@@@.#####.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" $%%%%%%%%.$%%%%%%.%.$%.%%.%%%.$%.....%%.$%%...%%%.$%.%%%.%%. . .#@#@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.@@@@@.@@@@@.@@#@@.+ ",
+" $%%%..%%%.$%%%%%.%%.$%.%%.%%%.$%.%%%%%%.$%.%%%%%%.$%%.%.%%%. . .#@#@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@#.@@@@@.@@##@.@@#@@.+ ",
+" $%%.%%.%%.$%%%%.%%%.$%.%%.%%%.$%....%%%.$%....%%%.$%%%.%%%%. . .@#@#@.#@@@#.@###@.#@@@#.#####.@###@.@@@@@.@@##@.@###@.+ ",
+" $%%....%%.$.%.%...%.$%.....%%.$%%%%%.%%.$%.%%%.%%.$%%.%.%%%. . .......................................................+ ",
+" $%%.%%%%%.$%.%%%%%%.$%%%%.%%%.$%.%%%.%%.$%.%%%.%%.$%.%%%.%%. . .......................................................+ ",
+" $%%%..%%%.$.%.%%%%%.$%%%%.%%%.$%%...%%%.$%%...%%%.$%%%%%%%%. . ",
+" $%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .......................................................+ ",
+" %.........%.........%.........%.........%.........%......... . .......................................................+ ",
+" $$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$% . .@@##@.@@@@@.@###@.@###@.@###@.@@@@@.@@@@@.@###@.#####.+ ",
+" $%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .@#@@@.@@@@@.#@@@#.#@@@#.#@@@#.@@@@@.@@#@@.#@@@#.@@@#@.+ ",
+" $%.%%%%%%.$%%%%%%%%.$%%%.%%%%.$%%...%%%.$%....%%%.$%%%%%%%%. . .#@@@@.@@@@@.#@@@#.@@@@#.@@@@#.@####.@@#@@.@@@@#.@@#@@.+ ",
+" $%.%%%%%%.$%%....%%.$%%..%%%%.$%.%%%.%%.$%%%%%.%%.$%%%%%%%%. . .####@.@@@@@.#@@@#.@@@#@.@@@#@.@#@@@.#####.@@@#@.@@@#@.+ ",
+" $%.%.%.%%.$%%.%%%%%.$%%%.%%%%.$%%%%%.%%.$%%...%%%.$%.....%%. . .#@@@#.@@@@@.#@@@#.@@#@@.@@#@@.@###@.@@#@@.@@#@@.@@@@#.+ ",
+" $%.%..%.%.$%%...%%%.$%%%.%%%%.$%%...%%%.$%%%%%.%%.$%%%%%%%%. . .#@@@#.@@##@.#@@@#.@#@@@.@#@@@.@#@@@.@@#@@.@#@@@.#@@@#.+ ",
+" $%.%.%%.%.$%%.%%%%%.$%%%.%%%%.$%.%%%%%%.$%.%%%.%%.$%%%%%%%%. . .@###@.@@##@.@###@.#####.#####.@####.@@@@@.#####.@###@.+ ",
+" $%.%.%%.%.$%%....%%.$%%...%%%.$%.....%%.$%%...%%%.$%%%%%%%%. . .......................................................+ ",
+" $%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .......................................................+ ",
+" %.........%.........%.........%.........%.........%......... . ",
+" $$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$%$$$$$$$$$% . ",
+" $%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .......................................................+ ",
+" $.%%%%.%%.$%%.%%%.%.$%%...%%%.$%%%%%%%%.$%%%%%%%%.$%%%.%%%%. . .......................................................+ ",
+" $.%.%.%.%.$%...%.%%.$%.%%%.%%.$%%%%%%%%.$%%%%%%%%.$%%%.%%%%. . .@@#@.@##@.###@.@@#@.####.@##@.####.@##@.@##@.@##@.@@@.+ ",
+" $..%..%.%.$%%.%.%%%.$%.%%%.%%.$%%%%%%%%.$%.....%%.$%.....%%. . .@##@.#@@#.@@@#.#@#@.#@@@.#@@@.@@@#.#@@#.#@@#.#@@#.@@@.+ ",
+" $..%.%..%.$%%%.%%%%.$%.%%%.%%.$%%%..%%%.$%%%%%%%%.$%%%.%%%%. . .@@#@.@@@#.@@@#.#@#@.###@.#@@@.@@@#.#@@#.#@@#.#@@#.@@@.+ ",
+" $.%.%%%.%.$%%.%%%%%.$%.%%%.%%.$%%%..%%%.$%.....%%.$%%%.%%%%. . .@@#@.@@#@.@##@.#@#@.@@@#@###@.@@#@.@##@.@###.#@@#.###.+ ",
+" $.%%%%.%%.$%.%%...%.$%%...%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .@@#@.@#@@.@@@#.####.@@@#@#@@#.@#@@.#@@#.@@@#.#@@#.@@@.+ ",
+" $%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%.$%%%%%%%%. . .@@#@.#@@@.@@@#.@@#@.#@@#@#@@#.@#@@.#@@#.@@@#.#@@#.@@@.+ ",
+" %.........%.........%.........%.........%.........%......... . .@###.####.###@.@@#@.@##..@##@.@#@@.@##@.@##@.@##@.@@@.+ ",
+" . .......................................................+ ",
+" . .......................................................+ ",
+"................................................................. ",
+" ",
+" ............................................................. ",
+" .@@@@@.@###@.@@#@@.@###@.#####.@@@#@.#####.@@##@.#####.@###@. ............................................................. ",
+" .@@@@@.#@@@#.@##@@.#@@@#.@@@#@.@@##@.#@@@@.@#@@@.@@@@#.#@@@#. ............................................................. ",
+" .@@@@@.#@@@#.@@#@@.@@@@#.@@#@@.@#@#@.####@.#@@@@.@@@#@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@@@@.#@@@#.@@#@@.@@@#@.@@@#@.#@@#@.@@@@#.####@.@@#@@.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@@@@.#@@@#.@@#@@.@@#@@.@@@@#.#####.@@@@#.#@@@#.@#@@@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@##@.#@@@#.@@#@@.@#@@@.#@@@#.@@@#@.#@@@#.#@@@#.@#@@@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@##@.@###@.@###@.#####.@###@.@@@#@.@###@.@###@.@#@@@.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@###@.@@@@@.@###@.####@.@###@.####@.#####.#####.@###@.#@@@#. ............................................................. ",
+" .#@@@#.@@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .#@@@#.@@@@@.#@@@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.#@@@@.#@@@#. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@####.#####.#####.####@.#@@@@.#@@@#.####@.####@.#@###.#####. ............................................................. ",
+" .@@@@#.@@@@@.#@@@#.#@@@#.#@@@@.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. ",
+" .@@@#@.@@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@@.#@@@@.#@@@#.#@@@#. ............................................................. ",
+" .@##@@.@@@@@.#@@@#.####@.@###@.####@.#####.#@@@@.@####.#@@@#. .....................................................@#@.@#@. ",
+" ............................................................. .@@#@@.@@@@@.@@##@.@###@.@###@.@###@.@###@.@###@.....##@.#@#. ",
+" ............................................................. .@##@@.@@@@@.@#@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.###.@#@.@##. ",
+" .@###@.@@###.#@@@#.#@@@@.#@@@#.#@@@#.@@#@@.####@.@###@.####@. .@@#@@.@@@@@.#@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.....@#@.@@#. ",
+" .@@#@@.@@@#@.#@@#@.#@@@@.##@##.#@@@#.@#@#@.#@@@#.#@@@#.#@@@#. .@@#@@.@@@@@.####@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.....###.@#@. ",
+" .@@#@@.@@@#@.#@#@@.#@@@@.#@#@#.##@@#.#@@@#.#@@@#.#@@@#.#@@@#. .@@#@@.@@@@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#...........&& ",
+" .@@#@@.@@@#@.##@@@.#@@@@.#@#@#.#@#@#.#@@@#.####@.#@@@#.####@. .@@#@@.@@##@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.@@###@@###@& ",
+" .@@#@@.@@@#@.#@#@@.#@@@@.#@@@#.#@@##.#@@@#.#@@@@.#@#@#.#@#@@. .@###@.@@##@.@###@.@###@.@###@.@###@.@###@.@###@.@#@@@@#@@@@. ",
+" .@@#@@.#@@#@.#@@#@.#@@@@.#@@@#.#@@@#.@#@#@.#@@@@.#@@#@.#@@#@. .................................................@@##@@#@@@@. ",
+" .@###@.@##@@.#@@@#.#####.#@@@#.#@@@#.@@#@@.#@@@@.@##@#.#@@@#. .#####.@@@@@.#####.@@@@@.#####.#####.@@@@@.@@@@@.@@@@#@#@@@@. ",
+" ............................................................. .#####.@@@@@.#####.@@@@@.#####.#####.@@@@@.@@@@@.@###@@@###@. ",
+" ............................................................. ............................................................. ",
+" .@###@.#####.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.#####.@@@@@.@@#@@. ",
+" .#@@@#.@@#@@.#@@@#.#@@@#.#@@@#.#@@@#.#@@@#.@@@@#.@@@@@.@@@@@. ............................................................. ",
+" .#@@@@.@@#@@.#@@@#.#@@@#.#@@@#.@#@#@.#@@@#.@@@#@.@####.@##@@. .....................................................@@@.@@@. ",
+" .@###@.@@#@@.#@@@#.#@@@#.#@#@#.@@#@@.@#@#@.@@#@@.@#@@@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.....@@@.@@@. ",
+" .@@@@#.@@#@@.#@@@#.#@@@#.#@#@#.@#@#@.@@#@@.@#@@@.@###@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@.@@@.@@@. ",
+" .#@@@#.@@#@@.#@@@#.@#@#@.#@#@#.#@@@#.@@#@@.#@@@@.@#@@@.@@#@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.....@@@.@@@. ",
+" .@###@.@@#@@.@###@.@@#@@.@#@#@.#@@@#.@@#@@.#####.@####.@###@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.....@@@.@@@. ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@............. ",
+" ............................................................. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@@@@@@@. ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@@@@@@@. ",
+" .@@#@@.@@#@@.@##@@.@##@@.@#@#@.@###@.@@#@@.@###@.@@#@@.@@#@@. .................................................@@@@@@@@@@@. ",
+" .@@#@@.@##@@.@@@#@.@@@#@.@#@#@.@#@@@.@#@@@.@@@#@.@#@#@.@#@#@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@@@@@@@. ",
+" .#####.@@#@@.@@#@@.@@#@@.@###@.@##@@.@##@@.@@#@@.@@#@@.@@##@. .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@@@@@@@. ",
+" .@@#@@.@@#@@.@#@@@.@@@#@.@@@#@.@@@#@.@#@#@.@@#@@.@#@#@.@@@#@. ............................................................. ",
+" .@@#@@.@###@.@###@.@##@@.@@@#@.@##@@.@@#@@.@@#@@.@@#@@.@@#@@. ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. @@###@@###@ @####@#@@@@ @####@#@@#@ @@@@@@@@@@@ ",
+" ............................................................. @#@@@@#@@@@ @#@@@@#@@@@ @#@@@@##@#@ @@@@@@@@@@@ ",
+" ............................................................. @@##@@#@@@@ @###@@#@@@@ @###@@####@ @@@@@@@@@@@ ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. @@@@#@#@@@@ @#@@@@#@@@@ @#@@@@#@##@ @@@@@@@@@@@ ",
+" .@@#@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. @###@@@###@ @#@@@@####@ @####@#@@#@ @@@@@@@@@@@ ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@#@#@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@#@@.@@#@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" .@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@.@@@@@. ",
+" ............................................................. "};
diff --git a/wmcalc_c.h b/wmcalc_c.h
new file mode 100644
index 0000000..6481d14
--- /dev/null
+++ b/wmcalc_c.h
@@ -0,0 +1,38 @@
+/* File: wmcalc_c.h
+ * Author: Edward H. Flora <ehflora at access1.net>
+ * Version: 0.2
+ *
+ * Description:
+ * This file contains the constants settings for the wmcalc program,
+ * except for the error constants, which are contained in the file wmcalc_err.h
+ *
+ * Change History:
+ * Date Modification
+ * 10/25/00 Original file creation, extracted from wmcalc.h
+ */
+#ifndef WMCALC_C_H
+#define WMCALC_C_H
+
+#define CONFIGFILEMAX 128
+#define CALC_CMD_SIZE 128
+#define CONFFILENAME "/.wmcalc"
+#define CONFTEMPFILE "/tmp/wmcalc.tmp"
+#define CONFIGGLOBAL "/etc/wmcalc.conf"
+#define VER 0
+#define REL 3
+
+#define LMASK 100
+#define MMASK 200
+#define RMASK 300
+
+#define CALCDONE 20 // Anything >= 10 should work
+#define DISPSIZE 10 // Number of characters in display
+#define NUM_BUTTONS 21
+#define NUM_MEM_CELLS 10
+
+#define APP_WIDTH 64
+#define APP_HEIGHT 64
+
+#define NO_BUTTON -1
+
+#endif
diff --git a/wmcalc_err.h b/wmcalc_err.h
new file mode 100644
index 0000000..79076ce
--- /dev/null
+++ b/wmcalc_err.h
@@ -0,0 +1,31 @@
+/* File: wmcalc_err.h
+ * Author: Edward H. Flora <ehflora at access1.net>
+ * Version: 0.2
+ *
+ * Description:
+ * This file contains the error codes for the wmcalc program.
+ *
+ * Change History:
+ * Date Modification
+ * 10/25/00 Original file creation, extracted from wmcalc.h
+ */
+
+#ifndef WMCALC_ERR_H
+#define WMCALC_ERR_H
+
+#define OKAY 0
+
+#define ERR_FILE_NOT_FOUND 1001
+#define ERR_TMP_FILE_FAILED 1002
+
+#define ERR_X_CREATE_WINDOW 1101
+#define ERR_X_CREATE_BITMAP 1102
+#define ERR_SETUP_WINDOW_NAME 1103
+#define ERR_CREATE_GC 1104
+#define ERR_X_DISPLAY 1105
+
+#define ERR_CREATE_PIXMAP 1201
+
+
+
+#endif
diff --git a/wmcalc_f.h b/wmcalc_f.h
new file mode 100644
index 0000000..64d127e
--- /dev/null
+++ b/wmcalc_f.h
@@ -0,0 +1,80 @@
+/* File: wmcalc_f.h
+ * Author: Edward H. Flora <ehflora at access1.net>
+ * Version: 0.2
+ *
+ * Description:
+ * This file contains the function prototypes for functional
+ * components of the wmcalc program.
+ *
+ * Change History:
+ * Date Modification
+ * 01/17/01 Updated whichKey() function to take a KeySym
+ * 11/09/00 Removed function clrmem() as this was merged into clrallmem()
+ * Also add function whichKey, in wmcalc.c to handle Keyboard
+ * events
+ * 10/25/00 Original file creation, extracted from wmcalc.h
+ */
+
+#ifndef WMCALC_F_H
+#define WMCALC_F_H
+
+#include <stdio.h>
+#include "wmcalc_x.h"
+#include "wmcalc_t.h"
+
+void ExecFunc(int val); // function to run app N as found in conf file
+void redraw(void);
+void getPixmaps(void);
+int whichButton(int x, int y); // determine which button has been pressed
+int whichKey(KeySym keysym); // determine which key has been pressed
+int flush_expose(Window w);
+void show_usage(void); // show usage message to stderr
+char *readln(FILE *fp); // read line from file, return pointer to it
+void defineButtonRegions(void); // Define boundaries for each button
+void displaystr(void);
+void displaychar(char ch, int location);
+ButtonArea getboundaries(char ch);
+int read_config(void);
+int write_config(void);
+void error_handler(int err_code, char *err_string);
+
+/* Calculator Specific functions */
+
+void clearcalc(void);
+void clearnum(void);
+void addnums(void);
+void subtnums(void);
+void multnums(void);
+void divnums(void);
+void chgsignnum(void);
+void sqrtnum(void);
+void sqrnum(void);
+void charkey(char ch);
+void equalfunc(void);
+void stormem(int mem_loc);
+void clrallmem(void);
+void startcalc(void);
+void recallmem(int mem_loc);
+
+/* Future functions yet to be implemented */
+
+//void scinotation(void);
+//void clearmem(void);
+//void userdef201(void);
+//void userdef205(void);
+//void userdef206(void);
+//void userdef210(void);
+//void userdef211(void);
+//void userdef215(void);
+//void userdef218(void);
+//void userdef220(void);
+//void userdef301(void);
+//void userdef305(void);
+//void userdef306(void);
+//void userdef310(void);
+//void userdef315(void);
+//void userdef318(void);
+//void userdef320(void);
+
+
+#endif
diff --git a/wmcalc_g.h b/wmcalc_g.h
new file mode 100644
index 0000000..f4b939a
--- /dev/null
+++ b/wmcalc_g.h
@@ -0,0 +1,73 @@
+/* File: wmcalc_g.h
+ * Author: Edward H. Flora <ehflora at access1.net>
+ * Version: 0.2
+ *
+ * Description:
+ * This file contains the global variables used by the wmcalc program.
+ *
+ * Change History:
+ * Date Modification
+ * 10/25/00 Original file creation, extracted from wmcalc.h
+ * 11/05/00 Added MemLock global array for locking values into Memory
+ * 11/05/00 Added Entries for "Locked" memory values in config CfgVarList
+ */
+
+#ifndef WMCALC_G_H
+#define WMCALC_G_H
+
+#include "wmcalc_x.h"
+#include "wmcalc_c.h"
+
+
+/* X11 Globals */
+Display *display;
+int screen;
+Window rootwin, win, iconwin;
+GC gc;
+int depth;
+Pixel bg_pixel, fg_pixel;
+
+XSizeHints xsizehints;
+XWMHints *xwmhints;
+XClassHint xclasshint;
+char configfile[CONFIGFILEMAX];
+char tempfile[CONFIGFILEMAX];
+
+Pixmap pixmask;
+
+ButtonArea dispchar;
+XpmIcon template, visible, buttons, charmap;
+
+
+/* Configuration File Information */
+char *CfgVarList[MAX_LABEL] = {"Mem0",
+ "Mem1",
+ "Mem2",
+ "Mem3",
+ "Mem4",
+ "Mem5",
+ "Mem6",
+ "Mem7",
+ "Mem8",
+ "Mem9",
+ "MEM0",
+ "MEM1",
+ "MEM2",
+ "MEM3",
+ "MEM4",
+ "MEM5",
+ "MEM6",
+ "MEM7",
+ "MEM8",
+ "MEM9",
+ "ImagChar",
+ "CalcStart"};
+
+char ImagChar = 'j';
+char SysCalcCmd[CALC_CMD_SIZE] = "xcalc &";
+
+
+double MemArray[NUM_MEM_CELLS];
+int MemLock [NUM_MEM_CELLS];
+
+#endif
diff --git a/wmcalc_t.h b/wmcalc_t.h
new file mode 100644
index 0000000..6ae53e2
--- /dev/null
+++ b/wmcalc_t.h
@@ -0,0 +1,54 @@
+/* File: wmcalc_t.h
+ * Author: Edward H. Flora <ehflora at access1.net>
+ * Version: 0.2
+ *
+ * Description:
+ * This file contains the typedefs for the wmcalc program.
+ *
+ * Change History:
+ * Date Modification
+ * 10/25/00 Original file creation, extracted from wmcalc.h
+ */
+
+#ifndef WMCALC_T_H
+#define WMCALC_T_H
+
+typedef struct _XpmIcon {
+ Pixmap pixmap;
+ Pixmap mask;
+ XpmAttributes attributes;
+} XpmIcon;
+
+typedef struct _button_region {
+ int x,y;
+ int i,j;
+} ButtonArea;
+
+typedef enum {
+ MEM_LABEL_0 = 0,
+ MEM_LABEL_1,
+ MEM_LABEL_2,
+ MEM_LABEL_3,
+ MEM_LABEL_4,
+ MEM_LABEL_5,
+ MEM_LABEL_6,
+ MEM_LABEL_7,
+ MEM_LABEL_8,
+ MEM_LABEL_9,
+ MEM_LOCK_0,
+ MEM_LOCK_1,
+ MEM_LOCK_2,
+ MEM_LOCK_3,
+ MEM_LOCK_4,
+ MEM_LOCK_5,
+ MEM_LOCK_6,
+ MEM_LOCK_7,
+ MEM_LOCK_8,
+ MEM_LOCK_9,
+ IMAG_LABEL,
+ CALC_LABEL,
+ MAX_LABEL
+} cfg_var_label_type;
+
+
+#endif
diff --git a/wmcalc_x.h b/wmcalc_x.h
new file mode 100644
index 0000000..f2d5e09
--- /dev/null
+++ b/wmcalc_x.h
@@ -0,0 +1,30 @@
+/****************************************************************
+ * File: wmcalc_x.h
+ * Version: 0.3
+ * Author: Edward H. Flora <ehflora at access1.net>
+ *
+ * This file is a part of the wmcalc application. As such, this
+ * file is licensed under the GNU General Public License, version 2.
+ * A copy of this license may be found in the file COPYING that should
+ * have been distributed with this file. If not, please refer to
+ * http://www.gnu.org/copyleft/gpl.html for details.
+ *
+ ****************************************************************
+ Description:
+ This file includes the X libraries.
+
+ Change History:
+ Date Modification
+ 12/10/00 Original File Creation, from Peter da Silva <peter at taronga.com>
+
+ ****************************************************************/
+#ifndef WMCALC_X_H
+#define WMCALC_X_H
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+#include <X11/keysym.h>
+
+#endif
diff --git a/wmcalcfunc.c b/wmcalcfunc.c
new file mode 100644
index 0000000..17f9518
--- /dev/null
+++ b/wmcalcfunc.c
@@ -0,0 +1,525 @@
+/****************************************************************
+ * File: wmcalcfunc.c
+ * Version: 0.21
+ * Author: Edward H. Flora <ehflora at access1.net>
+ *
+ * This file is a part of the wmcalc application. As such, this
+ * file is licensed under the GNU General Public License, version 2.
+ * A copy of this license may be found in the file COPYING that should
+ * have been distributed with this file. If not, please refer to
+ * http://www.gnu.org/copyleft/gpl.html for details.
+ *
+ ****************************************************************
+ Description:
+ This file contains the code for the actual calculator functions,
+ such as a add, subt, clear, etc.
+
+ Change History:
+ Date Modification
+ 11/03/00 File Header added
+
+ ****************************************************************/
+
+/***** Includes *************************************************/
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include "wmcalc_c.h"
+#include "wmcalc_err.h"
+#include "wmcalc_f.h"
+
+
+/****************************************************************
+ * Function: clearcalc
+ ****************************************************************
+ Description:
+ This function will clear the calculator display, and internal
+ flags.
+
+ Change History:
+ Date Modification
+ 11/03/00 Function header added
+ 11/04/00 Replaced magic numbers with DISPSIZE
+ ****************************************************************/
+void clearcalc(void) {
+ extern int StrCnt;
+ extern char PlusMinusFlag;
+ extern int ExpFlag;
+ extern int DecFlag;
+ extern double RegisterA;
+ extern double RegisterB;
+ extern char DispString[];
+ extern char OpFlag;
+ int i;
+
+ RegisterA = 0.0;
+ RegisterB = 0.0;
+ ExpFlag = 0;
+ DecFlag = 0;
+ PlusMinusFlag = '+';
+ StrCnt = 0;
+ for (i=0; i < DISPSIZE; i++) {
+ DispString[i] = ' ';
+ }
+ OpFlag = ' ';
+} /***** End of function clearcalc() *****************************/
+
+/****************************************************************
+ * Function: clearnum
+ ****************************************************************
+ Description:
+ Clears the current number being entered.
+
+ Change History:
+ Date Modification
+ 11/03/00 Updated function header
+ 11/04/00 Replaced magic numbers with DISPSIZE
+ ****************************************************************/
+void clearnum(void) {
+ extern int StrCnt;
+ extern char PlusMinusFlag;
+ extern int ExpFlag;
+ extern int DecFlag;
+ extern double RegisterA;
+ extern char DispString[];
+ int i;
+
+ RegisterA = 0.0;
+ ExpFlag = 0;
+ DecFlag = 0;
+ PlusMinusFlag = '+';
+ StrCnt = 0;
+ for (i=0; i < DISPSIZE; i++) {
+ DispString[i] = ' ';
+ }
+
+} /***** End of function clearnum() ******************************/
+
+/****************************************************************
+ * Function: charkey
+ ****************************************************************
+ Description:
+ Add characters to the number being entered.
+
+ Change History:
+ Date Modification
+ 11/03/00 Updated function header
+ 11/04/00 Replaced magic numbers with DISPSIZE
+ ****************************************************************/
+void charkey(char ch) {
+ extern int Verbose;
+ extern int StrCnt;
+ extern int DecFlag;
+ extern double RegisterA, RegisterB;
+ extern char DispString[];
+ int i;
+
+ if (Verbose) printf("In function charkey\n");
+
+ if (StrCnt < DISPSIZE) {
+ if (ch == '.') {
+ if (DecFlag == 0) {
+ for (i = 1; i < DISPSIZE; i++)
+ DispString[i-1] = DispString[i];
+ DecFlag = 1;
+ StrCnt++;
+ DispString[DISPSIZE - 1] = ch;
+ }
+ }
+ else {
+ for (i = 1; i < DISPSIZE; i++)
+ DispString[i-1] = DispString[i];
+ DispString[9] = ch;
+ StrCnt++;
+ }
+ } /* endif (StrCnt < DISPSIZE) */
+ else if (StrCnt == CALCDONE) {
+ RegisterB = RegisterA;
+ clearnum();
+ if (ch == '.') {
+ for (i = 1; i < DISPSIZE; i++)
+ DispString[i-1] = DispString[i];
+ DecFlag = 1;
+ StrCnt++;
+ DispString[DISPSIZE -1] = ch;
+ }
+ else {
+ for (i = 1; i < DISPSIZE; i++)
+ DispString[i-1] = DispString[i];
+ DispString[DISPSIZE - 1] = ch;
+ StrCnt++;
+ }
+ } /* endif (StrCnt == CALCDONE) */
+ RegisterA = atof(DispString);
+} /***** End of Function charkey() *******************************/
+
+
+/****************************************************************
+ * Function: chgsignnum
+ ****************************************************************
+ Description:
+ Change the sign of the number currently being entered
+
+ Change History:
+ Date Modification
+ 11/03/00 Updated Function header
+ ****************************************************************/
+void chgsignnum(void) {
+ extern int Verbose;
+ extern double RegisterA;
+ extern char DispString[];
+
+ if (Verbose) printf("In function chgsignnum\n");
+
+ RegisterA = -RegisterA;
+ sprintf(DispString, "%10.5g", RegisterA);
+
+} /***** End of function chgsignnum() *****************************/
+
+
+/****************************************************************
+ * Function: sqrnum
+ ****************************************************************
+ Description:
+ Square the number in RegisterA
+ Change History:
+ Date Modification
+ 11/03/00 Updated Function header
+ ****************************************************************/
+void sqrnum(void) {
+ extern int Verbose;
+ extern int StrCnt;
+ extern double RegisterA;
+ extern char DispString[];
+ extern int ImgFlag;
+
+ if (Verbose) printf("In function sqrnum\n");
+ RegisterA = atof(DispString);
+ RegisterA = pow(RegisterA, 2.0);
+ if (ImgFlag) {
+ RegisterA = -RegisterA;
+ ImgFlag = 0;
+ }
+ sprintf(DispString, "%10.5g", RegisterA);
+ StrCnt = CALCDONE;
+
+} /***** End of Function sqrnum() *******************************/
+
+/****************************************************************
+ * Function: sqrtnum
+ ****************************************************************
+ Description:
+ Take the square root of the number in RegisterA
+ Change History:
+ Date Modification
+ 11/03/00 Updated function header
+ 11/04/00 Replaced magic numbers with DISPSIZE
+ ****************************************************************/
+void sqrtnum(void) {
+ extern int Verbose;
+ extern int StrCnt;
+ extern double RegisterA;
+ extern int ImgFlag;
+ extern char ImagChar;
+ extern char DispString[];
+ int i;
+
+ if (Verbose) printf("In function sqrtnum\n");
+ RegisterA = atof(DispString);
+ if (RegisterA >= 0) {
+ RegisterA = pow(RegisterA, 0.5);
+ sprintf(DispString, "%10.5g", RegisterA);
+ }
+ else {
+ RegisterA = pow(-RegisterA, 0.5);
+ ImgFlag = 1;
+ sprintf(DispString, "%10.4g", RegisterA);
+ for(i=1; i < DISPSIZE - 1; i++)
+ DispString[i] = DispString[i+1];
+ DispString[DISPSIZE - 1] = ImagChar;
+ }
+ StrCnt = CALCDONE;
+
+} /***** End of function sqrtnum() ********************************/
+
+/****************************************************************
+ * Function: addnums
+ ****************************************************************
+ Description:
+ Add the number in Registers A to Register B.
+ Change History:
+ Date Modification
+ 11/03/00 Updated Function header
+ ****************************************************************/
+void addnums(void) {
+ extern int Verbose;
+ extern int StrCnt;
+ extern double RegisterA, RegisterB;
+ extern char OpFlag;
+
+ if(Verbose) printf("In function addnums: ");
+
+ if(OpFlag != ' ') {
+ equalfunc();
+ }
+ else {
+ if(Verbose) printf("%g + ?? = ??\n", RegisterB);
+ RegisterB = RegisterA;
+ }
+
+ StrCnt = CALCDONE;
+ OpFlag = '+';
+} /***** End of function addnums() *********************************/
+
+
+/****************************************************************
+ * Function: subtnums
+ ****************************************************************
+ Description:
+ Subtract current number (in RegisterA) from accumulated total.
+ Change History:
+ Date Modification
+ 11/03/00 Updated Function header
+ ****************************************************************/
+void subtnums(void) {
+ extern int Verbose;
+ extern int StrCnt;
+ extern double RegisterA, RegisterB;
+ extern char OpFlag;
+
+ if(Verbose) printf("In function subtnums: ");
+
+ if (OpFlag != ' ') {
+ equalfunc();
+ }
+ else {
+ if(Verbose) printf("%g - ?? = ??\n", RegisterB);
+ RegisterB = RegisterA;
+ }
+
+ StrCnt = CALCDONE;
+ OpFlag = '-';
+
+} /***** End of function subtnums() *****************************/
+
+/****************************************************************
+ * Function: multnums
+ ****************************************************************
+ Description:
+ Multiply number in RegisterA by the accumulated total.
+ Change History:
+ Date Modification
+ 11/03/00 Updated function header
+ ****************************************************************/
+void multnums(void) {
+ extern int Verbose;
+ extern int StrCnt;
+ extern char OpFlag;
+ extern double RegisterA, RegisterB;
+
+ if(Verbose) printf("In function multnums: ");
+
+ if(OpFlag != ' ') {
+ equalfunc();
+ }
+ else {
+ if(Verbose) printf("%g * ?? = ??\n", RegisterB);
+ RegisterB = RegisterA;
+ }
+
+ StrCnt = CALCDONE;
+ OpFlag = '*';
+} /***** End of function multnums() *****************************/
+
+/****************************************************************
+ * Function: divnums
+ ****************************************************************
+ Description:
+ Divide the accumulated total by the current number in RegisterA
+
+ Change History:
+ Date Modification
+ 11/04/00 Updated Function Header
+ ****************************************************************/
+void divnums(void) {
+ extern int Verbose;
+ extern int StrCnt;
+ extern double RegisterA, RegisterB;
+ extern char OpFlag;
+
+ if(Verbose) printf("In function divnums: ");
+
+ if(OpFlag != ' ') {
+ equalfunc();
+ }
+ else {
+ if(Verbose) printf("%g / ?? = ??\n", RegisterB);
+ RegisterB = RegisterA;
+ }
+
+ StrCnt = CALCDONE;
+ OpFlag = '/';
+} /* End of Function divnums() ********************************/
+
+/****************************************************************
+ * Function:
+ ****************************************************************
+ Description:
+ Calculate result of entered calculation.
+ Change History:
+ Date Modification
+ 11/04/00 Updated Function Header
+ ****************************************************************/
+void equalfunc (void) {
+ extern int Verbose;
+ extern int StrCnt;
+ extern char DispString[];
+ extern double RegisterA, RegisterB;
+ extern char OpFlag;
+
+ if (Verbose) printf("Equal Function: Operation >> %c <<\n", OpFlag);
+ switch (OpFlag) {
+ case '+':
+ RegisterA = RegisterB + RegisterA;
+ sprintf(DispString, "%10.5g", RegisterA);
+ break;
+ case '-':
+ RegisterA = RegisterB - RegisterA;
+ sprintf(DispString, "%10.5g", RegisterA);
+ break;
+ case '*':
+ RegisterA = RegisterB * RegisterA;
+ sprintf(DispString, "%10.5g", RegisterA);
+ break;
+ case '/':
+ RegisterA = RegisterB / RegisterA;
+ sprintf(DispString, "%10.5g", RegisterA);
+ break;
+ default:
+ break;
+ }
+ OpFlag = ' ';
+ StrCnt = CALCDONE;
+} /***** End of function equalfunc() ******************************/
+
+
+/****************************************************************
+ * Function: clrallmem
+ ****************************************************************
+ Description:
+ Clear all the values in memory
+ Change History:
+ Date Modification
+ 11/04/00 Updated Function Header
+ 11/04/00 Incorporated clrmem() function into this one, to
+ optimize code.
+ ****************************************************************/
+void clrallmem(void) {
+ extern int Verbose;
+ extern double MemArray[];
+ extern int MemLock[];
+ int i;
+
+ if (Verbose) printf("Clear All Memory Function\n");
+
+ for (i = 0; i < NUM_MEM_CELLS; i++) {
+ if (MemLock[i] != 1) {
+ MemArray[i] = 0.0;
+ if (Verbose) printf(" %f ", MemArray[i]);
+ }
+ }
+ if (Verbose) printf("\n");
+
+ write_config();
+} /***** End of function clrallmem() ****************************/
+
+
+/****************************************************************
+ * Function: stormem
+ ****************************************************************
+ Description:
+ Store value to memory cell #N
+
+ Change History:
+ Date Modification
+ 11/04/00 Updated function header
+ 11/05/00 Added Locked Memory capabilities
+ ****************************************************************/
+void stormem(int mem_loc) {
+ extern double MemArray[];
+ extern int MemLock[];
+ extern int Verbose;
+ extern double RegisterA;
+ int i;
+
+ if (Verbose)
+ printf("Store Value %f in Memory Cell %d\nMemory:", RegisterA, mem_loc);
+
+ if (MemLock[mem_loc] != 1) {
+ MemArray[mem_loc] = RegisterA;
+ write_config();
+ }
+ else {
+ if (Verbose) printf("Memory location %d Locked at %f\n",
+ mem_loc, MemArray[mem_loc]);
+ }
+
+ if (Verbose) {
+ for (i = 0; i < NUM_MEM_CELLS; i++)
+ printf(" %f ", MemArray[i]);
+ printf("\n");
+ }
+
+} /***** End of function stormem() ******************************/
+
+
+/****************************************************************
+ * Function: recallmem
+ ****************************************************************
+ Description:
+ Store value to memory cell #N
+ Change History:
+ Date Modification
+ 11/04/00 Updated function header
+ ****************************************************************/
+void recallmem(int mem_loc) {
+ extern double MemArray[];
+ extern int Verbose;
+ extern double RegisterA;
+ extern char DispString[];
+ int i;
+
+ if (Verbose)
+ printf("Recall Value in Memory Cell %d\nMemory:", mem_loc);
+
+ RegisterA = MemArray[mem_loc];
+
+ sprintf(DispString, "%10.5g", RegisterA);
+
+ if (Verbose) {
+ for (i = 0; i < NUM_MEM_CELLS; i++)
+ printf(" %f ", MemArray[i]);
+ printf("\n");
+ }
+} /***** End of function recallmem() ***************************/
+
+
+/****************************************************************
+ * Function: startcalc
+ ****************************************************************
+ Description:
+ Change the sign of the number currently being entered
+ Change History:
+ Date Modification
+ 11/04/00 Updated function header
+ ****************************************************************/
+void startcalc(void) {
+ extern int Verbose;
+ extern char SysCalcCmd[];
+
+ if (Verbose)
+ fprintf(stderr, "Starting external calculator %s\n", SysCalcCmd);
+
+ system(SysCalcCmd);
+} /***** End of function startcalc *****************************/
diff --git a/wmcalcscr.xpm b/wmcalcscr.xpm
new file mode 100644
index 0000000..ed4e94a
--- /dev/null
+++ b/wmcalcscr.xpm
@@ -0,0 +1,128 @@
+/* XPM */
+static char * wmcalcscr_xpm[] = {
+"64 64 61 1",
+" c None",
+". c #F3F3F3",
+"+ c #000000",
+"@ c #E0E0E0",
+"# c #516161",
+"$ c #A2A2B2",
+"% c #A2A2A2",
+"& c #A292B2",
+"* c #92A2A2",
+"= c #A292A2",
+"- c #9292A2",
+"; c #929292",
+"> c #9282A2",
+", c #829292",
+"' c #928292",
+") c #828292",
+"! c #828282",
+"~ c #827192",
+"{ c #615161",
+"] c #92A2B2",
+"^ c #9292B2",
+"/ c #8292A2",
+"( c #8282A2",
+"_ c #718292",
+": c #718282",
+"< c #C7C7C7",
+"[ c #414141",
+"} c #003F18",
+"| c #00FF00",
+"1 c #FFFFFF",
+"2 c #D5D6D5",
+"3 c #717182",
+"4 c #415151",
+"5 c #514151",
+"6 c #717171",
+"7 c #414151",
+"8 c #617182",
+"9 c #415141",
+"0 c #716182",
+"a c #617171",
+"b c #413041",
+"c c #304141",
+"d c #716171",
+"e c #616171",
+"f c #616182",
+"g c #303030",
+"h c #616161",
+"i c #303041",
+"j c #516171",
+"k c #304130",
+"l c #615171",
+"m c #203030",
+"n c #302030",
+"o c #515171",
+"p c #515161",
+"q c #827182",
+"r c #202030",
+"s c #717192",
+"t c #202020",
+"u c #515151",
+"v c #413051",
+"...............................................................+",
+".@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#+",
+".@$%$%&%&%&%&*=-&*=-=-=---=--;>;>;>;>,>,>,')',')')'))!)))!~!~!{+",
+".@$$*$]$*$*$*&*&*^*-*-*-*-*-/---,-,-,>,>,(,>,(,),),)))))_)_):)#+",
+".<[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[<+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".+}}|}}+}|||}+|||||+}}}|}+|||||+}}||}+|||||+}|||}+}|||}+}|||}+<+",
+".+}||}}+|}}}|+}}}|}+}}||}+|}}}}+}|}}}+}}}}|+|}}}|+|}}}|+|}}}|+<+",
+".+}}|}}+}}}}|+}}|}}+}|}|}+||||}+|}}}}+}}}|}+|}}}|+|}}}|+|}}}|+<+",
+".+}}|}}+}}}|}+}}}|}+|}}|}+}}}}|+||||}+}}|}}+}|||}+}||||+|}}}|+<+",
+".+}}|}}+}}|}}+}}}}|+|||||+}}}}|+|}}}|+}|}}}+|}}}|+}}}}|+|}}}|+<+",
+".+}}|}}+}|}}}+|}}}|+}}}|}+|}}}|+|}}}|+}|}}}+|}}}|+}}}|}+|}}}|+<+",
+".+}|||}+|||||+}|||}+}}}|}+}|||}+}|||}+}|}}}+}|||}+}||}}+}|||}+<+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".+|||||+}}}}}+|||||+|||||+}}}}}+|||||+}}}}}+|||||+|||||+}}}}}+<+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+",
+".@*^+11111111121111111112111111111211111111121111111111112+<:34+",
+".@=-+122222222+122222222+122222222+122222222+12222222+222++<335+",
+".@*-+1222++++2+12+++++22+122+++222+1222++222+12222222+222++<334+",
+".@=-+1222+2222+122222+22+12+222+22+122+22+22+1222222+2222++<365+",
+". at --+1222+2222+12222+222+122+++222+122+22+22+122222+22222++<337+",
+".@=-+12+2+2222+1222+2222+12+222+22+1222+++22+12222+222222++<365+",
+".@*-+122++2222+1222+2222+12+222+22+122222+22+1222+2222222++<839+",
+". at -;+1222+2222+1222+2222+122+++222+1222++222+1222+2222222++<067+",
+". at --+122222222+122222222+122222222+122222222+122222222222++<83[+",
+".@>;+2+++++++++2+++++++++2+++++++++2+++++++++2+++++++++++++<0ab+",
+". at --+11111111121111111112111111111211111111121111111111112+<a0[+",
+". at -;+122222+22+122222222+122222222+122222222+122222222222++<06[+",
+".@,-+1222222+2+12222+222+122++++22+1222++222+1222+222+222++<a0c+",
+".@>;+122222+22+12+22+222+122+22222+122+22222+12222+2+2222++<0ab+",
+".@,-+122222++2+12+22+222+122+++222+122+++222+122222+22222++<a0c+",
+".@>,+12+2+2222+12+++++22+122222+22+122+22+22+12222+2+2222++<dab+",
+".@,>+122+22222+12222+222+122+22+22+122+22+22+1222+222+222++<a0c+",
+".@',+12+2+2222+12222+222+1222++222+1222++222+122222222222++<0eb+",
+".@,>+122222222+122222222+122222222+122222222+122222222222++<afc+",
+".@>,+2+++++++++2+++++++++2+++++++++2+++++++++2+++++++++++++<deb+",
+".@,>+11111111121111111112111111111211111111121111111111112+<aec+",
+".@')+122222222+122222222+122222222+122222222+122222222222++<eeb+",
+".@,'+122222222+12222+222+1222++222+122+++222+122222222222++<aec+",
+".@',+122++++22+1222++222+122+22+22+122222+22+122222222222++<deb+",
+".@,(+122+22222+12222+222+122222+22+1222++222+1222+++++222++<eeg+",
+".@')+122+++222+12222+222+1222++222+122222+22+122222222222++<ehi+",
+".@,)+122+22222+12222+222+122+22222+122222+22+122222222222++<jek+",
+".@'!+122++++22+1222+++22+122++++22+122+++222+122222222222++<lhi+",
+".@))+122222222+122222222+122222222+122222222+122222222222++<eem+",
+".@))+2+++++++++2+++++++++2+++++++++2+++++++++2+++++++++++++<lhn+",
+".@))+11111111121111111112111111111211111111121111111111112+<#em+",
+".@)!+122222222+122222222+122222222+122222222+122222222222++<lhg+",
+".@))+122+22222+122+++222+122222222+122222222+122222222222++<jem+",
+".@~!+12+++22+2+12+222+22+122222222+122222222+122222+22222++<l#n+",
+". at _)+122+22+22+12+222+22+122222222+122++++22+122222+22222++<#lm+",
+".@)!+12222+222+12+222+22+122222222+122222222+1222+++++222++<lhn+",
+".@:~+1222+2222+12+222+22+122222222+122++++22+122222+22222++<#lm+",
+".@~!+122+22222+12+222+22+1222++222+122222222+122222+22222++<l#n+",
+".@:)+12+22+++2+122+++222+1222++222+122222222+122222222222++<#om+",
+".@~:+122222222+122222222+122222222+122222222+122222222222++<{pn+",
+".@:~+2+++++++++2+++++++++2+++++++++2+++++++++2+++++++++++++<#lm+",
+".@~:+++++++++++++++++++++++++++++++++++++++++++++++++++++++<{pn+",
+".@:~<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#om+",
+".@~:q3q3q3q3q3360636060a060adadadededeeheeehlhlhlhl#l#l#{p{p{pr+",
+".@:s:~:s:333333333a383a0a0a0a0afaeeeaeeeeejeje#ljl#l#l#o#opo#pt+",
+".@{upupupu5u545459575[5[7[v[7[b[bcbcbkbgigigigngngngnmnrntntrtr+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"};
diff --git a/wmcalcscr2.gif b/wmcalcscr2.gif
new file mode 100644
index 0000000..74ba958
Binary files /dev/null and b/wmcalcscr2.gif differ
diff --git a/wmcalcscr2.xpm b/wmcalcscr2.xpm
new file mode 100644
index 0000000..09332e7
--- /dev/null
+++ b/wmcalcscr2.xpm
@@ -0,0 +1,128 @@
+/* XPM */
+static char * wmcalcscr2_xpm[] = {
+"64 64 61 1",
+" c None",
+". c #F3F3F3",
+"+ c #000000",
+"@ c #E0E0E0",
+"# c #516161",
+"$ c #A2A2B2",
+"% c #A2A2A2",
+"& c #A292B2",
+"* c #92A2A2",
+"= c #A292A2",
+"- c #9292A2",
+"; c #929292",
+"> c #9282A2",
+", c #829292",
+"' c #928292",
+") c #828292",
+"! c #828282",
+"~ c #827192",
+"{ c #615161",
+"] c #92A2B2",
+"^ c #9292B2",
+"/ c #8292A2",
+"( c #8282A2",
+"_ c #718292",
+": c #718282",
+"< c #C7C7C7",
+"[ c #00FF00",
+"} c #003F18",
+"| c #FFFFFF",
+"1 c #D5D6D5",
+"2 c #717182",
+"3 c #514151",
+"4 c #415151",
+"5 c #717171",
+"6 c #414151",
+"7 c #617182",
+"8 c #415141",
+"9 c #716182",
+"0 c #414141",
+"a c #617171",
+"b c #413041",
+"c c #304141",
+"d c #716171",
+"e c #616171",
+"f c #616182",
+"g c #303030",
+"h c #616161",
+"i c #303041",
+"j c #516171",
+"k c #304130",
+"l c #615171",
+"m c #203030",
+"n c #302030",
+"o c #515171",
+"p c #515161",
+"q c #827182",
+"r c #202030",
+"s c #717192",
+"t c #202020",
+"u c #515151",
+"v c #413051",
+"...............................................................+",
+".@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#+",
+".@$%$%&%&%&%&*=-&*=-=-=---=--;>;>;>;>,>,>,')',')')'))!)))!~!~!{+",
+".@$$*$]$*$*$*&*&*^*-*-*-*-*-/---,-,-,>,>,(,>,(,),),)))))_)_):)#+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".+[[[[[+}}}}}+}}[}}+}}}[}+}}[}}+[[[[[+}[[[}+}[[[}+}}[[}+[[[[[+<+",
+".+}}}[}+}}}}}+}[[}}+}}[[}+}[[}}+[}}}}+[}}}[+[}}}[+}[}}}+[}}}}+<+",
+".+}}[}}+}}}}}+}}[}}+}[}[}+}}[}}+[[[[}+[}}}[+}}}}[+[}}}}+[[[[}+<+",
+".+}}}[}+}}}}}+}}[}}+[}}[}+}}[}}+}}}}[+}[[[[+}}}[}+[[[[}+}}}}[+<+",
+".+}}}}[+}}}}}+}}[}}+[[[[[+}}[}}+}}}}[+}}}}[+}}[}}+[}}}[+}}}}[+<+",
+".+[}}}[+}}[[}+}}[}}+}}}[}+}}[}}+[}}}[+}}}[}+}[}}}+[}}}[+[}}}[+<+",
+".+}[[[}+}}[[}+}[[[}+}}}[}+}[[[}+}[[[}+}[[}}+[[[[[+}[[[}+}[[[}+<+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".+[[[[[+}}}}}+[[[[[+[[[[[+}}}}}+}}}}}+[[[[[+}}}}}+}}}}}+[[[[[+<+",
+".+[[[[[+}}}}}+[[[[[+[[[[[+}}}}}+}}}}}+[[[[[+}}}}}+}}}}}+[[[[[+<+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+",
+".<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+",
+".@=-+|||||||||1|||||||||1|||||||||1|||||||||1||||||||||||1+<223+",
+".@*-+|11111111+|11111111+|11111111+|11111111+|1111111+111++<224+",
+".@=-+|111++++1+|1+++++11+|11+++111+|11+++111+|1111111+111++<253+",
+". at --+|111+1111+|11111+11+|1+111+11+|1+111+11+|111111+1111++<226+",
+".@=-+|111+1111+|1111+111+|11+++111+|1+111+11+|11111+11111++<253+",
+".@*-+|1+1+1111+|111+1111+|1+111+11+|11++++11+|1111+111111++<728+",
+". at -;+|11++1111+|111+1111+|1+111+11+|11111+11+|111+1111111++<956+",
+". at --+|111+1111+|111+1111+|11+++111+|11+++111+|111+1111111++<720+",
+".@>;+|11111111+|11111111+|11111111+|11111111+|11111111111++<9ab+",
+". at --+1+++++++++1+++++++++1+++++++++1+++++++++1+++++++++++++<a90+",
+". at -;+|||||||||1|||||||||1|||||||||1|||||||||1||||||||||||1+<950+",
+".@,-+|11111111+|11111111+|11111111+|11111111+|11111111111++<a9c+",
+".@>;+|11111+11+|1111+111+|1+++++11+|11+++111+|111+111+111++<9ab+",
+".@,-+|111111+1+|1+11+111+|1+111111+|1+111111+|1111+1+1111++<a9c+",
+".@>,+|11111+11+|1+11+111+|1++++111+|1++++111+|11111+11111++<dab+",
+".@,>+|1+1+1++1+|1+++++11+|11111+11+|1+111+11+|1111+1+1111++<a9c+",
+".@',+|11+11111+|1111+111+|1+111+11+|1+111+11+|111+111+111++<9eb+",
+".@,>+|1+1+1111+|1111+111+|11+++111+|11+++111+|11111111111++<afc+",
+".@>,+|11111111+|11111111+|11111111+|11111111+|11111111111++<deb+",
+".@,>+1+++++++++1+++++++++1+++++++++1+++++++++1+++++++++++++<aec+",
+".@')+|||||||||1|||||||||1|||||||||1|||||||||1||||||||||||1+<eeb+",
+".@,'+|11111111+|11111111+|11111111+|11111111+|11111111111++<aec+",
+".@',+|11111111+|1111+111+|11+++111+|1++++111+|11111111111++<deb+",
+".@,(+|11++++11+|111++111+|1+111+11+|11111+11+|11111111111++<eeg+",
+".@')+|11+11111+|1111+111+|11111+11+|11+++111+|111+++++111++<ehi+",
+".@,)+|11+++111+|1111+111+|11+++111+|11111+11+|11111111111++<jek+",
+".@'!+|11+11111+|1111+111+|1+111111+|1+111+11+|11111111111++<lhi+",
+".@))+|11++++11+|111+++11+|1+++++11+|11+++111+|11111111111++<eem+",
+".@))+|11111111+|11111111+|11111111+|11111111+|11111111111++<lhn+",
+".@))+1+++++++++1+++++++++1+++++++++1+++++++++1+++++++++++++<#em+",
+".@)!+|||||||||1|||||||||1|||||||||1|||||||||1||||||||||||1+<lhg+",
+".@))+|11111111+|11111111+|11111111+|11111111+|11111111111++<jem+",
+".@~!+|11+111+1+|11+++111+|11111111+|11111111+|11111+11111++<l#n+",
+". at _)+|1+++1+11+|1+111+11+|11111111+|11++++11+|11111+11111++<#lm+",
+".@)!+|11+1+111+|1+111+11+|11111111+|11111111+|111+++++111++<lhn+",
+".@:~+|111+1111+|1+111+11+|11111111+|11++++11+|11111+11111++<#lm+",
+".@~!+|11+11111+|1+111+11+|111++111+|11111111+|11111+11111++<l#n+",
+".@:)+|1+11+++1+|11+++111+|111++111+|11111111+|11111111111++<#om+",
+".@~:+|11111111+|11111111+|11111111+|11111111+|11111111111++<{pn+",
+".@:~+1+++++++++1+++++++++1+++++++++1+++++++++1+++++++++++++<#lm+",
+".@~:+++++++++++++++++++++++++++++++++++++++++++++++++++++++<{pn+",
+".@:~<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#om+",
+".@~:q2q2q2q2q2259525959a959adadadededeeheeehlhlhlhl#l#l#{p{p{pr+",
+".@:s:~:s:222222222a272a9a9a9a9afaeeeaeeeeejeje#ljl#l#l#o#opo#pt+",
+".@{upupupu3u34343836303060v060b0bcbcbkbgigigigngngngnmnrntntrtr+",
+".+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"};
diff --git a/wmcalcsrc.jpg b/wmcalcsrc.jpg
new file mode 100644
index 0000000..200cd31
Binary files /dev/null and b/wmcalcsrc.jpg differ
diff --git a/wmcalcswitch.c b/wmcalcswitch.c
new file mode 100644
index 0000000..f8b9846
--- /dev/null
+++ b/wmcalcswitch.c
@@ -0,0 +1,605 @@
+/****************************************************************
+ * File: wmcalcswitch.c
+ * Version: 0.21
+ * Date: November 1, 2000
+ * Author: Edward H. Flora <ehflora at access1.net>
+ *
+ * This file is a part of the wmcalc application. As such, this
+ * file is licensed under the GNU General Public License, version 2.
+ * A copy of this license may be found in the file COPYING that should
+ * have been distributed with this file. If not, please refer to
+ * http://www.gnu.org/copyleft/gpl.html for details.
+ *
+ ****************************************************************
+ Description:
+ This file contains system level functions, such as read/write of
+ the config file, character map boundaries, etc.
+
+ Change History:
+ Date Modification
+ 11/1/00 Updated Function headers, cleaned up comments some.
+
+ ****************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "wmcalc_err.h"
+#include "wmcalc_c.h"
+#include "wmcalc_f.h"
+
+/****************************************************************
+ * Function: ExecFunc
+ ****************************************************************
+ Description:
+ This function determines which button was pressed, and performs
+ the appropriate function.
+
+ Change History:
+ Date Modification
+ 11/01/00 Function header updated
+ ****************************************************************/
+void ExecFunc( int val ) {
+ extern int Verbose;
+
+ if (Verbose) printf("Execute function for button %d\n", val);
+
+ switch(val) {
+ case 100:
+ clearcalc();
+ break;
+ case 101:
+ sqrtnum();
+ break;
+ case 102:
+ charkey('7');
+ break;
+ case 103:
+ charkey('8');
+ break;
+ case 104:
+ charkey('9');
+ break;
+ case 105:
+ divnums();
+ break;
+ case 106:
+ sqrnum();
+ break;
+ case 107:
+ charkey('4');
+ break;
+ case 108:
+ charkey('5');
+ break;
+ case 109:
+ charkey('6');
+ break;
+ case 110:
+ multnums();
+ break;
+ case 111:
+ // scinotation();
+ startcalc();
+ break;
+ case 112:
+ charkey('1');
+ break;
+ case 113:
+ charkey('2');
+ break;
+ case 114:
+ charkey('3');
+ break;
+ case 115:
+ subtnums();
+ break;
+ case 116:
+ chgsignnum();
+ break;
+ case 117:
+ charkey('0');
+ break;
+ case 118:
+ charkey('.');
+ break;
+ case 119:
+ equalfunc();
+ break;
+ case 120:
+ addnums();
+ break;
+ case 200:
+ clrallmem();
+ break;
+ case 201:
+ sqrtnum();
+ // userdef201();
+ break;
+ case 202:
+ recallmem(7);
+ break;
+ case 203:
+ recallmem(8);
+ break;
+ case 204:
+ recallmem(9);
+ break;
+ case 205:
+ divnums();
+ // userdef205();
+ break;
+ case 206:
+ sqrnum();
+ // userdef206();
+ break;
+ case 207:
+ recallmem(4);
+ break;
+ case 208:
+ recallmem(5);
+ break;
+ case 209:
+ recallmem(6);
+ break;
+ case 210:
+ multnums();
+ // userdef210();
+ break;
+ case 211:
+ startcalc();
+ break;
+ case 212:
+ recallmem(1);
+ break;
+ case 213:
+ recallmem(2);
+ break;
+ case 214:
+ recallmem(3);
+ break;
+ case 215:
+ subtnums();
+ // userdef215();
+ break;
+ case 216:
+ chgsignnum();
+ break;
+ case 217:
+ recallmem(0);
+ break;
+ case 218:
+ // userdef218();
+ break;
+ case 219:
+ equalfunc();
+ break;
+ case 220:
+ addnums();
+ // userdef220();
+ break;
+ case 300:
+ clearnum();
+ break;
+ case 301:
+ sqrtnum();
+ // userdef301();
+ break;
+ case 302:
+ stormem(7);
+ break;
+ case 303:
+ stormem(8);
+ break;
+ case 304:
+ stormem(9);
+ break;
+ case 305:
+ divnums();
+ // userdef305();
+ break;
+ case 306:
+ sqrnum();
+ // userdef306();
+ break;
+ case 307:
+ stormem(4);
+ break;
+ case 308:
+ stormem(5);
+ break;
+ case 309:
+ stormem(6);
+ break;
+ case 310:
+ multnums();
+ // userdef310();
+ break;
+ case 311:
+ startcalc();
+ break;
+ case 312:
+ stormem(1);
+ break;
+ case 313:
+ stormem(2);
+ break;
+ case 314:
+ stormem(3);
+ break;
+ case 315:
+ subtnums();
+ // userdef315();
+ break;
+ case 316:
+ chgsignnum();
+ break;
+ case 317:
+ stormem(0);
+ break;
+ case 318:
+ // userdef318();
+ break;
+ case 319:
+ equalfunc();
+ break;
+ case 320:
+ addnums();
+ // userdef320();
+ break;
+ } /* End of switch statement */
+
+} /* End of function ExecFunc() *********************************/
+
+/****************************************************************
+ * Function: getboundaries
+ ****************************************************************
+ Description:
+ This function returns the x,y boundaries for each character
+ that is to be displayed on the display.
+
+ There must be a better way to do this, as by changing the file
+ charmap.xpm, one may have to adjust these constants.
+
+ Change History:
+ Date Modification
+ 11/01/00 Function header updated
+ 10/30/00 Added characters for the Memory indicator bar.
+ ****************************************************************/
+ButtonArea getboundaries(char ch) {
+ ButtonArea xybounds;
+
+ switch (ch) {
+ case '0':
+ xybounds.x = 1; xybounds.i = 6;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '1':
+ xybounds.x = 7; xybounds.i = 12;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '2':
+ xybounds.x = 13; xybounds.i = 18;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '3':
+ xybounds.x = 19; xybounds.i = 24;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '4':
+ xybounds.x = 25; xybounds.i = 30;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '5':
+ xybounds.x = 31; xybounds.i = 36;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '6':
+ xybounds.x = 37; xybounds.i = 42;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '7':
+ xybounds.x = 43; xybounds.i = 48;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '8':
+ xybounds.x = 49; xybounds.i = 54;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '9':
+ xybounds.x = 55; xybounds.i = 60;
+ xybounds.y = 1; xybounds.j = 8;
+ break;
+ case '+':
+ xybounds.x = 55; xybounds.i = 60;
+ xybounds.y = 28; xybounds.j = 35;
+ break;
+ case '-':
+ xybounds.x = 49; xybounds.i = 54;
+ xybounds.y = 28; xybounds.j = 35;
+ break;
+ case '.':
+ xybounds.x = 7; xybounds.i = 12;
+ xybounds.y = 10; xybounds.j = 17;
+ break;
+ case 'e':
+ xybounds.x = 1; xybounds.i = 6;
+ xybounds.y = 37; xybounds.j = 44;
+ break;
+ case 'i':
+ xybounds.x = 7; xybounds.i = 12;
+ xybounds.y = 37; xybounds.j = 44;
+ break;
+ case 'j':
+ xybounds.x = 13; xybounds.i = 18;
+ xybounds.y = 37; xybounds.j = 44;
+ break;
+ case 'n':
+ xybounds.x = 19; xybounds.i = 24;
+ xybounds.y = 37; xybounds.j = 44;
+ break;
+ case 'a':
+ xybounds.x = 25; xybounds.i = 30;
+ xybounds.y = 37; xybounds.j = 44;
+ break;
+ case 'f':
+ xybounds.x = 31; xybounds.i = 36;
+ xybounds.y = 37; xybounds.j = 44;
+ break;
+ case ' ':
+ xybounds.x = 1; xybounds.i = 6;
+ xybounds.y = 10; xybounds.j = 17;
+ break;
+ case '=':
+ xybounds.x = 55; xybounds.i = 60;
+ xybounds.y = 55; xybounds.j = 56;
+ break;
+ case '#':
+ xybounds.x = 55; xybounds.i = 60;
+ xybounds.y = 57; xybounds.j = 58;
+ break;
+ case '_':
+ xybounds.x = 55; xybounds.i = 60;
+ xybounds.y = 59; xybounds.j = 60;
+ break;
+ default:
+ xybounds.x = 1; xybounds.i = 6;
+ xybounds.y = 10; xybounds.j = 17;
+ break;
+ } /* end of switch statement */
+
+ return(xybounds);
+} /***** End of function getboundaries() ************************/
+
+/****************************************************************
+ * Function: write_config
+ ****************************************************************
+ Description:
+ This function updates the configuration file as memory locations
+ are updated in the program. It re-writes the entire file, but
+ should ignore all lines that do not start with "Mem".
+
+ Change History:
+ Date Modification
+ 11/01/00 Function Header updated
+ 11/05/00 Added Locked Memory Handling
+ ****************************************************************/
+int write_config(void) {
+ extern int Verbose;
+ extern double MemArray[];
+ extern char configfile[];
+ extern char tempfile[];
+ extern char *CfgVarList[];
+ FILE *fp, *fptmp;
+ char *line = NULL;
+ int mem_ndx = 0;
+ int err_code = OKAY;
+ char movefilecmd[2 * CONFIGFILEMAX + 10]; /* make sure enough room in string */
+
+ /* Open current Config file */
+ if ((fp = fopen(configfile, "r")) == NULL) { // Can't find config file
+ printf("%s: Cannot create configuration file\n", configfile);
+ return(ERR_FILE_NOT_FOUND);
+ }
+
+ /* We cannot write to the global config-file... */
+ if(!strcmp(configfile, CONFIGGLOBAL)) {
+ strcpy(configfile, getenv("HOME")); // Added to wmbutton by Gordon Fraser, 9/21/01
+ strcat(configfile, CONFFILENAME);
+ }
+
+ /* Open Temporary File */
+ if ((fptmp = fopen(tempfile, "w")) == NULL) { // Can't open file in /tmp
+ fprintf(stderr, "%s: Temporary File Open Failed\n", tempfile);
+ strcpy(tempfile, getenv("HOME"));
+ strcat(tempfile, "wmcalc.tmp");
+ if ((fptmp = fopen(tempfile, "w")) == NULL) { // Can't open file in HOME
+ fprintf(stderr, "%s: Temporary File Open Failed\n", tempfile);
+ return(ERR_TMP_FILE_FAILED);
+ }
+ }
+
+ while ((line = readln(fp)) != NULL) { // Read Lines in config file
+ if (Verbose) printf("line:%s", line);
+
+ if ((strncmp(line, CfgVarList[MEM_LABEL_0],
+ strlen(CfgVarList[MEM_LABEL_0]) - 1) == 0)) {
+ // -1 to generalize to all Mem? strings
+ // If we've found a memory entry
+ mem_ndx = atoi(line+strlen(CfgVarList[MEM_LABEL_0])-1);
+ if ((mem_ndx >= 0) && (mem_ndx <= (NUM_MEM_CELLS - 1))) {
+ fprintf(fptmp, "%s\t%f\n", CfgVarList[mem_ndx],
+ MemArray[mem_ndx]);
+ }
+ }
+ else {
+ fprintf(fptmp, "%s", line);
+ }
+ free(line);
+ } /* End of while loop */
+
+ /* Close open files */
+ fclose(fp);
+ fclose(fptmp);
+
+ /* Copy temp file over original */
+ /* Note: If changing command, make sure to adjust size of string above!! */
+ sprintf(movefilecmd, "mv -f %s %s\n", tempfile, configfile);
+ err_code = system(movefilecmd);
+
+ if(Verbose) printf("New config file written.\n");
+
+ return(err_code);
+} /***** End of function write_config() *************************/
+
+
+/****************************************************************
+ * Function: read_config
+ ****************************************************************
+ Description:
+ This function reads the configuration file on program startup,
+ and sets the appropriate configuration options.
+ (By default, this is ~/.wmcalc, or a user set value)
+
+ Change History:
+ Date Modification
+ 11/01/00 Function header updated.
+ 11/05/00 Added Lcoked Memory Capabilities
+ ****************************************************************/
+int read_config(void) {
+ extern int Verbose;
+ extern double MemArray[];
+ extern int MemLock[];
+ extern char *CfgVarList[];
+ extern char ImagChar;
+ extern char configfile[];
+ extern char SysCalcCmd[];
+ FILE *fp;
+ int i = 0;
+ int err_code = OKAY;
+ char *line = NULL;
+ char *sepstr = NULL;
+ char sep_ch = '\t';
+ char *cfg_var_ptr = NULL;
+
+
+ sepstr = &sep_ch;
+
+ if ((fp = fopen(configfile, "r")) == NULL) { // Can't find config file
+ strcpy(configfile, CONFIGGLOBAL); // ...so try to open global config
+ if ((fp = fopen(configfile, "r")) == NULL) { // Can't find global config file
+ fprintf(stderr, "%s: Configuration File not found\n", configfile);
+ return(ERR_FILE_NOT_FOUND);
+ } else {
+ write_config(); // if global config opened, save in homedir
+ }
+ }
+ else {
+ if (Verbose) printf("%s: Found Configuration File\n", configfile);
+ }
+
+ do { // Read Lines in config file
+ line = readln(fp);
+ if (Verbose) printf("Line Read:%s\n", line);
+ if (line == NULL) break; // if end of file, quit
+ if ( (line[0] != '#') && (line[0] != '\n')) { /* Ignore comments and
+ blanks */
+ if (strchr(line, sep_ch) != NULL) { /* The line has a tab, so let's
+ see if the variable is
+ understood */
+ i = 0;
+ /* Loop while we haven't found the variable */
+ while (((strncmp(line, CfgVarList[i], strlen(CfgVarList[i]))) != 0)
+ && (i < MAX_LABEL)) {
+ i++;
+ }
+ /* If we've found the variable, let's set the appropriate value */
+ if (i <= MAX_LABEL) {
+ if (Verbose) printf("Variable %s found\n", CfgVarList[i]);
+
+ /* Point to the 'tab' character, to read the value */
+ cfg_var_ptr = strchr(line, sep_ch);
+ cfg_var_ptr++; // ++ to avoid tab character itself
+
+ /* Now set the appropriate variable */
+ switch(i) {
+ case MEM_LABEL_0:
+ case MEM_LABEL_1:
+ case MEM_LABEL_2:
+ case MEM_LABEL_3:
+ case MEM_LABEL_4:
+ case MEM_LABEL_5:
+ case MEM_LABEL_6:
+ case MEM_LABEL_7:
+ case MEM_LABEL_8:
+ case MEM_LABEL_9:
+ /* Set Locked Flag */
+ MemLock[i] = 0;
+ /* Set Memory Element */
+ MemArray[i] = atof(cfg_var_ptr);
+ if (Verbose)
+ printf("Assign Memory Element %d to %f\n", i, MemArray[i]);
+ break;
+
+ case MEM_LOCK_0:
+ case MEM_LOCK_1:
+ case MEM_LOCK_2:
+ case MEM_LOCK_3:
+ case MEM_LOCK_4:
+ case MEM_LOCK_5:
+ case MEM_LOCK_6:
+ case MEM_LOCK_7:
+ case MEM_LOCK_8:
+ case MEM_LOCK_9:
+ /* Set Locked Flag */
+ MemLock[i - MEM_LOCK_0] = 1;
+ /* Set Memory Element */
+ MemArray[i - MEM_LOCK_0] = atof(cfg_var_ptr);
+ if (Verbose)
+ printf("Assign Memory Element %d to %f\n", i -
+ MEM_LOCK_0, MemArray[i - MEM_LOCK_0]);
+ break;
+
+ case IMAG_LABEL:
+ /* Get the character that the user wishes to use to
+ represent sqrt(-1) (i or j) */
+ if ((cfg_var_ptr[0] == 'i') || cfg_var_ptr[0] == 'j') {
+ ImagChar = cfg_var_ptr[0];
+ }
+ if (Verbose)
+ printf("Use character '%c' to represent sqrt(-1)\n", ImagChar);
+ break;
+
+ case CALC_LABEL:
+ /* Set external calculator start command */
+ strcpy(SysCalcCmd, cfg_var_ptr);
+ if (Verbose)
+ printf("Assign Calc Command: %s\n", cfg_var_ptr);
+ break;
+
+ default:
+ if (Verbose) printf("Unknown Config Variable: %s\n", line);
+ break;
+ }
+
+ }
+ /* Otherwise, we don't recognize the variable */
+ else {
+ if (Verbose) printf("Unknown Config Variable: %s\n", line);
+ }
+ }
+ /* Otherwise, we had a poorly formatted line in the config file. */
+ else {
+ if (Verbose) printf("Poorly formatted config file line\n:%s\n", line);
+ }
+ }
+ free(line);
+ } while (line != NULL);
+
+ fclose(fp);
+
+
+
+ return(err_code);
+} /***** End of function read_config **************************/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmcalc.git
More information about the Pkg-wmaker-commits
mailing list