COCA is a COmbobox CAlculator with Expression Parser.
Program is distributed as ZIP package: download to temporary directory and unpack to destination folder. See below for download link(s).
Following ones are the download links for manual installation:
COCA - COmbobox CAlculator v. 1.0 (13/6/2005, Hans-Peter Sulzer) | Readme/What's new |
Coca - a COmbobox CAlculator with expression parser
Copyright (c) 1996-2005, Hans-Peter Sulzer (hps), Berlin, Fürth/Bay
email: peter_sulzer@b.maus.de (max. 64 KByte per day from one sender!!!)
Snail Mail:
Vacher Straße 62a
90766 Fürth
Germany
If you write, please insert a self addressed envelope AND international
post reply coupons, else I won't reply.
This program is currently in a beta state. Therefore it is
forbidden to upload it to mailboxes (BBS), FTP-servers, ...,
include it on PD-/Freeware-/Shareware-CD-ROMs or -Disks, ...
You may only download it from Maus B3 - Phones: +49-30-82701143 (V.34
or ISDN X.75) - and you may give it to friends. When the program is
finished, I will release it as freeware. Please read "license.txt".
2005 Mar 27 23:15/hps/OS/2
Finally renamed all "pmcalc" filenames to "coca", changed the
titlebar, About, ... to print out "Coca" instead of "PMCalc"
and set the version number to 1.0 :-) First official release
version :-)))
2005 Mar 28 19:10/hps/OS/2
When overstrike mode was set, the virtual key "LEFT" didn't
work, because the presentation manager returns then a selection
(the current char). Corrected: Call to WinQuerySysValue() to
get the current PM-status (insert/overstrike). Compiled a
new version of calc.exe, cause the old was compiled with
debug switches. Version still 1.0.
2005 Mar 27 19:40/hps/OS/2
Included the Coca icon, but program name is still pmcalc
2005 Mar 26 20:10/hps/OS/2
Added virtual cursor key Left and Right. If a selection is marked
from Right to Left, theese keys work slightly different than the
keyboard (test it out) - but it would be a lot of fuzzling to
change this (most probably it isn't possible at all). As long as
you mark from Left to Right, it works as it should.
2005 Mar 26 18:00/hps/OS/2
Virtual DEL-key now is working :-)
2005 Mar 24 20:30/hps/OS/2
Started work to insert a virtual DEL-key, key appears, but doesn't
do anything :-(
2005 Mar 18, 22:30/hps/OS/2
Rewrote the hpsStrSlice-function: It works now like an entry field
of OS/2. New: hpsStrSlice(buf,"0123456789",3,5,32) results in the
sliced (sub) string "34" (Old (QDOS-like: "345"). This made it
much easier to add the Backspace (BS) key in virtual keyboard,
which is now done and works :-)
2005 Mar 08, 22:30/hps/OS/2
Added all (normal, i. e. just outputting a text) virtual keys of
the main keyboard plus (for testing) one function key for function
sin (inserts "sin("). Thereby detecting a fatal error and an error
in insvkey(). When appending the text of the virtual key to the
entry field of the combobox, it was not checked, if the buffer
(exprbuf) is large enough, to hold the catenated string - corrected
(hopefully - difficult to test, no time to insert more than 1000
chars ;-)). The selection was set false, if a text to insert
from a virtual key, was longer than 1 (e. g. as in "sin(") the
selection was text+1 to strlen(text) (e. g. for "sin(" "in("
was selected - corrected. So the calculator can now be fully
used via the virtual keyboard (with the help of marking in
the entry field of the combobox) and it looks much better :-)
2005 Mar 07 21:30/hps/OS/2
Added the function to the ENTER (CR) key in the virtual numeric
keypad, so that it does the same as pressing ENTER (Carriage
Return) on the real keyboard when the cursor is in the combo
box, i. e. (currently) calculate the result. It is now possible
to calculate expressions which don't use functions (like sin())
or variables without touching the (real) keyboard :-)))
Unfortunately, the calculator still uses the old Calculator
icon and is still called PMCalc (Presentation Manager Calculator),
but this will be changed soon to Coca with the wonderfully
Coca-Icon ;-)
2005 Mar 07 20:50/hps/OS/2
Added all buttons for the numeric keypad and the ENTER-key
(currently without a function), which cannot be handled as
the other virtual keys, which just insert a text. ENTER must issue
a command (i. e. calculate the result). Currently the ENTER key
is labeled CR (for Carriage Return), as it is not possible to
print a vertical text on a key (the ENTER-key spans two keyrows).
2005 Mar 07 18:00/hps/OS/2
Completly rewritten the drawing of the virtual keys (they are now
held in a table with the positions, size, name (printed on virtual
key) and the text which it shall insert in the combobox. So they
can all be created in a loop, the window IDs for a virtual
key start at IDbtnVKey (defined in pmcwin.h) and for every key 1
is added. So it is now possible to add virtual keys by just
inserting them to the virtual key table (constant vector vktable
defined in pmcwin.h). The window IDs for virtual keys are handled
fully automatically. I. e. the programmer mustn't bother about it
(ivk is used as an index into this table and is calculated in
inskey() by IDbtnVKey+sizeof(vktable)/sizeof(VKey).
The virtual key table also has a member himage, which is a handle
to a bitmap (or icon), which is currently ignored. In future
versions this will perhaps be used, to print a bitmap (or icon)
on the virtual key, instead of a normal text.
2005 Feb 28/hps/OS/2
Virtual key "4" in numeric virtual keypad is now
working correctly :-)))
2005 February/OS/2
Started to make the virtual keys working, i. e. inserting
text. Thereby the new module hpstools has been added with
the function hpsstrslice() to slice a string (a sliced
string is often called substring, e. g. in YACL). See
the source file hpstools.cpp how to use this function.
2000 Nov 29 17:00/OS/2
STATUS: Not compiled. Test version for adding all buttons, first
the numeric keypad. Result: All absolute (from top left) coordinates
are set in an include file. When the window is drawn, all the
y-coordinates are subtracted from the height of the frame window
under Presentation Manager and used directly under windows.
2000 Nov 28 16:50:00/hps/OS/2
Added code so that when "pressing" virtual keys '4', '7' or '8'
the appropiate number is inserted into the combobox with
WinSetWindowText. But it doesn't work, cause text is not
inserted (or appended), but the contents of listbox of the
combobox is completly overwritten. There seems to be no
function to insert text, so most probably the hard way
must be gone (getting cursor position, getting text,
manipulate the text in memory and write it back) :-(
2000 Nov 28 15:00/hps/OS/2
Added keys (push buttons) '4' and '8' (to the already existing '7')
in the virtual numeric keypad. All virtual keys currently just
display a message box: "CONTINUE HERE: Insert 'key' into combo box".
The adding of keys should be changed: It's better to use vectors,
so that the virtual keys may be initialized and manipulated in
a loop.
1997 Jul 20 20:15/hps/Win
- Changed the bahaviour of the combobox to the extended version,
i. e. if you now press the "Cursor Down key" (Down Arrow key) the
listbox of the combobox pops down and you can navigate in the
listbox with the "Cursor Up" and "Cursor Down" key (currently in
the Windows version of "Coca" only - I don't know, if this is also
possible for the Presentation Manager of OS/2).
Some errors in the Windows version corrected:
- No vertical scrollbar in listbox of combobox (horizontal scrollbar
is not possible in a Windows combobox :-( Oh no, I have no time to
subclass the combobox to implement a horizontal scrollbar for the
listbox myself ;-) )
- After getting back an old expression from the history (listbox of
the combobox) and pressing immediatly ENTER, nothing is output
(not even an error message). Albeit if you did edit the expression
(e. g. appending a Space) the result is output. This now works.
- Old entries (all older than 40) were never deleted.
- The release version still did output messages to the logfile
"PMCALC.LOG".
- Some cosmetic corrections (e. g. program name in About message
box was wrong).
1997 Jul 17 23:00/hps/Win
Finally ported all features to windows (including clipboard,
error handling and Icon). Changed name (and icon) to "Coca" for
Combobox Calculator. The icon has the writing "Coca" in it, and
looks similar to "Coca" in "Coca-Cola" (R) ;-) This is the first
Windows version given to another user (Anne).
1997 Mar 27 23:00/hps - Version 0.1
Added hyperbolic functions and absolute value function. Compiled
with release code and optimization on. First general available
pre release (0.x) version :-)
1997 Mar 23 22:00/hps
Added an "About PMCalc ..." button which displays a box with
information about PMCalc (Copyright) and the license of PMCalc.
1997 Mar 21 03:00/hps
Set focus to the history box (suggested by Tilmann Runck), so that
the cursor is now in the entry field of the combobox, so that the
user can immediatly begin typing the expression without clicking
into the entry field first.
1997 Mar 16 00:35/hps
Increased the precision of the final result with the I/O manipulator
setprecision(int n) to 14 (orslt << setprecision(14) << rslt << ends;).
Added the sqrt()-function, which calculates the square root (albeit
this is not really necessary, as one can use the power operator, i. e.
to calculate the third root of 8 use "8^(1/3)" which results in 2).
1997 Mar 16 00:30/hps
Corrected bug which crashed PMCalc when using any variables, was
in function isfunc, which was introduced when support for
functions was added to the parser.
1997 Mar 13 24:00/hps:
Added functions for natural and base 10 logarithm (ln and log, are
log and log10 in the standard library of ANSI-C)
1997 Mar 12 23:45/hps:
Power operator works now also for negative x (if power y is a whole
number) and if x = 0 (power y != 0).
1997 Mar 12 18:00/hps:
The icon is now displayed, after commenting WinSendMsg(...,WM_SETICON,
...) in the main() function. Thanks to Marcus Woletz who suggested
this in Maus group OS2.PROG.
1997 Mar 11 01:00/hps:
Important note: Just detected: For some reason the storing of
variables (eg. myvar=3.7) doesn't work (program is canceled by
OS/2 with illegal instruction or so) - this has worked sometimes
before - I will investigate in this tomorrow (or at a later time ;-) )
BTW: Not even the inbuild variables (e. g. "pi" are accessible - program
crashes - strange, I haven't changed anything inside this part AFAIK).
1997 Mar 11 00:45/hps
Power operator ('^') now working :-) I have had forgotten to insert
the Power-Token-Value (POWER1) into the switch()-statement in the
gettoken() function. After inserting it, it worked at once, even
in function calls like sin(3^3+3) which results in 0.5 (i. e. sin(30)).
The IBM PM-Debugger is great :-))) I found the error with the help of
it in 5 minutes :-)
1997 Mar 09 23:00/hps:
Inserted code for power (operator '^'), but it doesn't work, albeit
the rest (already implemented features) still seems to work (at least
what I have tested yet).
1997 Mar 09 14:00/hps:
Inserted an icon, but it doesn't work fully. In a program object
under OS/2 the icon is displayed but not in the system menu nor
when the program window is minimized
1997 Mar 08 23:00/hps:
Corrected bug in nested functions (function index must be saved
before calling expr() recursivly and restored afterwards)
1997 Mar 08 22:00/hps:
Compiled successfully, goniometric functions (sin, cos, tan, asin,
acos, atan) are now working correctly - even e. g. sin(asin(cos(57+3)))
results in 0.5 :-)
1997 Mar 04 22:00/hps:
Completed for compilation, 2 errors in lex.cpp (has to do with ise)
1996 Oct 10 21:00/hps
Rewrote the program and thereby eliminating the global variables. Program
not finished (doesn't compile because of errors).
1996 Oct 08 20:00/hps
Added support for goniometric functions (sin, cos, tan, asin, acos,
atan). Does not work always correct.
1996 even later/hps/Win:
Decided to make also a DOS and a Windows version. The windows version
didn't calculate correctly, albeit it uses the same code as the
DOS-version which seems to work. Decided to first rewrite the parser
to implement goniometric functions and powers before struggling further
with the DOS-/Windows-versions (the Windows interface is working quite
good, also it required subclassing of the entry field of the combo box,
which was not necessary in the PM). The Microsoft compiler seems to
have some drawbacks compared to the IBM compiler - but as it is standard
under DOS/Windows I prefer it over IBM Visual Age for Windows.
1996 at a later time/hps/OS/2:
Decided to make it a Presentation Manager Program and add support
for an expression history via a combobox.
1996 somewhere/hps:
Started project by experimenting with Bjarne Stroustrups simple Parser
from the Book "The C++ Programming language" |
hobbes.nmsu.edu/download/pub/os2/apps/calc/coca.zip | local copy |
This work is licensed under a Creative Commons Attribution 4.0 International License.
Add new comment