Projects
Choose a collection below, or start with Hello world to see a declaration alongside its output. Each example includes the files used to build it. The test suite checks the output against an expected result.
For a larger program, read A worked application: the inventory manager: a window, a command line and a database file, built for C and for Rust, with its recorded output and its 13 tests on each target. It stands beside the catalogue projects counted below.
On this page
How to read a project page#
- The recording shows the program running, from
structop applyonward. Games are played with a key script, one key per frame. Where no recording exists, the program's last screen stands in. - The .st files contain the application declarations. Some examples also include input files, layouts or data assets.
- Input, plan and generated source show what was typed, what
planprinted and the C or Rust source thatapplywrote.
Switching the catalog examples between C and Rust#
For projects using portable providers, edit only lang in intent.st and run structop apply. A GTK 2 example pairs its C implementation with StructOp/gtk-rs for Rust. The game projects pair ncurses with bracket-lib. Both backends use the same application files, input and expected output.
The catalog check ran all 209 documented projects. Of those, 195 produced the expected output on both C and Rust, including the pointer, pointer interpolation, local pointer and zlib examples; the zlib example calls a generated C library binding from either target. The other 14 passed on their declared target and use one of the following target-specific features.
| Examples | Target | Feature |
|---|---|---|
| Void pointer, native expression | C | Evaluate embedded C code |
| libc, curl, SQLite, SQLite in a function | C | Call generated C library bindings that take callbacks or a library handle, which the Rust target does not support yet |
| Pointer after despawn, pointer after remove | C | Keep a pointer into component storage or into a List while that storage changes, which the Rust target does not support yet |
| Mini crate, standard library, curl, rusqlite, flate2, rusqlite in a window | Rust | Call the generated Rust crate bindings |
The testing guide explains how to reproduce the catalog check.
Reading a dungeon screen#
The dungeon crawler draws its map with terminal characters. The random seed determines the layout.