Separated the demo in three sections of 30 seconds each:
- Basics of RPL and user interface (RPL, function keys, online help, catalog,
unicode, text editor)
- Mathematics (complex, vector, matrix, symbolic, based)
- Programming
Fixes: #1104
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Showing the address, type and size of RPL objects is not often useful.
It is generally sufficient to just show the object rendering.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The Qt file selector returns a null string for Cancel
In that case, don't attempt to save or load an empty file.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Fix clean build of simulator with `make sim`:
- Pass `TARGET=opt` instead of `TARGET=` when building tools
to ensure the tool gets properly built irrespective of environment
- Remove reference to obsolete Intel decimal library, which was still
hanging around in my build directories.
Fixes: #999
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
An active timer when calling `sys_sleep()` would keep bringing the
function out of the loop without calling `nanosleep`, which defeats
the purpose of that function to actually sleep.
The solution is to only take a timer into account if it triggered
while the function was running.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Reserve the main thread for display updates and keyboard interaction,
like for the Qt version. This allows the web simulator to work
correctly when you run a program or when you access the firwmare
interface.
The downside is that you need to run that on a web server that is able
to set the following [HTTP headers][coop]:
```
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
```
Unfortunately, it is not entirely clear if this can be made to work
easily with [GitHub pages][ghp].
Fixes: #994
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
[coop]: https://web.dev/articles/coop-coep
[ghp]: https://github.com/orgs/community/discussions/13309
The color used to draw firmware text was backwards.
Compute it correctly from the `inv` field (and rename it `color`).
Fixes: #995
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This is an in-tree port of [Franco Trimboli's excellent work][wasm].
The goal is to be able to run the simulator in a browser.
This builds with emscripten, as installed by the `emsdk`.
The `emsdk` is added as a submodule, and initialized on first build.
To build the browser WASM version of the simulator, run `make wasm`.
Fixes: #993
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Suggested-by: Franco Trimboli <sunpazed@gmail.com>
Co-developed-by: Franco Trimboli <sunpazed@gmail.com>
[wasm]: https://github.com/sunpazed/db48x-wasm
Enough algorithms need a separate notion of polynomials.
Devise a space-efficient representation for them.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Make it possible to run the DM42 configuration with color and the DM32
configuration in black-and-white.
Fixes: #907
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Put the object files in different locations, since they use different
configuration parameters that widely impact the generated code.
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>
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>
Split the recorders between `tests` and `tests_rpl`.
Separate the handling of commands into `process_test_commands` and
`process_test_key`, with the key handling happening before we actually
run the code.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This significantly improves the performance of tests by avoiding
delays waiting to process keys.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Use a separate channel for the communication of test commands with
the RPL thread, in order to make it simpler to deal with corner cases
such as an error being displayed.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This delay is necessary to avoid an occasional crash at startup when
running with `-Tall` and loading a large demo file.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This is a shortcut to save the current state.
Note that you can also get that with RSHIFT-EXIT.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
If two mouse clicks are issued quickly, the second one has the type
QEvent::MouseButtonDblClick. This leads to the event being ignored.
This is now fixed.
Signed-off-by: Kjell Christenson <kjell.christenson@gmail.com>
Reviewed-by: Christophe de Dinechin <christophe@dinechin.org>
The `qApp->primaryScreen()->devicePixelRatio()` method no longer
returns the correct pixel ratio at least on X11 over the network.
Add the `-s` option as a workaround to be able to auto-scale the
window for testing purpose.
It looks like gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4) thinks it's a good
idea to complain about every single zero-initialized C structure.
This is widely acknowledged as a (rather annoying)
[GCC bug](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119)
Add a constructor to silence the warning where possible.
For DMCP C structures where this is not possible, well, add ugly code.
With gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4), there is a message about
fall-through switch statements. Add comment to silence the warning when the
fall-through is intentional.
There was one case where the fall-through was not intentional.
Missing `break` added.
Fixes: #853
On Fedora 38, GCC incorrectly warns about unused arguments despite the
`__attribute__((unused)))` that should silence the warning.
Observed with gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4).
Fixes: #853
This is just to avoid setting `errno` when we are just trying to
make sure that the directory exists.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
These are two catalogs that behave much like the constants catalog,
and inherit most of the code.
The equations library is intended to store standard equations.
The library is for standard objects and various useful objects or
programs.
Both can be organized by topics.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Instead of proactively wait, add a wait loop checking for the result.
This allows the tests to run significantly faster.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Make sure that we capture consistent pixmaps, which we can do on the
RPL thread, and only defer the transfer of the pixmap to the main
thread, which is fast.
Additionally, optimize updates by doing a byte-by-byte xor comparison
in order to see which bytes actually changed. This minimizes the cost
on the RPL thread to update the pixmap.
This makes it possible to have a much better screen behaviour for the
`CBench` benchmark, where it updates it regularly on the screen while
not slowing things down too much.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add a callback to explicitly refresh the screen instead of relying on
a volatile counter indicating that the screen is dirty.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>