### Install EMSDK for Other Systems
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/epsilon_simulators/web/README.md
Make the setup script executable and then run it for first-time EMSDK setup on non-Windows systems.
```bash
chmod +x setup_web.sh & ./setup_web.sh
```
--------------------------------
### Epsilon First-Time Setup
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/epsilon_simulators/web/README.md
Execute Epsilon's setup script from the project root if it hasn't been done already.
```bash
chmod +x build/setup.sh & build/setup.sh
```
--------------------------------
### Install EMSDK for Windows
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/epsilon_simulators/web/README.md
Run this PowerShell script for the first-time setup of EMSDK on Windows.
```powershell
./setup_web.ps1
```
--------------------------------
### Install Epsilon SDK
Source: https://github.com/numworks/epsilon/blob/master/epsilon/docs/build/README.md
Set up the necessary tools and environment for building Epsilon. This script should be run in a compatible terminal.
```shell
chmod +x tools/setup.sh && tools/setup.sh
```
--------------------------------
### Install FreeBSD Packages
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Installs GNU make, libiconv, and optionally Fox-16 for FreeBSD. Required when building from source on FreeBSD.
```bash
pkg_add -r gmake libiconv fox16
```
--------------------------------
### Build and Install App on Device
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/README.md
Builds and installs the specified external app (e.g., 'sample_cpp') onto a connected NumWorks calculator. Ensure the calculator is connected and on the 'CALCULATOR IS CONNECTED' screen.
```shell
make -C sample_cpp PLATFORM=device run
```
--------------------------------
### Install Autotools on FreeBSD
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Installs Autotools on FreeBSD, necessary when cloning the HIDAPI source directly from the git repository.
```bash
pkg_add -r autotools
```
--------------------------------
### Install Fox-Toolkit on Mac (Ports)
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Installs Fox-Toolkit using MacPorts, suitable for building the Test GUI for personal use on your own computer.
```bash
sudo port install fox
```
--------------------------------
### Creating a Reusable Library with Haussmann
Source: https://github.com/numworks/epsilon/blob/master/haussmann/README.md
This example demonstrates setting up a reusable library structure using Haussmann. It includes defining source files, tests, and importing modules.
```makefile
SomeLib
├── src
│ ├── core.c
│ ├── dangerous.c
│ └── safe.c
├── test
│ ├── haussmann
│ └── SomeOtherLib
├── Makefile
│ └── Define PATH_haussmann, DEBUG, PLATFORM, OUTPUT_ROOT...
│ include haussmann/Makefile
│ $(call import_module,some_lib,.)
│ $(call import_module,some_other_lib,SomeOtherLib)
│ $(call create_goal,test_runner,some_lib some_other_lib)
└── module.mak
└── $(call create_module,some_lib,2, \
src/core.c \
src/dangerous.c:+unsafe \
src/safe.c:-unsafe \
)
```
--------------------------------
### Build and Copy Simulator Files
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/epsilon_simulators/windows/README.md
Build the epsilon simulator for Windows and copy the necessary executable and library files to the specified directory. This is typically done after the initial setup.
```bash
make PLATFORM=windows epsilon.exe
cp output/release/windows/epsilon.exe output/release/windows/libepsilon.a external_apps/epsilon_simulators/windows/
```
--------------------------------
### Install Linux Development Packages
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Installs necessary development packages for libudev and libusb on Debian/Ubuntu systems. Optionally includes Fox-toolkit for the test GUI.
```bash
sudo apt-get install libudev-dev libusb-1.0-0-dev libfox-1.6-dev
```
--------------------------------
### Build Fox-Toolkit from Source
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Builds and installs Fox-Toolkit from source, necessary for creating redistributable Test GUI app bundles on Mac due to X11 library compatibility issues with ports.
```bash
./configure && make && make install
```
--------------------------------
### Cursor Selection Example
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/layout.md
Illustrates a cursor selection within a Rack, defined by a range between two indexes.
```text
Rack
├─ FractionLayout
│ ├─ Rack
│ │ ├─ '3'
│ │ ├──> cursor selection in this rack between index 1 ...
│ │ ├─ '+'
│ │ ├─ '4'
│ │ └──> ... and index 4
│ └─ Rack
│ └─ '5'
├─ '*'
└─ '2'
```
--------------------------------
### Layout Cursor Example
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/layout.md
Demonstrates the position of a layout cursor within a Rack, indicating the index of the child to the right of the cursor.
```text
Rack
├─ FractionLayout
│ ├─ Rack
│ │ ├─ '3'
│ │ ├─ '+'
│ │ ├──> cursor in this rack at index 2
│ │ └─ '4'
│ └─ Rack
│ └─ '5'
├─ '*'
└─ '2'
```
--------------------------------
### Build HIDAPI Test GUI (Manual)
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Builds the HIDAPI Test GUI using manual Makefiles. This is an example of how to build the Test GUI when embedding HIDAPI.
```bash
cd testgui/
make -f Makefile-manual
```
--------------------------------
### Install Autotools on Linux
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Installs Autotools on Debian/Ubuntu systems, required when cloning the HIDAPI source directly from the git repository.
```bash
sudo apt-get install autotools-dev autoconf automake libtool
```
--------------------------------
### Install npm Package Manager
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/README.md
Install the 'nwlink' npm package globally. This is a prerequisite for building and managing external applications.
```shell
npm install -g nwlink
```
--------------------------------
### Layout Tree Structure Example
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/layout.md
Illustrates the representation of a mathematical layout as a tree structure of Racks and Layouts.
```text
Rack
├─ FractionLayout
│ ├─ Rack
│ │ ├─ '3'
│ │ ├─ '+'
│ │ └─ '4'
│ └─ Rack
│ └─ '5'
├─ '*'
└─ '2'
```
--------------------------------
### Build Instructions for yuv2rgb Library
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/video/yuv2rgb/README.md
Follow these steps to compile the yuv2rgb library and its test program. Ensure you have CMake installed.
```bash
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
```
--------------------------------
### Building an Application with Haussmann Modules
Source: https://github.com/numworks/epsilon/blob/master/haussmann/README.md
This example shows how to structure an application that utilizes a reusable library and other private modules with Haussmann. It defines dependencies and the main application goal.
```makefile
SomeApp
├── haussmann
├── sources
│ ├── external
│ │ └── SomeLib
│ ├── FirstModule
│ └── SecondModule
└── Makefile
└── Define PATH_haussmann, DEBUG, PLATFORM, OUTPUT_ROOT
include haussmann/Makefile
$(call import_module,some_lib,sources/external/SomeLib)
$(call import_module,first_module,sources/FirstModule)
$(call import_module,second_module,sources/SecondModule)
$(call create_goal,app,some_lib.unsafe first_module second_module)
```
--------------------------------
### Projection Example: Degrees to Radians
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/simplification.md
Illustrates the projection of trigonometric and other functions when converting from degrees to radians.
```math
trig(x*π/180,0)+(-1)*y+z+(-1)*floor(z)+π/2-atan(x)
```
--------------------------------
### TreeStack Log Output Example
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/tree.md
An example of the XML output generated by the TreeStack's log method, showing the hierarchical structure of trees and their associated references.
```xml
```
--------------------------------
### Build Libusb for Cross-Compilation
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Configure, build, and install libusb for cross-compilation. Ensure the HOST and STAGING environment variables are set appropriately for your target system.
```bash
./configure --host=$HOST --prefix=$STAGING
make
make install
```
--------------------------------
### VerticalOffset layout example
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/layout.md
Demonstrates the structure of a VerticalOffsetLayout within a Rack, showing its anchor and how it's positioned relative to it. The isSubScript and isPrefix flags control its placement.
```plaintext
Rack
├─ '2'
├─ '+'
├─ '3' ──> anchor of the vertical offset layout
└─ VerticalOffsetLayout(isSubscript: false, isPrefix: false)
└─ Rack
└─ '5'
```
--------------------------------
### Build Distributable App File
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/README.md
Builds the 'app.nwa' file for the specified external app (e.g., 'sample_cpp'), which can then be distributed and installed on other calculators via the NumWorks online uploader.
```shell
make -C sample_cpp PLATFORM=device build
```
--------------------------------
### Clone Epsilon Repository
Source: https://github.com/numworks/epsilon/blob/master/epsilon/docs/build/README.md
Retrieve the Epsilon source code from GitHub using Git. Navigate into the cloned directory to proceed with setup.
```shell
git clone https://github.com/numworks/epsilon.git
cd epsilon
```
--------------------------------
### Build HIDAPI Shared Library (Autotools)
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Builds HIDAPI as a shared library on Unix-like systems using Autotools. This is the recommended method for system-wide installation.
```bash
./bootstrap
./configure
make
make install <----- as root, or using sudo
```
--------------------------------
### Example Metrics Output
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/tree.md
When `POINCARE_METRICS=1` is enabled, the `METRICS` macro outputs detailed statistics for monitored functions, including `nextNode()` and `nextNodeInTreeStack` counts, and execution time in microseconds.
```text
Metrics [exception_run(ion_main_inner, testFilter, fromFilter, untilFilter)]
nextNode: 440191178
nextNodeInTreeStack:324743180
microseconds: 4560989
```
--------------------------------
### Projection in Advanced Reduction: atan to asin
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/simplification.md
Example of projecting atan(A) to asin(A / sqrt(A^2 + 1)) during advanced reduction to enable further simplifications.
```math
asin(A / sqrt(A^2 + 1))
```
--------------------------------
### Build HIDAPI for Cross-Compilation
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Configure and build HIDAPI for cross-compilation. This requires setting PKG_CONFIG environment variables to point to the staging directory where libusb and libudev were installed.
```bash
PKG_CONFIG_DIR= \
PKG_CONFIG_LIBDIR=$STAGING/lib/pkgconfig:$STAGING/share/pkgconfig \
PKG_CONFIG_SYSROOT_DIR=$STAGING \
./configure --host=$HOST --prefix=$STAGING
```
--------------------------------
### Build Libudev for Cross-Compilation
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Configure, build, and install libudev for cross-compilation, disabling specific features like gudev and introspection. Ensure the HOST and STAGING environment variables are set.
```bash
./configure --disable-gudev --disable-introspection --disable-hwdb \
--host=$HOST --prefix=$STAGING
make
make install
```
--------------------------------
### Read Slot Info with dfu-util
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/device/README.md
Use dfu-util to read the first 16 bytes of sRAM to determine the active firmware slot and kernel information. This command requires the dfu-util tool to be installed.
```bash
dfu-util -a 1 -s 0x20000000:16:force -U slot_info.bin
```
--------------------------------
### Get First Child Node
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/tree.md
Retrieve the first child of a tree node using `tree->nextNode()`. This is useful for starting iteration over children.
```cpp
Tree * firstChild = tree->nextNode();
```
--------------------------------
### Run Epsilon on Simulator
Source: https://github.com/numworks/epsilon/blob/master/epsilon/docs/build/README.md
Build and run the Epsilon firmware on your computer's simulator. Use 'make -j8' for parallel builds.
```shell
make PLATFORM=simulator clean
make -j8 PLATFORM=simulator epsilon.app.run
```
--------------------------------
### Build and Copy Linux Simulator
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/epsilon_simulators/linux/README.md
Build the epsilon simulator for the Linux platform and copy the binary to the designated directory.
```bash
make PLATFORM=linux epsilon.bin
cp output/release/linux/epsilon.bin external_apps/epsilon_simulators/linux/
```
--------------------------------
### Build and Copy Web Simulator
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/epsilon_simulators/web/README.md
Build the Epsilon web simulator and copy the output to the specified directory. Ensure the EMSDK environment variable is set.
```bash
make PLATFORM=web WEB_EXTERNAL_APPS=1 epsilon.html
cp output/release/web/epsilon.html external_apps/epsilon_simulators/web/
```
--------------------------------
### HIDAPI Sample Program
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
This C code demonstrates basic HIDAPI functionality, including initialization, device opening, reading strings, sending commands, and reading data. Error checking is omitted for brevity. Ensure hidapi.h is included and the library is linked.
```c
#ifdef WIN32
#include
#endif
#include
#include
#include "hidapi.h"
#define MAX_STR 255
int main(int argc, char* argv[])
{
int res;
unsigned char buf[65];
wchar_t wstr[MAX_STR];
hid_device *handle;
int i;
// Initialize the hidapi library
res = hid_init();
// Open the device using the VID, PID,
// and optionally the Serial number.
handle = hid_open(0x4d8, 0x3f, NULL);
// Read the Manufacturer String
res = hid_get_manufacturer_string(handle, wstr, MAX_STR);
wprintf(L"Manufacturer String: %s\n", wstr);
// Read the Product String
res = hid_get_product_string(handle, wstr, MAX_STR);
wprintf(L"Product String: %s\n", wstr);
// Read the Serial Number String
res = hid_get_serial_number_string(handle, wstr, MAX_STR);
wprintf(L"Serial Number String: (%d) %s\n", wstr[0], wstr);
// Read Indexed String 1
res = hid_get_indexed_string(handle, 1, wstr, MAX_STR);
wprintf(L"Indexed String 1: %s\n", wstr);
// Toggle LED (cmd 0x80). The first byte is the report number (0x0).
buf[0] = 0x0;
buf[1] = 0x80;
res = hid_write(handle, buf, 65);
// Request state (cmd 0x81). The first byte is the report number (0x0).
buf[0] = 0x0;
buf[1] = 0x81;
res = hid_write(handle, buf, 65);
// Read requested state
res = hid_read(handle, buf, 65);
// Print out the returned buffer.
for (i = 0; i < 4; i++)
printf("buf[%d]: %d\n", i, buf[i]);
// Finalize the hidapi library
res = hid_exit();
return 0;
}
```
--------------------------------
### Build and Copy Epsilon Simulator
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/epsilon_simulators/macos/README.md
Build the Epsilon simulator for MacOS and copy the application to the designated external applications directory.
```bash
make PLATFORM=macos epsilon.app
cp -r output/release/macos/epsilon.app external_apps/epsilon_simulators/macos/
```
--------------------------------
### Build and Run App on Web Simulator
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/README.md
Builds and runs the specified external app (e.g., 'sample_cpp') on the web Epsilon simulator. This requires the web simulator server to be running in a separate shell and the EMSDK environment to be activated.
```shell
make -C sample_cpp PLATFORM=web run
```
--------------------------------
### Run App on Native Simulator
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/README.md
Builds and runs the specified external app (e.g., 'sample_cpp') on a native Epsilon simulator (Linux, macOS, Windows). The simulator will open directly with the app loaded.
```shell
make -C sample_cpp PLATFORM=simulator run
```
--------------------------------
### Projection in Advanced Reduction: arcosh to ln
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/simplification.md
Example of projecting arcosh(A) to ln(A + sqrt(A^2 - 1)) during advanced reduction.
```math
ln(A + sqrt(A^2 - 1))
```
--------------------------------
### Documenting Build Targets with Haussmann
Source: https://github.com/numworks/epsilon/blob/master/haussmann/README.md
Use these functions to automatically add build targets and their descriptions to `make help`. Ensure the target name and description are provided.
```makefile
$(call document_extension,exe,A windows executable)
```
```makefile
$(call document_other_target,format,Format modified .cpp and .py files)
```
--------------------------------
### Use KTree Constructor for Single Node
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/tree.md
Use a KTree constructor without parentheses if only the node itself is needed, for example, to clone it.
```cpp
KCos->cloneNode(); // equivalent to SharedTreeStack->pushCos()
```
--------------------------------
### Build HIDAPI Test GUI (Windows Visual Studio)
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Builds the HIDAPI Test GUI on Windows using Visual Studio. Open and build the .sln file located in the testgui/ directory.
```csharp
Build the .sln file in the testgui/ directory.
```
--------------------------------
### Restore Symlinks on Windows (Msys2)
Source: https://github.com/numworks/epsilon/blob/master/epsilon/docs/build/README.md
On Windows using Msys2, run this command to restore necessary symbolic links after SDK setup.
```shell
chmod +x tools/restore_symlinks.sh && tools/restore_symlinks.sh
```
--------------------------------
### Launch Web Simulator Server
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/README.md
Launches a local server required for the web simulator. This command should be run in a separate shell before building and running the app on the web simulator.
```shell
make -C sample_cpp server
```
--------------------------------
### Get Next Sibling Node
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/tree.md
Iterate to the next sibling node using `firstChild->nextTree()`. This method is used after obtaining the first child.
```cpp
Tree * secondChild = firstChild->nextTree();
```
--------------------------------
### Get References from Event Data
Source: https://github.com/numworks/epsilon/blob/master/epsilon/build/poincare_visualization/visualization.html
Extracts reference elements from a given event data node. This is a helper function for processing event references.
```javascript
function references(data) {
return data.firstElementChild.children
}
```
--------------------------------
### RGB24 to YUV420p Conversion Test
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/video/yuv2rgb/README.md
Execute the test program for RGB24 to YUV420p conversion. Provide the input PPM file and an output filename template.
```bash
./test_yuv_rgb yuv2rgb image.ppm image
```
--------------------------------
### Debug App on Native Simulator
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/README.md
Builds and prepares the specified external app (e.g., 'sample_cpp') for debugging on a native Epsilon simulator using GDB or LLDB.
```shell
make -C sample_cpp PLATFORM=simulator debug
```
--------------------------------
### Configure SDL for Static Linking
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/README.md
Run the configure script in the SDL sources with the --disable-shared flag to prepare for static linking. Copy generated files to the ion/src/simulator/external/Makefile directory.
```bash
./configure --disable-shared
```
--------------------------------
### Add Embedded ARM Rust Target
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/sample_rust/README.md
Installs the necessary Rust toolchain target for embedded ARM development, required for building applications for the NumWorks calculator.
```shell
rustup target add thumbv7em-none-eabihf
```
--------------------------------
### Setup SVG Container for Visualization
Source: https://github.com/numworks/epsilon/blob/master/epsilon/build/struct_layout/visualization.html
Appends an SVG element to the DOM and configures its dimensions and styles. It also sets up a group element for the main chart area.
```javascript
var svg = d3.select("#chart").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.bottom + margin.top)
.style("margin-left", -margin.left + "px")
.style("margin.right", -margin.right + "px")
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.style("shape-rendering", "crispEdges");
```
--------------------------------
### Empty rack display
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/layout.md
An empty rack is displayed as a yellow square unless the cursor is active within it. This example shows a FractionLayout with an empty rack as its denominator.
```plaintext
# Tree of
# 2
# ---
# Ø
FractionLayout
├─ Rack
│ └─ '2'
└─ Rack (EMPTY)
└──> if cursor is not here, display rack as a yellow square
```
--------------------------------
### Build HIDAPI DLL (Windows Visual Studio)
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Builds the HIDAPI DLL on Windows using Visual Studio. Open and build the .sln file located in the windows/ directory.
```csharp
Build the .sln file in the windows/ directory.
```
--------------------------------
### Approximation Entry Points
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/approximation.md
These are the main entry points for the Approximation API. They take an input Tree, Parameters, and an optional Context to return the approximated input under the requested dimension.
```APIDOC
## Approximation Methods
These methods approximate an input `Tree` using provided `Parameters` and an optional `Context`.
### `ToTree(const Tree *, Parameters, Context)`
Returns the approximated input as a `Tree`.
### `To(const Tree *, Parameters, Context)`
Returns the approximated input as a `double` or `float`. This method is overloaded to accept an abscissa value, which replaces `Var0` in the approximation.
### `ToComplex(const Tree *, Parameters, Context)`
Returns the approximated input as a `std::complex`.
### `ToPointOrRealScalar(const Tree *, Parameters, Context)`
Returns the approximated input as a `PointOrRealScalar`. This method is overloaded to accept an abscissa value.
### `ToPoint(const Tree *, Parameters, Context)`
Returns the approximated input as a `Point`.
### `ToBoolean(const Tree *, Parameters, Context)`
Returns the approximated input as an `Approximation::BooleanOrUndefined` value.
```
--------------------------------
### Create Executable Goal with create_goal
Source: https://github.com/numworks/epsilon/blob/master/haussmann/README.md
Use the `create_goal` function to define an executable target, specifying its name, modules, an optional subdirectory, and a description. The target can be built using `make .`.
```makefile
$(call create_goal,demo, \
database \
gui \
render \
,, \
A simple demo of the app
)
```
--------------------------------
### YUV420p to RGB24 Conversion Test
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/video/yuv2rgb/README.md
Execute the test program for YUV420p to RGB24 conversion. Provide the input YUV file, width, height, and an output filename template. The program will generate multiple output files (e.g., output_sse.ppm).
```bash
./test_yuv_rgb yuv2rgb image.yuv 4096 2160 image
```
--------------------------------
### Build Rust App with Cargo
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/sample_rust/README.md
Compiles the Rust application using Cargo, the Rust build system and package manager. This command will also download and install the nwlink SDK.
```shell
cargo build
```
--------------------------------
### Build HIDAPI Manual (Linux)
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/README.txt
Builds HIDAPI using manual Makefiles on Linux. This method is primarily for understanding the build process for embedding HIDAPI directly into an application.
```bash
cd linux/
make -f Makefile-manual
```
--------------------------------
### Copy SDL Source Files
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/README.md
Copy the SDL source and include directories into the Epsilon project. Also, copy SDL Android Java code to the simulator/android directory.
```bash
cp -r sources/SDL/src epsilon/ion/src/simulator/external/sdl
```
```bash
cp -r sources/SDL/include epsilon/ion/src/simulator/external/sdl
```
```bash
cp -r sources/SDL/android-project/app/src/main/java/org/libsdl/app epsilon/ion/src/simulator/android/src/java/org
```
--------------------------------
### Grandparent Element Setup
Source: https://github.com/numworks/epsilon/blob/master/epsilon/build/struct_layout/visualization.html
Appends a 'grandparent' group to the SVG, which is used for displaying the root node's information and handling clicks for transitions. It includes a background rectangle and a text element.
```javascript
var grandparent = svg.append("g")
.attr("class", "grandparent");
grandparent.append("rect")
.attr("y", -margin.top)
.attr("width", width)
.attr("height", margin.top);
grandparent.append("text")
.attr("x", 6)
.attr("y", 6 - margin.top)
.attr("dy", ".75em");
```
--------------------------------
### Use Rack and Layout Pointers
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/style_guide.md
Use specific pointer types like `Rack*` and `Layout*` to clearly distinguish between different node types and improve code clarity.
```cpp
void moveCursorAt(Rack * rack, int index) {
Layout * layout = rack->child(index);
...
```
--------------------------------
### Wrap Global Variables in GlobalBox in C++
Source: https://github.com/numworks/epsilon/blob/master/epsilon/build/tidy/RULES.md
Non-constant global variables must be wrapped in OMG::GlobalBox to allow for state resetting. This example shows initialization, shutdown, and method access.
```c++
class MyObject {
public:
void myMethod();
}
OMG::GlobalBox Foo;
Foo.init();
Foo.shutdown();
Foo->myMethod();
```
--------------------------------
### Get Specific Child Node by Index
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/tree.md
Access a specific child node by its index using `tree->child(n)`. Ensure the index `n` is within the valid range of children.
```cpp
Tree * childN = tree->child(n);
```
--------------------------------
### Get Tree Node Dimension
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/tree.md
Use `Dimension::Get(tree)` to determine the dimension of an expression (scalar, matrix, boolean, point, or unit). `Dimension::ListLength(tree)` can check the size of a list of dimensions.
```cpp
Dimension::Get(tree)
```
--------------------------------
### Run Rust App on Calculator
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/sample_rust/README.md
Builds and deploys the Rust application to the NumWorks calculator using the DFU protocol over USB. Ensure the calculator is connected and on the 'CALCULATOR IS CONNECTED' screen.
```shell
cargo run
```
--------------------------------
### Visualize Specific Scenario Evolution
Source: https://github.com/numworks/epsilon/blob/master/epsilon/build/poincare_visualization/README.md
Execute this command to visualize the Poincaré treestack evolution for a particular scenario. Specify the scenario file using the SCENARIO argument.
```bash
make SCENARIO=tests/calculation/calculation_addition.nws poincare_log_visualization
```
--------------------------------
### Build Target for Specific Slot (N0120)
Source: https://github.com/numworks/epsilon/blob/master/epsilon/docs/build/README.md
Build the userland firmware for a specific slot (e.g., Slot B) on the N0120 model. This is part of the manual flashing process.
```shell
make -j8 PLATFORM=n0120 userland.B.dfu
```
--------------------------------
### Creating a Tree with Pattern Matching
Source: https://github.com/numworks/epsilon/blob/master/poincare/doc/tree.md
Use `PatternMatching::Create` to build a tree from a pattern and a context. This method safely clones placeholders from the context into the resulting tree, ensuring validity.
```cpp
Tree * expr3 = PatternMatching::Create(KAdd(1_e, KA), {.KA = expr2});
```
--------------------------------
### Compare Epsilon Python with MicroPython
Source: https://github.com/numworks/epsilon/blob/master/epsilon/python/upgrade.md
Use this command to compare the current Epsilon Python files with the MicroPython project files to identify differences or patches.
```bash
git diff Path/to/epsilon/py Path/to/micropython/py
```
--------------------------------
### Activate EMSDK Environment (Linux/macOS)
Source: https://github.com/numworks/epsilon/blob/master/epsilon/external_apps/README.md
Activates the Emscripten SDK environment on Linux or macOS using the source command. This is necessary before building and running apps for the web simulator.
```shell
source emsdk/emsdk_env.sh
```
--------------------------------
### Tagging and Archiving HIDAPI Release
Source: https://github.com/numworks/epsilon/blob/master/shared/ion/src/simulator/external/sdl/src/hidapi/HACKING.txt
Use these commands to set the version, tag the release, and create a zip archive for distribution.
```bash
export VERSION=0.1.0
export TAG_NAME=hidapi-$VERSION
git tag $TAG_NAME
git archive --format zip --prefix $TAG_NAME/ $TAG_NAME >../$TAG_NAME.zip
```
--------------------------------
### Flash Firmware to Specific Slot (N0120, Slot A)
Source: https://github.com/numworks/epsilon/blob/master/epsilon/docs/build/README.md
Manually flash the built firmware for Slot A on an N0120 model and leave the flashing tool. Requires the DFU file path.
```shell
python3 tools/device/dfu.py -s 0x90010000:leave -D output/release/n0120/userland.A.dfu
```