Store files and objects as BMP files.
Recall BMP files as graphical objects.
Also adjust `Show` to not add a border to input graphical objects.
Fixes: #867
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `Clone` command creates a clone of the object on top of stack.
This is useful for example to be able to garbage-collect an object
that the subobject was extracted from.
The hardest part was to actually come up with a test that reliably
shows the memory being saved.
Fixes: #871
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
`Increment` increments a variable and returns its value.
`Decrement` decrements a variable and returns its value.
Fixes: #872
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
We need to ignore a few additional rows of pixels at the top,
otherwise the test images depend on the month name, e.g. "April",
which has a descender for "p", modifies pixesl at the top.
Fixes: #873
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement `Sto+`, `Sto-`, `Sto*` and `Sto/` like on the HP48.
Implmeent `Rcl+`, `Rcl-`, `Rcl*` and `Rcl/` like on the HP42
(even if for RPL, there is not much to gain compared to separate
operation)
Fixes: #866
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
For equations, it's often the case that they render horizontally.
Have `Show` automatically switch between horizontal and vertical mode.
The `MaxW` value has been increased to 1280 to match this new
behaviour, and the `MaxH` value has been decreased to 1280 because a
1280x1280 bitmap is already about 204K, so it is unlikely to work well
in the DM32 memory constraints.
Fixes: #869
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add a word wrapping in the editor at a position defined by
`EditorWrapColumn`. This makes editing of moderately large programs
more practical.
Fixes: #870
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The vertical rendering mode renders one RPL instruction per line while
editing. This makes the program look a bit more like RPN programs.
Fixes: #868
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `SetBit` command sets a bit in the value,
e.g. `2 4 SETBIT` is `18`
The `ClearBit` command clears a bit in the value,
e.g. `16#2A 3 CLEARBIT` is `16#22`.
the `FlipBit` command flips a bit in the value,
e.g. `3 18 FLIPBIT` is `262147`.
Fixes: #850
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
For all commands, put the arity check in the top-level evaluator.
This factors out all that code in a single (source-code) location.
This also makes it possible to use arity reliably during parsing of
expressions, and fixes a number of cases where it wqas set wrong, like
for the `det` command and many others.
Finally, it fixes missing calls to `rt.args` for a number of commands,
while explicitly removing it (`nargs < 0`) for a few cases where it
was harful, like `LastArgs` or `Undo`.
Fixes: #865
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The project now supports the DM32 just as well as the DM42, so it's better to
not have the DM42 so prominently in the title.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
In an expression, parse `Foo(1;2;3;4)` as a function call invoking
`Foo` with arguments `1 2 3 4`.
Fixes: #863
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Move `nand`, `nor`, `implies`, `equiv` and `excludes` to the two-bytes
section of identifiers.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add calls to `program::interrupted()` to make sure we can interrupt a
running sum or product function.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Instead of only emitting the `Unterminated` error message for the
outermost expression, emit it for the innermost unterminated
expression, which gives a much better sub-range for the editor.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add "real" n-ary functions for `sum` and `product`.
Note that the HP50G does symbolic pre-computation for sums, with the
interesting side effect that it may give "strange" results for empty
sums. For example, `I 10 1 'I^3' Σ` gives `-2024`, which is a bit
suprising.
The rationale, I believe, is that `I A B 'I^3' Σ` is first simplified
as `'(B^2+2*B^3+B^4-A^2+2*A^3-A^4)/4'`, which gives the negative
result when `A>B`.
This behaviour is not replicated in DB48X, which follows the HP48
model, where a sum between 10 and 1 returns 0, not a negative value.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Render `comb` and `perm` using the traditional mathematical notation.
Note that this is different from the way the HP48 and HP50G do it:
- The HP48 gives an `Undefined name` error for `N M COMB`
- The HP50 expands this to a factorial-based expression.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Remove the `DataMenu`.
Replace `PrintMenu` with `ListMenu` as keyboard-accessible menu
(we can tuck the rarely used `PrintMenu` under `I/O`)
Add list product, sum, etc to `ListMenu`
Modify `ProgramMenu` to add special program entry characters.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
For some reason, I used the `Sum` (`Σ`) and `Product` (`∏`) commands
for list sums and products. This is not the way the HP48/HP50 do it,
so it's better to have dedicated `ΣList` and `∏List` commands.
Also implemented the missing `∆List` command and added the missing
related tests for all these commands.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Use a smaller font for the argument of these functions.
Also add tests for `sqrt`, `cbrt` and `xroot`
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This release is mostly about bug fixes, improving the build on
simulator, and accelerating the test suite while keeping it stable.
** New features **
* simulator: Add F8 key to save state in the simulator
* errors: Add a beep when an error is shown
* linux: Add `-s` option for screen scaling (when Qt gets scaling wrong)
* equations: Get library equation value for plotter, solver and integrator
* characters: Add constant, equation and lib markers to RPL menu
* characters: Add music-related characters and character menu
* commands: Add missing stack commands (nip, pick3, ndupn, unrot, unpick)
** Bug fixes **
* variables: Clone purged objects on stack after `Purge`
* units: unit * symbolic is preserved as is (e.g. `'A'_m`)
* compare: Enforce the `NumericalResults` flag for comparisons
* constants: Fix parsing of constants, equations and library items
* sto: Repair `file exists` error storing to a source file
* simulator: Do not try to create directory if it exists
* Report file errors, e.g. permissions or I/O errors
* equations: Mark `c` and `R` as constants in equations
* simulator: Double clicks are now considered as virtual keyboard touches
* ui: Emit only one beep, not two, for a syntax error on the command line
* ui: Avoid rare null-dereference crash when menu label is not set
* complex: Report a syntax error if the second half is empty
* utf8: Do not accept constant/equation/library codepoint in names
* units: Multiplying by `1_m` is OK even with algebraic
* tests: Avoid case where CLEAR does not clear errors
* audio: Improve audio reliability on the simulator
* linux: Rewrite the audio-generation code to avoid crashes
* linux: Avoid infinite recursion in the tests
* linux: Fix warnings about unused variables
* linux: Avoid warnings about null pointer in strcmp
* linux: Avoid build error due to bad `ularge` overload in settings
* linux: Fix type issue for the Insert function (reported as a warning)
* linux: Remove warning about mixing enums and integers
* linux: Avoid error on printf format
* linux: Avoid warnings about type qualifiers
* linux: Remove warnings about incompatible function casts
* linux: Address warnings about missing initializers
* linux: Fix warning about prinf formats
* linux: Address warning about signed vs unsigned
* linux: Remove warning about fall-through switch statement
* linux: Remove warnings about unused arguments
* tests: Repair several tests that were unstable due to scrolling images
* tests: Increase memory size to avoid occasional out of memory failures
* object: Make `as_uint32` and `as_uint64` consistent for negative input
** Improvements **
* ui: Emulate HP48/HP50G behavior for errors (do not require key to continue)
* simulator: Add I/O wrapper around file state save/restore
* dmcp: Remove double return in the code
* simulator: Accept numeric keys in DMCP menus
* doc: Add Kjell Christenson to list of authors
* tests: Run command-line tests silently
* tests: Clear settings the fast way for quick tests
* dmcp: Do not treat the buzzer as a recorder error (avoid message noise)
* simulator: Ensure error messages show up in a recorder dump
* tests: Increase memory size to avoid failing tests
* tests: Increase delay waiting for function plots to appear
* tests: Refactor test suite interaction with RPL thread to accelerate it
* tests: Add a delay before launching the test thread to load initial state
* tests: Add missing reference picture for `char-menu`
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `as_uint32()` and `as_uint64()` functions were not consistent for
all kinds of negative input. Make them return default value or
`value_error()` in all cases.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `LastArg` stack was not correctly saved for the stack operations.
Note that the behaviour of these commands is not always very
consistent across commands. Some attempts were made to replicate the
HP behaviour for commands like `Pick` or `DropN` for compatibility.
Fixes: #859
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `nip` command is equivalent to `swap drop`
It's an HP-50G only command.
Fixes: #841
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
With the new test/RPL sync, we no longer need the explicit waits.
With this, we regularly go below 300s for the whole test suite.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
It is possible for that function to be called when there is no label.
In that case, we do a null-dereference trying to check if we have a
symbol instead of a text.
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>
Add a check for `LastArgs` returning the last equation and not the
last evaluation argument for the plot function.
This fixes the problem with `plot-pgm` mismatch.
Also replace explicit wait times with uses of `LENGTHY`.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The new sync between tests and RPL theads was not working correctly in
the case of `Wait` and `Show` commands because they were popping keys
without correctly updating `last_key`.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `Lib` menu was added, which changes the default screen. This
explains the observed change in `help-exit.png`.
There was a minor change in clipping for the help that causes a
mismatch on `help-keyboard.png`.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>