Fix the vertical bearing of the `v` glyph so that it does not appear
to be one pixel above the others.
Also add glyphs for
* dot-product (`⋅`, U8901)
* cross-product (`⨯`, 10799)
These can be used to refer to the `CROSS` and `DOT` commands.
Fixes: #1117
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add rendering and editing of polynomials.
On the command line, a polynommial is identified by a prefix `Ⓟ`
(which displays as `[poly]` inverted).
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement polynomial euclidean division, which gives a meaning to
divide and remainder for polynomials.
Polynomial division is only well-defined with a single variable.
On HP calculators, this is configured by the `VX` variable in the
`CASDIR` directory. A similar mechanism is provided allowing the
creation of an algebraic configuration directory.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `Boxes` menu is a replication of the `Blocks` menu.
Replace it with a `Music` menu.
Add four missing music glyphs to the font.
Also add the reference file for `chars-menu.png`, which was missing.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
There was a prefix in the editor in the first iteration of the
implementation for constants. This was actually a good idea, since it
lets us distinguish if you really want a constant or a normal symbol.
One of the main benefits is that there is no namespace clash. For
example, you can again use the `g` name, since the g constant will
actually be (cst) g. This was breaking the part in the Demo that used
`g` as a value for the level of green.
Visually, added three characters that show as (cst), (eq) and (lib) in
the text editor, in order to know what kind of name we are dealing
with.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Instead of identifying a constant using a name, use an index in the
constants list, which takes less space and is more efficient at
runtime.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add character catalog when inside text.
Define character menus with various languages and shapes.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Organize the Greek characters menu so that uppercase letters are
shifted and diacritical show up above in the same menu page.
Also add some missing glyphs in Greek font.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Dynamic constants menu, similar to units menu, which is populated
either from an internal table, or from `config/constants.csv`
Fixes: #497
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add an superscript `r` for radians, and superscript `π` for
pi-radians. This commit only adds the glyphs, but changes in parsing
of units is also necessary, see next commits.
Fixes: #809
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The glyphs added in 1444a8adb6 were lost
along the way (probably by keeping the font editor open during a
bisect). Restore them.
Fixes: #712
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Created glyph for "tool", adapted from DejaVu Sans.
Added the glyph for `⇆`. It turns out that DM-32 and DM-42 have
the two arrows in different directions.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The generated font files contained an ID that could depend on the
configuration settings for the build. That caused the font file on
DM32 to be incorrect, which caused a crash when editing text.
Fixes: #458
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add the various units menus that are present on the HP50G.
The units themselves are not fully implemented yet.
Fixes: #16
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This is a very basic implementation of unit objects.
Unit objects are treated as equations where the outermost object
is an ID_mkunit operator.
Fixes: #16
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Fixes the bug where the cursor was not blinking correctly unless some other
animation was happening (bug #407).
Add a setting to adjust the cursor blink rate, `CursorBlinkRate`.
Fixes: #407
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Select the minimum number of significant digits before switching to
scientific notation in `FIX` mode.
The default value is 0, which is similar to how HP calculators
perform. For example, with `2 FIX`, the value `0.055` will display as
`0.06`, and `0.0055` will display as `0.01`.
A higher value will switch to scienfic mode to show at least the given
number of digits. For instance, with `2 FIX`, if the value is `1`,
then `0.055` will still display as `0.06` but `0.0055` will display as
`5.50E-3`. If the value is `2`, then `0.055` will display as `5.5E-2`.
In other words, setting the value to `0` emulates the behaviour of HP
calculators. Seting the value to `34` will switch to scientific
notation if not all digits can be displayed
Fixes: #412
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement a really basic algorithm for integration evaluation.
This divides the integration surface by two every time.
This appears much less efficient than the integration done by HP calculators.
Fixes: #42
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `Cycle` function is mostly intended for interactive use, mapped
on the `EEX` key.
Currently implemented cycles:
* Polar <-> Rectangular for complex numbers
* Decimal <-> Fraction
* Integer <-> Based (cycles through the bases)
* Array <-> List <-> Program
* Text <-> Symbol
Fixes: #273
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement stubs for cut, copy, paste and other editor menu commands.
That makes the editor functionally complete, but not functional.
Fixes: #381
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
All the 'last' things are directly accessible, so there is no real
need for a dedicated menu. Having the command directly accessible
makes more sense from a usability point of view.
Fixes: #396
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add an `EditMenu` which is mapped to xshift-Down.
Also update the stack menu to put `LastX` there.
Fixes: #394Fixes: #396
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
With this commit, we probably have an almost complete layout of menus
and their mapping to keyboard commands.
Several of the menus are not complete yet, but the general layout is
probably quite close to the "final product".
Fixes: #389
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Reorganize the menus and keyboard according to the following logic:
1. Match the documented keyboard layout
2. No more than 18 entries per menu
The highest impact is on the `ModesMenu`, which is now split into more
logical units.
Fixes: #389
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `LastX` implementation is not part of any RPL implementation that
I am aware of, but it is a staple of RPN. Implementing it in RPL might
make it easier to backport a few RPN programs.
Fixes: #384
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Use graphic-based rendering of stack levels (depends on setting)
This will enable more advanced rendering in the future e.g. for
equations or matrices.
Fixes: #382
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement three graphic primitives `GXor` and `GOr` (same as HP48)
and `GAnd` (specific to DB48X)
Fixes: #383
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Graphic objects (GROB in RPL parlance) represent bitsmaps of arbitrary
size. They can be used to represent the screen or any other graphic
surface.
Fixes: #30
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The tag type is used to add a label to any arbitrary object.
It is parsed as `:Label:object`, and renders the same, except on the
stack where it renders as `Label:object`.
Note that the HP48 renders a label with an extra space. The space is
apparently gone on the HP50.
Fixes: #21
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Remove the `PlotFunction`, use `FunctionPlot` for that feature (there
is no point in having two IDs, one of which was useless).
Parameterize the rendering code with the function plot type.
Implement polar by rewriting result as `y * exp(i*x)`.
Fixes: #364
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit implements comments that are preserved in the source code.
A comment begins with `@` and ends with the end of line.
It acts as a no-operation during execution.
It is rendered beginning with a new-line.
This commit also adjusts various issues related to rendering of
newlines and indentation in loops or blocks.
Fixes: #94
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add a numeric settting for evaluation, forcing evaluation to a decimal
value (much like the HP48 does, and like the numeric flag on HP50).
Set this flag transitorily while evaluating equations to implement
`->NUM` for equations.
Evaluate fractions and function arguments numerically when the flag is
set.
Fixes: #345Fixes: #346
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `Clip` command sets the clipping rectangle. It takes a list with 4 pixel
coordinates. If the list is empty, it resets the clipping rectangle to the whole
screen.
The `CurrentClip` command returns the current clipping rectangle on the stack.
Fixes: #313
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Adding a separate command that plots a function taken from the stack.
Moving forward, I am considering maintaining two parallel set of
commands for plotting:
1/ `Draw` (aka `DrawPlot`) would be the higher-level one, obeying the
semantics of RPL on HP48, i.e. fetching a function from `EQ` with
`PPAR` specifying the type of function to plot and the independent
variable.
2/ `PlotFunction` would be the lower-level one, taking its function
from the stack, and assuming the function itself takes its input
from the stack.
Fixes: #339
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Wait for a key press or a time lapse.
When the argument is greater than 0, interrupt the program for the given number
of seconds, which can be fractional.
When the argument is 0 or negative, wait indefinitely until a key is
pressed. The key code for the key that was pressed will be pushed in the
stack. If the argument is negative, the current menu will be displayed on the
screen during the wait.
Fixes: #324
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `drax` command (also spelled `DrawAxes`) is used to draw the axes
for the plot according to the values in `ppar` (or `PlotParameters`).
Fixes: #321
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add `line` command to draw a line
Add `foreground` and `bacground` commands to set patterns
Add `LineWidth` command to set line width
Fixes: #311Fixes: #312
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>