diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..066be0f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + name: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: Install Linux GUI dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev + - uses: Swatinem/rust-cache@v2 + - run: cargo build --workspace --release + - run: cargo test --workspace + - run: cargo clippy --workspace --all-targets -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index c7bad59..b5d592a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,136 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "accesskit" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e883d1d28c5fd5568c79ed2d2bd48d9f2fd3945c8974ed0f53690ceddb051be" +dependencies = [ + "enumn", + "serde", + "uuid", +] + +[[package]] +name = "accesskit_atspi_common" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24f5baf62e34a4a6c30e3d697e4782f821a7337049c44c3b40576a27dfbb580d" +dependencies = [ + "accesskit", + "accesskit_consumer", + "atspi-common", + "phf 0.14.0", + "serde", + "zvariant", +] + +[[package]] +name = "accesskit_consumer" +version = "0.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3da8f27636015191b2264ee1df681503170a632cafd832fdc1edfdd4e3a2fd3" +dependencies = [ + "accesskit", + "hashbrown 0.17.1", +] + +[[package]] +name = "accesskit_ios" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5280724673bbfa8b30a838c013500b719392989be3b97c5a9964062c252c232" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", +] + +[[package]] +name = "accesskit_macos" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "123828ceeec755b05255e3976cb0852993202de98a0626c97dd8d34246991f84" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "accesskit_unix" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5192871228c54f1b0fb4a85cef000e11a3804f25d2165f14afa0daa67f3f6" +dependencies = [ + "accesskit", + "accesskit_atspi_common", + "async-channel", + "async-executor", + "async-task", + "atspi", + "futures-lite", + "futures-util", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_windows" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498668b90da9995302a0055aaecad4756932333da2ddef6baee1c00844c430fc" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "static_assertions", + "windows", + "windows-core", +] + +[[package]] +name = "accesskit_winit" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd4ab4437b520ff03088fbe48676a11e7d44a929535e64b31432c1073e48dbcc" +dependencies = [ + "accesskit", + "accesskit_ios", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "raw-window-handle", + "winit", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "serde", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.5" @@ -17,6 +147,40 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.6.21" @@ -53,7 +217,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -64,7 +228,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -82,6 +246,179 @@ dependencies = [ "num-traits", ] +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "wl-clipboard-rs", + "x11rb", +] + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.5", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.5", +] + +[[package]] +name = "async-recursion" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.5", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "atomic" version = "0.6.1" @@ -91,6 +428,49 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atspi" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d" +dependencies = [ + "atspi-common", + "atspi-proxies", +] + +[[package]] +name = "atspi-common" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d" +dependencies = [ + "enumflags2", + "serde", + "static_assertions", + "zbus", + "zbus-lockstep", + "zbus-lockstep-macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "atspi-proxies" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc" +dependencies = [ + "atspi-common", + "serde", + "zbus", +] + [[package]] name = "autocfg" version = "1.5.1" @@ -107,18 +487,44 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" name = "bench51" version = "0.1.0" dependencies = [ + "bench51-core", "clap", "ratatui", "ratatui-textarea", ] +[[package]] +name = "bench51-core" +version = "0.1.0" + +[[package]] +name = "bench51-gui" +version = "0.1.0" +dependencies = [ + "bench51-core", + "clap", + "eframe", + "egui_tiles", + "rfd", + "serde", +] + [[package]] name = "bit-set" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" dependencies = [ - "bit-vec", + "bit-vec 0.6.3", +] + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec 0.9.1", ] [[package]] @@ -127,6 +533,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + [[package]] name = "bitflags" version = "1.3.2" @@ -138,6 +550,9 @@ name = "bitflags" version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] [[package]] name = "block-buffer" @@ -148,6 +563,37 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.3", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.5", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + [[package]] name = "bumpalo" version = "3.20.3" @@ -165,31 +611,109 @@ name = "bytemuck" version = "1.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" - -[[package]] -name = "castaway" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" dependencies = [ - "rustversion", + "bytemuck_derive", ] [[package]] -name = "cc" -version = "1.9.0" +name = "bytemuck_derive" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877bf67ac8e52449eb2f9e98a344ea163beb70dd1f9eebe3cc5357dcfeaee4df" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" dependencies = [ - "find-msvc-tools", - "shlex", + "proc-macro2", + "quote", + "syn 3.0.9", ] [[package]] -name = "cfg-if" -version = "1.0.5" +name = "byteorder-lite" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.5", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop 0.13.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.5", + "rustix 1.1.5", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877bf67ac8e52449eb2f9e98a344ea163beb70dd1f9eebe3cc5357dcfeaee4df" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] name = "cfg_aliases" @@ -197,6 +721,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + [[package]] name = "clap" version = "4.5.54" @@ -237,12 +770,51 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" +[[package]] +name = "clipboard-win" +version = "5.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" +dependencies = [ + "error-code", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + +[[package]] +name = "color" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" +dependencies = [ + "bytemuck", +] + [[package]] name = "colorchoice" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "compact_str" version = "0.9.1" @@ -257,6 +829,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "convert_case" version = "0.10.0" @@ -266,6 +847,46 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -275,12 +896,27 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055" +dependencies = [ + "cfg-if", +] + [[package]] name = "critical-section" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + [[package]] name = "crossterm" version = "0.29.0" @@ -293,7 +929,7 @@ dependencies = [ "document-features", "mio", "parking_lot", - "rustix", + "rustix 1.1.5", "signal-hook", "signal-hook-mio", "winapi", @@ -308,6 +944,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + [[package]] name = "crypto-common" version = "0.1.7" @@ -325,9 +967,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb2a7d3066da2de787b7f032c736763eb7ae5d355f81a68bab2675a96008b0bf" dependencies = [ "lab", - "phf", + "phf 0.11.3", ] +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + [[package]] name = "darling" version = "0.24.1" @@ -406,6 +1054,33 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "libc", + "objc2 0.6.5", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + [[package]] name = "document-features" version = "0.2.12" @@ -416,1426 +1091,4225 @@ dependencies = [ ] [[package]] -name = "either" -version = "1.19.0" +name = "downcast-rs" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] -name = "equivalent" -version = "1.0.3" +name = "dpi" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" [[package]] -name = "errno" -version = "0.3.14" +name = "ecolor" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +checksum = "31bcbef0d4263a63eb32c4834e5d711613035ce1333468e107d928923e21e6e2" dependencies = [ - "libc", - "windows-sys", + "bytemuck", + "emath", + "serde", ] [[package]] -name = "euclid" -version = "0.22.14" +name = "eframe" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +checksum = "9c5642501a65ca657d05f00c643a5c14ff2346cb3818032bfe23d58e1f8e5f84" dependencies = [ - "num-traits", + "ahash", + "bytemuck", + "document-features", + "egui", + "egui-wgpu", + "egui-winit", + "egui_glow", + "glutin", + "glutin-winit", + "image", + "js-sys", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "pollster 1.0.1", + "profiling", + "raw-window-handle", + "ron", + "send_wrapper", + "serde", + "static_assertions", + "wasm-bindgen", + "web-sys", + "web-time", + "wgpu", + "windows-sys 0.61.2", + "winit", ] [[package]] -name = "fancy-regex" -version = "0.11.0" +name = "egui" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" +checksum = "bec9144f49b7a28b5f395d3147e325b4fe3e77ba686eac11d1bdf0a7da3f375f" dependencies = [ - "bit-set", - "regex", + "accesskit", + "ahash", + "bitflags 2.13.2", + "emath", + "epaint", + "itertools 0.15.0", + "log", + "nohash-hasher", + "profiling", + "ron", + "serde", + "smallvec", + "unicode-segmentation", + "web-sys", ] [[package]] -name = "filedescriptor" -version = "0.8.3" +name = "egui-wgpu" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d" +checksum = "0309cbe1febed48af5b974e4bcc424b35e9664863a4d402697147b57a488c864" dependencies = [ - "libc", - "thiserror 1.0.69", - "winapi", + "ahash", + "bytemuck", + "document-features", + "egui", + "epaint", + "log", + "profiling", + "thiserror 2.0.21", + "type-map", + "web-time", + "wgpu", + "winit", ] [[package]] -name = "find-msvc-tools" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" - -[[package]] -name = "finl_unicode" -version = "1.5.0" +name = "egui-winit" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80bb028c8b4148c9ee0cca68fcd9add6044e81d3619f48577ddf13a263d047a2" +checksum = "e4e449f4c4a2a60c7ccb4ba7fa4078417bfe1f9ddc03b5e05ce75748e33a70de" +dependencies = [ + "accesskit_winit", + "arboard", + "block2 0.6.2", + "bytemuck", + "egui", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "objc2-ui-kit 0.3.2", + "profiling", + "raw-window-handle", + "serde", + "smithay-clipboard", + "web-time", + "windows-sys 0.61.2", + "winit", +] [[package]] -name = "fixedbitset" -version = "0.4.2" +name = "egui_glow" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +checksum = "9275ca5cc35a6b7c94e0e8cedf22542f66cb0cf45ed8ab2657c78ff49fec7268" +dependencies = [ + "bytemuck", + "egui", + "glow", + "log", + "profiling", + "winit", +] [[package]] -name = "fnv" -version = "1.0.7" +name = "egui_tiles" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "c08803282261f981e84f422b9f716450caee4c2a0301278e27aab721dff99218" +dependencies = [ + "ahash", + "egui", + "itertools 0.15.0", + "log", + "serde", +] [[package]] -name = "foldhash" -version = "0.2.0" +name = "either" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] -name = "futures-core" -version = "0.3.34" +name = "emath" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" +checksum = "e73ce90f54750be8672c02be0743fe47530e6f251e066f0ee2869b59eb297af5" +dependencies = [ + "bytemuck", + "serde", +] [[package]] -name = "futures-task" -version = "0.3.34" +name = "endi" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" [[package]] -name = "futures-util" -version = "0.3.34" +name = "enumflags2" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" dependencies = [ - "futures-core", - "futures-task", - "pin-project-lite", - "slab", + "enumflags2_derive", + "serde", ] [[package]] -name = "generic-array" -version = "0.14.7" +name = "enumflags2_derive" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" dependencies = [ - "typenum", - "version_check", + "proc-macro2", + "quote", + "syn 2.0.113", ] [[package]] -name = "getrandom" -version = "0.3.4" +name = "enumn" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", + "proc-macro2", + "quote", + "syn 2.0.113", ] [[package]] -name = "getrandom" -version = "0.4.3" +name = "epaint" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +checksum = "97bac86ae3dde93fc3951e790951caea739ff39a6c89d909cdaf1d9278dbb1bd" dependencies = [ - "cfg-if", - "libc", - "r-efi 6.0.0", + "ahash", + "bytemuck", + "ecolor", + "emath", + "epaint_default_fonts", + "font-types", + "harfrust", + "log", + "nohash-hasher", + "parking_lot", + "profiling", + "self_cell", + "serde", + "skrifa", + "smallvec", + "unicode-general-category", + "unicode-properties", + "unicode-segmentation", + "vello_cpu", ] [[package]] -name = "hashbrown" -version = "0.17.1" +name = "epaint_default_fonts" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] +checksum = "cfc1cc505827f4c23eedc297975a0fd038268d41293f389dd8ff3b574aefab19" [[package]] -name = "heck" -version = "0.5.0" +name = "equivalent" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" [[package]] -name = "hex" -version = "0.4.3" +name = "errno" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] [[package]] -name = "ident_case" -version = "1.0.1" +name = "error-code" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" [[package]] -name = "indoc" -version = "2.0.8" +name = "euclid" +version = "0.22.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" dependencies = [ - "rustversion", + "num-traits", ] [[package]] -name = "instability" -version = "0.3.14" +name = "event-listener" +version = "5.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c3b5acc1e2fd9375041a388da33d1eb8aed5f7a8c0dd3543e3ea2805adfbe20" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" dependencies = [ - "darling", - "indoc", - "proc-macro2", - "quote", - "syn 3.0.9", + "parking", + "pin-project-lite", ] [[package]] -name = "is_terminal_polyfill" -version = "1.70.2" +name = "event-listener-strategy" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] [[package]] -name = "itertools" -version = "0.14.0" +name = "fancy-regex" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" dependencies = [ - "either", + "bit-set 0.5.3", + "regex", ] [[package]] -name = "itoa" -version = "1.0.18" +name = "fastrand" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] -name = "js-sys" -version = "0.3.106" +name = "fax" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" dependencies = [ - "cfg-if", - "futures-util", - "wasm-bindgen", + "simd-adler32", ] [[package]] -name = "kasuari" -version = "0.4.13" +name = "fearless_simd" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f14c90e40a6133f4805b83542a7ed7364f56070b447f56e7f4e90297122209" +checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" + +[[package]] +name = "filedescriptor" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d" dependencies = [ - "hashbrown", - "portable-atomic", - "thiserror 2.0.21", + "libc", + "thiserror 1.0.69", + "winapi", ] [[package]] -name = "lab" -version = "0.11.0" +name = "find-msvc-tools" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf36173d4167ed999940f804952e6b08197cae5ad5d572eb4db150ce8ad5d58f" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" [[package]] -name = "lazy_static" -version = "1.5.1" +name = "finl_unicode" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" +checksum = "80bb028c8b4148c9ee0cca68fcd9add6044e81d3619f48577ddf13a263d047a2" [[package]] -name = "libc" -version = "0.2.191" +name = "fixedbitset" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] -name = "libm" -version = "0.2.16" +name = "fixedbitset" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] -name = "line-clipping" -version = "0.3.8" +name = "flate2" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e752191d037c44ad111a8caa762921926658402f01cc1253f7bef2020ece4f5e" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" dependencies = [ - "bitflags 2.13.2", + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", ] [[package]] -name = "linux-raw-sys" -version = "0.12.1" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "litrs" -version = "1.0.1" +name = "foldhash" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] -name = "lock_api" -version = "0.4.14" +name = "foldhash" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d" dependencies = [ - "scopeguard", + "bytemuck", + "serde", ] [[package]] -name = "log" -version = "0.4.34" +name = "foreign-types" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] [[package]] -name = "lru" -version = "0.18.5" +name = "foreign-types-macros" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef9ac18847474e638e3702b76c65d4eb93428471a74778ef0f1be711717f89b5" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" dependencies = [ - "hashbrown", + "proc-macro2", + "quote", + "syn 3.0.9", ] [[package]] -name = "mac_address" -version = "1.2.1" +name = "foreign-types-shared" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0581a75c45969c63afd2bb87b1d8b25cfcc556c7a918cf9bb13b0fe8d2381" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" dependencies = [ - "nix 0.31.3", - "windows-sys", + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", ] [[package]] -name = "memchr" -version = "2.8.3" +name = "futures-macro" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] [[package]] -name = "memmem" -version = "0.1.1" +name = "futures-task" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64a92489e2744ce060c349162be1c5f33c6969234104dbd99ddb5feb08b8c15" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" [[package]] -name = "memoffset" -version = "0.9.1" +name = "futures-util" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ - "autocfg", + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "slab", ] [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] [[package]] -name = "mio" -version = "1.2.4" +name = "gethostname" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ - "libc", - "log", - "wasi", - "windows-sys", + "rustix 1.1.5", + "windows-link", ] [[package]] -name = "nix" -version = "0.29.0" +name = "getrandom" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ - "bitflags 2.13.2", "cfg-if", - "cfg_aliases", "libc", + "r-efi 5.3.0", + "wasip2", ] [[package]] -name = "nix" -version = "0.31.3" +name = "getrandom" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ - "bitflags 2.13.2", "cfg-if", - "cfg_aliases", "libc", - "memoffset", + "r-efi 6.0.0", ] [[package]] -name = "nom" -version = "7.1.3" +name = "gl_generator" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" dependencies = [ - "memchr", - "minimal-lexical", + "khronos_api", + "log", + "xml-rs", ] [[package]] -name = "num-conv" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" - -[[package]] -name = "num-derive" -version = "0.4.2" +name = "glifo" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +checksum = "282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.113", + "bytemuck", + "foldhash 0.2.0", + "hashbrown 0.17.1", + "log", + "peniko", + "skrifa", + "smallvec", + "vello_common", ] [[package]] -name = "num-traits" -version = "0.2.19" +name = "glow" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" dependencies = [ - "autocfg", + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "num_threads" -version = "0.1.8" +name = "glutin" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cabcc654086861f9e1bc5115258de62ef92c79b20f4615a1b0cc57c4e82027d4" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" dependencies = [ - "libc", + "bitflags 2.13.2", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", ] [[package]] -name = "once_cell" -version = "1.21.4" +name = "glutin-winit" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] [[package]] -name = "once_cell_polyfill" -version = "1.70.2" +name = "glutin_egl_sys" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] [[package]] -name = "ordered-float" -version = "4.6.0" +name = "glutin_glx_sys" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" dependencies = [ - "num-traits", + "gl_generator", + "x11-dl", ] [[package]] -name = "palette" -version = "0.7.7" +name = "glutin_wgl_sys" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddeed8580d347d2abf3dcf06a5f0b3dc020258338526b277847cd4248a70fc64" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" dependencies = [ - "approx", - "libm", - "palette_derive", - "palette_math", + "gl_generator", ] [[package]] -name = "palette_derive" -version = "0.7.7" +name = "gpu-allocator" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88537020289b719d81be994ccf1bbf4990f477e2f69ee52fe3e45f43a02e56be" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" dependencies = [ - "by_address", - "proc-macro2", - "quote", - "syn 2.0.113", + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", + "windows", ] [[package]] -name = "palette_math" -version = "0.7.7" +name = "guillotiere" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e6eb142958d64335fb0e345c5b9ead2ecd6fc438c307e9d7d3c4fd428dbaf12" +checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab" dependencies = [ - "libm", + "euclid", ] [[package]] -name = "parking_lot" -version = "0.12.5" +name = "half" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ - "lock_api", - "parking_lot_core", + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", ] [[package]] -name = "parking_lot_core" -version = "0.9.12" +name = "harfrust" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", + "bitflags 2.13.2", + "bytemuck", + "read-fonts", "smallvec", - "windows-link", ] [[package]] -name = "pest" -version = "2.9.4" +name = "hashbrown" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd47a460a9cbc3b3429c7e22bf0d76653e779319bae45a499ca010c9a990bb23" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "memchr", - "psm", - "stacker", - "ucd-trie", + "foldhash 0.1.5", ] [[package]] -name = "pest_derive" -version = "2.9.4" +name = "hashbrown" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "203e46697708f7519ab1608393cf89239cafb46b8e6d08a8ffe359359b11ef44" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ - "pest", - "pest_generator", + "allocator-api2", + "equivalent", + "foldhash 0.2.0", ] [[package]] -name = "pest_generator" -version = "2.9.4" +name = "hashbrown" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e84ae6340a458d3d6cfc73cf328cf3cfe90b2484cd0de25eb66aa954615ed4d5" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 3.0.9", + "allocator-api2", + "equivalent", + "foldhash 0.2.0", ] [[package]] -name = "pest_meta" -version = "2.9.4" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b57f92f32b3dbce6598fd8f5cdf1f06a6072570b8103fa21728fa9036923e710" -dependencies = [ - "pest", -] +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "phf" -version = "0.11.3" +name = "hermit-abi" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" dependencies = [ - "phf_macros", - "phf_shared", + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "tiff", ] [[package]] -name = "phf_codegen" -version = "0.11.3" +name = "indexmap" +version = "2.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ - "phf_generator", - "phf_shared", + "equivalent", + "hashbrown 0.17.1", ] [[package]] -name = "phf_generator" -version = "0.11.3" +name = "indoc" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1" dependencies = [ - "phf_shared", - "rand", + "rustversion", ] [[package]] -name = "phf_macros" -version = "0.11.3" +name = "instability" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +checksum = "4c3b5acc1e2fd9375041a388da33d1eb8aed5f7a8c0dd3543e3ea2805adfbe20" dependencies = [ - "phf_generator", - "phf_shared", + "darling", + "indoc", "proc-macro2", "quote", - "syn 2.0.113", + "syn 3.0.9", ] [[package]] -name = "phf_shared" -version = "0.11.3" +name = "is_terminal_polyfill" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ - "siphasher", + "either", ] [[package]] -name = "pin-project-lite" -version = "0.2.17" +name = "itertools" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] [[package]] -name = "portable-atomic" -version = "1.15.0" +name = "itoa" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] -name = "powerfmt" -version = "0.2.1" +name = "jni" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] [[package]] -name = "proc-macro2" -version = "1.0.104" +name = "jni-macros" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" dependencies = [ - "unicode-ident", + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.113", ] [[package]] -name = "psm" -version = "0.1.24" +name = "jni-sys" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" dependencies = [ - "cc", + "jni-sys 0.4.1", ] [[package]] -name = "quote" -version = "1.0.42" +name = "jni-sys" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" dependencies = [ - "proc-macro2", + "jni-sys-macros", ] [[package]] -name = "r-efi" -version = "5.3.0" +name = "jni-sys-macros" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.113", +] [[package]] -name = "r-efi" -version = "6.0.0" +name = "jobserver" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] [[package]] -name = "rand" -version = "0.8.8" +name = "js-sys" +version = "0.3.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" dependencies = [ - "rand_core", + "cfg-if", + "futures-util", + "wasm-bindgen", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "kasuari" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "72f14c90e40a6133f4805b83542a7ed7364f56070b447f56e7f4e90297122209" +dependencies = [ + "hashbrown 0.17.1", + "portable-atomic", + "thiserror 2.0.21", +] [[package]] -name = "ratatui" -version = "0.30.2" +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + +[[package]] +name = "lab" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf36173d4167ed999940f804952e6b08197cae5ad5d572eb4db150ce8ad5d58f" + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.5", +] + +[[package]] +name = "line-clipping" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e752191d037c44ad111a8caa762921926658402f01cc1253f7bef2020ece4f5e" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litrs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lru" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef9ac18847474e638e3702b76c65d4eb93428471a74778ef0f1be711717f89b5" +dependencies = [ + "hashbrown 0.17.1", +] + +[[package]] +name = "mac_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0581a75c45969c63afd2bb87b1d8b25cfcc556c7a918cf9bb13b0fe8d2381" +dependencies = [ + "nix 0.31.3", + "windows-sys 0.61.2", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" +dependencies = [ + "libc", +] + +[[package]] +name = "memmem" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a64a92489e2744ce060c349162be1c5f33c6969234104dbd99ddb5feb08b8c15" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", + "memoffset", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "num_threads" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cabcc654086861f9e1bc5115258de62ef92c79b20f4615a1b0cc57c4e82027d4" +dependencies = [ + "libc", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "libc", + "objc2 0.5.3", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.3", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core 0.2.2", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-float" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "palette" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddeed8580d347d2abf3dcf06a5f0b3dc020258338526b277847cd4248a70fc64" +dependencies = [ + "approx", + "libm", + "palette_derive", + "palette_math", +] + +[[package]] +name = "palette_derive" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88537020289b719d81be994ccf1bbf4990f477e2f69ee52fe3e45f43a02e56be" +dependencies = [ + "by_address", + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "palette_math" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e6eb142958d64335fb0e345c5b9ead2ecd6fc438c307e9d7d3c4fd428dbaf12" +dependencies = [ + "libm", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "peniko" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "linebender_resource_handle", + "smallvec", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pest" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd47a460a9cbc3b3429c7e22bf0d76653e779319bae45a499ca010c9a990bb23" +dependencies = [ + "memchr", + "psm", + "stacker", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "203e46697708f7519ab1608393cf89239cafb46b8e6d08a8ffe359359b11ef44" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e84ae6340a458d3d6cfc73cf328cf3cfe90b2484cd0de25eb66aa954615ed4d5" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "pest_meta" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b57f92f32b3dbce6598fd8f5cdf1f06a6072570b8103fa21728fa9036923e710" +dependencies = [ + "pest", +] + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset 0.5.7", + "hashbrown 0.15.5", + "indexmap", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros 0.14.0", + "phf_shared 0.14.0", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand", +] + +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared 0.14.0", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "pollster" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336" + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "psm" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" +dependencies = [ + "cc", +] + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "ratatui" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3274ba0a2c5e1bcad2a2005d20f4dc59dad26b2eb0940fb094500dba4099d57d" dependencies = [ - "instability", - "ratatui-core", - "ratatui-crossterm", - "ratatui-macros", - "ratatui-termina", - "ratatui-termwiz", - "ratatui-widgets", - "serde", + "instability", + "ratatui-core", + "ratatui-crossterm", + "ratatui-macros", + "ratatui-termina", + "ratatui-termwiz", + "ratatui-widgets", + "serde", +] + +[[package]] +name = "ratatui-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbb175c433c8e28a809d1f5773a2ae96e68c0ce40db865cbab1020bf33ae479c" +dependencies = [ + "bitflags 2.13.2", + "compact_str", + "critical-section", + "hashbrown 0.17.1", + "itertools 0.14.0", + "kasuari", + "lru", + "palette", + "serde", + "strum", + "thiserror 2.0.21", + "unicode-segmentation", + "unicode-truncate", + "unicode-width", +] + +[[package]] +name = "ratatui-crossterm" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567584a3b0e6a8203c23de40b4861497266725eb5363dbfd18a1edd603cca9f0" +dependencies = [ + "cfg-if", + "crossterm", + "instability", + "ratatui-core", +] + +[[package]] +name = "ratatui-macros" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7dc68daa7498a43e4d68e0eb078427e10c38fbcfbb1e42d955f1fa2140d814" +dependencies = [ + "ratatui-core", + "ratatui-widgets", +] + +[[package]] +name = "ratatui-termina" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0bf912d9e66f057a759d92e386a280ea886b352ab757d6ac4d653c7ed2c43c2" +dependencies = [ + "instability", + "ratatui-core", + "termina", +] + +[[package]] +name = "ratatui-termwiz" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf03e0380b7744054d6cb74224fe3adf062a029754933f575ca1e3b4c2ce977" +dependencies = [ + "ratatui-core", + "termwiz", +] + +[[package]] +name = "ratatui-textarea" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78cdce79220909bec1bb8307c29fad7d0df7434280da6ecaf44cb208393bed00" +dependencies = [ + "ratatui-core", + "ratatui-crossterm", + "ratatui-widgets", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "ratatui-widgets" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66e3d19bcc9130ca376277d93b60767ff121ace3be06f5f95f81dd68956407d1" +dependencies = [ + "bitflags 2.13.2", + "hashbrown 0.17.1", + "indoc", + "instability", + "itertools 0.14.0", + "line-clipping", + "ratatui-core", + "serde", + "strum", + "time", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "rfd" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20dafead71c16a34e1ff357ddefc8afc11e7d51d6d2b9fbd07eaa48e3e540220" +dependencies = [ + "block2 0.6.2", + "dispatch2", + "js-sys", + "libc", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "percent-encoding", + "pollster 0.4.0", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "ron" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3fe97c18ff24299ea56f802c5693eb34266fb0bc8317f4e101debc8a3ceaf" +dependencies = [ + "bitflags 2.13.2", + "serde", + "serde_derive", + "typeid", + "unicode-ident", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" +dependencies = [ + "serde", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.14.5", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.5", + "thiserror 2.0.21", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit 0.20.0", + "wayland-backend", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "stacker" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.61.2", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.113" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "termina" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9048a889effe34a5cddee0af7f53285198b16dca3be510858d38dfdb3e62a04e" +dependencies = [ + "bitflags 2.13.2", + "parking_lot", + "rustix 1.1.5", + "signal-hook", + "windows-sys 0.61.2", +] + +[[package]] +name = "terminfo" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ea810f0692f9f51b382fff5893887bb4580f5fa246fde546e0b13e7fcee662" +dependencies = [ + "fnv", + "nom 7.1.3", + "phf 0.11.3", + "phf_codegen", +] + +[[package]] +name = "termios" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b" +dependencies = [ + "libc", +] + +[[package]] +name = "termwiz" +version = "0.23.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4676b37242ccbd1aabf56edb093a4827dc49086c0ffd764a5705899e0f35f8f7" +dependencies = [ + "anyhow", + "base64", + "bitflags 2.13.2", + "fancy-regex", + "filedescriptor", + "finl_unicode", + "fixedbitset 0.4.2", + "hex", + "lazy_static", + "libc", + "log", + "memmem", + "nix 0.29.0", + "num-derive", + "num-traits", + "ordered-float", + "pest", + "pest_derive", + "phf 0.11.3", + "sha2", + "signal-hook", + "siphasher", + "terminfo", + "termios", + "thiserror 1.0.69", + "ucd-trie", + "unicode-segmentation", + "vtparse", + "wezterm-bidi", + "wezterm-blob-leases", + "wezterm-color-types", + "wezterm-dynamic", + "wezterm-input-types", + "winapi", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde_core", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.17+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.113", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tree_magic_mini" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +dependencies = [ + "memchr", + "nom 8.0.0", + "petgraph", +] + +[[package]] +name = "type-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" +dependencies = [ + "rustc-hash 2.1.3", +] + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-truncate" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5" +dependencies = [ + "itertools 0.14.0", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606" +dependencies = [ + "atomic", + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", ] [[package]] -name = "ratatui-core" -version = "0.1.2" +name = "vello_common" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbb175c433c8e28a809d1f5773a2ae96e68c0ce40db865cbab1020bf33ae479c" +checksum = "bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd" dependencies = [ - "bitflags 2.13.2", - "compact_str", - "critical-section", - "hashbrown", - "itertools", - "kasuari", - "lru", - "palette", - "serde", - "strum", + "bytemuck", + "fearless_simd", + "guillotiere", + "log", + "peniko", + "smallvec", "thiserror 2.0.21", - "unicode-segmentation", - "unicode-truncate", - "unicode-width", ] [[package]] -name = "ratatui-crossterm" -version = "0.1.2" +name = "vello_cpu" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567584a3b0e6a8203c23de40b4861497266725eb5363dbfd18a1edd603cca9f0" +checksum = "ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9" +dependencies = [ + "bytemuck", + "glifo", + "hashbrown 0.17.1", + "vello_common", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vtparse" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d9b2acfb050df409c972a37d3b8e08cdea3bddb0c09db9d53137e504cfabed0" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" dependencies = [ "cfg-if", - "crossterm", - "instability", - "ratatui-core", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", ] [[package]] -name = "ratatui-macros" -version = "0.7.2" +name = "wasm-bindgen-futures" +version = "0.4.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7dc68daa7498a43e4d68e0eb078427e10c38fbcfbb1e42d955f1fa2140d814" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" dependencies = [ - "ratatui-core", - "ratatui-widgets", + "js-sys", + "tokio", + "wasm-bindgen", ] [[package]] -name = "ratatui-termina" -version = "0.1.0" +name = "wasm-bindgen-macro" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0bf912d9e66f057a759d92e386a280ea886b352ab757d6ac4d653c7ed2c43c2" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" dependencies = [ - "instability", - "ratatui-core", - "termina", + "quote", + "wasm-bindgen-macro-support", ] [[package]] -name = "ratatui-termwiz" -version = "0.1.2" +name = "wasm-bindgen-macro-support" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf03e0380b7744054d6cb74224fe3adf062a029754933f575ca1e3b4c2ce977" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" dependencies = [ - "ratatui-core", - "termwiz", + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", ] [[package]] -name = "ratatui-textarea" -version = "0.9.3" +name = "wasm-bindgen-shared" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cdce79220909bec1bb8307c29fad7d0df7434280da6ecaf44cb208393bed00" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" dependencies = [ - "ratatui-core", - "ratatui-crossterm", - "ratatui-widgets", - "unicode-segmentation", - "unicode-width", + "unicode-ident", ] [[package]] -name = "ratatui-widgets" -version = "0.3.2" +name = "wayland-backend" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66e3d19bcc9130ca376277d93b60767ff121ace3be06f5f95f81dd68956407d1" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.5", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ "bitflags 2.13.2", - "hashbrown", - "indoc", - "instability", - "itertools", - "line-clipping", - "ratatui-core", - "serde", - "strum", - "time", - "unicode-segmentation", - "unicode-width", + "rustix 1.1.5", + "wayland-backend", + "wayland-scanner", ] [[package]] -name = "redox_syscall" -version = "0.5.18" +name = "wayland-csd-frame" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", ] [[package]] -name = "regex" -version = "1.13.1" +name = "wayland-cursor" +version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", + "rustix 1.1.5", + "wayland-client", + "xcursor", ] [[package]] -name = "regex-automata" -version = "0.4.18" +name = "wayland-protocols" +version = "0.32.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", ] [[package]] -name = "regex-syntax" -version = "0.8.11" +name = "wayland-protocols-experimental" +version = "20250721.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] [[package]] -name = "rustc_version" -version = "0.4.1" +name = "wayland-protocols-misc" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" dependencies = [ - "semver", + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", ] [[package]] -name = "rustix" -version = "1.1.5" +name = "wayland-protocols-plasma" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" dependencies = [ "bitflags 2.13.2", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", ] [[package]] -name = "rustversion" -version = "1.0.23" +name = "wayland-protocols-wlr" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wezterm-bidi" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0a6e355560527dd2d1cf7890652f4f09bb3433b6aadade4c9b5ed76de5f3ec" +dependencies = [ + "log", + "wezterm-dynamic", +] + +[[package]] +name = "wezterm-blob-leases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692daff6d93d94e29e4114544ef6d5c942a7ed998b37abdc19b17136ea428eb7" +dependencies = [ + "getrandom 0.3.4", + "mac_address", + "sha2", + "thiserror 1.0.69", + "uuid", +] + +[[package]] +name = "wezterm-color-types" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7de81ef35c9010270d63772bebef2f2d6d1f2d20a983d27505ac850b8c4b4296" +dependencies = [ + "csscolorparser", + "deltae", + "lazy_static", + "wezterm-dynamic", +] [[package]] -name = "ryu" -version = "1.0.23" +name = "wezterm-dynamic" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +checksum = "5f2ab60e120fd6eaa68d9567f3226e876684639d22a4219b313ff69ec0ccd5ac" +dependencies = [ + "log", + "ordered-float", + "strsim", + "thiserror 1.0.69", + "wezterm-dynamic-derive", +] [[package]] -name = "scopeguard" -version = "1.2.0" +name = "wezterm-dynamic-derive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "46c0cf2d539c645b448eaffec9ec494b8b19bd5077d9e58cb1ae7efece8d575b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] -name = "semver" -version = "1.0.28" +name = "wezterm-input-types" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +checksum = "7012add459f951456ec9d6c7e6fc340b1ce15d6fc9629f8c42853412c029e57e" +dependencies = [ + "bitflags 1.3.2", + "euclid", + "lazy_static", + "serde", + "wezterm-dynamic", +] [[package]] -name = "serde" -version = "1.0.229" +name = "wgpu" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" dependencies = [ - "serde_core", - "serde_derive", + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "naga", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", ] [[package]] -name = "serde_core" -version = "1.0.229" +name = "wgpu-core" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" dependencies = [ - "serde_derive", + "arrayvec", + "bit-set 0.10.0", + "bit-vec 0.9.1", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-wasm", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", ] [[package]] -name = "serde_derive" -version = "1.0.229" +name = "wgpu-core-deps-apple" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", + "wgpu-hal", ] [[package]] -name = "sha2" -version = "0.10.9" +name = "wgpu-core-deps-emscripten" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +checksum = "d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86" dependencies = [ - "cfg-if", - "cpufeatures", - "digest", + "wgpu-hal", ] [[package]] -name = "shlex" -version = "2.0.1" +name = "wgpu-core-deps-wasm" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" +checksum = "d260ca2ca8adc654f513a869bf3cac0b47f5b8d3f87803d6942015f8de597aae" +dependencies = [ + "wgpu-hal", +] [[package]] -name = "signal-hook" -version = "0.3.18" +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" dependencies = [ - "libc", - "signal-hook-registry", + "wgpu-hal", ] [[package]] -name = "signal-hook-mio" -version = "0.2.5" +name = "wgpu-hal" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set 0.10.0", + "bitflags 2.13.2", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "hashbrown 0.17.1", + "js-sys", + "khronos-egl", "libc", - "mio", - "signal-hook", + "libloading", + "log", + "naga", + "naga-types", + "ndk-sys", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge", + "wgpu-types", + "windows", + "windows-core", + "windows-result", ] [[package]] -name = "signal-hook-registry" -version = "1.4.8" +name = "wgpu-naga-bridge" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" dependencies = [ - "errno", - "libc", + "naga", + "wgpu-types", ] [[package]] -name = "siphasher" -version = "1.0.4" +name = "wgpu-types" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] [[package]] -name = "slab" -version = "0.4.12" +name = "winapi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] [[package]] -name = "smallvec" -version = "1.16.3" +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "stacker" -version = "0.1.25" +name = "winapi-util" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "cc", - "cfg-if", - "libc", - "psm", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.11.1" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "strum" -version = "0.28.0" +name = "windows" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ - "strum_macros", + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", ] [[package]] -name = "strum_macros" -version = "0.28.0" +name = "windows-collections" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.113", + "windows-core", ] [[package]] -name = "syn" -version = "1.0.109" +name = "windows-core" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", ] [[package]] -name = "syn" -version = "2.0.113" +name = "windows-future" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "windows-core", + "windows-link", + "windows-threading", ] [[package]] -name = "syn" -version = "3.0.9" +name = "windows-implement" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "unicode-ident", + "syn 2.0.113", ] [[package]] -name = "termina" -version = "0.3.3" +name = "windows-interface" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9048a889effe34a5cddee0af7f53285198b16dca3be510858d38dfdb3e62a04e" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ - "bitflags 2.13.2", - "parking_lot", - "rustix", - "signal-hook", - "windows-sys", + "proc-macro2", + "quote", + "syn 2.0.113", ] [[package]] -name = "terminfo" -version = "0.9.0" +name = "windows-link" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4ea810f0692f9f51b382fff5893887bb4580f5fa246fde546e0b13e7fcee662" -dependencies = [ - "fnv", - "nom", - "phf", - "phf_codegen", -] +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "termios" -version = "0.3.3" +name = "windows-numerics" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "libc", + "windows-core", + "windows-link", ] [[package]] -name = "termwiz" -version = "0.23.3" +name = "windows-result" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4676b37242ccbd1aabf56edb093a4827dc49086c0ffd764a5705899e0f35f8f7" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "anyhow", - "base64", - "bitflags 2.13.2", - "fancy-regex", - "filedescriptor", - "finl_unicode", - "fixedbitset", - "hex", - "lazy_static", - "libc", - "log", - "memmem", - "nix 0.29.0", - "num-derive", - "num-traits", - "ordered-float", - "pest", - "pest_derive", - "phf", - "sha2", - "signal-hook", - "siphasher", - "terminfo", - "termios", - "thiserror 1.0.69", - "ucd-trie", - "unicode-segmentation", - "vtparse", - "wezterm-bidi", - "wezterm-blob-leases", - "wezterm-color-types", - "wezterm-dynamic", - "wezterm-input-types", - "winapi", + "windows-link", ] [[package]] -name = "thiserror" -version = "1.0.69" +name = "windows-strings" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "thiserror-impl 1.0.69", + "windows-link", ] [[package]] -name = "thiserror" -version = "2.0.21" +name = "windows-sys" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "thiserror-impl 2.0.21", + "windows-targets", ] [[package]] -name = "thiserror-impl" -version = "1.0.69" +name = "windows-sys" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.113", + "windows-targets", ] [[package]] -name = "thiserror-impl" -version = "2.0.21" +name = "windows-sys" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", + "windows-link", ] [[package]] -name = "time" -version = "0.3.55" +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "deranged", - "libc", - "num-conv", - "num_threads", - "powerfmt", - "serde_core", - "time-core", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] -name = "time-core" -version = "0.1.9" +name = "windows-threading" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] [[package]] -name = "typenum" -version = "1.20.1" +name = "windows_aarch64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] -name = "ucd-trie" -version = "0.1.7" +name = "windows_aarch64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] -name = "unicode-ident" -version = "1.0.22" +name = "windows_i686_gnu" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] -name = "unicode-segmentation" -version = "1.13.3" +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] -name = "unicode-truncate" -version = "2.0.1" +name = "windows_i686_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5" -dependencies = [ - "itertools", - "unicode-segmentation", - "unicode-width", -] +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] -name = "unicode-width" -version = "0.2.2" +name = "windows_x86_64_gnu" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] -name = "utf8parse" -version = "0.2.2" +name = "windows_x86_64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] -name = "uuid" -version = "1.28.0" +name = "windows_x86_64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" dependencies = [ - "atomic", - "getrandom 0.4.3", + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2 0.5.1", + "bytemuck", + "calloop 0.13.0", + "cfg_aliases", + "concurrent-queue", + "core-foundation", + "core-graphics", + "cursor-icon", + "dpi", "js-sys", + "libc", + "memmap2", + "ndk", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "smithay-client-toolkit 0.19.2", + "smol_str", + "tracing", + "unicode-segmentation", "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", ] [[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "vtparse" -version = "0.6.2" +name = "winnow" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9b2acfb050df409c972a37d3b8e08cdea3bddb0c09db9d53137e504cfabed0" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" dependencies = [ - "utf8parse", + "memchr", ] [[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" +name = "wit-bindgen" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" +name = "wl-clipboard-rs" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +checksum = "959c7ac3b8afde864f7a7448ac16f29b2b83350b7eccbf77fb781c3999aa6848" dependencies = [ - "wit-bindgen", + "libc", + "log", + "os_pipe", + "rustix 1.1.5", + "thiserror 2.0.21", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", ] [[package]] -name = "wasm-bindgen" -version = "0.2.129" +name = "x11-dl" +version = "2.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" dependencies = [ - "cfg-if", + "libc", "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", + "pkg-config", ] [[package]] -name = "wasm-bindgen-macro" -version = "0.2.129" +name = "x11rb" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.5", + "x11rb-protocol", ] [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.129" +name = "x11rb-protocol" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 3.0.9", - "wasm-bindgen-shared", -] +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" [[package]] -name = "wasm-bindgen-shared" -version = "0.2.129" +name = "xcursor" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" -dependencies = [ - "unicode-ident", -] +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" [[package]] -name = "wezterm-bidi" -version = "0.2.3" +name = "xkbcommon-dl" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0a6e355560527dd2d1cf7890652f4f09bb3433b6aadade4c9b5ed76de5f3ec" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ + "bitflags 2.13.2", + "dlib", "log", - "wezterm-dynamic", + "once_cell", + "xkeysym", ] [[package]] -name = "wezterm-blob-leases" -version = "0.1.1" +name = "xkeysym" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692daff6d93d94e29e4114544ef6d5c942a7ed998b37abdc19b17136ea428eb7" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" dependencies = [ - "getrandom 0.3.4", - "mac_address", - "sha2", - "thiserror 1.0.69", + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.5", + "serde", + "serde_repr", + "tracing", + "uds_windows", "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros", + "zbus_names", + "zvariant", ] [[package]] -name = "wezterm-color-types" -version = "0.3.0" +name = "zbus-lockstep" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de81ef35c9010270d63772bebef2f2d6d1f2d20a983d27505ac850b8c4b4296" +checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" dependencies = [ - "csscolorparser", - "deltae", - "lazy_static", - "wezterm-dynamic", + "zbus_xml", + "zvariant", ] [[package]] -name = "wezterm-dynamic" -version = "0.2.1" +name = "zbus-lockstep-macros" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2ab60e120fd6eaa68d9567f3226e876684639d22a4219b313ff69ec0ccd5ac" +checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" dependencies = [ - "log", - "ordered-float", - "strsim", - "thiserror 1.0.69", - "wezterm-dynamic-derive", + "proc-macro2", + "quote", + "syn 2.0.113", + "zbus-lockstep", + "zbus_xml", + "zvariant", ] [[package]] -name = "wezterm-dynamic-derive" -version = "0.1.1" +name = "zbus_macros" +version = "5.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c0cf2d539c645b448eaffec9ec494b8b19bd5077d9e58cb1ae7efece8d575b" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" dependencies = [ + "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 3.0.9", + "zbus_names", + "zvariant", + "zvariant_utils", ] [[package]] -name = "wezterm-input-types" -version = "0.1.0" +name = "zbus_names" +version = "4.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7012add459f951456ec9d6c7e6fc340b1ce15d6fc9629f8c42853412c029e57e" +checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" dependencies = [ - "bitflags 1.3.2", - "euclid", - "lazy_static", "serde", - "wezterm-dynamic", + "winnow", + "zvariant", ] [[package]] -name = "winapi" -version = "0.3.9" +name = "zbus_xml" +version = "5.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "serde", + "winnow", + "zbus_names", + "zvariant", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +name = "zcheapstr" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +checksum = "939f186d9ecebe044315a5cb6d6f78568bbc21152adc954d5a0c2f58bdbc9920" +dependencies = [ + "serde", +] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "zerocopy" +version = "0.8.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] [[package]] -name = "windows-link" -version = "0.2.1" +name = "zerocopy-derive" +version = "0.8.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.113", +] [[package]] -name = "windows-sys" -version = "0.61.2" +name = "zlib-rs" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" dependencies = [ - "windows-link", + "zune-core", ] [[package]] -name = "wit-bindgen" -version = "0.57.1" +name = "zvariant" +version = "5.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" +checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow", + "zcheapstr", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.9", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.9", + "winnow", +] diff --git a/Cargo.toml b/Cargo.toml index 286a395..6e91347 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,33 @@ -[package] -name = "bench51" +[workspace] +members = ["crates/*"] + +[workspace.package] version = "0.1.0" edition = "2024" + +[workspace.lints.rust] +unsafe_code = "forbid" + +[workspace.dependencies] +bench51-core = { path = "crates/bench51-core" } +clap = { version = "4.5.54", features = ["derive"] } + +[package] +name = "bench51" +version.workspace = true +edition.workspace = true description = "A TUI Intel 8051 assembler, simulator and debugger" [dependencies] -clap = { version = "4.5.54", features = ["derive"] } +bench51-core.workspace = true +clap.workspace = true ratatui = "0.30" ratatui-textarea = "0.9" + +[lints] +workspace = true + +# egui and wgpu are unusably slow without optimisation; keep our own crates +# quick to rebuild. +[profile.dev.package."*"] +opt-level = 2 diff --git a/README.md b/README.md index d356b3a..c06f301 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,48 @@ -# bench51 — a TUI 8051 assembler, simulator & debugger - -A small, Keil µVision-style IDE for the Intel 8051 that runs in your terminal. -Write assembly in the built-in editor, assemble it, inspect the listing and -Intel HEX output, then run, pause and single-step the program while watching -registers, SFRs, memory, ports, timers, interrupts and the serial port. - -Built in Rust with [ratatui](https://ratatui.rs). It is a learning tool, not a -cycle-exact replacement for a vendor simulator. - -![Debugging serial_hello.asm: source, registers, peripherals, IRAM and the UART console](docs/screenshots/debug_serial.png) +# bench51 — an 8051 assembler, simulator & debugger + +[![CI](https://img.shields.io/github/actions/workflow/status/krolyxon/bench51/ci.yml?branch=master&style=flat-square&label=CI&labelColor=000000)](https://github.com/krolyxon/bench51/actions/workflows/ci.yml) +[![Version](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fkrolyxon%2Fbench51%2Fmaster%2FCargo.toml&query=%24.workspace.package.version&label=version&style=flat-square&labelColor=000000&color=333333)](Cargo.toml) +[![Top language](https://img.shields.io/github/languages/top/krolyxon/bench51?style=flat-square&logo=rust&logoColor=white&labelColor=000000&color=333333)](https://github.com/krolyxon/bench51) +[![Lines of code](https://img.shields.io/badge/lines%20of%20code-9.8k-333333?style=flat-square&labelColor=000000)](crates) +[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-333333?style=flat-square&labelColor=000000)](Cargo.toml) +[![License](https://img.shields.io/github/license/krolyxon/bench51?style=flat-square&labelColor=000000&color=333333)](LICENSE) +[![Platforms](https://img.shields.io/badge/platform-Linux%20%7C%20Windows%20%7C%20macOS-333333?style=flat-square&labelColor=000000)](#usage) +[![Target](https://img.shields.io/badge/target-Intel%208051%20%28MCS--51%29-D71921?style=flat-square&labelColor=000000)](https://en.wikipedia.org/wiki/Intel_8051) +[![egui](https://img.shields.io/badge/GUI-egui-333333?style=flat-square&labelColor=000000)](https://github.com/emilk/egui) +[![ratatui](https://img.shields.io/badge/TUI-ratatui-333333?style=flat-square&labelColor=000000)](https://ratatui.rs) +[![Last commit](https://img.shields.io/github/last-commit/krolyxon/bench51?style=flat-square&labelColor=000000&color=333333)](https://github.com/krolyxon/bench51/commits) + +A small, Keil µVision-style IDE for the Intel 8051. Write assembly in the +editor, build it, inspect the listing and Intel HEX output, then run, pause +and single-step the program while watching registers, SFRs, memory, ports, +timers, interrupts and the serial port, all in a window laid out like +µVision. + +Like Emacs, it also runs in a terminal: the same assembler and simulator +come with a TUI (`bench51`) for SSH sessions and terminal setups. + +Built in Rust with [egui](https://github.com/emilk/egui) and +[ratatui](https://ratatui.rs). It is a learning tool, not a cycle-exact +replacement for a vendor simulator. + +![Debug session: registers, source with the PC, disassembly, memory and UART #1](docs/screenshots/gui_debug.png) - - + + - - + + - - + + - - + +
Editor with the assembled Keil-style listingStopped at a breakpoint inside the timer 0 ISR, SFR viewEditor and Keil-style build outputStopped at a breakpoint in a timer ISR, light theme
Editor + assembled listingBreakpoint inside a timer ISR, SFR viewEditor + build outputBreakpoint in a timer ISR, light theme
Assembler errors marked in the gutter and listed in the Errors tabIntel HEX output tabPorts, timers and interrupts windows docked side by sideAssembler errors in the gutter and Build Output
Assembler errors in the gutter and Errors tabIntel HEX outputPeripheral windows, rearrangedAssembler errors
@@ -35,15 +52,20 @@ I had microcontroller practicals to get through, and the course expects you to use Keil µVision. Keil µVision doesn't run on Linux. Rather than fight with Wine or a Windows VM every lab session, I wrote my own: bench51 does the parts of µVision those practicals actually need (write the code, assemble it, look -at the listing and HEX, step through it and watch the registers) right in the -terminal. +at the listing and HEX, step through it and watch the registers) natively on +Linux, in a window or right in the terminal. ----- ## Features -- **Editor** with undo/redo, breakpoint and error markers in the gutter — - or press Ctrl-G to edit in your own `$EDITOR` (vim, nvim, nano, …). +- **µVision layout**: menus and toolbar, a Project window, the editor, Build + Output, and in a debug session the Registers, Disassembly, Memory, Symbols, + UART #1, Ports, Timers and Interrupts windows. Every window docks and tabs + wherever you drag it; the edit and debug layouts are remembered separately, + as in µVision. +- **Editor** with syntax highlighting, undo/redo, find, and breakpoint, error + and PC markers in the gutter. - **Two-pass assembler** for the full 8051 instruction set (all 255 opcodes): - labels, expressions (`+ - * / MOD AND OR XOR NOT SHL SHR HIGH LOW`, `$`) - number formats `42`, `2Ah`, `0x2A`, `101010b`, `52o`, `'*'` @@ -63,9 +85,88 @@ terminal. breakpoints, changed-value highlighting, memory poke, adjustable speed. - **Open `.hex` files**: they're disassembled into editable source that re-assembles to the identical image. +- **Dark and light themes** in a monochrome, dot-matrix design (Space + Grotesk, Space Mono and Doto, bundled). ## Usage +```bash +cargo install --path crates/bench51-gui # installs `bench51-gui` + +cargo run --release -p bench51-gui # welcome screen +cargo run --release -p bench51-gui -- examples/*.asm # open several files +cargo run --release -p bench51-gui -- firmware.hex # disassemble & debug a HEX file +cargo run --release -p bench51-gui -- --theme light +``` + +`--theme system|dark|light` overrides the theme chosen in View → Theme, and +`--clock ` the Xtal set in Project → Options for Target (default +11.0592), which is used for the elapsed-time display. + +On Linux it runs on Wayland and X11 and uses the XDG desktop portal for file +dialogs. To add it to your application launcher: + +```bash +install -Dm644 crates/bench51-gui/assets/bench51-gui.desktop ~/.local/share/applications/bench51-gui.desktop +install -Dm644 crates/bench51-gui/assets/bench51-gui.svg ~/.local/share/icons/hicolor/scalable/apps/bench51-gui.svg +``` + +It also builds for Windows and macOS. On Debian or Ubuntu, first install the +packages egui needs: `libxcb-render0-dev libxcb-shape0-dev +libxcb-xfixes0-dev libxkbcommon-dev libssl-dev`. + +## Keys + +The keys are µVision's, with the TUI's as aliases: + +| Key | Action | +| --- | --- | +| F7 | build target (also writes `.lst` and `.hex` next to a saved file) | +| Ctrl-F5 / F4 | start / stop the debug session | +| F5 | run / stop | +| F11 / F10 | step into / step over | +| Ctrl-F11 / F12 | step out | +| Ctrl-F10 / F8 | run to the cursor line | +| F9 / Ctrl-Shift-F9 | toggle breakpoint / remove all breakpoints | +| F6 | reset the CPU | +| Ctrl-N / Ctrl-O / Ctrl-S / Ctrl-W | new / open / save / close | +| Ctrl-F | find | +| F1 | all shortcuts | + +Click the gutter to toggle a breakpoint, double-click a byte in Memory to +change it, click a pin in Ports to hold it low from outside, and click the +bit chips in Registers, Timers and Interrupts to flip SFR bits. Files can be +dropped onto the window. + +## Terminal version + +`bench51` is the same IDE in a terminal, the way `emacs -nw` is Emacs +without a window. It has the editor, listing, HEX and error views, and a +debug screen with registers, peripherals, memory, ports and the UART. The +same binary also assembles headlessly, which is handy in scripts and +Makefiles. + +![The TUI debugging serial_hello.asm: source, registers, peripherals, IRAM and the UART console](docs/screenshots/debug_serial.png) + + + + + + + + + + + + + + + + + + +
Editor with the assembled Keil-style listingStopped at a breakpoint inside the timer 0 ISR, SFR view
Editor + assembled listingBreakpoint inside a timer ISR, SFR view
Assembler errors marked in the gutter and listed in the Errors tabIntel HEX output tab
Assembler errors in the gutter and Errors tabIntel HEX output
+ ```bash cargo install --path . # installs the `bench51` binary @@ -81,7 +182,7 @@ cargo run --release -- --assemble prog.asm -o out.hex --lst out.lst `--clock ` sets the oscillator frequency used for the elapsed-time display (default 11.0592). -## Keys +### Terminal keys | Key | Action | | --- | --- | @@ -100,7 +201,8 @@ cargo run --release -- --assemble prog.asm -o out.hex --lst out.lst Edit mode: `Alt-1/2/3` switch between Listing, HEX and Errors; `Alt-↑/↓`, `Alt-PgUp/PgDn` scroll them. The editor uses Emacs-style keys -(`Ctrl-U` undo, `Ctrl-R` redo, `Ctrl-Y` paste). +(`Ctrl-U` undo, `Ctrl-R` redo, `Ctrl-Y` paste), or press Ctrl-G to edit in +your own `$EDITOR` (vim, nvim, nano, …). Debug mode: `Tab` cycles focus between Source, Memory, Ports and Serial. Letter shortcuts work too, for terminals that swallow function keys: @@ -133,10 +235,16 @@ Letter shortcuts work too, for terminals that swallow function keys: ## Development ```bash -cargo test # assembler, CPU, peripheral and example-program tests -cargo clippy +cargo test --workspace # assembler, CPU, peripheral, session and example-program tests +cargo clippy --workspace --all-targets ``` -Code layout: `src/isa.rs` (opcode table shared by everything), `src/asm/` -(assembler, listing, Intel HEX), `src/sim/` (CPU, peripherals, disassembler), -`src/ui/` (ratatui front end). +Code layout: + +- `crates/bench51-gui/` is the `bench51-gui` desktop app (egui). +- `src/` is the `bench51` terminal app (ratatui), including headless + assembly. +- `crates/bench51-core/`, shared by both: `isa.rs` (opcode table), `asm/` + (assembler, listing, Intel HEX), `sim/` (CPU, peripherals, disassembler), + `session.rs` (build, run, step and breakpoints), `syntax.rs` + (highlighting tokens), `files.rs` (HEX loading) diff --git a/crates/bench51-core/Cargo.toml b/crates/bench51-core/Cargo.toml new file mode 100644 index 0000000..a50fcde --- /dev/null +++ b/crates/bench51-core/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "bench51-core" +version.workspace = true +edition.workspace = true +description = "Intel 8051 assembler, simulator and debugger session shared by the bench51 front ends" + +[dependencies] + +[lints] +workspace = true diff --git a/src/asm/expr.rs b/crates/bench51-core/src/asm/expr.rs similarity index 100% rename from src/asm/expr.rs rename to crates/bench51-core/src/asm/expr.rs diff --git a/src/asm/hex.rs b/crates/bench51-core/src/asm/hex.rs similarity index 100% rename from src/asm/hex.rs rename to crates/bench51-core/src/asm/hex.rs diff --git a/src/asm/lexer.rs b/crates/bench51-core/src/asm/lexer.rs similarity index 100% rename from src/asm/lexer.rs rename to crates/bench51-core/src/asm/lexer.rs diff --git a/src/asm/listing.rs b/crates/bench51-core/src/asm/listing.rs similarity index 100% rename from src/asm/listing.rs rename to crates/bench51-core/src/asm/listing.rs diff --git a/src/asm/mod.rs b/crates/bench51-core/src/asm/mod.rs similarity index 100% rename from src/asm/mod.rs rename to crates/bench51-core/src/asm/mod.rs diff --git a/crates/bench51-core/src/files.rs b/crates/bench51-core/src/files.rs new file mode 100644 index 0000000..e1fcff7 --- /dev/null +++ b/crates/bench51-core/src/files.rs @@ -0,0 +1,95 @@ +//! Loading programs: assembly sources as they are, Intel HEX images as +//! disassembled source. + +use std::path::Path; + +use crate::asm::hex; +use crate::sfr::{hex8, hex16}; +use crate::sim::disasm; + +pub enum Loaded { + Source(String), + /// A HEX image turned into source that reassembles to the same bytes. + Hex { + source: String, + bytes: usize, + }, +} + +pub fn is_hex_path(path: &Path) -> bool { + path.extension() + .is_some_and(|e| e.eq_ignore_ascii_case("hex") || e.eq_ignore_ascii_case("ihx")) +} + +/// Reads `path`. Errors are ready to show to the user. +pub fn load(path: &Path) -> Result { + let text = std::fs::read_to_string(path) + .map_err(|e| format!("cannot open {}: {e}", path.display()))?; + if !is_hex_path(path) { + return Ok(Loaded::Source(text)); + } + let bytes = hex::read(&text).map_err(|e| format!("invalid HEX file: {e}"))?; + Ok(Loaded::Hex { + source: disassemble_image(&bytes, path), + bytes: bytes.len(), + }) +} + +/// Builds an assembler source from a HEX image by disassembling each +/// contiguous run of bytes. Reassembling it reproduces the image exactly. +pub fn disassemble_image(bytes: &[(u16, u8)], path: &Path) -> String { + let mut code = Box::new([0u8; 0x10000]); + let mut used = vec![false; 0x10000]; + for &(a, b) in bytes { + code[a as usize] = b; + used[a as usize] = true; + } + let mut src = format!("; disassembled from {}\n", path.display()); + let mut addr = 0usize; + while addr < 0x10000 { + if !used[addr] { + addr += 1; + continue; + } + src.push_str(&format!("\n ORG {}\n", hex16(addr as u16))); + while addr < 0x10000 && used[addr] { + let d = disasm::disassemble(&code, addr as u16); + let size = d.size as usize; + if (addr..addr + size).all(|a| a < 0x10000 && used[a]) { + src.push_str(&format!(" {:<24}; {:04X}\n", d.text, addr)); + addr += size; + } else { + src.push_str(&format!( + " DB {:<21}; {:04X}\n", + hex8(code[addr]), + addr + )); + addr += 1; + } + } + } + src.push_str(" END\n"); + src +} + +#[cfg(test)] +mod tests { + use std::path::Path; + + use crate::asm::{assemble, hex}; + + #[test] + fn hex_disassembly_reassembles_to_the_same_image() { + let out = assemble(include_str!("../../../examples/serial_hello.asm")); + assert!(out.ok()); + let image = hex::read(&out.intel_hex()).unwrap(); + let src = super::disassemble_image(&image, Path::new("x.hex")); + let again = assemble(&src); + assert!(again.ok(), "{:?}", again.diagnostics); + let mut a: Vec<_> = out.bytes().collect(); + let mut b: Vec<_> = again.bytes().collect(); + a.sort(); + b.sort(); + assert_eq!(a, b); + } +} diff --git a/src/isa.rs b/crates/bench51-core/src/isa.rs similarity index 99% rename from src/isa.rs rename to crates/bench51-core/src/isa.rs index c2dd8da..22a5f96 100644 --- a/src/isa.rs +++ b/crates/bench51-core/src/isa.rs @@ -28,7 +28,7 @@ pub enum Operand { impl Operand { /// Bytes this operand occupies after the opcode byte. - pub fn len(self) -> u8 { + pub(crate) fn len(self) -> u8 { match self { Operand::Imm8 | Operand::Direct | Operand::Bit | Operand::NotBit => 1, Operand::Addr11 | Operand::Rel => 1, diff --git a/crates/bench51-core/src/lib.rs b/crates/bench51-core/src/lib.rs new file mode 100644 index 0000000..5af8514 --- /dev/null +++ b/crates/bench51-core/src/lib.rs @@ -0,0 +1,10 @@ +//! Intel 8051 assembler, simulator and debugger session shared by the +//! bench51 front ends (the `bench51` TUI and the `bench51-gui` desktop app). + +pub mod asm; +pub mod files; +pub mod isa; +pub mod session; +pub mod sfr; +pub mod sim; +pub mod syntax; diff --git a/crates/bench51-core/src/session.rs b/crates/bench51-core/src/session.rs new file mode 100644 index 0000000..912204b --- /dev/null +++ b/crates/bench51-core/src/session.rs @@ -0,0 +1,417 @@ +//! A debugging session: the simulator, the program loaded into it, +//! breakpoints and run state. Front ends own the source text and decide +//! when to build; everything else about running a program lives here. + +use std::collections::{HashMap, HashSet}; +use std::path::Path; + +use crate::asm::{self, AsmOutput, Diagnostic}; +use crate::sim::{Sim, Stop}; + +/// Result of the last successful assembly, which the simulator runs. +pub struct Build { + pub source: Vec, + pub out: AsmOutput, + pub addr_to_line: HashMap, +} + +impl Build { + /// First address emitted by `line`, if any. + pub fn line_addr(&self, line: usize) -> Option { + self.out + .lines + .get(line) + .filter(|l| !l.bytes.is_empty()) + .and_then(|l| l.addr) + } +} + +/// Instructions executed per tick (one tick ≈ 33 ms) for each speed setting. +pub const SPEEDS: [u32; 8] = [1, 5, 25, 100, 500, 2_000, 10_000, 40_000]; + +/// Instruction budget for step over / step out / run to cursor. +const STEP_BUDGET: u32 = 5_000_000; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum MemSpace { + Iram, + Sfr, + Xram, + Code, +} + +impl MemSpace { + pub const ALL: [MemSpace; 4] = [ + MemSpace::Iram, + MemSpace::Sfr, + MemSpace::Xram, + MemSpace::Code, + ]; + + pub fn name(self) -> &'static str { + match self { + MemSpace::Iram => "IRAM", + MemSpace::Sfr => "SFR", + MemSpace::Xram => "XRAM", + MemSpace::Code => "CODE", + } + } +} + +pub struct Session { + pub sim: Sim, + /// Last assembler result, even if it had errors (for diagnostics). + pub last_asm: Option<(String, AsmOutput)>, + /// Last error-free build, loaded into the simulator. + pub build: Option, + /// Breakpoints by source line. + pub breakpoints: HashSet, + pub running: bool, + /// The next run chunk starts a fresh run and may leave a breakpoint. + resume: bool, + /// Index into `SPEEDS`. + pub speed: usize, + pub clock_mhz: f64, + /// Memory before the last step or run chunk, to highlight changes. + pub prev_iram: [u8; 256], + pub prev_sfr: [u8; 128], + /// Outcome of the last command, for the status line. + pub status: String, +} + +impl Session { + pub fn new(clock_mhz: f64) -> Self { + Self { + sim: Sim::new(), + last_asm: None, + build: None, + breakpoints: HashSet::new(), + running: false, + resume: false, + speed: 5, + clock_mhz, + prev_iram: [0; 256], + prev_sfr: [0; 128], + status: String::new(), + } + } + + /// Forgets the program and breakpoints, for a newly loaded source. + pub fn clear(&mut self) { + self.breakpoints.clear(); + self.build = None; + self.last_asm = None; + self.running = false; + } + + /// Whether `lines` differ from the source the simulator is running. + pub fn is_stale<'a>(&self, lines: impl IntoIterator) -> bool { + self.build + .as_ref() + .is_none_or(|b| !b.source.iter().map(String::as_str).eq(lines)) + } + + /// Diagnostics of the last assembly, if it was of exactly `source`. + pub fn diagnostics_for(&self, source: &str) -> &[Diagnostic] { + match &self.last_asm { + Some((src, out)) if src == source => &out.diagnostics, + _ => &[], + } + } + + // ---- Build ---- + + /// Assembles `source`. On success the program is loaded into a freshly + /// reset simulator and, if `path` (the saved source file) is given, + /// `.lst` and `.hex` files are written next to it. + pub fn assemble(&mut self, source: &str, path: Option<&Path>) -> bool { + let out = asm::assemble(source); + let ok = out.ok(); + if ok { + self.sim.load_code(out.bytes()); + self.sim.reset(); + self.running = false; + self.status = format!("assembled: {} bytes, 0 errors", out.code_size()); + if let Some(path) = path { + self.write_outputs(&out, source, path); + } + self.build = Some(Build { + source: source.split('\n').map(String::from).collect(), + addr_to_line: out.addr_to_line(), + out: out.clone(), + }); + self.snapshot(); + } else { + let first = &out.diagnostics[0]; + self.status = format!( + "{} error(s); line {}: {}", + out.diagnostics.len(), + first.line + 1, + first.msg + ); + } + self.last_asm = Some((source.to_string(), out)); + ok + } + + /// Makes sure a build of `source` is loaded; returns false on errors. + pub fn ensure_built(&mut self, source: &str, path: Option<&Path>) -> bool { + !self.is_stale(source.split('\n')) || self.assemble(source, path) + } + + fn write_outputs(&mut self, out: &AsmOutput, source: &str, path: &Path) { + let res = std::fs::write(path.with_extension("lst"), out.listing(source)) + .and_then(|_| std::fs::write(path.with_extension("hex"), out.intel_hex())); + if let Err(e) = res { + self.status = format!("assembled, but writing .lst/.hex failed: {e}"); + } + } + + // ---- Breakpoints ---- + + pub fn toggle_breakpoint(&mut self, line: usize) { + if !self.breakpoints.remove(&line) { + self.breakpoints.insert(line); + } + } + + pub fn bp_addrs(&self) -> HashSet { + let Some(b) = &self.build else { + return HashSet::new(); + }; + self.breakpoints + .iter() + .filter_map(|&l| b.line_addr(l)) + .collect() + } + + // ---- Execution ---- + + pub fn snapshot(&mut self) { + self.prev_iram = self.sim.iram; + self.prev_sfr = self.sim.sfr; + } + + /// Source line of the instruction at the PC. + pub fn pc_line(&self) -> Option { + self.build.as_ref()?.addr_to_line.get(&self.sim.pc).copied() + } + + /// Stops running and describes why in `status`. + pub fn report(&mut self, stop: Stop) { + self.running = false; + self.status = match stop { + Stop::Breakpoint(pc) => format!("breakpoint at {pc:04X}h"), + Stop::ReservedOpcode { pc, opcode } => { + format!("reserved opcode {opcode:02X}h at {pc:04X}h — stopped") + } + Stop::PowerDown => "CPU in power-down mode (PCON.PD) — reset to continue".into(), + Stop::Target | Stop::Budget => format!("stopped at {:04X}h", self.sim.pc), + }; + } + + fn step_with(&mut self, f: impl FnOnce(&mut Sim, &HashSet) -> Stop) { + self.running = false; + self.snapshot(); + let bps = self.bp_addrs(); + match f(&mut self.sim, &bps) { + Stop::Target => self.status = format!("PC = {:04X}h", self.sim.pc), + s => self.report(s), + } + } + + pub fn step_into(&mut self) { + self.step_with(|s, _| match s.step() { + Ok(()) => Stop::Target, + Err(e) => e, + }); + } + + pub fn step_over(&mut self) { + self.step_with(|s, b| s.step_over(STEP_BUDGET, b)); + } + + pub fn step_out(&mut self) { + self.step_with(|s, b| s.step_out(STEP_BUDGET, b)); + } + + /// Runs until the first instruction of `line`, or a breakpoint. + /// Returns false if the line holds no code. + pub fn run_to_line(&mut self, line: usize) -> bool { + let Some(target) = self.build.as_ref().and_then(|b| b.line_addr(line)) else { + self.status = "no code on that line".into(); + return false; + }; + self.step_with(|s, bps| { + let mut bps = bps.clone(); + bps.insert(target); + match s.run(STEP_BUDGET, &bps, true) { + Stop::Breakpoint(pc) if pc == target => Stop::Target, + other => other, + } + }); + true + } + + /// Starts free running; `tick` then advances the program. Needs a build. + pub fn start(&mut self) { + if self.build.is_none() { + return; + } + self.running = true; + self.resume = true; + self.status = "running…".into(); + } + + pub fn pause(&mut self) { + self.running = false; + self.status = format!("paused at {:04X}h", self.sim.pc); + } + + /// Runs one chunk of `SPEEDS[speed]` instructions if running. Front ends + /// call this every ~33 ms. + pub fn tick(&mut self) { + if !self.running { + return; + } + self.snapshot(); + let bps = self.bp_addrs(); + let resume = std::mem::take(&mut self.resume); + match self.sim.run(SPEEDS[self.speed], &bps, resume) { + Stop::Budget => {} + s => self.report(s), + } + } + + pub fn reset(&mut self) { + self.sim.reset(); + self.running = false; + self.snapshot(); + self.status = "reset".into(); + } + + /// Writes `value` at `addr` in `space`. Returns false if out of range. + pub fn poke(&mut self, space: MemSpace, addr: u32, value: u8) -> bool { + let ok = match space { + MemSpace::Iram if addr <= 0xFF => { + self.sim.iram[addr as usize] = value; + true + } + MemSpace::Sfr if (0x80..=0xFF).contains(&addr) => { + self.sim.set_sfr(addr as u8, value); + true + } + MemSpace::Xram if addr <= 0xFFFF => { + self.sim.xram[addr as usize] = value; + true + } + MemSpace::Code if addr <= 0xFFFF => { + self.sim.code[addr as usize] = value; + true + } + _ => false, + }; + self.status = if ok { + format!("wrote {value:02X}h at {addr:X}h") + } else { + "address out of range".into() + }; + ok + } + + /// Simulated time since reset at `clock_mhz` (12 clocks per machine cycle). + pub fn elapsed(&self) -> String { + let micros = self.sim.cycles as f64 * 12.0 / self.clock_mhz; + if micros >= 1_000_000.0 { + format!("{:.3} s", micros / 1e6) + } else if micros >= 1000.0 { + format!("{:.3} ms", micros / 1e3) + } else { + format!("{micros:.2} µs") + } + } +} + +/// Name of the interrupt source served at vector `v`. +pub fn vector_name(v: u16) -> &'static str { + match v { + 0x03 => "INT0", + 0x0B => "T0", + 0x13 => "INT1", + 0x1B => "T1", + 0x23 => "UART", + _ => "?", + } +} + +#[cfg(test)] +mod tests { + use super::{MemSpace, Session}; + + const PROG: &str = "\ + ORG 0 + LJMP main + ORG 30h +main: MOV R0,#0 +loop: ACALL bump + SJMP loop +bump: INC R0 + NOP + RET + END"; + + fn session() -> Session { + let mut s = Session::new(12.0); + assert!(s.assemble(PROG, None), "{}", s.status); + s + } + + #[test] + fn breakpoints_steps_and_run_to_line() { + let mut s = session(); + s.toggle_breakpoint(6); // bump: INC R0 + s.start(); + s.tick(); + assert!(!s.running); + assert_eq!(s.pc_line(), Some(6)); + assert_eq!(s.status, format!("breakpoint at {:04X}h", s.sim.pc)); + + s.step_into(); // INC R0 + assert_eq!(s.sim.reg(0), 1); + assert_eq!(s.pc_line(), Some(7)); + s.step_out(); // back after ACALL + assert_eq!(s.pc_line(), Some(5)); + + s.toggle_breakpoint(6); + s.step_into(); // SJMP loop + assert_eq!(s.pc_line(), Some(4)); + s.step_over(); // whole call + assert_eq!((s.pc_line(), s.sim.reg(0)), (Some(5), 2)); + + assert!(s.run_to_line(7)); + assert_eq!((s.pc_line(), s.sim.reg(0)), (Some(7), 3)); + assert!(!s.run_to_line(0)); // ORG: no code + } + + #[test] + fn staleness_errors_and_poke() { + let mut s = session(); + assert!(!s.is_stale(PROG.split('\n'))); + let edited = PROG.replace("NOP", "NOP\n NOP"); + assert!(s.is_stale(edited.split('\n'))); + assert!(s.ensure_built(&edited, None)); + assert!(!s.is_stale(edited.split('\n'))); + + let bad = " MOV A,\n FOO\n"; + assert!(!s.assemble(bad, None)); + assert_eq!(s.diagnostics_for(bad).len(), 2); + assert!(s.diagnostics_for(PROG).is_empty()); + assert!(s.build.is_some(), "a failed build keeps the last good one"); + + assert!(s.poke(MemSpace::Iram, 0x30, 0xAB)); + assert_eq!(s.sim.iram[0x30], 0xAB); + assert!(s.poke(MemSpace::Sfr, 0x90, 0x0F)); + assert!(!s.poke(MemSpace::Sfr, 0x20, 1)); + assert_eq!(s.status, "address out of range"); + } +} diff --git a/src/sfr.rs b/crates/bench51-core/src/sfr.rs similarity index 100% rename from src/sfr.rs rename to crates/bench51-core/src/sfr.rs diff --git a/src/sim/cpu.rs b/crates/bench51-core/src/sim/cpu.rs similarity index 100% rename from src/sim/cpu.rs rename to crates/bench51-core/src/sim/cpu.rs diff --git a/src/sim/disasm.rs b/crates/bench51-core/src/sim/disasm.rs similarity index 100% rename from src/sim/disasm.rs rename to crates/bench51-core/src/sim/disasm.rs diff --git a/src/sim/mod.rs b/crates/bench51-core/src/sim/mod.rs similarity index 96% rename from src/sim/mod.rs rename to crates/bench51-core/src/sim/mod.rs index b8f734f..a990368 100644 --- a/src/sim/mod.rs +++ b/crates/bench51-core/src/sim/mod.rs @@ -385,7 +385,7 @@ mod example_tests { #[test] fn serial_hello_greets_and_echoes() { - let mut s = load(include_str!("../../examples/serial_hello.asm")); + let mut s = load(include_str!("../../../../examples/serial_hello.asm")); steps(&mut s, 60_000); assert_eq!( String::from_utf8_lossy(&s.uart.tx_log), @@ -398,7 +398,7 @@ mod example_tests { #[test] fn timer_irq_ticks() { - let mut s = load(include_str!("../../examples/timer_irq.asm")); + let mut s = load(include_str!("../../../../examples/timer_irq.asm")); steps(&mut s, 5_000); // ~10000 cycles at one interrupt per 1000 cycles. assert!((3..=10).contains(&s.reg(7)), "R7 = {}", s.reg(7)); @@ -406,7 +406,7 @@ mod example_tests { #[test] fn button_counts_edges_while_idle() { - let mut s = load(include_str!("../../examples/button_int0.asm")); + let mut s = load(include_str!("../../../../examples/button_int0.asm")); steps(&mut s, 20); assert!(s.idle); for _ in 0..3 { @@ -420,10 +420,10 @@ mod example_tests { #[test] fn bcd_and_lookup() { - let mut s = load(include_str!("../../examples/bcd_add.asm")); + let mut s = load(include_str!("../../../../examples/bcd_add.asm")); steps(&mut s, 20); assert_eq!((s.iram[0x31], s.iram[0x30]), (0x69, 0x12)); - let mut s = load(include_str!("../../examples/lookup_movc.asm")); + let mut s = load(include_str!("../../../../examples/lookup_movc.asm")); steps(&mut s, 3 + 4 * 5 + 3); // setup, digits 0-3, then up to MOV P2,A assert_eq!(s.sfr(crate::sfr::P2), 0x66); // digit 4 } diff --git a/src/sim/periph.rs b/crates/bench51-core/src/sim/periph.rs similarity index 100% rename from src/sim/periph.rs rename to crates/bench51-core/src/sim/periph.rs diff --git a/crates/bench51-core/src/syntax.rs b/crates/bench51-core/src/syntax.rs new file mode 100644 index 0000000..2e7b37e --- /dev/null +++ b/crates/bench51-core/src/syntax.rs @@ -0,0 +1,192 @@ +//! Minimal 8051 assembly tokenizer for syntax highlighting. + +use std::ops::Range; + +use crate::{isa, sfr}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Tok { + /// Whitespace, punctuation and identifiers without a special meaning. + Plain, + Comment, + Str, + /// A label definition (`name:` at the start of a line). + Label, + Mnemonic, + /// Directives and expression operators (`ORG`, `DB`, `HIGH`, `MOD`, …). + Directive, + Register, + /// Predefined SFR and bit names. + Sfr, + Number, +} + +fn is_directive(w: &str) -> bool { + matches!( + w, + "ORG" + | "DB" + | "DW" + | "DS" + | "END" + | "EQU" + | "SET" + | "BIT" + | "DATA" + | "IDATA" + | "XDATA" + | "CODE" + | "CSEG" + | "XSEG" + | "DSEG" + | "AT" + | "USING" + | "NAME" + | "BYTE" + | "WORD" + ) +} + +fn word_kind(w: &str, first_word: bool) -> Tok { + let u = w.to_ascii_uppercase(); + let reg = matches!(u.as_str(), "A" | "AB" | "C" | "DPTR" | "PC") + || (u.len() == 2 + && u.starts_with('R') + && u.as_bytes()[1].is_ascii_digit() + && u.as_bytes()[1] < b'8'); + if reg { + Tok::Register + } else if is_directive(&u) { + Tok::Directive + } else if first_word && isa::is_mnemonic(&u) { + Tok::Mnemonic + } else if sfr::SFRS.iter().chain(sfr::BITS).any(|(n, _)| *n == u) { + Tok::Sfr + } else if matches!( + u.as_str(), + "HIGH" | "LOW" | "MOD" | "AND" | "OR" | "XOR" | "NOT" | "SHL" | "SHR" + ) { + Tok::Directive + } else { + Tok::Plain + } +} + +/// Splits a source line into classified byte ranges that together cover +/// the whole line. +pub fn tokens(line: &str) -> Vec<(Range, Tok)> { + let b = line.as_bytes(); + let n = b.len(); + let mut out = Vec::new(); + let mut i = 0; + let mut seen_word = false; + while i < n { + let c = b[i]; + let start = i; + let tok = if c == b';' { + i = n; + Tok::Comment + } else if c == b'\'' || c == b'"' { + i += 1; + while i < n && b[i] != c { + i += 1; + } + i = (i + 1).min(n); + Tok::Str + } else if c.is_ascii_alphabetic() || c == b'_' || c == b'?' { + while i < n && (b[i].is_ascii_alphanumeric() || b[i] == b'_' || b[i] == b'?') { + i += 1; + } + if !seen_word && b.get(i) == Some(&b':') { + Tok::Label + } else { + let t = word_kind(&line[start..i], !seen_word); + seen_word = true; + t + } + } else if c.is_ascii_digit() || c == b'#' || c == b'$' { + i += 1; + while i < n && b[i].is_ascii_alphanumeric() { + i += 1; + } + Tok::Number + } else { + // Non-ASCII bytes land here too, so ranges stay on char boundaries. + while i < n && !(b[i].is_ascii_alphanumeric() || b"_?;'\"#$".contains(&b[i])) { + i += 1; + } + Tok::Plain + }; + out.push((start..i, tok)); + } + out +} + +#[cfg(test)] +mod tests { + use super::{Tok, tokens}; + + fn kinds(line: &str) -> Vec<(&str, Tok)> { + tokens(line) + .into_iter() + .filter(|(_, t)| *t != Tok::Plain) + .map(|(r, t)| (&line[r], t)) + .collect() + } + + #[test] + fn classifies_an_instruction_line() { + assert_eq!( + kinds("main: MOV TMOD,#20h ; timer 1"), + vec![ + ("main", Tok::Label), + ("MOV", Tok::Mnemonic), + ("TMOD", Tok::Sfr), + ("#20h", Tok::Number), + ("; timer 1", Tok::Comment), + ] + ); + assert_eq!( + kinds(" mov a,r7"), + vec![ + ("mov", Tok::Mnemonic), + ("a", Tok::Register), + ("r7", Tok::Register) + ] + ); + } + + #[test] + fn directives_strings_and_operators() { + assert_eq!( + kinds("msg: DB \"Hi; there\", HIGH(x) ; c"), + vec![ + ("msg", Tok::Label), + ("DB", Tok::Directive), + ("\"Hi; there\"", Tok::Str), + ("HIGH", Tok::Directive), + ("; c", Tok::Comment), + ] + ); + } + + #[test] + fn ranges_cover_the_line_even_with_unicode() { + for line in [ + "", + " ", + "x DB 'é', 1 ; µs → ok", + "\"unterminated", + "€€ MOV", + ] { + let t = tokens(line); + let mut pos = 0; + for (r, _) in &t { + assert_eq!(r.start, pos, "{line:?}"); + assert!(line.is_char_boundary(r.end)); + pos = r.end; + } + assert_eq!(pos, line.len()); + } + } +} diff --git a/crates/bench51-gui/Cargo.toml b/crates/bench51-gui/Cargo.toml new file mode 100644 index 0000000..5c27ddb --- /dev/null +++ b/crates/bench51-gui/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "bench51-gui" +version.workspace = true +edition.workspace = true +description = "A Keil µVision-style desktop IDE for the Intel 8051, built on bench51" + +[dependencies] +bench51-core.workspace = true +clap.workspace = true +eframe = { version = "0.37", default-features = false, features = [ + "accesskit", + "clipboard", + "default_fonts", + "persistence", + "wayland", + "wgpu", + "x11", +] } +egui_tiles = { version = "0.18", features = ["serde"] } +rfd = "0.17" +serde = { version = "1", features = ["derive"] } + +[lints] +workspace = true diff --git a/crates/bench51-gui/assets/bench51-gui.desktop b/crates/bench51-gui/assets/bench51-gui.desktop new file mode 100644 index 0000000..7da85ab --- /dev/null +++ b/crates/bench51-gui/assets/bench51-gui.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=bench51 +GenericName=8051 IDE +Comment=Intel 8051 assembler, simulator and debugger +Exec=bench51-gui %F +Icon=bench51-gui +Terminal=false +Categories=Development;IDE;Electronics; +Keywords=8051;8052;MCS-51;assembler;simulator;debugger;keil;microcontroller; +MimeType=text/x-asm; +StartupWMClass=bench51-gui diff --git a/crates/bench51-gui/assets/bench51-gui.svg b/crates/bench51-gui/assets/bench51-gui.svg new file mode 100644 index 0000000..570177b --- /dev/null +++ b/crates/bench51-gui/assets/bench51-gui.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/crates/bench51-gui/assets/fonts/Doto[ROND,wght].ttf b/crates/bench51-gui/assets/fonts/Doto[ROND,wght].ttf new file mode 100644 index 0000000..ed8f0db Binary files /dev/null and b/crates/bench51-gui/assets/fonts/Doto[ROND,wght].ttf differ diff --git a/crates/bench51-gui/assets/fonts/OFL-Doto.txt b/crates/bench51-gui/assets/fonts/OFL-Doto.txt new file mode 100644 index 0000000..e0b8ec1 --- /dev/null +++ b/crates/bench51-gui/assets/fonts/OFL-Doto.txt @@ -0,0 +1,93 @@ +Copyright 2024 The Doto Project Authors (https://github.com/oliverlalan/Doto) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/crates/bench51-gui/assets/fonts/OFL-SpaceGrotesk.txt b/crates/bench51-gui/assets/fonts/OFL-SpaceGrotesk.txt new file mode 100644 index 0000000..cb512b9 --- /dev/null +++ b/crates/bench51-gui/assets/fonts/OFL-SpaceGrotesk.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Space Grotesk Project Authors (https://github.com/floriankarsten/space-grotesk) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/crates/bench51-gui/assets/fonts/OFL-SpaceMono.txt b/crates/bench51-gui/assets/fonts/OFL-SpaceMono.txt new file mode 100644 index 0000000..a72b0a7 --- /dev/null +++ b/crates/bench51-gui/assets/fonts/OFL-SpaceMono.txt @@ -0,0 +1,93 @@ +Copyright 2016 The Space Mono Project Authors (https://github.com/googlefonts/spacemono) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/crates/bench51-gui/assets/fonts/SpaceGrotesk-Medium.ttf b/crates/bench51-gui/assets/fonts/SpaceGrotesk-Medium.ttf new file mode 100644 index 0000000..341b633 Binary files /dev/null and b/crates/bench51-gui/assets/fonts/SpaceGrotesk-Medium.ttf differ diff --git a/crates/bench51-gui/assets/fonts/SpaceGrotesk-Regular.ttf b/crates/bench51-gui/assets/fonts/SpaceGrotesk-Regular.ttf new file mode 100644 index 0000000..46aa5da Binary files /dev/null and b/crates/bench51-gui/assets/fonts/SpaceGrotesk-Regular.ttf differ diff --git a/crates/bench51-gui/assets/fonts/SpaceMono-Bold.ttf b/crates/bench51-gui/assets/fonts/SpaceMono-Bold.ttf new file mode 100644 index 0000000..2c4f268 Binary files /dev/null and b/crates/bench51-gui/assets/fonts/SpaceMono-Bold.ttf differ diff --git a/crates/bench51-gui/assets/fonts/SpaceMono-Regular.ttf b/crates/bench51-gui/assets/fonts/SpaceMono-Regular.ttf new file mode 100644 index 0000000..1cfa365 Binary files /dev/null and b/crates/bench51-gui/assets/fonts/SpaceMono-Regular.ttf differ diff --git a/crates/bench51-gui/src/app.rs b/crates/bench51-gui/src/app.rs new file mode 100644 index 0000000..43c9f17 --- /dev/null +++ b/crates/bench51-gui/src/app.rs @@ -0,0 +1,661 @@ +//! The application: window chrome around a tree of docked panes, the run +//! loop, file handling, and every action the UI can ask for. + +use std::path::{Path, PathBuf}; + +use bench51_core::files::{self, Loaded}; +use eframe::egui::{ + self, CentralPanel, Context, Key, Modifiers, Panel, Shape, ThemePreference, Ui, ViewportCommand, +}; +use egui_tiles::Tree; + +use crate::layout::{self, Pane, PaneBehavior}; +use crate::state::{Action, BuildTab, LogKind, LogLine, Modal, Mode, Prefs, State, ThemePref}; +use crate::theme::{self, palette}; +use crate::{chrome, modals}; + +/// One simulation chunk, as in the TUI's frame loop. +const TICK: f64 = 1.0 / 30.0; + +const SOURCE_EXTENSIONS: [&str; 4] = ["asm", "a51", "s", "src"]; +const HEX_EXTENSIONS: [&str; 2] = ["hex", "ihx"]; + +const TEMPLATE: &str = "\ +; New 8051 program. F7 builds, Ctrl+F5 starts debugging, F11 steps. + ORG 0000h + LJMP main + + ORG 0030h +main: MOV A,#01h ; walking LED pattern on P1 +loop: MOV P1,A + RL A + SJMP loop + + END +"; + +pub struct GuiApp { + st: State, + edit_tree: Tree, + debug_tree: Tree, + last_time: Option, + tick_debt: f64, + /// The user confirmed quitting with unsaved changes. + allow_close: bool, + title: String, +} + +fn theme_preference(t: ThemePref) -> ThemePreference { + match t { + ThemePref::System => ThemePreference::System, + ThemePref::Dark => ThemePreference::Dark, + ThemePref::Light => ThemePreference::Light, + } +} + +fn load_tree( + cc: &eframe::CreationContext<'_>, + key: &str, + default: fn() -> Tree, +) -> Tree { + let mut tree = cc + .storage + .and_then(|s| eframe::get_value::>(s, key)) + .filter(|t| t.tiles.find_pane(&Pane::Editor).is_some()) + .unwrap_or_else(default); + // Panes added in newer versions are simply missing; nothing to fix up. + if tree.root.is_none() { + tree = default(); + } + tree +} + +impl GuiApp { + pub fn new( + cc: &eframe::CreationContext<'_>, + files: Vec, + clock: Option, + theme: Option, + ) -> Self { + let ctx = &cc.egui_ctx; + theme::install(ctx); + let mut prefs: Prefs = cc + .storage + .and_then(|s| eframe::get_value(s, "prefs")) + .unwrap_or_default(); + if let Some(c) = clock { + prefs.clock_mhz = c; + } + if let Some(t) = theme { + prefs.theme = t; + } + prefs.speed = prefs.speed.min(bench51_core::session::SPEEDS.len() - 1); + ctx.set_theme(theme_preference(prefs.theme)); + ctx.set_zoom_factor(prefs.zoom.clamp(0.5, 3.0)); + let mut app = Self { + st: State::new(prefs), + edit_tree: load_tree(cc, "edit_layout", layout::edit_tree), + debug_tree: load_tree(cc, "debug_layout", layout::debug_tree), + last_time: None, + tick_debt: 0.0, + allow_close: false, + title: String::new(), + }; + for f in files { + app.open_path(&f); + } + app + } + + fn tree(&mut self) -> &mut Tree { + match self.st.mode { + Mode::Edit => &mut self.edit_tree, + Mode::Debug => &mut self.debug_tree, + } + } + + // ---- Input ---- + + fn shortcuts(&mut self, ctx: &Context) { + if self.st.modal.is_some() { + return; + } + let cmd = Modifiers::COMMAND; + let cmd_shift = Modifiers::COMMAND | Modifiers::SHIFT; + let none = Modifiers::NONE; + let running = self.st.running(); + let active = self.st.active; + // Most specific first: `consume_key` ignores extra Shift. + let table: [(Modifiers, Key, Action); 25] = [ + (cmd_shift, Key::S, Action::SaveAs), + (cmd, Key::S, Action::Save), + (none, Key::F2, Action::Save), + (cmd, Key::N, Action::New), + (cmd, Key::O, Action::Open), + (cmd, Key::W, Action::Close(active)), + (cmd, Key::Q, Action::Quit), + (cmd, Key::F, Action::Find), + (none, Key::F1, Action::Modal(Modal::Shortcuts)), + (none, Key::F7, Action::Build), + (cmd, Key::F5, Action::ToggleDebug), + (none, Key::F4, Action::ToggleDebug), + (none, Key::F5, Action::RunPause), + (cmd, Key::F11, Action::StepOut), + (none, Key::F12, Action::StepOut), + (none, Key::F11, Action::StepInto), + (cmd, Key::F10, Action::RunToCursor), + (none, Key::F10, Action::StepOver), + (none, Key::F8, Action::RunToCursor), + (cmd_shift, Key::F9, Action::ClearBreakpoints), + (none, Key::F9, Action::ToggleBreakpoint), + (none, Key::F6, Action::Reset), + (cmd, Key::Plus, Action::Zoom(0.1)), + (cmd, Key::Minus, Action::Zoom(-0.1)), + (cmd, Key::Num0, Action::ZoomReset), + ]; + ctx.input_mut(|i| { + for (mods, key, action) in table { + if i.consume_key(mods, key) { + self.st.actions.push(action); + } + } + if running && i.consume_key(none, Key::Escape) { + self.st.actions.push(Action::RunPause); + } + }); + } + + fn handle_drops(&mut self, ctx: &Context) { + let dropped: Vec = ctx.input(|i| { + i.raw + .dropped_files + .iter() + .map(|f| f.path().to_path_buf()) + .filter(|p| !p.as_os_str().is_empty()) + .collect() + }); + for path in dropped { + self.open_path(&path); + } + } + + fn handle_close(&mut self, ctx: &Context) { + if ctx.input(|i| i.viewport().close_requested()) + && !self.allow_close + && self.st.docs.iter().any(|d| d.dirty()) + { + ctx.send_viewport_cmd(ViewportCommand::CancelClose); + self.st.modal = Some(Modal::ConfirmQuit); + } + } + + /// Advances the running program in fixed 33 ms chunks of wall time. + fn pace(&mut self, ctx: &Context) { + let now = ctx.input(|i| i.time); + let dt = self.last_time.map_or(0.0, |t| now - t); + self.last_time = Some(now); + let speed = self.st.prefs.speed; + let Some(doc) = self.st.doc_mut() else { + return; + }; + doc.session.speed = speed; + if !doc.session.running { + self.tick_debt = 0.0; + return; + } + self.tick_debt = (self.tick_debt + dt).min(TICK * 3.0); + while self.tick_debt >= TICK && doc.session.running { + doc.session.tick(); + self.tick_debt -= TICK; + } + if !doc.session.running || speed <= 2 { + doc.follow_pc = true; + } + if doc.session.running { + ctx.request_repaint(); + } + } + + // ---- Files ---- + + fn open_path(&mut self, path: &Path) { + let canon = path.canonicalize().ok(); + if let Some(i) = self.st.docs.iter().position(|d| { + d.path.as_ref().and_then(|p| p.canonicalize().ok()) == canon && canon.is_some() + }) { + self.activate(i); + return; + } + // An untouched new document is replaced, as editors usually do. + if self.st.docs.len() == 1 { + let d = &self.st.docs[0]; + if d.path.is_none() && d.label.is_none() && !d.dirty() && d.text == TEMPLATE { + self.st.docs.clear(); + } + } + match files::load(path) { + Err(e) => { + self.st.log(LogKind::Error, e.clone()); + if let Some(d) = self.st.doc_mut() { + d.session.status = e; + } + } + Ok(Loaded::Source(text)) => { + self.pause_active(); + let doc = self.st.add_doc(Some(path.to_path_buf()), &text); + doc.session.status = format!("opened {}", path.display()); + self.st.prefs.add_recent(path); + self.st + .log(LogKind::Info, format!("opened {}", path.display())); + } + Ok(Loaded::Hex { source, bytes }) => { + self.pause_active(); + let name = path.file_name().map(|n| n.to_string_lossy().into_owned()); + let doc = self.st.add_doc(None, &source); + doc.label = name; + // Not saved anywhere yet: Save asks for an .asm name. + doc.saved.clear(); + self.st.prefs.add_recent(path); + self.build(); + if let Some(d) = self.st.doc_mut() { + d.session.status = format!( + "loaded {} ({bytes} bytes) and disassembled it", + path.display() + ); + } + } + } + } + + fn start_dir(&self) -> Option { + self.st + .doc() + .and_then(|d| d.path.as_ref()) + .and_then(|p| p.parent().map(Path::to_path_buf)) + .or_else(|| { + self.st + .prefs + .recent + .first() + .and_then(|p| p.parent().map(Path::to_path_buf)) + }) + .or_else(|| std::env::current_dir().ok()) + } + + fn open_dialog(&mut self) { + let mut all: Vec<&str> = SOURCE_EXTENSIONS.to_vec(); + all.extend(HEX_EXTENSIONS); + let mut dialog = rfd::FileDialog::new() + .set_title("Open") + .add_filter("8051 source or Intel HEX", &all) + .add_filter("8051 assembly", &SOURCE_EXTENSIONS) + .add_filter("Intel HEX", &HEX_EXTENSIONS) + .add_filter("All files", &["*"]); + if let Some(dir) = self.start_dir() { + dialog = dialog.set_directory(dir); + } + for path in dialog.pick_files().unwrap_or_default() { + self.open_path(&path); + } + } + + fn save(&mut self, ask: bool) { + let dir = self.start_dir(); + let Some(doc) = self.st.doc_mut() else { + return; + }; + let path = match (&doc.path, ask) { + (Some(p), false) => Some(p.clone()), + _ => { + let name = doc.name(); + let stem = name.rsplit_once('.').map_or(name.as_str(), |(s, _)| s); + let mut dialog = rfd::FileDialog::new() + .set_title("Save as") + .add_filter("8051 assembly", &SOURCE_EXTENSIONS) + .set_file_name(format!("{stem}.asm")); + if let Some(dir) = dir { + dialog = dialog.set_directory(dir); + } + dialog.save_file() + } + }; + let Some(path) = path else { + return; + }; + let mut contents = doc.text.clone(); + if !contents.ends_with('\n') { + contents.push('\n'); + } + match std::fs::write(&path, contents) { + Ok(()) => { + doc.saved = doc.text.clone(); + doc.session.status = format!("saved {}", path.display()); + doc.path = Some(path.clone()); + doc.label = None; + self.st.prefs.add_recent(&path); + } + Err(e) => { + let msg = format!("cannot save {}: {e}", path.display()); + doc.session.status = msg.clone(); + self.st.log(LogKind::Error, msg); + } + } + } + + fn close(&mut self, i: usize) { + if i >= self.st.docs.len() { + return; + } + self.st.docs.remove(i); + if self.st.active >= i && self.st.active > 0 { + self.st.active -= 1; + } + if self.st.docs.is_empty() { + self.st.mode = Mode::Edit; + self.st.active = 0; + } + } + + fn pause_active(&mut self) { + if let Some(d) = self.st.doc_mut() + && d.session.running + { + d.session.pause(); + } + } + + fn activate(&mut self, i: usize) { + if i < self.st.docs.len() && i != self.st.active { + self.pause_active(); + self.st.active = i; + } + } + + // ---- Build & debug ---- + + /// Assembles the active document and reports Keil-style in the Build + /// Output. Returns whether it built without errors. + fn build(&mut self) -> bool { + let Some(doc) = self.st.docs.get_mut(self.st.active) else { + return false; + }; + let (name, target, id) = (doc.name(), doc.target(), doc.id); + let ok = doc.session.assemble(&doc.text, doc.path.as_deref()); + let mut lines = vec![ + (LogKind::Info, format!("Build target '{target}'"), None), + (LogKind::Info, format!("assembling {name}..."), None), + ]; + let out = &doc.session.last_asm.as_ref().unwrap().1; + if ok { + lines.push(( + LogKind::Info, + format!("Program Size: code={} bytes", out.code_size()), + None, + )); + if doc.path.is_some() { + lines.push(( + LogKind::Info, + format!("creating hex file from \"{target}\"..."), + None, + )); + } + if doc.session.status.contains("failed") { + lines.push((LogKind::Error, doc.session.status.clone(), None)); + } + lines.push((LogKind::Ok, format!("\"{target}\" - 0 Error(s)"), None)); + doc.follow_pc = true; + } else { + for d in &out.diagnostics { + lines.push(( + LogKind::Error, + format!("{name}({}:{}): error: {}", d.line + 1, d.col + 1, d.msg), + Some((id, d.line, d.col)), + )); + } + lines.push(( + LogKind::Error, + format!("\"{target}\" - {} Error(s)", out.diagnostics.len()), + None, + )); + let first = &out.diagnostics[0]; + doc.goto = Some((first.line, first.col)); + } + for (kind, text, target) in lines { + self.st.log.push(LogLine { text, kind, target }); + } + self.st.log(LogKind::Info, ""); + if !ok { + self.st.mode = Mode::Edit; + self.st.build_tab = BuildTab::Messages; + layout::show_pane(&mut self.edit_tree, Pane::Build); + } + ok + } + + fn ensure_built(&mut self) -> bool { + match self.st.doc() { + None => false, + Some(d) if d.stale() => self.build(), + Some(_) => true, + } + } + + /// Runs a debugger command on the active document, building first and + /// entering the debug layout, as Keil does. + fn debug_cmd(&mut self, f: impl FnOnce(&mut bench51_core::session::Session, (usize, usize))) { + if !self.ensure_built() { + return; + } + self.st.mode = Mode::Debug; + if let Some(doc) = self.st.doc_mut() { + f(&mut doc.session, doc.cursor); + doc.follow_pc = true; + } + } + + fn apply(&mut self, ctx: &Context, action: Action) { + match action { + Action::New => { + self.pause_active(); + self.st.add_doc(None, TEMPLATE); + } + Action::Open => self.open_dialog(), + Action::OpenPath(p) => self.open_path(&p), + Action::Save => self.save(false), + Action::SaveAs => self.save(true), + Action::Close(i) => { + if self.st.docs.get(i).is_some_and(|d| d.dirty()) { + self.st.modal = Some(Modal::ConfirmClose(i)); + } else { + self.close(i); + } + } + Action::ForceClose(i) => self.close(i), + Action::Activate(i) => self.activate(i), + Action::Quit => ctx.send_viewport_cmd(ViewportCommand::Close), + Action::ForceQuit => { + self.allow_close = true; + ctx.send_viewport_cmd(ViewportCommand::Close); + } + Action::Build => { + if self.build() && self.st.mode == Mode::Edit { + self.st.build_tab = BuildTab::Messages; + } + } + Action::ToggleDebug => match self.st.mode { + Mode::Edit => { + if self.ensure_built() { + self.st.mode = Mode::Debug; + if let Some(d) = self.st.doc_mut() { + d.follow_pc = true; + } + } + } + Mode::Debug => { + self.pause_active(); + self.st.mode = Mode::Edit; + } + }, + Action::RunPause => { + if self.st.running() { + self.pause_active(); + if let Some(d) = self.st.doc_mut() { + d.follow_pc = true; + } + } else { + self.debug_cmd(|s, _| s.start()); + } + } + Action::StepInto => self.debug_cmd(|s, _| s.step_into()), + Action::StepOver => self.debug_cmd(|s, _| s.step_over()), + Action::StepOut => self.debug_cmd(|s, _| s.step_out()), + Action::RunToCursor => self.debug_cmd(|s, (line, _)| { + s.run_to_line(line); + }), + Action::Reset => { + if let Some(d) = self.st.doc_mut() { + d.session.reset(); + d.follow_pc = true; + } + } + Action::ToggleBreakpoint => { + if let Some(d) = self.st.doc_mut() { + d.session.toggle_breakpoint(d.cursor.0); + } + } + Action::ClearBreakpoints => { + if let Some(d) = self.st.doc_mut() { + d.session.breakpoints.clear(); + d.session.status = "all breakpoints removed".into(); + } + } + Action::SetSpeed(i) => self.st.prefs.speed = i, + Action::SetClock(mhz) => { + self.st.prefs.clock_mhz = mhz; + for d in &mut self.st.docs { + d.session.clock_mhz = mhz; + } + } + Action::Goto { doc, line, col } => { + if let Some(i) = self.st.docs.iter().position(|d| d.id == doc) { + self.activate(i); + self.st.docs[i].goto = Some((line, col)); + layout::show_pane(self.tree(), Pane::Editor); + } + } + Action::ShowPane(p) => layout::show_pane(self.tree(), p), + Action::ResetLayout => { + *self.tree() = match self.st.mode { + Mode::Edit => layout::edit_tree(), + Mode::Debug => layout::debug_tree(), + } + } + Action::SetTheme(t) => { + self.st.prefs.theme = t; + ctx.set_theme(theme_preference(t)); + } + Action::Zoom(d) => ctx.set_zoom_factor((ctx.zoom_factor() + d).clamp(0.5, 3.0)), + Action::ZoomReset => ctx.set_zoom_factor(1.0), + Action::Find => { + if self.st.doc().is_some() { + self.st.find.open = true; + self.st.find.focus = true; + } + } + Action::Modal(m) => self.st.modal = Some(m), + } + } + + fn update_title(&mut self, ctx: &Context) { + let title = match self.st.doc() { + Some(d) => format!( + "{}{} — bench51", + d.name(), + if d.dirty() { " •" } else { "" } + ), + None => "bench51".to_string(), + }; + if title != self.title { + ctx.send_viewport_cmd(ViewportCommand::Title(title.clone())); + self.title = title; + } + } +} + +impl eframe::App for GuiApp { + fn ui(&mut self, ui: &mut Ui, _frame: &mut eframe::Frame) { + let ctx = ui.ctx().clone(); + let p = palette(&ctx); + self.shortcuts(&ctx); + self.handle_drops(&ctx); + self.handle_close(&ctx); + self.pace(&ctx); + self.st.prefs.zoom = ctx.zoom_factor(); + + let bar = |top: i8, bottom: i8| { + egui::Frame::NONE.fill(p.black).inner_margin(egui::Margin { + left: 10, + right: 10, + top, + bottom, + }) + }; + Panel::top("menu") + .frame(bar(4, 0)) + .show_separator_line(false) + .show(ui, |ui| chrome::menu_bar(ui, &mut self.st)); + Panel::top("toolbar") + .frame(bar(4, 6)) + .show_separator_line(false) + .show(ui, |ui| chrome::toolbar(ui, &mut self.st)); + Panel::bottom("status") + .frame(bar(6, 6)) + .show_separator_line(false) + .show(ui, |ui| chrome::status_bar(ui, &self.st)); + + CentralPanel::default() + .frame( + egui::Frame::NONE + .fill(p.black) + .inner_margin(egui::Margin::symmetric(6, 0)), + ) + .show(ui, |ui| { + let tree = match self.st.mode { + Mode::Edit => &mut self.edit_tree, + Mode::Debug => &mut self.debug_tree, + }; + let cards = ui.painter().add(Shape::Noop); + let editor_tile = tree.tiles.find_pane(&Pane::Editor); + let mut behavior = PaneBehavior { + st: &mut self.st, + editor_tile, + }; + tree.ui(&mut behavior, ui); + ui.painter() + .set(cards, Shape::Vec(layout::card_shapes(tree, p.surface))); + }); + + modals::show(&ctx, &mut self.st); + for action in std::mem::take(&mut self.st.actions) { + self.apply(&ctx, action); + } + self.update_title(&ctx); + } + + fn save(&mut self, storage: &mut dyn eframe::Storage) { + eframe::set_value(storage, "prefs", &self.st.prefs); + eframe::set_value(storage, "edit_layout", &self.edit_tree); + eframe::set_value(storage, "debug_layout", &self.debug_tree); + } + + /// Layouts, theme and zoom are saved above. egui's own memory would + /// restore scroll positions keyed by document number onto whatever file + /// gets that number next session. + fn persist_egui_memory(&self) -> bool { + false + } + + fn clear_color(&self, visuals: &egui::Visuals) -> [f32; 4] { + visuals.panel_fill.to_normalized_gamma_f32() + } +} diff --git a/crates/bench51-gui/src/chrome.rs b/crates/bench51-gui/src/chrome.rs new file mode 100644 index 0000000..47b8325 --- /dev/null +++ b/crates/bench51-gui/src/chrome.rs @@ -0,0 +1,421 @@ +//! Window chrome: menu bar, toolbar and status bar. They sit directly on +//! the page, without boxes. + +use bench51_core::session::SPEEDS; +use eframe::egui::{self, Align, Button, FontId, Layout, RichText, Stroke, Ui}; + +use crate::icons::Icon; +use crate::layout::Pane; +use crate::state::{Action, Modal, Mode, State, ThemePref}; +use crate::theme::{ACCENT, LABEL, LABEL_TRACKING, palette}; +use crate::widgets; + +fn item(ui: &mut Ui, text: &str, shortcut: &str) -> bool { + let p = palette(ui.ctx()); + let label = RichText::new(text.to_uppercase()) + .font(FontId::monospace(12.0)) + .extra_letter_spacing(0.5) + .color(p.text_primary); + let mut b = Button::new(label).min_size(egui::vec2(240.0, 24.0)); + if !shortcut.is_empty() { + b = b.shortcut_text( + RichText::new(shortcut) + .font(FontId::monospace(11.0)) + .color(p.text_disabled), + ); + } + ui.add(b).clicked() +} + +fn check(ui: &mut Ui, text: &str, on: bool) -> bool { + let mark = if on { "● " } else { " " }; + item(ui, &format!("{mark}{text}"), "") +} + +fn title(ui: &Ui, text: &str) -> RichText { + let p = palette(ui.ctx()); + RichText::new(text.to_uppercase()) + .font(FontId::monospace(LABEL)) + .extra_letter_spacing(LABEL_TRACKING) + .color(p.text_secondary) +} + +pub fn menu_bar(ui: &mut Ui, st: &mut State) { + let mut acts = Vec::new(); + let has_doc = st.doc().is_some(); + egui::MenuBar::new().ui(ui, |ui| { + ui.menu_button(title(ui, "File"), |ui| { + if item(ui, "New", "Ctrl+N") { + acts.push(Action::New); + } + if item(ui, "Open…", "Ctrl+O") { + acts.push(Action::Open); + } + ui.menu_button(title(ui, "Open recent"), |ui| { + if st.prefs.recent.is_empty() { + ui.label(palette(ui.ctx()).label("none")); + } + for path in &st.prefs.recent { + let name = path.display().to_string(); + if ui + .button(RichText::new(name).font(FontId::monospace(12.0))) + .clicked() + { + acts.push(Action::OpenPath(path.clone())); + } + } + }); + ui.separator(); + if item(ui, "Save", "Ctrl+S") { + acts.push(Action::Save); + } + if item(ui, "Save as…", "Ctrl+Shift+S") { + acts.push(Action::SaveAs); + } + if has_doc && item(ui, "Close file", "Ctrl+W") { + acts.push(Action::Close(st.active)); + } + ui.separator(); + if item(ui, "Quit", "Ctrl+Q") { + acts.push(Action::Quit); + } + }); + ui.menu_button(title(ui, "Edit"), |ui| { + if item(ui, "Find…", "Ctrl+F") { + acts.push(Action::Find); + } + ui.separator(); + if item(ui, "Toggle breakpoint", "F9") { + acts.push(Action::ToggleBreakpoint); + } + if item(ui, "Kill all breakpoints", "Ctrl+Shift+F9") { + acts.push(Action::ClearBreakpoints); + } + }); + ui.menu_button(title(ui, "View"), |ui| { + for pane in Pane::ALL { + if item(ui, pane.title(), "") { + acts.push(Action::ShowPane(pane)); + } + } + ui.separator(); + ui.menu_button(title(ui, "Theme"), |ui| { + for (t, name) in [ + (ThemePref::System, "System"), + (ThemePref::Dark, "Dark"), + (ThemePref::Light, "Light"), + ] { + if check(ui, name, st.prefs.theme == t) { + acts.push(Action::SetTheme(t)); + } + } + }); + if item(ui, "Zoom in", "Ctrl++") { + acts.push(Action::Zoom(0.1)); + } + if item(ui, "Zoom out", "Ctrl+-") { + acts.push(Action::Zoom(-0.1)); + } + if item(ui, "Actual size", "Ctrl+0") { + acts.push(Action::ZoomReset); + } + ui.separator(); + if item(ui, "Reset layout", "") { + acts.push(Action::ResetLayout); + } + }); + ui.menu_button(title(ui, "Project"), |ui| { + if item(ui, "Build target", "F7") { + acts.push(Action::Build); + } + ui.separator(); + if item(ui, "Options for target…", "") { + acts.push(Action::Modal(Modal::Options( + st.prefs.clock_mhz.to_string(), + ))); + } + }); + ui.menu_button(title(ui, "Debug"), |ui| { + let session = if st.mode == Mode::Debug { + "Stop debug session" + } else { + "Start debug session" + }; + if item(ui, session, "Ctrl+F5") { + acts.push(Action::ToggleDebug); + } + ui.separator(); + let run = if st.running() { "Stop" } else { "Run" }; + if item(ui, run, "F5") { + acts.push(Action::RunPause); + } + if item(ui, "Step into", "F11") { + acts.push(Action::StepInto); + } + if item(ui, "Step over", "F10") { + acts.push(Action::StepOver); + } + if item(ui, "Step out", "Ctrl+F11") { + acts.push(Action::StepOut); + } + if item(ui, "Run to cursor line", "Ctrl+F10") { + acts.push(Action::RunToCursor); + } + if item(ui, "Reset CPU", "F6") { + acts.push(Action::Reset); + } + ui.separator(); + ui.menu_button(title(ui, "Speed"), |ui| { + for (i, n) in SPEEDS.iter().enumerate() { + if check(ui, &format!("{n} / tick"), st.prefs.speed == i) { + acts.push(Action::SetSpeed(i)); + } + } + }); + }); + ui.menu_button(title(ui, "Peripherals"), |ui| { + for (pane, name) in [ + (Pane::Ports, "I/O ports"), + (Pane::Timers, "Timers"), + (Pane::Interrupts, "Interrupts"), + (Pane::Serial, "Serial (UART #1)"), + ] { + if item(ui, name, "") { + acts.push(Action::ShowPane(pane)); + } + } + }); + ui.menu_button(title(ui, "Help"), |ui| { + if item(ui, "Keyboard shortcuts", "F1") { + acts.push(Action::Modal(Modal::Shortcuts)); + } + if item(ui, "About bench51", "") { + acts.push(Action::Modal(Modal::About)); + } + }); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + let p = palette(ui.ctx()); + ui.label(title(ui, "bench51").color(p.text_disabled)); + }); + }); + st.actions.extend(acts); +} + +pub fn toolbar(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let has_doc = st.doc().is_some(); + let running = st.running(); + let debug = st.mode == Mode::Debug; + let mut acts = Vec::new(); + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 2.0; + let mut b = |ui: &mut Ui, icon, tip, enabled, on, act| { + if widgets::icon_button(ui, icon, tip, enabled, on).clicked() { + acts.push(act); + } + }; + b(ui, Icon::New, "New file (Ctrl+N)", true, false, Action::New); + b(ui, Icon::Open, "Open (Ctrl+O)", true, false, Action::Open); + b( + ui, + Icon::Save, + "Save (Ctrl+S)", + has_doc, + false, + Action::Save, + ); + ui.add_space(18.0); + b( + ui, + Icon::Build, + "Build target (F7)", + has_doc, + false, + Action::Build, + ); + ui.add_space(18.0); + b( + ui, + Icon::Debug, + if debug { + "Stop debug session (Ctrl+F5)" + } else { + "Start debug session (Ctrl+F5)" + }, + has_doc, + debug, + Action::ToggleDebug, + ); + ui.add_space(18.0); + b( + ui, + Icon::Reset, + "Reset CPU (F6)", + has_doc, + false, + Action::Reset, + ); + if running { + b( + ui, + Icon::Pause, + "Stop (F5)", + has_doc, + false, + Action::RunPause, + ); + } else { + b(ui, Icon::Run, "Run (F5)", has_doc, false, Action::RunPause); + } + b( + ui, + Icon::StepInto, + "Step into (F11)", + has_doc, + false, + Action::StepInto, + ); + b( + ui, + Icon::StepOver, + "Step over (F10)", + has_doc, + false, + Action::StepOver, + ); + b( + ui, + Icon::StepOut, + "Step out (Ctrl+F11)", + has_doc, + false, + Action::StepOut, + ); + b( + ui, + Icon::RunToCursor, + "Run to cursor line (Ctrl+F10)", + has_doc, + false, + Action::RunToCursor, + ); + ui.add_space(18.0); + b( + ui, + Icon::Breakpoint, + "Toggle breakpoint (F9)", + has_doc, + false, + Action::ToggleBreakpoint, + ); + + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + ui.spacing_mut().item_spacing.x = 10.0; + ui.add_space(6.0); + let speed = st.prefs.speed; + ui.label( + RichText::new(format!("{:>6} / TICK", SPEEDS[speed])) + .font(FontId::monospace(LABEL)) + .color(p.text_secondary), + ); + if let Some(i) = widgets::segment_bar( + ui, + 136.0, + 10.0, + SPEEDS.len(), + speed + 1, + p.text_display, + true, + ) { + acts.push(Action::SetSpeed(i)); + } + ui.label(p.label("Speed")); + }); + }); + st.actions.extend(acts); +} + +/// True for status messages that report a failure. +fn is_error(msg: &str) -> bool { + let m = msg.to_ascii_lowercase(); + [ + "error(s)", + "cannot ", + "invalid ", + "failed", + "reserved opcode", + "out of range", + ] + .iter() + .any(|w| m.contains(w)) +} + +pub fn status_bar(ui: &mut Ui, st: &State) { + let p = palette(ui.ctx()); + let text = |s: String| { + RichText::new(s.to_uppercase()) + .font(FontId::monospace(LABEL)) + .extra_letter_spacing(0.6) + }; + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 14.0; + let doc = st.doc(); + let (state, live) = match doc { + None => ("no file", false), + Some(d) if d.session.running => ("running", true), + Some(d) if d.session.build.is_none() => ("not built", false), + Some(d) if d.stale() => ("source changed", false), + Some(_) if st.mode == Mode::Debug => ("stopped", false), + Some(_) => ("ready", false), + }; + let mode = if st.mode == Mode::Debug { + "simulation" + } else { + "edit" + }; + ui.label(text(mode.into()).color(p.text_disabled)); + // Running: a dot that blinks in hard 2 Hz steps. + let (r, _) = ui.allocate_exact_size(egui::vec2(8.0, 8.0), egui::Sense::hover()); + let on = !live || (ui.input(|i| i.time) * 4.0) as i64 % 2 == 0; + if live && on { + ui.painter().circle_filled(r.center(), 3.5, p.text_display); + } else { + ui.painter() + .circle_stroke(r.center(), 3.0, Stroke::new(1.0, p.text_disabled)); + } + ui.label(text(format!("[{state}]")).color(if live { + p.text_display + } else { + p.text_secondary + })); + if let Some(d) = doc { + let msg = &d.session.status; + if !msg.is_empty() { + let color = if is_error(msg) { + ACCENT + } else { + p.text_primary + }; + let shown = if is_error(msg) { + format!("[error: {msg}]") + } else { + msg.clone() + }; + ui.label(text(shown).color(color)); + } + } + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + ui.label(text(format!("{} MHz", st.prefs.clock_mhz)).color(p.text_disabled)); + if let Some(d) = doc { + if d.session.build.is_some() { + ui.label(text(format!("cyc {}", d.session.sim.cycles)).color(p.text_secondary)); + ui.label(text(format!("t {}", d.session.elapsed())).color(p.text_secondary)); + } + ui.label( + text(format!("l {} c {}", d.cursor.0 + 1, d.cursor.1 + 1)) + .color(p.text_secondary), + ); + } + }); + }); +} diff --git a/crates/bench51-gui/src/editor.rs b/crates/bench51-gui/src/editor.rs new file mode 100644 index 0000000..8efc1b2 --- /dev/null +++ b/crates/bench51-gui/src/editor.rs @@ -0,0 +1,657 @@ +//! The code editor: document tabs, a find bar, syntax-highlighted text and +//! a gutter with breakpoints, line numbers, addresses, errors and the PC. + +use std::collections::{HashMap, HashSet}; + +use bench51_core::syntax::tokens; +use eframe::egui::{ + self, Align, Align2, Color32, CursorIcon, FontId, Id, Key, Layout, Modifiers, Rect, RichText, + Sense, Shape, Stroke, TextBuffer, TextFormat, Ui, Vec2, + cache::{ComputerMut, FrameCache}, + pos2, + text::{CCursor, CCursorRange, LayoutJob}, + text_edit::TextEditState, + vec2, +}; + +use crate::state::{Action, Document, Mode, State}; +use crate::theme::{self, ACCENT, BODY, DARK, LIGHT, WARNING, palette}; +use crate::widgets::{self, PillKind}; + +const MARGIN: Vec2 = vec2(10.0, 8.0); + +pub fn show(ui: &mut Ui, st: &mut State) { + doc_tabs(ui, st); + if st.docs.is_empty() { + welcome(ui, st); + return; + } + if st.find.open { + find_bar(ui, st); + } + code(ui, st); +} + +// ------------------------------------------------------------- tabs, find + +fn doc_tabs(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let height = 30.0; + let (strip, _) = ui.allocate_exact_size(vec2(ui.available_width(), height), Sense::hover()); + ui.painter().hline( + strip.x_range(), + strip.bottom() - 0.5, + Stroke::new(1.0, p.border), + ); + let mut child = ui.new_child( + egui::UiBuilder::new() + .max_rect(strip.shrink2(vec2(6.0, 0.0))) + .layout(Layout::left_to_right(Align::Center)), + ); + let ui = &mut child; + ui.spacing_mut().item_spacing.x = 0.0; + for (i, doc) in st.docs.iter().enumerate() { + let active = i == st.active; + let name = doc.name(); + let galley = + ui.painter() + .layout_no_wrap(name, FontId::monospace(12.0), Color32::PLACEHOLDER); + let pad = 12.0; + let dirty_w = if doc.dirty() { 10.0 } else { 0.0 }; + let w = galley.size().x + 2.0 * pad + dirty_w + 14.0; + let (rect, resp) = ui.allocate_exact_size(vec2(w, height), Sense::click()); + let resp = resp.on_hover_cursor(CursorIcon::PointingHand); + let fg = if active { + p.text_display + } else if resp.hovered() { + p.text_secondary + } else { + p.text_disabled + }; + let text_pos = Align2::LEFT_CENTER + .align_size_within_rect(galley.size(), rect.shrink2(vec2(pad, 0.0))) + .min; + let text_w = galley.size().x; + ui.painter().galley(text_pos, galley, fg); + if active { + ui.painter().hline( + text_pos.x..=text_pos.x + text_w, + rect.bottom() - 1.5, + Stroke::new(2.0, p.text_display), + ); + } + if doc.dirty() { + ui.painter().circle_filled( + pos2(text_pos.x + text_w + 7.0, rect.center().y), + 2.5, + p.text_secondary, + ); + } + let close = + Rect::from_center_size(pos2(rect.right() - pad, rect.center().y), Vec2::splat(12.0)); + let close_resp = ui + .interact(close, Id::unique(("doc_close", doc.id)), Sense::click()) + .on_hover_cursor(CursorIcon::PointingHand); + if resp.hovered() || close_resp.hovered() || active { + let c = if close_resp.hovered() { + p.text_display + } else { + p.text_disabled + }; + let r = close.shrink(3.0); + let s = Stroke::new(1.2, c); + ui.painter() + .line_segment([r.left_top(), r.right_bottom()], s); + ui.painter() + .line_segment([r.right_top(), r.left_bottom()], s); + } + if close_resp.clicked() || resp.clicked_by(egui::PointerButton::Middle) { + st.actions.push(Action::Close(i)); + } else if resp.clicked() { + st.actions.push(Action::Activate(i)); + } + } + let plus = ui + .add( + egui::Button::new( + RichText::new("+") + .font(FontId::monospace(14.0)) + .color(p.text_disabled), + ) + .frame(false), + ) + .on_hover_text("New file (Ctrl+N)"); + if plus.clicked() { + st.actions.push(Action::New); + } + if st.mode == Mode::Debug { + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + ui.add_space(8.0); + ui.label(p.label("Read-only while debugging").color(p.text_disabled)); + }); + } +} + +fn find_bar(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let mut step = None; + let mut close = false; + ui.horizontal(|ui| { + ui.add_space(MARGIN.x); + ui.label(p.label("Find")); + let resp = widgets::underline_input(ui, &mut st.find.query, "text", 220.0); + if std::mem::take(&mut st.find.focus) { + resp.request_focus(); + } + if resp.lost_focus() && ui.input(|i| i.key_pressed(Key::Enter)) { + step = Some(!ui.input(|i| i.modifiers.shift)); + resp.request_focus(); + } + if resp.has_focus() && ui.input(|i| i.key_pressed(Key::Escape)) { + close = true; + } + let count = st + .doc() + .map_or(0, |d| find_all(&d.text, &st.find.query).len()); + ui.label(p.label(format!("{count} found")).color(p.text_disabled)); + if widgets::pill(ui, "Prev", PillKind::Ghost).clicked() { + step = Some(false); + } + if widgets::pill(ui, "Next", PillKind::Ghost).clicked() { + step = Some(true); + } + if widgets::pill(ui, "Close", PillKind::Ghost).clicked() { + close = true; + } + }); + if let (Some(forward), Some(doc)) = (step, st.docs.get_mut(st.active)) { + find_step(doc, &st.find.query, forward); + } + if close { + st.find.open = false; + } +} + +/// Byte ranges of case-insensitive matches of `query` in `text`. +fn find_all(text: &str, query: &str) -> Vec<(usize, usize)> { + if query.is_empty() { + return Vec::new(); + } + let hay = text.to_ascii_lowercase(); + let needle = query.to_ascii_lowercase(); + hay.match_indices(&needle) + .take(2000) + .map(|(i, m)| (i, i + m.len())) + .collect() +} + +fn find_step(doc: &mut Document, query: &str, forward: bool) { + let matches = find_all(&doc.text, query); + if matches.is_empty() { + doc.find_hit = None; + return; + } + let here = char_to_byte(&doc.text, doc.cursor_char); + let hit = doc.find_hit.filter(|h| matches.contains(h)); + let pick = if forward { + let from = hit.map_or(here, |h| h.0 + 1); + matches.iter().find(|m| m.0 >= from).or(matches.first()) + } else { + let before = hit.map_or(here, |h| h.0); + matches + .iter() + .rev() + .find(|m| m.0 < before) + .or(matches.last()) + }; + if let Some(&(a, b)) = pick { + let ca = doc.text[..a].chars().count(); + let cb = ca + doc.text[a..b].chars().count(); + doc.select = Some((ca, cb)); + doc.find_hit = Some((a, b)); + } +} + +// -------------------------------------------------------------- welcome + +fn welcome(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let rect = ui.available_rect_before_wrap(); + let grid = if ui.visuals().dark_mode { + p.border + } else { + p.border_visible.gamma_multiply(0.5) + }; + widgets::dot_grid(ui.painter(), rect, grid, 16.0); + let inner = rect.shrink2(vec2(56.0, 48.0)); + ui.scope_builder(egui::UiBuilder::new().max_rect(inner), |ui| { + ui.add_space(24.0); + ui.label(p.hero("BENCH51", theme::HERO_XL)); + ui.add_space(4.0); + ui.label(p.label("8051 assembler · simulator · debugger")); + ui.add_space(40.0); + ui.horizontal(|ui| { + if widgets::pill(ui, "New file", PillKind::Primary).clicked() { + st.actions.push(Action::New); + } + ui.add_space(8.0); + if widgets::pill(ui, "Open…", PillKind::Secondary).clicked() { + st.actions.push(Action::Open); + } + }); + if !st.prefs.recent.is_empty() { + ui.add_space(48.0); + ui.label(p.label("Recent")); + ui.add_space(8.0); + for path in st.prefs.recent.clone() { + let name = path.file_name().map_or_else( + || path.display().to_string(), + |n| n.to_string_lossy().into(), + ); + let dir = path + .parent() + .map(|d| d.display().to_string()) + .unwrap_or_default(); + ui.horizontal(|ui| { + let r = ui + .add( + egui::Label::new( + RichText::new(name) + .font(FontId::monospace(BODY)) + .color(p.text_primary), + ) + .sense(Sense::click()), + ) + .on_hover_cursor(CursorIcon::PointingHand); + ui.label( + RichText::new(dir) + .font(FontId::monospace(12.0)) + .color(p.text_disabled), + ); + if r.clicked() { + st.actions.push(Action::OpenPath(path.clone())); + } + }); + } + } + }); +} + +// ----------------------------------------------------------------- code + +#[derive(Default)] +struct Highlighter; + +impl ComputerMut<(bool, &str), LayoutJob> for Highlighter { + fn compute(&mut self, (dark, text): (bool, &str)) -> LayoutJob { + highlight(text, dark) + } +} + +type HighlightCache = FrameCache; + +/// Lays out `text` with the greyscale syntax palette. The job's text is +/// exactly `text`, as `TextEdit` requires. +pub fn highlight(text: &str, dark: bool) -> LayoutJob { + let p = if dark { &DARK } else { &LIGHT }; + let font = FontId::monospace(BODY); + let bold = FontId::new(BODY, theme::mono_bold()); + let mut job = LayoutJob::default(); + job.wrap.max_width = f32::INFINITY; + for (i, line) in text.split('\n').enumerate() { + if i > 0 { + job.append("\n", 0.0, TextFormat::simple(font.clone(), p.text_primary)); + } + for (r, tok) in tokens(line) { + let (color, strong) = p.syntax(tok); + let font_id = if strong { bold.clone() } else { font.clone() }; + job.append(&line[r], 0.0, TextFormat::simple(font_id, color)); + } + } + job +} + +pub fn char_to_byte(text: &str, ci: usize) -> usize { + text.char_indices().nth(ci).map_or(text.len(), |(b, _)| b) +} + +/// (line, column) of char index `ci`. +fn line_col(text: &str, ci: usize) -> (usize, usize) { + let b = char_to_byte(text, ci); + let before = &text[..b]; + let line = before.matches('\n').count(); + let start = before.rfind('\n').map_or(0, |i| i + 1); + (line, before[start..].chars().count()) +} + +/// Char index of (line, column), clamped to the text. +fn char_index(text: &str, line: usize, col: usize) -> usize { + let mut ci = 0; + for (i, l) in text.split('\n').enumerate() { + let n = l.chars().count(); + if i == line { + return ci + col.min(n); + } + ci += n + 1; + } + text.chars().count() +} + +/// Replaces the selection with spaces up to the next 8-column tab stop, +/// matching the assembler listing. +fn insert_tab(ctx: &egui::Context, id: Id, text: &mut String) { + let Some(mut state) = TextEditState::load(ctx, id) else { + return; + }; + let Some(range) = state.cursor.char_range() else { + return; + }; + let (a, b) = { + let (x, y) = (range.primary.index.0, range.secondary.index.0); + (x.min(y), x.max(y)) + }; + let (ba, bb) = (char_to_byte(text, a), char_to_byte(text, b)); + let start = text[..ba].rfind('\n').map_or(0, |i| i + 1); + let col = text[start..ba].chars().count(); + let n = 8 - col % 8; + text.replace_range(ba..bb, &" ".repeat(n)); + state + .cursor + .set_char_range(Some(CCursorRange::one(CCursor::new(a + n)))); + state.store(ctx, id); +} + +/// What the gutter and backgrounds need, gathered before the text is +/// borrowed by the `TextEdit`. +struct Marks { + errors: HashMap, + breakpoints: HashSet, + pc_line: Option, + /// Code address of each line, shown while debugging. + addrs: Option>, +} + +fn code(ui: &mut Ui, st: &mut State) { + let debug = st.mode == Mode::Debug; + let query = if st.find.open { + st.find.query.clone() + } else { + String::new() + }; + let Some(doc) = st.docs.get_mut(st.active) else { + return; + }; + let p = palette(ui.ctx()); + let dark = ui.visuals().dark_mode; + let font = FontId::monospace(BODY); + let row_h = ui.fonts_mut(|f| f.row_height(&font)); + let char_w = ui.fonts_mut(|f| f.glyph_width(&font, '0')); + let n_lines = doc.text.split('\n').count(); + let digits = n_lines.to_string().len().max(3); + + let s = &doc.session; + let built = s.build.is_some() && !doc.stale(); + let marks = Marks { + errors: s + .diagnostics_for(&doc.text) + .iter() + .rev() + .map(|d| (d.line, d.msg.clone())) + .collect(), + breakpoints: s.breakpoints.clone(), + pc_line: (debug && built && (!s.running || s.speed <= 2)) + .then(|| s.pc_line()) + .flatten(), + addrs: (debug && built).then(|| { + let b = s.build.as_ref().unwrap(); + (0..b.out.lines.len()) + .filter_map(|l| Some((l, b.line_addr(l)?))) + .collect() + }), + }; + let follow = std::mem::take(&mut doc.follow_pc) + .then_some(marks.pc_line) + .flatten(); + + let bp_w = 20.0; + let num_w = digits as f32 * char_w; + let addr_w = if marks.addrs.is_some() { + 4.0 * char_w + 16.0 + } else { + 0.0 + }; + let gutter_w = bp_w + num_w + addr_w + 16.0; + let edit_id = Id::unique(("editor", doc.id)); + let ctx = ui.ctx().clone(); + + if !debug + && ctx.memory(|m| m.has_focus(edit_id)) + && ctx.input_mut(|i| i.consume_key(Modifiers::NONE, Key::Tab)) + { + insert_tab(&ctx, edit_id, &mut doc.text); + } + + // Programmatic cursor moves: jump to a line (taking keyboard focus), or + // select a find match (leaving focus in the find bar, so Enter there + // can't overwrite the match). + let mut scroll_to_char = None; + let jump = doc + .goto + .take() + .map(|(line, col)| { + let c = char_index(&doc.text, line, col); + ((c, c), true) + }) + .or(doc.select.take().map(|r| (r, false))); + if let Some(((a, b), focus)) = jump { + let mut state = TextEditState::load(&ctx, edit_id).unwrap_or_default(); + state + .cursor + .set_char_range(Some(CCursorRange::two(CCursor::new(a), CCursor::new(b)))); + state.store(&ctx, edit_id); + if focus { + ctx.memory_mut(|m| m.request_focus(edit_id)); + } + // The TextEdit only reports its cursor while focused. + doc.cursor_char = a; + doc.cursor = line_col(&doc.text, a); + scroll_to_char = Some(a); + } + let hit = doc.find_hit; + + let matches = find_all(&doc.text, &query); + let mut clicked_line = None; + let mut cursor = None; + + egui::ScrollArea::both() + .id_salt(("code", doc.id)) + .auto_shrink([false; 2]) + .show(ui, |ui| { + let bg = ui.painter().add(Shape::Noop); + ui.horizontal_top(|ui| { + ui.spacing_mut().item_spacing = Vec2::ZERO; + let min_h = n_lines as f32 * row_h + 2.0 * MARGIN.y; + let (gutter, gutter_resp) = ui.allocate_exact_size( + vec2(gutter_w, min_h.max(ui.available_height())), + Sense::click(), + ); + + let mut layouter = |ui: &Ui, buf: &dyn TextBuffer, _wrap: f32| { + let job = ui.memory_mut(|m| { + m.caches + .cache::() + .get((dark, buf.as_str())) + .clone() + }); + ui.fonts_mut(|f| f.layout_job(job)) + }; + let mut ro: &str; + let buf: &mut dyn TextBuffer = if debug { + ro = doc.text.as_str(); + &mut ro + } else { + &mut doc.text + }; + let out = egui::TextEdit::multiline(buf) + .id(edit_id) + .font(font.clone()) + .frame(egui::Frame::NONE) + .margin(egui::Margin::symmetric(MARGIN.x as i8, MARGIN.y as i8)) + .desired_width(f32::INFINITY) + .desired_rows(1) + .lock_focus(true) + .layouter(&mut layouter) + .show(ui); + cursor = out.cursor_range.map(|r| r.primary.index.0); + + let galley = &out.galley; + let origin = out.galley_pos; + let content_right = ui + .max_rect() + .right() + .max(origin.x + galley.size().x + MARGIN.x); + let row_rect = |line: usize| -> Rect { + let y = galley + .rows + .get(line) + .map_or(origin.y + line as f32 * row_h, |r| origin.y + r.pos.y); + Rect::from_min_max(pos2(gutter.left(), y), pos2(content_right, y + row_h)) + }; + + // Backgrounds: find matches and the PC row. + let mut shapes = Vec::new(); + for &(a, b) in matches.iter().take(500) { + let ca = doc_text_chars(galley.text(), a); + let cb = doc_text_chars(galley.text(), b); + let ra = galley.pos_from_cursor(CCursor::new(ca)); + let rb = galley.pos_from_cursor(CCursor::new(cb)); + if (ra.top() - rb.top()).abs() < 1.0 { + let r = Rect::from_min_max(ra.min, pos2(rb.left(), ra.bottom())) + .translate(origin.to_vec2()); + let current = hit == Some((a, b)); + shapes.push(Shape::rect_filled( + r.expand(1.0), + 2.0, + WARNING.gamma_multiply(if current { 0.85 } else { 0.3 }), + )); + } + } + if let Some(pc) = marks.pc_line { + let r = row_rect(pc); + shapes.push(Shape::rect_filled(r, 0.0, p.surface_raised)); + shapes.push(Shape::rect_filled( + Rect::from_min_size(r.min, vec2(2.0, r.height())), + 0.0, + ACCENT, + )); + } + ui.painter().set(bg, Shape::Vec(shapes)); + + // Gutter. + let clip = ui.clip_rect(); + let painter = ui.painter(); + let first = ((clip.top() - origin.y) / row_h).floor().max(0.0) as usize; + let last = (((clip.bottom() - origin.y) / row_h).ceil() as usize + 1).min(n_lines); + let cursor_line = doc.cursor.0; + for line in first..last { + let r = row_rect(line); + let cy = r.center().y; + let err = marks.errors.contains_key(&line); + let bp = marks.breakpoints.contains(&line); + let bx = gutter.left() + 4.0 + bp_w / 2.0; + if bp { + painter.circle_filled(pos2(bx, cy), 4.5, ACCENT); + } else if err { + let s = Stroke::new(1.5, ACCENT); + let d = 3.5; + painter.line_segment([pos2(bx - d, cy - d), pos2(bx + d, cy + d)], s); + painter.line_segment([pos2(bx + d, cy - d), pos2(bx - d, cy + d)], s); + } + let num_color = if err { + ACCENT + } else if Some(line) == marks.pc_line { + p.text_display + } else if line == cursor_line && !debug { + p.text_secondary + } else { + p.text_disabled + }; + painter.text( + pos2(gutter.left() + 4.0 + bp_w + num_w, cy), + Align2::RIGHT_CENTER, + (line + 1).to_string(), + font.clone(), + num_color, + ); + if let Some(addr) = marks.addrs.as_ref().and_then(|a| a.get(&line)) { + painter.text( + pos2(gutter.left() + 4.0 + bp_w + num_w + 12.0, cy), + Align2::LEFT_CENTER, + format!("{addr:04X}"), + font.clone(), + p.text_disabled, + ); + } + } + let gutter_resp = gutter_resp.on_hover_cursor(CursorIcon::PointingHand); + if gutter_resp.clicked() + && let Some(pos) = gutter_resp.interact_pointer_pos() + { + let line = ((pos.y - origin.y) / row_h).floor(); + if line >= 0.0 && (line as usize) < n_lines { + clicked_line = Some(line as usize); + } + } + let hovered_line = gutter_resp + .hover_pos() + .map(|pos| ((pos.y - origin.y) / row_h).floor() as usize); + if let Some(msg) = hovered_line.and_then(|l| marks.errors.get(&l)) { + gutter_resp.on_hover_text(msg); + } + + if let Some(line) = follow { + ui.scroll_to_rect(row_rect(line), Some(Align::Center)); + } + if let Some(ci) = scroll_to_char { + let r = galley + .pos_from_cursor(CCursor::new(ci)) + .translate(origin.to_vec2()); + ui.scroll_to_rect(r.expand2(vec2(40.0, 0.0)), Some(Align::Center)); + } + }); + }); + + if let Some(ci) = cursor { + doc.cursor_char = ci; + doc.cursor = line_col(&doc.text, ci); + } + if let Some(line) = clicked_line { + doc.session.toggle_breakpoint(line); + } +} + +/// Char index of byte offset `b` in `text`. +fn doc_text_chars(text: &str, b: usize) -> usize { + text[..b.min(text.len())].chars().count() +} + +#[cfg(test)] +mod tests { + use super::{char_index, highlight, line_col}; + + #[test] + fn layout_job_reproduces_the_text() { + let text = "main: MOV A,#1 ; µs\n\n\tDB \"x\"\n"; + assert_eq!(highlight(text, true).text, text); + } + + #[test] + fn cursor_conversions_round_trip() { + let text = "ab\nµcd\n\nx"; + for ci in 0..=text.chars().count() { + let (l, c) = line_col(text, ci); + assert_eq!(char_index(text, l, c), ci); + } + assert_eq!(line_col(text, 4), (1, 1)); + } +} diff --git a/crates/bench51-gui/src/icons.rs b/crates/bench51-gui/src/icons.rs new file mode 100644 index 0000000..c3bb77a --- /dev/null +++ b/crates/bench51-gui/src/icons.rs @@ -0,0 +1,200 @@ +//! Monoline toolbar icons drawn with the painter: 1.5 px strokes on a +//! 16-unit grid, at most six strokes each, no fills. + +use std::f32::consts::TAU; + +use eframe::egui::{Color32, IconData, Painter, Pos2, Rect, Shape, Stroke, vec2}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Icon { + New, + Open, + Save, + Build, + Debug, + Reset, + Run, + Pause, + StepInto, + StepOver, + StepOut, + RunToCursor, + Breakpoint, +} + +pub fn paint(painter: &Painter, rect: Rect, icon: Icon, color: Color32) { + let s = rect.width().min(rect.height()) / 16.0; + let o = rect.center() - vec2(8.0, 8.0) * s; + let p = |x: f32, y: f32| o + vec2(x, y) * s; + let stroke = Stroke::new(1.5, color); + let line = |pts: &[(f32, f32)]| { + painter.add(Shape::line( + pts.iter().map(|&(x, y)| p(x, y)).collect(), + stroke, + )); + }; + let closed = |pts: &[(f32, f32)]| { + painter.add(Shape::closed_line( + pts.iter().map(|&(x, y)| p(x, y)).collect(), + stroke, + )); + }; + // Arc around (cx, cy) from angle a0 to a1 (radians, clockwise on screen). + let arc = |cx: f32, cy: f32, r: f32, a0: f32, a1: f32| -> Vec { + let n = 24; + (0..=n) + .map(|i| { + let a = a0 + (a1 - a0) * i as f32 / n as f32; + p(cx + r * a.cos(), cy + r * a.sin()) + }) + .collect() + }; + let dot = |x: f32, y: f32| painter.circle_stroke(p(x, y), 1.5 * s, stroke); + + match icon { + Icon::New => { + closed(&[ + (3.0, 1.5), + (9.5, 1.5), + (13.0, 5.0), + (13.0, 14.5), + (3.0, 14.5), + ]); + line(&[(9.5, 1.5), (9.5, 5.0), (13.0, 5.0)]); + } + Icon::Open => { + closed(&[ + (1.5, 3.0), + (6.0, 3.0), + (7.5, 4.5), + (14.5, 4.5), + (14.5, 13.0), + (1.5, 13.0), + ]); + line(&[(1.5, 7.0), (14.5, 7.0)]); + } + Icon::Save => { + line(&[(8.0, 1.5), (8.0, 10.0)]); + line(&[(4.5, 6.5), (8.0, 10.0), (11.5, 6.5)]); + line(&[(2.0, 10.0), (2.0, 14.0), (14.0, 14.0), (14.0, 10.0)]); + } + Icon::Build => { + // A DIP chip: body and four pins. + closed(&[(4.0, 3.5), (12.0, 3.5), (12.0, 12.5), (4.0, 12.5)]); + for y in [6.0, 10.0] { + line(&[(1.5, y), (4.0, y)]); + line(&[(12.0, y), (14.5, y)]); + } + } + Icon::Debug => { + // Power switch: starts and stops the debug session. + painter.add(Shape::line( + arc(8.0, 9.0, 5.5, -TAU * 0.17, TAU * 0.67), + stroke, + )); + line(&[(8.0, 1.5), (8.0, 8.0)]); + } + Icon::Reset => { + painter.add(Shape::line( + arc(8.0, 8.5, 5.5, -TAU * 0.2, TAU * 0.6), + stroke, + )); + let tip = ( + 8.0 + 5.5 * (TAU * 0.6f32).cos(), + 8.5 + 5.5 * (TAU * 0.6f32).sin(), + ); + line(&[(tip.0 - 3.5, tip.1 - 0.5), tip, (tip.0 + 0.5, tip.1 - 3.5)]); + } + Icon::Run => closed(&[(4.5, 2.5), (13.0, 8.0), (4.5, 13.5)]), + Icon::Pause => { + line(&[(5.5, 3.0), (5.5, 13.0)]); + line(&[(10.5, 3.0), (10.5, 13.0)]); + } + Icon::StepInto => { + line(&[(8.0, 1.5), (8.0, 9.5)]); + line(&[(4.5, 6.0), (8.0, 9.5), (11.5, 6.0)]); + dot(8.0, 13.5); + } + Icon::StepOver => { + painter.add(Shape::line(arc(8.0, 9.0, 5.5, TAU * 0.5, TAU), stroke)); + line(&[(10.5, 8.0), (13.5, 9.0), (14.5, 6.0)]); + dot(8.0, 13.5); + } + Icon::StepOut => { + line(&[(8.0, 10.5), (8.0, 2.0)]); + line(&[(4.5, 5.5), (8.0, 2.0), (11.5, 5.5)]); + dot(8.0, 13.5); + } + Icon::RunToCursor => { + line(&[(1.5, 8.0), (11.0, 8.0)]); + line(&[(7.5, 4.5), (11.0, 8.0), (7.5, 11.5)]); + line(&[(14.5, 3.0), (14.5, 13.0)]); + } + Icon::Breakpoint => { + painter.circle_stroke(p(8.0, 8.0), 5.0 * s, stroke); + } + } +} + +/// Window icon: a dot-matrix "51" in white on black with one red dot. +pub fn app_icon() -> IconData { + const N: usize = 64; + // 5×7 glyphs. + const FIVE: [&str; 7] = [ + "#####", "#....", "####.", "....#", "....#", "#...#", ".###.", + ]; + const ONE: [&str; 7] = [ + "..#..", ".##..", "..#..", "..#..", "..#..", "..#..", ".###.", + ]; + let mut rgba = vec![0u8; N * N * 4]; + // Rounded black tile. + let r = 12.0; + for y in 0..N { + for x in 0..N { + let (fx, fy) = (x as f32 + 0.5, y as f32 + 0.5); + let dx = (r - fx).max(fx - (N as f32 - r)).max(0.0); + let dy = (r - fy).max(fy - (N as f32 - r)).max(0.0); + let a = (r + 0.5 - (dx * dx + dy * dy).sqrt()).clamp(0.0, 1.0); + rgba[(y * N + x) * 4 + 3] = (a * 255.0) as u8; + } + } + let mut put_disc = |cx: f32, cy: f32, r: f32, c: [u8; 3]| { + for y in 0..N { + for x in 0..N { + let d = ((x as f32 + 0.5 - cx).powi(2) + (y as f32 + 0.5 - cy).powi(2)).sqrt(); + let a = (r + 0.5 - d).clamp(0.0, 1.0); + if a > 0.0 { + let i = (y * N + x) * 4; + for k in 0..3 { + rgba[i + k] = (rgba[i + k] as f32 * (1.0 - a) + c[k] as f32 * a) as u8; + } + rgba[i + 3] = 255; + } + } + } + }; + let pitch = 4.0; + let (x0, y0) = (11.0, 19.0); + for (gi, glyph) in [FIVE, ONE].iter().enumerate() { + for (row, bits) in glyph.iter().enumerate() { + for (col, b) in bits.bytes().enumerate() { + if b == b'#' { + let cx = x0 + (gi * 6 + col) as f32 * pitch + pitch / 2.0; + let cy = y0 + row as f32 * pitch + pitch / 2.0; + put_disc(cx, cy, 1.5, [255, 255, 255]); + } + } + } + } + put_disc(52.0, 12.0, 3.0, [0xD7, 0x19, 0x21]); + IconData { + rgba, + width: N as u32, + height: N as u32, + } +} + +/// Square box for an icon of size `size` centred in `rect`. +pub fn icon_rect(rect: Rect, size: f32) -> Rect { + Rect::from_center_size(rect.center(), vec2(size, size)) +} diff --git a/crates/bench51-gui/src/layout.rs b/crates/bench51-gui/src/layout.rs new file mode 100644 index 0000000..b4b2407 --- /dev/null +++ b/crates/bench51-gui/src/layout.rs @@ -0,0 +1,362 @@ +//! Dockable panes: Keil's edit and debug window layouts on `egui_tiles`, +//! with Nothing-style tab bars and flat surface cards. + +use eframe::egui::{ + self, Align2, Color32, CornerRadius, Id, Rect, Response, Sense, Shape, Stroke, Ui, Vec2, + WidgetText, vec2, +}; +use egui_tiles::{ + Behavior, Container, LinearDir, ResizeState, SimplificationOptions, TabState, Tabs, Tile, + TileId, Tiles, Tree, UiResponse, +}; +use serde::{Deserialize, Serialize}; + +use crate::panes; +use crate::state::State; +use crate::theme::{self, palette}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Pane { + Project, + Editor, + Build, + Registers, + Memory, + Disassembly, + Symbols, + Serial, + Ports, + Timers, + Interrupts, +} + +impl Pane { + pub const ALL: [Pane; 11] = [ + Pane::Project, + Pane::Editor, + Pane::Build, + Pane::Registers, + Pane::Disassembly, + Pane::Memory, + Pane::Symbols, + Pane::Serial, + Pane::Ports, + Pane::Timers, + Pane::Interrupts, + ]; + + pub fn title(self) -> &'static str { + match self { + Pane::Project => "Project", + Pane::Editor => "Editor", + Pane::Build => "Build Output", + Pane::Registers => "Registers", + Pane::Memory => "Memory", + Pane::Disassembly => "Disassembly", + Pane::Symbols => "Symbols", + Pane::Serial => "UART #1", + Pane::Ports => "Ports", + Pane::Timers => "Timers", + Pane::Interrupts => "Interrupts", + } + } + + /// Panes this one is grouped with by default, to dock it next to them + /// when it is reopened. + fn neighbours(self) -> &'static [Pane] { + match self { + Pane::Project | Pane::Registers => &[Pane::Registers, Pane::Project], + Pane::Editor | Pane::Disassembly => &[Pane::Disassembly, Pane::Editor], + Pane::Build | Pane::Memory | Pane::Symbols => { + &[Pane::Memory, Pane::Build, Pane::Symbols] + } + Pane::Serial | Pane::Ports | Pane::Timers | Pane::Interrupts => &[ + Pane::Serial, + Pane::Ports, + Pane::Timers, + Pane::Interrupts, + Pane::Memory, + ], + } + } +} + +const GAP: f32 = 6.0; +const TAB_BAR: f32 = 30.0; + +fn tabs(tiles: &mut Tiles, panes: &[Pane]) -> TileId { + let ids = panes.iter().map(|&p| tiles.insert_pane(p)).collect(); + tiles.insert_tab_tile(ids) +} + +fn linear(tiles: &mut Tiles, dir: LinearDir, children: &[(TileId, f32)]) -> TileId { + let ids: Vec = children.iter().map(|c| c.0).collect(); + let id = match dir { + LinearDir::Horizontal => tiles.insert_horizontal_tile(ids), + LinearDir::Vertical => tiles.insert_vertical_tile(ids), + }; + if let Some(Tile::Container(Container::Linear(l))) = tiles.get_mut(id) { + for &(child, share) in children { + l.shares.set_share(child, share); + } + } + id +} + +/// Keil's build-mode layout: project on the left, editor over build output. +pub fn edit_tree() -> Tree { + let mut t = Tiles::default(); + let project = tabs(&mut t, &[Pane::Project]); + let editor = tabs(&mut t, &[Pane::Editor]); + let build = tabs(&mut t, &[Pane::Build]); + let right = linear(&mut t, LinearDir::Vertical, &[(editor, 0.7), (build, 0.3)]); + let root = linear( + &mut t, + LinearDir::Horizontal, + &[(project, 0.18), (right, 0.82)], + ); + Tree::new(Id::unique("edit_layout"), root, t) +} + +/// Keil's debug-mode layout: registers on the left, source and disassembly +/// in the middle, memory and peripherals along the bottom. +pub fn debug_tree() -> Tree { + let mut t = Tiles::default(); + let regs = tabs(&mut t, &[Pane::Registers, Pane::Project]); + let editor = tabs(&mut t, &[Pane::Editor]); + let disasm = tabs(&mut t, &[Pane::Disassembly]); + let mem = tabs(&mut t, &[Pane::Memory, Pane::Symbols, Pane::Build]); + let periph = tabs( + &mut t, + &[Pane::Serial, Pane::Ports, Pane::Timers, Pane::Interrupts], + ); + let top = linear( + &mut t, + LinearDir::Horizontal, + &[(editor, 0.62), (disasm, 0.38)], + ); + let bottom = linear( + &mut t, + LinearDir::Horizontal, + &[(mem, 0.56), (periph, 0.44)], + ); + let right = linear(&mut t, LinearDir::Vertical, &[(top, 0.6), (bottom, 0.4)]); + let root = linear( + &mut t, + LinearDir::Horizontal, + &[(regs, 0.19), (right, 0.81)], + ); + Tree::new(Id::unique("debug_layout"), root, t) +} + +/// Brings `pane` to the front, docking it next to its usual neighbours if +/// it was closed. +pub fn show_pane(tree: &mut Tree, pane: Pane) { + if let Some(id) = tree.tiles.find_pane(&pane) { + tree.make_active(|tid, _| tid == id); + return; + } + let new = tree.tiles.insert_pane(pane); + let target = pane + .neighbours() + .iter() + .filter_map(|n| tree.tiles.find_pane(n)) + .filter_map(|id| tree.tiles.parent_of(id)) + .find(|&parent| { + matches!( + tree.tiles.get(parent), + Some(Tile::Container(Container::Tabs(_))) + ) + }); + if let Some(parent) = target + && let Some(Tile::Container(Container::Tabs(t))) = tree.tiles.get_mut(parent) + { + t.add_child(new); + t.set_active(new); + return; + } + let tabs_id = tree.tiles.insert_container(Tabs::new(vec![new])); + match tree.root { + Some(root) => { + if let Some(Tile::Container(c)) = tree.tiles.get_mut(root) { + c.add_child(tabs_id); + } else { + tree.root = Some(tree.tiles.insert_horizontal_tile(vec![root, tabs_id])); + } + } + None => tree.root = Some(tabs_id), + } +} + +/// Flat surface cards behind every visible tab group: the page shows +/// through the gaps between them. +pub fn card_shapes(tree: &Tree, fill: Color32) -> Vec { + tree.tiles + .iter() + .filter(|(_, t)| matches!(t, Tile::Container(Container::Tabs(_)))) + .filter_map(|(&id, _)| tree.tiles.rect(id)) + .map(|r| Shape::rect_filled(r, CornerRadius::same(8), fill)) + .collect() +} + +pub struct PaneBehavior<'a> { + pub st: &'a mut State, + /// Tile of the editor pane, whose group hides its tab bar. + pub editor_tile: Option, +} + +impl Behavior for PaneBehavior<'_> { + fn pane_ui(&mut self, ui: &mut Ui, _tile_id: TileId, pane: &mut Pane) -> UiResponse { + panes::show(*pane, ui, self.st); + UiResponse::None + } + + fn tab_title_for_pane(&mut self, pane: &Pane) -> WidgetText { + pane.title().into() + } + + fn is_tab_closable(&self, tiles: &Tiles, tile_id: TileId) -> bool { + matches!(tiles.get(tile_id), Some(Tile::Pane(p)) if *p != Pane::Editor) + } + + fn tab_ui( + &mut self, + tiles: &mut Tiles, + ui: &mut Ui, + id: Id, + tile_id: TileId, + state: &TabState, + ) -> Response { + let p = palette(ui.ctx()); + let title = match tiles.get(tile_id) { + Some(Tile::Pane(pane)) => pane.title(), + _ => "Group", + }; + let galley = WidgetText::from(p.label(title)).into_galley( + ui, + Some(egui::TextWrapMode::Extend), + f32::INFINITY, + egui::TextStyle::Small, + ); + let pad = 12.0; + let close_w = if state.closable { 16.0 } else { 0.0 }; + let width = galley.size().x + 2.0 * pad + close_w; + let (_, rect) = ui.allocate_space(vec2(width, ui.available_height())); + let resp = ui + .interact(rect, id, Sense::click_and_drag()) + .on_hover_cursor(egui::CursorIcon::PointingHand); + + if ui.is_rect_visible(rect) && !state.is_being_dragged { + let fg = if state.active { + p.text_display + } else if resp.hovered() { + p.text_secondary + } else { + p.text_disabled + }; + let text_rect = Rect::from_min_max( + rect.min + vec2(pad, 0.0), + rect.max - vec2(pad + close_w, 0.0), + ); + let pos = Align2::LEFT_CENTER + .align_size_within_rect(galley.size(), text_rect) + .min; + let text_w = galley.size().x; + ui.painter().galley(pos, galley, fg); + if state.active { + ui.painter().hline( + pos.x..=pos.x + text_w, + rect.bottom() - 1.0, + Stroke::new(2.0, p.text_display), + ); + } + if state.closable { + let c = Rect::from_center_size( + egui::pos2(rect.right() - pad - 4.0, rect.center().y), + Vec2::splat(12.0), + ); + let close = ui + .interact(c, id.with("close"), Sense::click()) + .on_hover_cursor(egui::CursorIcon::PointingHand); + if resp.hovered() || close.hovered() || state.active { + let col = if close.hovered() { + p.text_display + } else { + p.text_disabled + }; + let r = c.shrink(3.0); + let s = Stroke::new(1.2, col); + ui.painter() + .line_segment([r.left_top(), r.right_bottom()], s); + ui.painter() + .line_segment([r.right_top(), r.left_bottom()], s); + } + if (close.clicked() || resp.clicked_by(egui::PointerButton::Middle)) + && self.on_tab_close(tiles, tile_id) + { + tiles.remove(tile_id); + } + } + } + resp + } + + fn is_tab_bar_visible(&self, _tile_id: TileId, tabs: &Tabs) -> bool { + // The editor brings its own document tabs; a second bar above them + // would only repeat "EDITOR". + !(tabs.children.len() == 1 && self.editor_tile == Some(tabs.children[0])) + } + + fn tab_bar_height(&self, _style: &egui::Style) -> f32 { + TAB_BAR + } + + fn gap_width(&self, _style: &egui::Style) -> f32 { + GAP + } + + fn min_size(&self) -> f32 { + 64.0 + } + + fn tab_bar_color(&self, _visuals: &egui::Visuals) -> Color32 { + Color32::TRANSPARENT + } + + fn tab_bar_hline_stroke(&self, visuals: &egui::Visuals) -> Stroke { + let p = if visuals.dark_mode { + &theme::DARK + } else { + &theme::LIGHT + }; + Stroke::new(1.0, p.border) + } + + fn resize_stroke(&self, style: &egui::Style, state: ResizeState) -> Stroke { + let p = if style.visuals.dark_mode { + &theme::DARK + } else { + &theme::LIGHT + }; + match state { + ResizeState::Idle => Stroke::NONE, + ResizeState::Hovering => Stroke::new(1.0, p.text_disabled), + ResizeState::Dragging => Stroke::new(1.0, p.text_display), + } + } + + fn simplification_options(&self) -> SimplificationOptions { + SimplificationOptions { + all_panes_must_have_tabs: true, + ..Default::default() + } + } + + fn drag_preview_color(&self, visuals: &egui::Visuals) -> Color32 { + visuals.selection.bg_fill + } + + fn drag_preview_stroke(&self, visuals: &egui::Visuals) -> Stroke { + visuals.selection.stroke + } +} diff --git a/crates/bench51-gui/src/main.rs b/crates/bench51-gui/src/main.rs new file mode 100644 index 0000000..8b45fbe --- /dev/null +++ b/crates/bench51-gui/src/main.rs @@ -0,0 +1,57 @@ +// No console window behind the app on Windows release builds. +#![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")] + +mod app; +mod chrome; +mod editor; +mod icons; +mod layout; +mod modals; +mod panes; +mod state; +mod theme; +mod widgets; + +use std::path::PathBuf; +use std::sync::Arc; + +use clap::Parser; +use eframe::egui; + +/// Keil µVision-style desktop IDE for the Intel 8051, built on bench51. +#[derive(Parser, Debug)] +#[command(version, about)] +struct Args { + /// Assembly sources (.asm, .a51) or Intel HEX files (.hex, .ihx) to open. + files: Vec, + + /// Oscillator frequency in MHz, used to show elapsed time. + #[arg(long)] + clock: Option, + + /// Colour theme, overriding the saved choice. + #[arg(long, value_enum)] + theme: Option, +} + +fn main() -> eframe::Result { + let args = Args::parse(); + let options = eframe::NativeOptions { + viewport: egui::ViewportBuilder::default() + .with_title("bench51") + .with_app_id("bench51-gui") + .with_inner_size([1440.0, 900.0]) + .with_min_inner_size([960.0, 600.0]) + .with_icon(Arc::new(icons::app_icon())), + ..Default::default() + }; + eframe::run_native( + "bench51-gui", + options, + Box::new(move |cc| { + Ok(Box::new(app::GuiApp::new( + cc, args.files, args.clock, args.theme, + ))) + }), + ) +} diff --git a/crates/bench51-gui/src/modals.rs b/crates/bench51-gui/src/modals.rs new file mode 100644 index 0000000..c1c791c --- /dev/null +++ b/crates/bench51-gui/src/modals.rs @@ -0,0 +1,208 @@ +//! Dialogs: unsaved-changes confirmation, target options, shortcuts, about. + +use eframe::egui::{ + self, Align, Color32, Context, CornerRadius, FontId, Key, Layout, RichText, Stroke, Ui, +}; + +use crate::state::{Action, Modal, State}; +use crate::theme::{BODY, HERO, palette}; +use crate::widgets::{self, PillKind}; + +const SHORTCUTS: &[(&str, &[(&str, &str)])] = &[ + ( + "File", + &[ + ("Ctrl+N", "new file"), + ("Ctrl+O", "open .asm / .a51, or .hex (disassembled)"), + ("Ctrl+S F2", "save"), + ("Ctrl+Shift+S", "save as"), + ("Ctrl+W", "close file"), + ("Ctrl+F", "find"), + ], + ), + ( + "Build & debug", + &[ + ("F7", "build target (writes .lst and .hex)"), + ("Ctrl+F5 F4", "start / stop debug session"), + ("F5", "run / stop"), + ("F11", "step into"), + ("F10", "step over"), + ("Ctrl+F11 F12", "step out"), + ("Ctrl+F10 F8", "run to cursor line"), + ("F9", "toggle breakpoint"), + ("Ctrl+Shift+F9", "kill all breakpoints"), + ("F6", "reset CPU"), + ("Esc", "stop running"), + ], + ), + ( + "Windows", + &[ + ("Ctrl+Tab", "next tab in the hovered group"), + ("Ctrl+ +/-/0", "zoom"), + ("double-click", "edit a memory byte"), + ], + ), +]; + +fn frame(ctx: &Context) -> egui::Frame { + let p = crate::theme::palette(ctx); + egui::Frame::new() + .fill(p.surface) + .stroke(Stroke::new(1.0, p.border_visible)) + .corner_radius(CornerRadius::same(16)) + .inner_margin(egui::Margin::same(24)) +} + +/// Title on the left, `[ X ]` close on the right. +fn header(ui: &mut Ui, title: &str) -> bool { + let p = palette(ui.ctx()); + let mut close = false; + ui.horizontal(|ui| { + ui.label(p.label(title)); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + close = widgets::pill(ui, "[ X ]", PillKind::Ghost).clicked(); + }); + }); + ui.add_space(12.0); + close +} + +pub fn show(ctx: &Context, st: &mut State) { + let Some(modal) = st.modal.clone() else { + return; + }; + let mut close = false; + let mut acts = Vec::new(); + let resp = egui::Modal::new(egui::Id::unique("modal")) + .frame(frame(ctx)) + .backdrop_color(Color32::from_black_alpha(204)) + .show(ctx, |ui| { + let p = palette(ui.ctx()); + ui.set_max_width(480.0); + match &modal { + Modal::ConfirmClose(i) => { + let name = st.docs.get(*i).map(|d| d.name()).unwrap_or_default(); + close |= header(ui, "Unsaved changes"); + ui.label( + RichText::new(format!("Save changes to {name} before closing?")) + .size(BODY) + .color(p.text_primary), + ); + ui.add_space(24.0); + ui.horizontal(|ui| { + if widgets::pill(ui, "Save", PillKind::Primary).clicked() { + acts.push(Action::Activate(*i)); + acts.push(Action::Save); + acts.push(Action::Close(*i)); + close = true; + } + if widgets::pill(ui, "Discard", PillKind::Secondary).clicked() { + acts.push(Action::ForceClose(*i)); + close = true; + } + close |= widgets::pill(ui, "Cancel", PillKind::Ghost).clicked(); + }); + } + Modal::ConfirmQuit => { + let n = st.docs.iter().filter(|d| d.dirty()).count(); + close |= header(ui, "Unsaved changes"); + ui.label( + RichText::new(format!( + "{n} file{} unsaved changes.", + if n == 1 { " has" } else { "s have" } + )) + .size(BODY) + .color(p.text_primary), + ); + ui.add_space(24.0); + ui.horizontal(|ui| { + if widgets::pill(ui, "Quit without saving", PillKind::Secondary).clicked() { + acts.push(Action::ForceQuit); + close = true; + } + close |= widgets::pill(ui, "Cancel", PillKind::Ghost).clicked(); + }); + } + Modal::Options(text) => { + close |= header(ui, "Options for target"); + let mut text = text.clone(); + ui.label(p.label("Xtal (MHz)")); + ui.add_space(4.0); + let r = widgets::underline_input(ui, &mut text, "11.0592", 160.0); + if !r.has_focus() && !r.lost_focus() && text.is_empty() { + r.request_focus(); + } + ui.add_space(4.0); + ui.label( + p.label("Used to turn machine cycles into elapsed time") + .color(p.text_disabled), + ); + let valid = text.trim().parse::().ok().filter(|v| *v > 0.0); + ui.add_space(24.0); + let enter = r.lost_focus() && ui.input(|i| i.key_pressed(Key::Enter)); + ui.horizontal(|ui| { + if (widgets::pill(ui, "OK", PillKind::Primary).clicked() || enter) + && let Some(v) = valid + { + acts.push(Action::SetClock(v)); + close = true; + } + close |= widgets::pill(ui, "Cancel", PillKind::Ghost).clicked(); + }); + if !close { + st.modal = Some(Modal::Options(text)); + } + } + Modal::Shortcuts => { + close |= header(ui, "Keyboard shortcuts"); + egui::ScrollArea::vertical() + .max_height(420.0) + .show(ui, |ui| { + for (section, keys) in SHORTCUTS { + ui.label(p.label(section).color(p.text_disabled)); + ui.add_space(4.0); + egui::Grid::new(section) + .num_columns(2) + .spacing([24.0, 4.0]) + .show(ui, |ui| { + for (k, what) in *keys { + ui.label( + RichText::new(*k) + .font(FontId::monospace(12.0)) + .color(p.text_display), + ); + ui.label(RichText::new(*what).color(p.text_secondary)); + ui.end_row(); + } + }); + ui.add_space(16.0); + } + }); + } + Modal::About => { + close |= header(ui, "About"); + ui.label(p.hero("BENCH51", HERO)); + ui.add_space(4.0); + ui.label(p.label(format!("version {}", env!("CARGO_PKG_VERSION")))); + ui.add_space(16.0); + ui.label( + RichText::new( + "An Intel 8051 assembler, simulator and debugger laid out like \ + Keil µVision. A learning tool, not a cycle-exact replacement \ + for a vendor simulator.", + ) + .color(p.text_primary), + ); + } + } + }); + if resp.should_close() { + close = true; + } + if close { + st.modal = None; + } + st.actions.extend(acts); +} diff --git a/crates/bench51-gui/src/panes/build.rs b/crates/bench51-gui/src/panes/build.rs new file mode 100644 index 0000000..296d324 --- /dev/null +++ b/crates/bench51-gui/src/panes/build.rs @@ -0,0 +1,188 @@ +//! Build Output: Keil-style messages, the listing and the Intel HEX file. + +use bench51_core::syntax::tokens; +use eframe::egui::text::LayoutJob; +use eframe::egui::{self, Align, CursorIcon, FontId, Layout, RichText, Sense, TextFormat, Ui}; + +use crate::state::{Action, BuildTab, LogKind, Mode, State}; +use crate::theme::{ACCENT, HERO, palette}; +use crate::widgets; + +pub fn show(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let summary = st.doc().map(|d| match &d.session.last_asm { + Some((src, out)) if out.ok() => { + (out.code_size().to_string(), "bytes", false, src != &d.text) + } + Some((src, out)) => ( + out.diagnostics.len().to_string(), + "errors", + true, + src != &d.text, + ), + None => (String::new(), "not built", false, false), + }); + ui.horizontal(|ui| { + if let Some((n, unit, err, changed)) = &summary { + let color = if *err { ACCENT } else { p.text_display }; + // The PC is the hero while debugging; one per screen. + if n.is_empty() { + } else if st.mode == Mode::Edit { + ui.label(p.hero(n, HERO).color(color)); + } else { + ui.label(p.data(n).size(18.0).color(color)); + } + ui.vertical(|ui| { + ui.add_space(if st.mode == Mode::Edit { 14.0 } else { 2.0 }); + ui.label(p.label(*unit)); + if *changed { + ui.label(p.label("[source changed]").color(p.text_disabled)); + } + }); + } + ui.with_layout(Layout::right_to_left(Align::Min), |ui| { + widgets::segmented( + ui, + &mut st.build_tab, + &[ + (BuildTab::Messages, "Messages"), + (BuildTab::Listing, "Listing"), + (BuildTab::Hex, "HEX"), + ], + ); + }); + }); + ui.add_space(8.0); + match st.build_tab { + BuildTab::Messages => messages(ui, st), + BuildTab::Listing => listing(ui, st), + BuildTab::Hex => hex(ui, st), + } +} + +fn messages(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + if st.log.is_empty() { + widgets::empty_state( + ui, + "No messages", + "Build output appears here. F7 assembles.", + ); + return; + } + let mut goto = None; + egui::ScrollArea::vertical() + .stick_to_bottom(true) + .auto_shrink([false; 2]) + .show(ui, |ui| { + ui.spacing_mut().item_spacing.y = 3.0; + for line in &st.log { + let color = match line.kind { + LogKind::Info => p.text_secondary, + LogKind::Ok => p.text_primary, + LogKind::Error => ACCENT, + }; + let text = RichText::new(&line.text) + .font(FontId::monospace(12.5)) + .color(color); + if let Some(target) = line.target { + let r = ui + .add(egui::Label::new(text).sense(Sense::click())) + .on_hover_cursor(CursorIcon::PointingHand); + if r.clicked() { + goto = Some(target); + } + } else { + ui.label(text); + } + } + }); + if let Some((doc, line, col)) = goto { + st.actions.push(Action::Goto { doc, line, col }); + } +} + +fn rows(ui: &mut Ui, id: &str, lines: &[&str], mut row: impl FnMut(&str) -> LayoutJob) { + let row_h = ui.fonts_mut(|f| f.row_height(&FontId::monospace(12.5))) + 2.0; + egui::ScrollArea::both() + .id_salt(id) + .auto_shrink([false; 2]) + .show_rows(ui, row_h, lines.len(), |ui, range| { + ui.spacing_mut().item_spacing.y = 0.0; + for i in range { + ui.add(egui::Label::new(row(lines[i])).extend()); + } + }); +} + +fn listing(ui: &mut Ui, st: &State) { + let p = palette(ui.ctx()); + let Some((src, out)) = st.doc().and_then(|d| d.session.last_asm.as_ref()) else { + widgets::empty_state(ui, "No listing", "Press F7 to assemble."); + return; + }; + let text = out.listing(src); + let lines: Vec<&str> = text.lines().collect(); + let size = 12.5; + rows(ui, "listing", &lines, |l| { + let font = FontId::monospace(size); + if l.starts_with("***") { + return LayoutJob::simple_singleline(l.to_string(), font, ACCENT); + } + let is_code = l.len() > 25 && l.is_char_boundary(25); + if is_code && (l.as_bytes()[0].is_ascii_hexdigit() || l.starts_with(' ')) { + let (head, rest) = l.split_at(25); + let mut job = LayoutJob::default(); + let head_color = if l.starts_with(' ') { + p.text_disabled + } else { + p.text_secondary + }; + job.append(head, 0.0, TextFormat::simple(font, head_color)); + for (r, tok) in tokens(rest) { + let (color, _) = p.syntax(tok); + job.append( + &rest[r], + 0.0, + TextFormat::simple(FontId::monospace(size), color), + ); + } + return job; + } + LayoutJob::simple_singleline(l.to_string(), font, p.text_secondary) + }); +} + +fn hex(ui: &mut Ui, st: &State) { + let p = palette(ui.ctx()); + let Some((_, out)) = st.doc().and_then(|d| d.session.last_asm.as_ref()) else { + widgets::empty_state(ui, "No HEX file", "Press F7 to assemble."); + return; + }; + if !out.ok() { + widgets::empty_state(ui, "No HEX file", "Fix the errors to generate Intel HEX."); + return; + } + let text = out.intel_hex(); + let lines: Vec<&str> = text.lines().collect(); + rows(ui, "hex", &lines, |l| { + let font = FontId::monospace(12.5); + let mut job = LayoutJob::default(); + if l.len() < 11 { + job.append(l, 0.0, TextFormat::simple(font, p.text_primary)); + return job; + } + let n = l.len(); + for (part, color) in [ + (&l[..1], p.text_disabled), + (&l[1..3], p.text_secondary), + (&l[3..7], p.text_display), + (&l[7..9], p.text_secondary), + (&l[9..n - 2], p.text_primary), + (&l[n - 2..], p.text_disabled), + ] { + job.append(part, 0.0, TextFormat::simple(font.clone(), color)); + } + job + }); +} diff --git a/crates/bench51-gui/src/panes/disasm.rs b/crates/bench51-gui/src/panes/disasm.rs new file mode 100644 index 0000000..3021687 --- /dev/null +++ b/crates/bench51-gui/src/panes/disasm.rs @@ -0,0 +1,193 @@ +//! Disassembly window: every instruction of the build with its address, +//! bytes and label, decoded from code memory as it is now. + +use bench51_core::sim::disasm; +use bench51_core::syntax::{Tok, tokens}; +use eframe::egui::{self, Align2, CursorIcon, FontId, Id, Rect, Sense, Ui, pos2, vec2}; + +use crate::state::{Action, State}; +use crate::theme::{ACCENT, palette}; +use crate::widgets; + +struct Row { + line: usize, + addr: u16, + len: usize, + label: String, + /// Source text for DB/DW lines, which aren't instructions. + data: Option, +} + +fn rows(source: &[String], build: &bench51_core::session::Build) -> Vec { + let mut out = Vec::new(); + for (line, lo) in build.out.lines.iter().enumerate() { + let (Some(addr), false) = (lo.addr, lo.bytes.is_empty()) else { + continue; + }; + let text = source.get(line).map_or("", String::as_str); + let toks = tokens(text); + let mut label = String::new(); + let mut data = None; + for (r, t) in &toks { + match t { + Tok::Label if label.is_empty() => label = text[r.clone()].to_string(), + Tok::Directive => { + let rest = &text[r.start..]; + let rest = rest.split(';').next().unwrap_or(rest).trim_end(); + data = Some(rest.to_string()); + break; + } + Tok::Mnemonic => break, + _ => {} + } + } + out.push(Row { + line, + addr, + len: lo.bytes.len(), + label, + data, + }); + } + out +} + +pub fn show(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let Some(doc) = st.docs.get_mut(st.active) else { + widgets::empty_state(ui, "No program", "Open or create a source file."); + return; + }; + let doc_id = doc.id; + let s = &mut doc.session; + let Some(build) = &s.build else { + widgets::empty_state(ui, "Not built", "Press F7 to assemble."); + return; + }; + let rows = rows(&build.source, build); + let font = FontId::monospace(13.0); + let cw = ui.fonts_mut(|f| f.glyph_width(&font, '0')); + let row_h = ui.fonts_mut(|f| f.row_height(&font)) + 6.0; + let col_addr = 20.0; + let col_bytes = col_addr + 6.0 * cw; + let col_label = col_bytes + 10.0 * cw; + let col_insn = col_label + 10.0 * cw; + + // Header. + let (hdr, _) = ui.allocate_exact_size(vec2(ui.available_width(), 18.0), Sense::hover()); + for (x, name) in [ + (col_addr, "Addr"), + (col_bytes, "Bytes"), + (col_label, "Label"), + (col_insn, "Instruction"), + ] { + ui.painter().text( + pos2(hdr.left() + x, hdr.center().y), + Align2::LEFT_CENTER, + name.to_uppercase(), + FontId::monospace(crate::theme::LABEL), + p.text_disabled, + ); + } + ui.add_space(4.0); + + let pc = s.sim.pc; + let show_pc = !s.running || s.speed <= 2; + let pc_row = rows.iter().position(|r| r.addr == pc); + let bps = s.breakpoints.clone(); + + // Follow the PC whenever it moves while stopped. + let last_id = Id::unique(("disasm_last_pc", doc_id)); + let last = ui.data(|d| d.get_temp::(last_id)); + let mut area = egui::ScrollArea::vertical() + .id_salt(("disasm", doc_id)) + .auto_shrink([false; 2]); + if show_pc && last != Some(pc) { + ui.data_mut(|d| d.insert_temp(last_id, pc)); + if let Some(i) = pc_row { + let view = ui.available_height(); + area = area.vertical_scroll_offset((i as f32 * row_h - view / 2.0).max(0.0)); + } + } + + let mut toggle = None; + let mut goto = None; + area.show_rows(ui, row_h, rows.len(), |ui, range| { + ui.spacing_mut().item_spacing.y = 0.0; + for i in range { + let r = &rows[i]; + let (rect, resp) = + ui.allocate_exact_size(vec2(ui.available_width(), row_h), Sense::click()); + let painter = ui.painter(); + let cy = rect.center().y; + let is_pc = show_pc && pc_row == Some(i); + if is_pc { + painter.rect_filled(rect, 0.0, p.surface_raised); + painter.rect_filled( + Rect::from_min_size(rect.min, vec2(2.0, rect.height())), + 0.0, + ACCENT, + ); + } + if bps.contains(&r.line) { + painter.circle_filled(pos2(rect.left() + 10.0, cy), 4.0, ACCENT); + } + let text = |x: f32, s: String, c| { + painter.text( + pos2(rect.left() + x, cy), + Align2::LEFT_CENTER, + s, + font.clone(), + c, + ); + }; + text( + col_addr, + format!("{:04X}", r.addr), + if is_pc { + p.text_display + } else { + p.text_secondary + }, + ); + let bytes: Vec = (0..r.len.min(3)) + .map(|k| format!("{:02X}", s.sim.code[r.addr.wrapping_add(k as u16) as usize])) + .collect(); + let more = if r.len > 3 { "…" } else { "" }; + text(col_bytes, bytes.join(" ") + more, p.text_disabled); + text(col_label, r.label.clone(), p.text_display); + match &r.data { + Some(d) => text(col_insn, d.clone(), p.text_secondary), + None => text( + col_insn, + disasm::disassemble(&s.sim.code, r.addr).text, + if is_pc { + p.text_display + } else { + p.text_primary + }, + ), + } + let resp = resp.on_hover_cursor(CursorIcon::Default); + if resp.clicked() + && resp + .interact_pointer_pos() + .is_some_and(|pos| pos.x < rect.left() + col_addr) + { + toggle = Some(r.line); + } else if resp.double_clicked() { + goto = Some(r.line); + } + } + }); + if let Some(line) = toggle { + s.toggle_breakpoint(line); + } + if let Some(line) = goto { + st.actions.push(Action::Goto { + doc: doc_id, + line, + col: 0, + }); + } +} diff --git a/crates/bench51-gui/src/panes/interrupts.rs b/crates/bench51-gui/src/panes/interrupts.rs new file mode 100644 index 0000000..7f088fa --- /dev/null +++ b/crates/bench51-gui/src/panes/interrupts.rs @@ -0,0 +1,83 @@ +//! Interrupt system: enable, priority and request flag of each source. + +use bench51_core::session::{Session, vector_name}; +use bench51_core::sfr::{IE, IP, SCON, TCON}; +use eframe::egui::{self, Ui}; + +use super::sfr_chip; +use crate::theme::{WARNING, palette}; +use crate::widgets; + +/// (name, vector, IE/IP mask, request flag as (SFR, mask)). +const SOURCES: [(&str, u16, u8, (u8, u8)); 5] = [ + ("INT0", 0x03, 0x01, (TCON, 0x02)), + ("T0", 0x0B, 0x02, (TCON, 0x20)), + ("INT1", 0x13, 0x04, (TCON, 0x08)), + ("T1", 0x1B, 0x08, (TCON, 0x80)), + ("UART", 0x23, 0x10, (SCON, 0x03)), +]; + +pub fn show(ui: &mut Ui, s: &mut Session) { + let p = palette(ui.ctx()); + egui::ScrollArea::vertical() + .auto_shrink([false; 2]) + .show(ui, |ui| { + ui.horizontal(|ui| { + sfr_chip(ui, s, "EA", IE, 0x80); + ui.add_space(12.0); + let state = if s.sim.power_down { + ("power-down", WARNING) + } else if s.sim.idle { + ("idle", WARNING) + } else { + ("running", p.text_secondary) + }; + ui.label(p.label("CPU")); + ui.label(p.label(state.0).color(state.1)); + }); + ui.add_space(10.0); + egui::Grid::new("irqs") + .num_columns(5) + .spacing([14.0, 6.0]) + .show(ui, |ui| { + for h in ["Source", "Vector", "Enable", "Priority", "Request"] { + ui.label(p.label(h).color(p.text_disabled)); + } + ui.end_row(); + for (name, vector, mask, (flag_sfr, flag_mask)) in SOURCES { + let active = s.sim.last_irq == Some(vector) && !s.sim.in_service.is_empty(); + ui.label(p.label(name).color(if active { + p.text_display + } else { + p.text_primary + })); + ui.label(p.data(format!("{vector:04X}")).color(p.text_secondary)); + sfr_chip(ui, s, "EN", IE, mask); + sfr_chip(ui, s, "HI", IP, mask); + let req = s.sim.sfr(flag_sfr) & flag_mask != 0; + if flag_sfr == SCON { + widgets::bit_chip(ui, "RI|TI", req); + } else { + sfr_chip(ui, s, "REQ", flag_sfr, flag_mask); + } + ui.end_row(); + } + }); + widgets::section(ui, "In service"); + let levels = if s.sim.in_service.is_empty() { + "none".to_string() + } else { + s.sim + .in_service + .iter() + .map(|l| format!("L{l}")) + .collect::>() + .join(" > ") + }; + widgets::stat_row(ui, "Levels", p.data(levels)); + let last = s.sim.last_irq.map_or("—".to_string(), |v| { + format!("{v:04X}h {}", vector_name(v)) + }); + widgets::stat_row(ui, "Last taken", p.data(last)); + }); +} diff --git a/crates/bench51-gui/src/panes/memory.rs b/crates/bench51-gui/src/panes/memory.rs new file mode 100644 index 0000000..acd1d18 --- /dev/null +++ b/crates/bench51-gui/src/panes/memory.rs @@ -0,0 +1,305 @@ +//! Memory window: IRAM, SFRs, XRAM and code as a hex grid. Double-click a +//! byte to change it. + +use bench51_core::session::{MemSpace, Session}; +use bench51_core::sfr; +use eframe::egui::{ + self, Align, Align2, FontId, Key, Layout, Rect, Sense, TextEdit, Ui, pos2, vec2, +}; + +use crate::state::{MemView, State}; +use crate::theme::{ACCENT, WARNING, palette}; +use crate::widgets; + +const PER_ROW: usize = 16; + +pub fn show(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let mut space = st.mem.space; + ui.horizontal(|ui| { + if widgets::segmented( + ui, + &mut space, + &[ + (MemSpace::Iram, "IRAM"), + (MemSpace::Sfr, "SFR"), + (MemSpace::Xram, "XRAM"), + (MemSpace::Code, "CODE"), + ], + ) { + st.mem.edit = None; + } + if space != MemSpace::Sfr { + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + let r = widgets::underline_input(ui, &mut st.mem.goto, "addr", 64.0); + ui.label(p.label("Go to")); + if r.lost_focus() && ui.input(|i| i.key_pressed(Key::Enter)) { + let t = st.mem.goto.trim().trim_start_matches("0x"); + if let Ok(a) = u32::from_str_radix(t.trim_end_matches(['h', 'H']), 16) { + st.mem.scroll_to = Some(a); + } + } + }); + } + }); + st.mem.space = space; + ui.add_space(8.0); + let Some(doc) = st.docs.get_mut(st.active) else { + widgets::empty_state(ui, "No program", "Open or create a source file."); + return; + }; + if doc.session.build.is_none() { + widgets::empty_state(ui, "Not built", "Press F7 to assemble."); + return; + } + match space { + MemSpace::Sfr => sfr_table(ui, &mut doc.session, &mut st.mem), + _ => hex_grid(ui, &mut doc.session, &mut st.mem), + } +} + +fn parse_byte(s: &str) -> Option { + u8::from_str_radix(s.trim().trim_end_matches(['h', 'H']), 16).ok() +} + +/// Inline editor for one byte. Returns true when editing ended. +fn edit_cell(ui: &mut Ui, rect: Rect, text: &mut String) -> (bool, Option) { + let p = palette(ui.ctx()); + ui.painter() + .rect_filled(rect.expand(2.0), 2.0, p.surface_raised); + let r = ui.put( + rect.expand(2.0), + TextEdit::singleline(text) + .font(FontId::monospace(13.0)) + .char_limit(2) + .frame(egui::Frame::NONE) + .margin(egui::Margin::ZERO) + .text_color(p.text_display), + ); + if !r.has_focus() && !r.lost_focus() { + r.request_focus(); + } + if r.lost_focus() { + let commit = ui.input(|i| i.key_pressed(Key::Enter)); + return (true, commit.then(|| parse_byte(text)).flatten()); + } + (false, None) +} + +fn hex_grid(ui: &mut Ui, s: &mut Session, mem: &mut MemView) { + let p = palette(ui.ctx()); + let space = mem.space; + let font = FontId::monospace(13.0); + let cw = ui.fonts_mut(|f| f.glyph_width(&font, '0')); + let row_h = ui.fonts_mut(|f| f.row_height(&font)) + 4.0; + let total = if space == MemSpace::Iram { + 256 + } else { + 0x10000 + }; + let addr_digits = if total > 256 { 4 } else { 2 }; + let x_bytes = (addr_digits + 2) as f32 * cw; + let byte_x = |i: usize| x_bytes + (i * 3) as f32 * cw + if i >= 8 { cw } else { 0.0 }; + let x_ascii = byte_x(PER_ROW) + cw; + + let pc = s.sim.pc as usize; + let pc_len = bench51_core::isa::info(s.sim.code[pc]).map_or(1, |i| i.size as usize); + let bps = s.bp_addrs(); + let bank = s.sim.reg_addr(0) as usize; + let sp = s.sim.sp() as usize; + + let mut area = egui::ScrollArea::vertical() + .id_salt(("mem", space.name())) + .auto_shrink([false; 2]); + if let Some(a) = mem.scroll_to.take() { + area = area.vertical_scroll_offset((a as usize % total / PER_ROW) as f32 * row_h); + } + let mut poke = None; + area.show_rows(ui, row_h, total / PER_ROW, |ui, range| { + ui.spacing_mut().item_spacing.y = 0.0; + for row in range { + let base = row * PER_ROW; + let (rect, resp) = + ui.allocate_exact_size(vec2(ui.available_width(), row_h), Sense::click()); + if !ui.is_rect_visible(rect) { + continue; + } + let painter = ui.painter(); + let cy = rect.center().y; + let addr = if addr_digits == 4 { + format!("{base:04X}") + } else { + format!("{base:02X}") + }; + painter.text( + pos2(rect.left(), cy), + Align2::LEFT_CENTER, + addr, + font.clone(), + p.text_secondary, + ); + let mut ascii = String::with_capacity(PER_ROW); + for i in 0..PER_ROW { + let a = base + i; + let (v, fg, inverted) = match space { + MemSpace::Iram => { + let v = s.sim.iram[a]; + let fg = if v != s.prev_iram[a] { + WARNING + } else if (bank..bank + 8).contains(&a) { + p.text_display + } else if v == 0 { + p.text_disabled + } else { + p.text_primary + }; + (v, fg, a == sp) + } + MemSpace::Xram => { + let v = s.sim.xram[a]; + ( + v, + if v == 0 { + p.text_disabled + } else { + p.text_primary + }, + false, + ) + } + _ => { + let v = s.sim.code[a]; + let fg = if bps.contains(&(a as u16)) { + ACCENT + } else if v == 0 { + p.text_disabled + } else { + p.text_primary + }; + (v, fg, (pc..pc + pc_len).contains(&a)) + } + }; + let cell = Rect::from_min_size( + pos2(rect.left() + byte_x(i) - 2.0, rect.top() + 1.0), + vec2(2.0 * cw + 4.0, row_h - 2.0), + ); + let editing = mem.edit.as_ref().is_some_and(|(ea, _)| *ea as usize == a); + if editing { + let (_, text) = mem.edit.as_mut().unwrap(); + let (done, value) = edit_cell(ui, cell.shrink2(vec2(2.0, 1.0)), text); + if done { + if let Some(v) = value { + poke = Some((a as u32, v)); + } + mem.edit = None; + } + } else { + let painter = ui.painter(); + let fg = if inverted { + painter.rect_filled(cell, 2.0, p.text_display); + p.black + } else { + fg + }; + painter.text( + pos2(rect.left() + byte_x(i), cy), + Align2::LEFT_CENTER, + format!("{v:02X}"), + font.clone(), + fg, + ); + } + ascii.push(if v.is_ascii_graphic() || v == b' ' { + v as char + } else { + '·' + }); + } + ui.painter().text( + pos2(rect.left() + x_ascii, cy), + Align2::LEFT_CENTER, + ascii, + font.clone(), + p.text_disabled, + ); + if resp.double_clicked() + && let Some(pos) = resp.interact_pointer_pos() + { + let x = pos.x - rect.left(); + if let Some(i) = + (0..PER_ROW).find(|&i| x >= byte_x(i) - 4.0 && x < byte_x(i) + 2.5 * cw) + { + let a = base + i; + let v = match space { + MemSpace::Iram => s.sim.iram[a], + MemSpace::Xram => s.sim.xram[a], + _ => s.sim.code[a], + }; + mem.edit = Some((a as u32, format!("{v:02X}"))); + } + } + } + }); + if let Some((a, v)) = poke { + s.poke(space, a, v); + } +} + +fn sfr_table(ui: &mut Ui, s: &mut Session, mem: &mut MemView) { + let p = palette(ui.ctx()); + let cols = if ui.available_width() > 620.0 { 3 } else { 2 }; + let per_col = sfr::SFRS.len().div_ceil(cols); + let mut poke = None; + egui::ScrollArea::vertical() + .auto_shrink([false; 2]) + .show(ui, |ui| { + egui::Grid::new("sfr_table") + .num_columns(cols * 4) + .spacing([14.0, 5.0]) + .show(ui, |ui| { + for r in 0..per_col { + for c in 0..cols { + let Some(&(name, addr)) = sfr::SFRS.get(c * per_col + r) else { + continue; + }; + let v = s.sim.read_direct(addr, true); + let changed = super::sfr_changed(s, addr); + ui.label(p.label(name).color(p.text_secondary)); + ui.label(p.data(format!("{addr:02X}")).color(p.text_disabled)); + let editing = mem.edit.as_ref().is_some_and(|(a, _)| *a == addr as u32); + if editing { + let (rect, _) = + ui.allocate_exact_size(vec2(24.0, 18.0), Sense::hover()); + let (_, text) = mem.edit.as_mut().unwrap(); + let (done, value) = edit_cell(ui, rect, text); + if done { + if let Some(v) = value { + poke = Some((addr as u32, v)); + } + mem.edit = None; + } + } else { + let color = if changed { WARNING } else { p.text_primary }; + let resp = ui.add( + egui::Label::new(p.data(format!("{v:02X}")).color(color)) + .sense(Sense::click()), + ); + if resp.double_clicked() { + mem.edit = Some((addr as u32, format!("{v:02X}"))); + } + } + let bits = p.data(format!("{v:08b}")).size(12.0).color(if changed { + WARNING + } else { + p.text_disabled + }); + ui.label(bits); + } + ui.end_row(); + } + }); + }); + if let Some((a, v)) = poke { + s.poke(MemSpace::Sfr, a, v); + } +} diff --git a/crates/bench51-gui/src/panes/mod.rs b/crates/bench51-gui/src/panes/mod.rs new file mode 100644 index 0000000..2aac7bf --- /dev/null +++ b/crates/bench51-gui/src/panes/mod.rs @@ -0,0 +1,68 @@ +//! Tool windows docked around the editor. + +mod build; +mod disasm; +mod interrupts; +mod memory; +mod ports; +mod project; +mod registers; +mod serial; +mod symbols; +mod timers; + +use bench51_core::session::Session; +use eframe::egui::{self, Ui}; + +use crate::editor; +use crate::layout::Pane; +use crate::state::State; +use crate::widgets; + +pub fn show(pane: Pane, ui: &mut Ui, st: &mut State) { + if pane == Pane::Editor { + editor::show(ui, st); + return; + } + egui::Frame::NONE + .inner_margin(egui::Margin::symmetric(14, 10)) + .show(ui, |ui| { + ui.set_min_size(ui.available_size()); + match pane { + Pane::Project => project::show(ui, st), + Pane::Build => build::show(ui, st), + Pane::Registers => with_session(ui, st, registers::show), + Pane::Memory => memory::show(ui, st), + Pane::Disassembly => disasm::show(ui, st), + Pane::Symbols => symbols::show(ui, st), + Pane::Serial => serial::show(ui, st), + Pane::Ports => with_session(ui, st, ports::show), + Pane::Timers => with_session(ui, st, timers::show), + Pane::Interrupts => with_session(ui, st, interrupts::show), + Pane::Editor => unreachable!(), + } + }); +} + +/// Runs `f` with the active document's session, or shows why there is +/// nothing to inspect yet. +fn with_session(ui: &mut Ui, st: &mut State, f: fn(&mut Ui, &mut Session)) { + match st.docs.get_mut(st.active) { + Some(doc) if doc.session.build.is_some() => f(ui, &mut doc.session), + Some(_) => widgets::empty_state(ui, "Not built", "Press F7 to assemble."), + None => widgets::empty_state(ui, "No program", "Open or create a source file."), + } +} + +/// Whether bit `mask` of SFR `addr` is set, and a click toggles it. +pub fn sfr_chip(ui: &mut Ui, s: &mut Session, name: &str, addr: u8, mask: u8) { + let v = s.sim.sfr(addr); + if widgets::bit_chip(ui, name, v & mask != 0).clicked() { + s.sim.set_sfr(addr, v ^ mask); + } +} + +/// An SFR value differs from the snapshot taken before the last step. +pub fn sfr_changed(s: &Session, addr: u8) -> bool { + s.sim.sfr(addr) != s.prev_sfr[(addr & 0x7F) as usize] +} diff --git a/crates/bench51-gui/src/panes/ports.rs b/crates/bench51-gui/src/panes/ports.rs new file mode 100644 index 0000000..b55b151 --- /dev/null +++ b/crates/bench51-gui/src/panes/ports.rs @@ -0,0 +1,77 @@ +//! I/O ports: the latch each instruction writes, and the pins the program +//! reads. Click a pin to hold it low from outside, like a button. + +use bench51_core::session::Session; +use bench51_core::sfr::P0; +use eframe::egui::{self, Ui}; + +use crate::theme::palette; +use crate::widgets::{self, Dot}; + +pub fn show(ui: &mut Ui, s: &mut Session) { + let p = palette(ui.ctx()); + egui::ScrollArea::vertical() + .auto_shrink([false; 2]) + .show(ui, |ui| { + egui::Grid::new("ports") + .num_columns(11) + .spacing([2.0, 4.0]) + .show(ui, |ui| { + ui.label(""); + ui.label(""); + for bit in (0..8).rev() { + ui.vertical_centered(|ui| { + ui.label(p.label(bit.to_string()).color(p.text_disabled)); + }); + } + ui.label(""); + ui.end_row(); + for port in 0..4usize { + let addr = P0 + 0x10 * port as u8; + let latch = s.sim.sfr(addr); + let pins = s.sim.port_pins(port); + ui.label(p.label(format!("P{port}")).color(p.text_primary)); + ui.label(p.label("latch").color(p.text_disabled)); + for bit in (0..8u8).rev() { + let m = 1 << bit; + let dot = if latch & m != 0 { Dot::High } else { Dot::Low }; + let r = widgets::pin_dot(ui, dot) + .on_hover_text(format!("P{port}.{bit} latch — click to toggle")); + if r.clicked() { + s.sim.set_sfr(addr, latch ^ m); + } + } + ui.label(p.data(format!("{latch:02X}")).color(p.text_secondary)); + ui.end_row(); + + ui.label(""); + ui.label(p.label("pins").color(p.text_disabled)); + for bit in (0..8u8).rev() { + let m = 1 << bit; + let dot = if s.sim.pins[port] & m == 0 { + Dot::PulledLow + } else if pins & m != 0 { + Dot::High + } else { + Dot::Low + }; + let r = widgets::pin_dot(ui, dot).on_hover_text(format!( + "P{port}.{bit} pin — click to pull low from outside" + )); + if r.clicked() { + s.sim.pins[port] ^= m; + } + } + ui.label(p.data(format!("{pins:02X}"))); + ui.end_row(); + ui.add_space(6.0); + ui.end_row(); + } + }); + ui.add_space(4.0); + ui.label( + p.label("● 1 ○ 0 red: held low outside") + .color(p.text_disabled), + ); + }); +} diff --git a/crates/bench51-gui/src/panes/project.rs b/crates/bench51-gui/src/panes/project.rs new file mode 100644 index 0000000..12f764c --- /dev/null +++ b/crates/bench51-gui/src/panes/project.rs @@ -0,0 +1,137 @@ +//! Project window: the target being built, open files, and the sources in +//! its folder. + +use std::path::{Path, PathBuf}; + +use eframe::egui::{self, CursorIcon, FontId, Id, RichText, Sense, Ui}; + +use crate::state::{Action, State}; +use crate::theme::{BODY, palette}; +use crate::widgets; + +const EXTENSIONS: [&str; 6] = ["asm", "a51", "s", "src", "hex", "ihx"]; + +/// Source files in `dir`, re-read at most every two seconds. +fn folder_files(ui: &Ui, dir: &Path) -> Vec { + let id = Id::unique(("project_dir", dir)); + let now = ui.input(|i| i.time); + if let Some((t, files)) = ui.data(|d| d.get_temp::<(f64, Vec)>(id)) + && now - t < 2.0 + { + return files; + } + let mut files: Vec = std::fs::read_dir(dir) + .into_iter() + .flatten() + .flatten() + .map(|e| e.path()) + .filter(|p| { + p.extension() + .and_then(|e| e.to_str()) + .is_some_and(|e| EXTENSIONS.contains(&e.to_ascii_lowercase().as_str())) + }) + .collect(); + files.sort(); + ui.data_mut(|d| d.insert_temp(id, (now, files.clone()))); + files +} + +fn row(ui: &mut Ui, text: &str, color: egui::Color32, indent: f32) -> egui::Response { + ui.horizontal(|ui| { + ui.add_space(indent); + ui.add( + egui::Label::new( + RichText::new(text) + .font(FontId::monospace(BODY - 1.0)) + .color(color), + ) + .sense(Sense::click()) + .truncate(), + ) + .on_hover_cursor(CursorIcon::PointingHand) + }) + .inner +} + +pub fn show(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + egui::ScrollArea::vertical() + .auto_shrink([false; 2]) + .show(ui, |ui| { + ui.label(p.label("Target")); + ui.add_space(4.0); + match st.doc() { + Some(doc) => { + ui.label( + RichText::new(doc.target()) + .font(FontId::new(18.0, crate::theme::grotesk_medium())) + .color(p.text_display), + ); + let built = if doc.session.build.is_none() { + "not built" + } else if doc.stale() { + "source changed" + } else { + "built" + }; + ui.label(p.label(built).color(p.text_disabled)); + } + None => { + ui.label(p.label("none").color(p.text_disabled)); + } + } + + widgets::section(ui, "Open files"); + let mut act = None; + for (i, doc) in st.docs.iter().enumerate() { + let color = if i == st.active { + p.text_display + } else { + p.text_secondary + }; + let name = if doc.dirty() { + format!("{} •", doc.name()) + } else { + doc.name() + }; + if row(ui, &name, color, 12.0).clicked() { + act = Some(Action::Activate(i)); + } + } + + let dir = st + .doc() + .and_then(|d| d.path.as_ref()) + .and_then(|p| p.parent().map(Path::to_path_buf)) + .or_else(|| std::env::current_dir().ok()); + if let Some(dir) = dir { + let shown = dir + .file_name() + .map_or_else(|| dir.display().to_string(), |n| n.to_string_lossy().into()); + widgets::section(ui, &format!("Folder · {shown}")); + let files = folder_files(ui, &dir); + if files.is_empty() { + ui.label(p.label("no sources").color(p.text_disabled)); + } + for f in files { + let open = st.docs.iter().any(|d| d.path.as_deref() == Some(&f)); + let name = f + .file_name() + .unwrap_or_default() + .to_string_lossy() + .into_owned(); + let color = if open { + p.text_primary + } else { + p.text_secondary + }; + if row(ui, &name, color, 12.0).double_clicked() { + act = Some(Action::OpenPath(f.clone())); + } + } + } + if let Some(a) = act { + st.actions.push(a); + } + }); +} diff --git a/crates/bench51-gui/src/panes/registers.rs b/crates/bench51-gui/src/panes/registers.rs new file mode 100644 index 0000000..5257cb7 --- /dev/null +++ b/crates/bench51-gui/src/panes/registers.rs @@ -0,0 +1,105 @@ +//! Keil's register window. The program counter is the screen's hero. + +use bench51_core::session::Session; +use bench51_core::sfr::{ACC, B, DPH, DPL, PSW, SP}; +use bench51_core::sim::disasm; +use eframe::egui::{self, RichText, Ui}; + +use super::{sfr_changed, sfr_chip}; +use crate::theme::{HERO, WARNING, palette}; +use crate::widgets; + +pub fn show(ui: &mut Ui, s: &mut Session) { + let p = palette(ui.ctx()); + egui::ScrollArea::vertical() + .auto_shrink([false; 2]) + .show(ui, |ui| { + ui.label(p.label("Program counter")); + ui.label(p.hero(format!("{:04X}", s.sim.pc), HERO)); + let here = disasm::disassemble(&s.sim.code, s.sim.pc); + let state = if s.sim.power_down { + "power-down" + } else if s.sim.idle { + "idle" + } else { + "" + }; + ui.horizontal(|ui| { + ui.label(p.data(here.text).color(p.text_secondary)); + if !state.is_empty() { + ui.label(p.label(state).color(WARNING)); + } + }); + + widgets::section(ui, "Registers"); + let value = |v: String, changed: bool| { + p.data(v) + .color(if changed { WARNING } else { p.text_primary }) + }; + let iram_changed = |a: u8| s.sim.iram[a as usize] != s.prev_iram[a as usize]; + egui::Grid::new("regs") + .num_columns(4) + .spacing([16.0, 6.0]) + .show(ui, |ui| { + let pairs: [(&str, String, bool); 4] = [ + ("A", format!("{:02X}", s.sim.acc()), sfr_changed(s, ACC)), + ("B", format!("{:02X}", s.sim.b()), sfr_changed(s, B)), + ("SP", format!("{:02X}", s.sim.sp()), sfr_changed(s, SP)), + ( + "DPTR", + format!("{:04X}", s.sim.dptr()), + sfr_changed(s, DPL) || sfr_changed(s, DPH), + ), + ]; + for row in pairs.chunks(2) { + for (name, v, ch) in row { + ui.label(p.label(*name)); + ui.label(value(v.clone(), *ch)); + } + ui.end_row(); + } + for r in 0..4u8 { + for n in [r, r + 4] { + let a = s.sim.reg_addr(n); + ui.label(p.label(format!("R{n}"))); + ui.label(value( + format!("{:02X}", s.sim.iram[a as usize]), + iram_changed(a), + )); + } + ui.end_row(); + } + }); + + widgets::section(ui, "PSW"); + ui.horizontal_wrapped(|ui| { + ui.spacing_mut().item_spacing.x = 4.0; + ui.label(value(format!("{:02X}", s.sim.psw()), sfr_changed(s, PSW))); + ui.add_space(6.0); + for (name, mask) in [ + ("CY", 0x80), + ("AC", 0x40), + ("F0", 0x20), + ("RS1", 0x10), + ("RS0", 0x08), + ("OV", 0x04), + ("P", 0x01), + ] { + sfr_chip(ui, s, name, PSW, mask); + } + }); + ui.add_space(4.0); + widgets::stat_row(ui, "Bank", p.data(s.sim.bank().to_string())); + + widgets::section(ui, "Time"); + widgets::stat_row(ui, "Cycles", p.data(s.sim.cycles.to_string())); + widgets::stat_row(ui, "Elapsed", p.data(s.elapsed())); + widgets::stat_row( + ui, + "Clock", + RichText::new(format!("{} MHz", s.clock_mhz)) + .font(crate::theme::mono(crate::theme::LABEL + 1.0)) + .color(p.text_secondary), + ); + }); +} diff --git a/crates/bench51-gui/src/panes/serial.rs b/crates/bench51-gui/src/panes/serial.rs new file mode 100644 index 0000000..9bfe8a2 --- /dev/null +++ b/crates/bench51-gui/src/panes/serial.rs @@ -0,0 +1,86 @@ +//! UART #1: what the 8051 transmits, and a line to type into its receiver. + +use bench51_core::sfr::SCON; +use eframe::egui::{self, Align, FontId, Key, Layout, RichText, Ui}; + +use crate::state::State; +use crate::theme::palette; +use crate::widgets::{self, PillKind}; + +pub fn show(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let Some(doc) = st.docs.get_mut(st.active) else { + widgets::empty_state(ui, "No program", "Open or create a source file."); + return; + }; + let s = &mut doc.session; + let scon = s.sim.sfr(SCON); + ui.horizontal(|ui| { + ui.label(p.label(format!("Mode {}", scon >> 6))); + ui.add_space(8.0); + ui.spacing_mut().item_spacing.x = 4.0; + for (name, mask) in [("REN", 0x10), ("TI", 0x02), ("RI", 0x01)] { + super::sfr_chip(ui, s, name, SCON, mask); + } + ui.add_space(8.0); + ui.label( + p.label(format!("{} queued", s.sim.uart_rx_pending().len())) + .color(p.text_disabled), + ); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if widgets::pill(ui, "Clear", PillKind::Ghost).clicked() { + s.sim.uart.tx_log.clear(); + } + }); + }); + ui.add_space(6.0); + + let mut text = String::new(); + for &b in &s.sim.uart.tx_log { + match b { + b'\n' => text.push('\n'), + b'\r' => {} + 0x20..=0x7E => text.push(b as char), + _ => text.push('·'), + } + } + let input_h = 34.0; + egui::ScrollArea::vertical() + .stick_to_bottom(true) + .auto_shrink([false; 2]) + .max_height((ui.available_height() - input_h).max(40.0)) + .show(ui, |ui| { + if text.is_empty() { + ui.label(p.label("[no output yet]").color(p.text_disabled)); + } else { + ui.label( + RichText::new(text) + .font(FontId::monospace(13.0)) + .color(p.text_primary), + ); + } + }); + ui.add_space(6.0); + ui.horizontal(|ui| { + ui.label( + RichText::new(">") + .font(FontId::monospace(13.0)) + .color(p.text_secondary), + ); + let w = ui.available_width(); + let r = widgets::underline_input( + ui, + &mut st.serial_input, + "type, then Enter sends it with CR", + w, + ); + if r.lost_focus() && ui.input(|i| i.key_pressed(Key::Enter)) { + let mut bytes = std::mem::take(&mut st.serial_input).into_bytes(); + bytes.push(b'\r'); + if let Some(doc) = st.docs.get_mut(st.active) { + doc.session.sim.uart_send(&bytes); + } + r.request_focus(); + } + }); +} diff --git a/crates/bench51-gui/src/panes/symbols.rs b/crates/bench51-gui/src/panes/symbols.rs new file mode 100644 index 0000000..fcfbaed --- /dev/null +++ b/crates/bench51-gui/src/panes/symbols.rs @@ -0,0 +1,90 @@ +//! Symbol table of the build, with live values for memory symbols. + +use bench51_core::asm::SymKind; +use eframe::egui::{self, CursorIcon, Sense, Ui}; + +use crate::state::{Action, State}; +use crate::theme::{WARNING, palette}; +use crate::widgets; + +pub fn show(ui: &mut Ui, st: &mut State) { + let p = palette(ui.ctx()); + let Some(doc) = st.docs.get(st.active) else { + widgets::empty_state(ui, "No program", "Open or create a source file."); + return; + }; + let doc_id = doc.id; + let s = &doc.session; + let Some(build) = &s.build else { + widgets::empty_state(ui, "Not built", "Press F7 to assemble."); + return; + }; + let mut goto = None; + if build.out.symbols.is_empty() { + widgets::empty_state(ui, "No symbols", "Labels and EQU names appear here."); + return; + } + egui::ScrollArea::vertical() + .auto_shrink([false; 2]) + .show(ui, |ui| { + egui::Grid::new("symbols") + .num_columns(4) + .spacing([20.0, 6.0]) + .show(ui, |ui| { + for h in ["Name", "Kind", "Value", "Now"] { + ui.label(p.label(h).color(p.text_disabled)); + } + ui.end_row(); + for (name, sym) in &build.out.symbols { + let v = sym.value; + let name_label = egui::Label::new(p.data(name).color(p.text_display)) + .sense(Sense::click()); + let resp = ui + .add(name_label) + .on_hover_cursor(CursorIcon::PointingHand) + .on_hover_text("Go to definition"); + if resp.clicked() { + goto = Some(sym.line); + } + ui.label(p.label(sym.kind.name())); + let width = if (0..=0xFF).contains(&v) { 2 } else { 4 }; + ui.label( + p.data(format!("{:0width$X}", v & 0xFFFF)) + .color(p.text_secondary), + ); + let now = match sym.kind { + SymKind::Data | SymKind::Idata if (0..=0xFF).contains(&v) => { + let a = v as usize; + Some(( + format!("{:02X}", s.sim.iram[a]), + s.sim.iram[a] != s.prev_iram[a], + )) + } + SymKind::Xdata if (0..=0xFFFF).contains(&v) => { + Some((format!("{:02X}", s.sim.xram[v as usize]), false)) + } + SymKind::Bit if (0..=0xFF).contains(&v) => { + Some((u8::from(s.sim.read_bit(v as u8, true)).to_string(), false)) + } + _ => None, + }; + match now { + Some((t, changed)) => ui.label(p.data(t).color(if changed { + WARNING + } else { + p.text_primary + })), + None => ui.label(p.data("—").color(p.text_disabled)), + }; + ui.end_row(); + } + }); + }); + if let Some(line) = goto { + st.actions.push(Action::Goto { + doc: doc_id, + line, + col: 0, + }); + } +} diff --git a/crates/bench51-gui/src/panes/timers.rs b/crates/bench51-gui/src/panes/timers.rs new file mode 100644 index 0000000..b4f0fab --- /dev/null +++ b/crates/bench51-gui/src/panes/timers.rs @@ -0,0 +1,102 @@ +//! Timer/counter 0 and 1: mode, control bits and progress to overflow. + +use bench51_core::session::Session; +use bench51_core::sfr::{TCON, TH0, TH1, TL0, TL1, TMOD}; +use eframe::egui::{self, Align, Layout, Ui}; + +use super::{sfr_changed, sfr_chip}; +use crate::theme::{WARNING, palette}; +use crate::widgets; + +/// Count so far and the count at which the timer overflows. +pub fn progress(mode: u8, th: u8, tl: u8) -> (u32, u32) { + match mode { + 0 => (((th as u32) << 5) | (tl as u32 & 0x1F), 1 << 13), + 1 => (((th as u32) << 8) | tl as u32, 1 << 16), + 2 => { + let span = 256 - th as u32; + ((tl as u32).saturating_sub(th as u32).min(span), span.max(1)) + } + _ => (tl as u32, 256), + } +} + +fn timer(ui: &mut Ui, s: &mut Session, n: u8) { + let p = palette(ui.ctx()); + let (th, tl) = if n == 0 { (TH0, TL0) } else { (TH1, TL1) }; + let shift = 4 * n; + let ctl = (s.sim.sfr(TMOD) >> shift) & 0x0F; + let mut mode = ctl & 3; + let (tr, tf) = if n == 0 { (0x10, 0x20) } else { (0x40, 0x80) }; + let running = s.sim.sfr(TCON) & tr != 0; + + ui.horizontal(|ui| { + ui.label(p.label(format!("Timer {n}")).color(p.text_primary)); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + let desc = match mode { + 0 => "13-bit", + 1 => "16-bit", + 2 => "8-bit auto-reload", + _ => "split 8-bit", + }; + ui.label(p.label(desc).color(p.text_disabled)); + }); + }); + ui.add_space(4.0); + ui.horizontal(|ui| { + let changed = sfr_changed(s, th) || sfr_changed(s, tl); + ui.label( + p.data(format!("{:02X} {:02X}", s.sim.sfr(th), s.sim.sfr(tl))) + .size(18.0) + .color(if changed { WARNING } else { p.text_primary }), + ); + ui.label(p.label(format!("TH{n} TL{n}")).color(p.text_disabled)); + }); + let (count, max) = progress(mode, s.sim.sfr(th), s.sim.sfr(tl)); + let segments = 24; + let filled = (count as u64 * segments as u64 / max as u64) as usize; + let color = if running { + p.text_display + } else { + p.text_disabled + }; + let w = ui.available_width().min(360.0); + widgets::segment_bar(ui, w, 8.0, segments, filled, color, false); + ui.add_space(6.0); + ui.horizontal_wrapped(|ui| { + ui.spacing_mut().item_spacing.x = 4.0; + if widgets::segmented(ui, &mut mode, &[(0, "M0"), (1, "M1"), (2, "M2"), (3, "M3")]) { + let tmod = s.sim.sfr(TMOD) & !(3 << shift) | (mode << shift); + s.sim.set_sfr(TMOD, tmod); + } + ui.add_space(6.0); + sfr_chip(ui, s, "GATE", TMOD, 0x08 << shift); + sfr_chip(ui, s, "C/T", TMOD, 0x04 << shift); + sfr_chip(ui, s, &format!("TR{n}"), TCON, tr); + sfr_chip(ui, s, &format!("TF{n}"), TCON, tf); + }); +} + +pub fn show(ui: &mut Ui, s: &mut Session) { + egui::ScrollArea::vertical() + .auto_shrink([false; 2]) + .show(ui, |ui| { + timer(ui, s, 0); + ui.add_space(24.0); + timer(ui, s, 1); + }); +} + +#[cfg(test)] +mod tests { + use super::progress; + + #[test] + fn overflow_progress_per_mode() { + assert_eq!(progress(1, 0x80, 0x00), (0x8000, 0x10000)); + assert_eq!(progress(0, 0x01, 0xFF), (0x3F, 0x2000)); + assert_eq!(progress(2, 0xFD, 0xFE), (1, 3)); + assert_eq!(progress(2, 0xFF, 0xFF), (0, 1)); + assert_eq!(progress(3, 0x12, 0x40), (0x40, 256)); + } +} diff --git a/crates/bench51-gui/src/state.rs b/crates/bench51-gui/src/state.rs new file mode 100644 index 0000000..c008b92 --- /dev/null +++ b/crates/bench51-gui/src/state.rs @@ -0,0 +1,293 @@ +//! Application state shared by every pane, and the actions panes ask for. + +use std::path::{Path, PathBuf}; + +use bench51_core::session::{MemSpace, Session}; +use serde::{Deserialize, Serialize}; + +use crate::layout::Pane; + +/// Keil's two window layouts: building and debugging. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Mode { + Edit, + Debug, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, clap::ValueEnum)] +pub enum ThemePref { + System, + Dark, + Light, +} + +/// Settings that survive restarts. +#[derive(Serialize, Deserialize)] +#[serde(default)] +pub struct Prefs { + pub theme: ThemePref, + pub recent: Vec, + pub speed: usize, + pub clock_mhz: f64, + pub zoom: f32, +} + +impl Default for Prefs { + fn default() -> Self { + Self { + theme: ThemePref::System, + recent: Vec::new(), + speed: 5, + clock_mhz: 11.0592, + zoom: 1.0, + } + } +} + +impl Prefs { + pub fn add_recent(&mut self, path: &Path) { + let path = path.canonicalize().unwrap_or_else(|_| path.to_path_buf()); + self.recent.retain(|p| *p != path); + self.recent.insert(0, path); + self.recent.truncate(10); + } +} + +/// An open source file and the simulator running it. +pub struct Document { + /// Stable id for egui widget state. + pub id: u64, + pub path: Option, + /// Name shown for documents without a path (e.g. a disassembled HEX file). + pub label: Option, + pub text: String, + pub saved: String, + pub session: Session, + /// Cursor position as (line, column), updated by the editor. + pub cursor: (usize, usize), + /// Cursor position as a char index into `text`. + pub cursor_char: usize, + /// Move the cursor here and scroll to it on the next frame. + pub goto: Option<(usize, usize)>, + /// Select this char range and scroll to it on the next frame, keeping + /// keyboard focus where it is (the find bar). + pub select: Option<(usize, usize)>, + /// Byte range of the current find match. + pub find_hit: Option<(usize, usize)>, + /// Scroll the editor and disassembly to the PC on the next frame. + pub follow_pc: bool, +} + +impl Document { + pub fn new(id: u64, path: Option, text: &str, clock_mhz: f64) -> Self { + let text = text.replace("\r\n", "\n"); + Self { + id, + path, + label: None, + saved: text.clone(), + text, + session: Session::new(clock_mhz), + cursor: (0, 0), + cursor_char: 0, + goto: None, + select: None, + find_hit: None, + follow_pc: false, + } + } + + pub fn name(&self) -> String { + if let Some(name) = self.path.as_ref().and_then(|p| p.file_name()) { + return name.to_string_lossy().into_owned(); + } + self.label.clone().unwrap_or_else(|| "untitled.asm".into()) + } + + /// File name without extension, Keil's "target" name. + pub fn target(&self) -> String { + let name = self.name(); + match name.rsplit_once('.') { + Some((stem, _)) if !stem.is_empty() => stem.to_string(), + _ => name, + } + } + + pub fn dirty(&self) -> bool { + self.text != self.saved + } + + /// The editor text differs from the program in the simulator. + pub fn stale(&self) -> bool { + self.session.is_stale(self.text.split('\n')) + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum LogKind { + Info, + Ok, + Error, +} + +/// A line in the Build Output messages. +pub struct LogLine { + pub text: String, + pub kind: LogKind, + /// Clicking the line jumps here: (document id, line, column). + pub target: Option<(u64, usize, usize)>, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum BuildTab { + Messages, + Listing, + Hex, +} + +/// Everything the menus, toolbar, shortcuts and panes can ask for. They +/// queue actions; `GuiApp::apply` runs them once the frame's UI is done. +#[derive(Debug, Clone, PartialEq)] +pub enum Action { + New, + Open, + OpenPath(PathBuf), + Save, + SaveAs, + /// Close a document, asking first if it has unsaved changes. + Close(usize), + /// Close without asking. + ForceClose(usize), + Activate(usize), + Quit, + /// Quit even with unsaved changes. + ForceQuit, + Build, + ToggleDebug, + RunPause, + StepInto, + StepOver, + StepOut, + RunToCursor, + Reset, + ToggleBreakpoint, + ClearBreakpoints, + SetSpeed(usize), + SetClock(f64), + Goto { + doc: u64, + line: usize, + col: usize, + }, + ShowPane(Pane), + ResetLayout, + SetTheme(ThemePref), + Zoom(f32), + ZoomReset, + Find, + Modal(Modal), +} + +#[derive(Debug, Clone, PartialEq)] +pub enum Modal { + /// Unsaved changes in this document. + ConfirmClose(usize), + ConfirmQuit, + Shortcuts, + /// Options for Target: the oscillator frequency, being edited. + Options(String), + About, +} + +pub struct MemView { + pub space: MemSpace, + pub goto: String, + /// Scroll so this address is visible on the next frame. + pub scroll_to: Option, + /// Byte being edited inline: (address, text). + pub edit: Option<(u32, String)>, +} + +pub struct FindBar { + pub open: bool, + pub query: String, + /// Give the query field keyboard focus on the next frame. + pub focus: bool, +} + +pub struct State { + pub docs: Vec, + pub active: usize, + next_doc_id: u64, + pub mode: Mode, + pub prefs: Prefs, + pub log: Vec, + pub actions: Vec, + pub modal: Option, + pub mem: MemView, + pub build_tab: BuildTab, + pub serial_input: String, + pub find: FindBar, +} + +impl State { + pub fn new(prefs: Prefs) -> Self { + Self { + docs: Vec::new(), + active: 0, + next_doc_id: 1, + mode: Mode::Edit, + prefs, + log: Vec::new(), + actions: Vec::new(), + modal: None, + mem: MemView { + space: MemSpace::Iram, + goto: String::new(), + scroll_to: None, + edit: None, + }, + build_tab: BuildTab::Messages, + serial_input: String::new(), + find: FindBar { + open: false, + query: String::new(), + focus: false, + }, + } + } + + pub fn doc(&self) -> Option<&Document> { + self.docs.get(self.active) + } + + pub fn doc_mut(&mut self) -> Option<&mut Document> { + self.docs.get_mut(self.active) + } + + pub fn add_doc(&mut self, path: Option, text: &str) -> &mut Document { + let id = self.next_doc_id; + self.next_doc_id += 1; + let mut doc = Document::new(id, path, text, self.prefs.clock_mhz); + doc.session.speed = self.prefs.speed; + self.docs.push(doc); + self.active = self.docs.len() - 1; + self.docs.last_mut().unwrap() + } + + pub fn log(&mut self, kind: LogKind, text: impl Into) { + self.log.push(LogLine { + text: text.into(), + kind, + target: None, + }); + if self.log.len() > 2000 { + self.log.drain(..500); + } + } + + /// The active document's simulator is free running. + pub fn running(&self) -> bool { + self.doc().is_some_and(|d| d.session.running) + } +} diff --git a/crates/bench51-gui/src/theme.rs b/crates/bench51-gui/src/theme.rs new file mode 100644 index 0000000..4ce80e7 --- /dev/null +++ b/crates/bench51-gui/src/theme.rs @@ -0,0 +1,293 @@ +//! Nothing design tokens mapped onto egui: palettes for both themes, the +//! bundled fonts, and text helpers that keep the type budget in one place. + +use std::sync::Arc; + +use bench51_core::syntax::Tok; +use eframe::egui::{ + self, Color32, Context, CornerRadius, FontData, FontDefinitions, FontFamily, FontId, RichText, + Shadow, Stroke, Style, TextStyle, Theme, Visuals, + epaint::text::{FontTweak, VariationCoords}, +}; + +/// The colour tokens of one theme (`references/tokens.md` §2). +pub struct Palette { + /// Page background: OLED black / warm off-white paper. + pub black: Color32, + pub surface: Color32, + pub surface_raised: Color32, + pub border: Color32, + pub border_visible: Color32, + pub text_disabled: Color32, + pub text_secondary: Color32, + pub text_primary: Color32, + pub text_display: Color32, + pub interactive: Color32, +} + +pub const DARK: Palette = Palette { + black: Color32::from_rgb(0x00, 0x00, 0x00), + surface: Color32::from_rgb(0x11, 0x11, 0x11), + surface_raised: Color32::from_rgb(0x1A, 0x1A, 0x1A), + border: Color32::from_rgb(0x22, 0x22, 0x22), + border_visible: Color32::from_rgb(0x33, 0x33, 0x33), + text_disabled: Color32::from_rgb(0x66, 0x66, 0x66), + text_secondary: Color32::from_rgb(0x99, 0x99, 0x99), + text_primary: Color32::from_rgb(0xE8, 0xE8, 0xE8), + text_display: Color32::from_rgb(0xFF, 0xFF, 0xFF), + interactive: Color32::from_rgb(0x5B, 0x9B, 0xF6), +}; + +pub const LIGHT: Palette = Palette { + black: Color32::from_rgb(0xF5, 0xF5, 0xF5), + surface: Color32::from_rgb(0xFF, 0xFF, 0xFF), + surface_raised: Color32::from_rgb(0xF0, 0xF0, 0xF0), + border: Color32::from_rgb(0xE8, 0xE8, 0xE8), + border_visible: Color32::from_rgb(0xCC, 0xCC, 0xCC), + text_disabled: Color32::from_rgb(0x99, 0x99, 0x99), + text_secondary: Color32::from_rgb(0x66, 0x66, 0x66), + text_primary: Color32::from_rgb(0x1A, 0x1A, 0x1A), + text_display: Color32::from_rgb(0x00, 0x00, 0x00), + interactive: Color32::from_rgb(0x00, 0x7A, 0xFF), +}; + +/// Signal red: breakpoints, errors, the PC bar. Never decorative. +pub const ACCENT: Color32 = Color32::from_rgb(0xD7, 0x19, 0x21); +/// Values that changed since the last step. +pub const WARNING: Color32 = Color32::from_rgb(0xD4, 0xA8, 0x43); + +/// The three type sizes: labels, body/data, and the one hero per screen. +pub const LABEL: f32 = 11.0; +pub const BODY: f32 = 14.0; +pub const HERO: f32 = 44.0; +/// Doto at welcome-screen scale. +pub const HERO_XL: f32 = 72.0; +/// Tracking for ALL CAPS labels (0.08em at 11px). +pub const LABEL_TRACKING: f32 = 0.9; + +pub fn palette(ctx: &Context) -> &'static Palette { + match ctx.theme() { + Theme::Dark => &DARK, + Theme::Light => &LIGHT, + } +} + +pub fn mono_bold() -> FontFamily { + FontFamily::Name("mono-bold".into()) +} + +pub fn grotesk_medium() -> FontFamily { + FontFamily::Name("grotesk-medium".into()) +} + +pub fn doto() -> FontFamily { + FontFamily::Name("doto".into()) +} + +pub fn mono(size: f32) -> FontId { + FontId::monospace(size) +} + +impl Palette { + /// Instrument-panel label: Space Mono, ALL CAPS, tracked, secondary grey. + pub fn label(&self, text: impl AsRef) -> RichText { + RichText::new(text.as_ref().to_uppercase()) + .font(mono(LABEL)) + .extra_letter_spacing(LABEL_TRACKING) + .color(self.text_secondary) + } + + /// Data value in Space Mono at body size. + pub fn data(&self, text: impl Into) -> RichText { + RichText::new(text) + .font(mono(BODY)) + .color(self.text_primary) + } + + /// Dot-matrix hero number. One per screen. + pub fn hero(&self, text: impl Into, size: f32) -> RichText { + RichText::new(text) + .font(FontId::new(size, doto())) + .color(self.text_display) + } + + /// Syntax colours: greyscale first, hierarchy by brightness and weight. + pub fn syntax(&self, tok: Tok) -> (Color32, bool) { + match tok { + Tok::Label => (self.text_display, true), + Tok::Mnemonic => (self.text_display, false), + Tok::Register | Tok::Sfr | Tok::Plain => (self.text_primary, false), + Tok::Number | Tok::Str | Tok::Directive => (self.text_secondary, false), + Tok::Comment => (self.text_disabled, false), + } + } +} + +fn fonts() -> FontDefinitions { + let mut defs = FontDefinitions::default(); + let mut add = |name: &str, bytes: &'static [u8], tweak: FontTweak| { + defs.font_data.insert( + name.to_owned(), + Arc::new(FontData::from_static(bytes).tweak(tweak)), + ); + }; + add( + "space-grotesk", + include_bytes!("../assets/fonts/SpaceGrotesk-Regular.ttf"), + FontTweak::default(), + ); + add( + "space-grotesk-medium", + include_bytes!("../assets/fonts/SpaceGrotesk-Medium.ttf"), + FontTweak::default(), + ); + add( + "space-mono", + include_bytes!("../assets/fonts/SpaceMono-Regular.ttf"), + FontTweak::default(), + ); + add( + "space-mono-bold", + include_bytes!("../assets/fonts/SpaceMono-Bold.ttf"), + FontTweak::default(), + ); + // Round dots, bold enough to read as a display face. + add( + "doto", + include_bytes!("../assets/fonts/Doto[ROND,wght].ttf"), + FontTweak { + coords: VariationCoords::new([(b"ROND", 100.0), (b"wght", 800.0)]), + ..FontTweak::default() + }, + ); + + // egui's own fonts stay behind ours as fallbacks for symbols. + let prop_fallback = defs.families[&FontFamily::Proportional].clone(); + let mono_fallback = defs.families[&FontFamily::Monospace].clone(); + let with = |first: &[&str], rest: &[String]| -> Vec { + first + .iter() + .map(|s| s.to_string()) + .chain(rest.iter().cloned()) + .collect() + }; + defs.families.insert( + FontFamily::Proportional, + with(&["space-grotesk"], &prop_fallback), + ); + defs.families + .insert(FontFamily::Monospace, with(&["space-mono"], &mono_fallback)); + defs.families + .insert(mono_bold(), with(&["space-mono-bold"], &mono_fallback)); + defs.families.insert( + grotesk_medium(), + with(&["space-grotesk-medium"], &prop_fallback), + ); + defs.families + .insert(doto(), with(&["doto", "space-mono"], &mono_fallback)); + defs +} + +fn visuals(p: &Palette, dark: bool) -> Visuals { + let mut v = if dark { + Visuals::dark() + } else { + Visuals::light() + }; + let technical = CornerRadius::same(4); + v.panel_fill = p.black; + v.window_fill = p.surface; + v.window_stroke = Stroke::new(1.0, p.border_visible); + v.window_shadow = Shadow::NONE; + v.popup_shadow = Shadow::NONE; + v.window_corner_radius = CornerRadius::same(16); + v.menu_corner_radius = CornerRadius::same(8); + v.window_highlight_topmost = false; + v.extreme_bg_color = p.surface; + v.text_edit_bg_color = Some(p.surface); + v.faint_bg_color = p.surface_raised; + v.code_bg_color = p.surface_raised; + v.hyperlink_color = p.interactive; + v.warn_fg_color = WARNING; + v.error_fg_color = ACCENT; + v.selection.bg_fill = if dark { + Color32::from_white_alpha(46) + } else { + Color32::from_black_alpha(36) + }; + v.selection.stroke = Stroke::new(1.0, p.text_display); + v.text_cursor.stroke = Stroke::new(2.0, p.text_display); + v.striped = false; + v.indent_has_left_vline = false; + v.collapsing_header_frame = false; + v.slider_trailing_fill = true; + v.resize_corner_size = 8.0; + + let w = &mut v.widgets; + w.noninteractive.bg_fill = p.surface; + w.noninteractive.weak_bg_fill = p.surface; + w.noninteractive.bg_stroke = Stroke::new(1.0, p.border); + w.noninteractive.fg_stroke = Stroke::new(1.0, p.text_primary); + w.noninteractive.corner_radius = technical; + + w.inactive.bg_fill = p.surface_raised; + w.inactive.weak_bg_fill = Color32::TRANSPARENT; + w.inactive.bg_stroke = Stroke::new(1.0, p.border_visible); + w.inactive.fg_stroke = Stroke::new(1.0, p.text_primary); + w.inactive.corner_radius = technical; + w.inactive.expansion = 0.0; + + // Hover: the border and text brighten. No scale, no glow. + w.hovered.bg_fill = p.surface_raised; + w.hovered.weak_bg_fill = p.surface_raised; + w.hovered.bg_stroke = Stroke::new(1.0, p.text_secondary); + w.hovered.fg_stroke = Stroke::new(1.5, p.text_display); + w.hovered.corner_radius = technical; + w.hovered.expansion = 0.0; + + w.active.bg_fill = p.surface_raised; + w.active.weak_bg_fill = p.surface_raised; + w.active.bg_stroke = Stroke::new(1.0, p.text_primary); + w.active.fg_stroke = Stroke::new(2.0, p.text_display); + w.active.corner_radius = technical; + w.active.expansion = 0.0; + + w.open = w.hovered; + v +} + +fn style(theme: Theme) -> Style { + let (p, dark) = match theme { + Theme::Dark => (&DARK, true), + Theme::Light => (&LIGHT, false), + }; + let mut s = Style { + visuals: visuals(p, dark), + ..Style::default() + }; + s.text_styles = [ + (TextStyle::Small, FontId::monospace(LABEL)), + (TextStyle::Body, FontId::proportional(BODY)), + (TextStyle::Button, FontId::monospace(12.0)), + (TextStyle::Heading, FontId::new(18.0, grotesk_medium())), + (TextStyle::Monospace, FontId::monospace(13.0)), + ] + .into(); + s.spacing.item_spacing = egui::vec2(8.0, 4.0); + s.spacing.button_padding = egui::vec2(10.0, 4.0); + s.spacing.interact_size.y = 22.0; + s.spacing.menu_margin = egui::Margin::same(8); + s.spacing.window_margin = egui::Margin::same(16); + s.spacing.menu_spacing = 2.0; + s.animation_time = 0.15; + s.interaction.selectable_labels = false; + s.interaction.tooltip_delay = 0.4; + s +} + +/// Installs the fonts and both themes on `ctx`. +pub fn install(ctx: &Context) { + ctx.set_fonts(fonts()); + ctx.set_style_of(Theme::Dark, style(Theme::Dark)); + ctx.set_style_of(Theme::Light, style(Theme::Light)); +} diff --git a/crates/bench51-gui/src/widgets.rs b/crates/bench51-gui/src/widgets.rs new file mode 100644 index 0000000..6fdadd3 --- /dev/null +++ b/crates/bench51-gui/src/widgets.rs @@ -0,0 +1,378 @@ +//! Nothing-style controls: buttons, segmented controls and bars, bit chips, +//! pin dots, stat rows and empty states. + +use eframe::egui::{ + self, Align, Align2, Color32, CornerRadius, CursorIcon, FontId, Layout, Painter, Rect, + Response, RichText, Sense, Stroke, StrokeKind, TextWrapMode, Ui, WidgetText, pos2, vec2, +}; + +use crate::icons::{self, Icon}; +use crate::theme::{self, ACCENT, LABEL, LABEL_TRACKING, palette}; + +fn galley(ui: &Ui, text: RichText) -> std::sync::Arc { + WidgetText::from(text).into_galley( + ui, + Some(TextWrapMode::Extend), + f32::INFINITY, + egui::TextStyle::Small, + ) +} + +/// Square toolbar button with a monoline icon. `on` shows it latched +/// (inverted), e.g. while the debug session is active. +pub fn icon_button(ui: &mut Ui, icon: Icon, tip: &str, enabled: bool, on: bool) -> Response { + let p = palette(ui.ctx()); + let size = vec2(30.0, 28.0); + let sense = if enabled { + Sense::click() + } else { + Sense::hover() + }; + let (rect, resp) = ui.allocate_exact_size(size, sense); + let resp = resp.on_hover_text(tip); + if ui.is_rect_visible(rect) { + let painter = ui.painter(); + let radius = CornerRadius::same(4); + let fg = if !enabled { + p.text_disabled + } else if on { + p.black + } else if resp.hovered() { + p.text_display + } else { + p.text_primary + }; + if on && enabled { + painter.rect_filled(rect, radius, p.text_display); + } else if resp.hovered() { + painter.rect_stroke( + rect, + radius, + Stroke::new(1.0, p.border_visible), + StrokeKind::Inside, + ); + } + icons::paint(painter, icons::icon_rect(rect, 16.0), icon, fg); + } + if enabled { + resp.on_hover_cursor(CursorIcon::PointingHand) + } else { + resp + } +} + +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum PillKind { + /// White pill with black text: the one action to take. + Primary, + /// Outlined pill. + Secondary, + /// Text only. + Ghost, +} + +/// Pill button: Space Mono, ALL CAPS, tracked. +pub fn pill(ui: &mut Ui, text: &str, kind: PillKind) -> Response { + let p = palette(ui.ctx()); + let label = RichText::new(text.to_uppercase()) + .font(FontId::monospace(12.0)) + .extra_letter_spacing(0.7); + let g = galley(ui, label); + let size = vec2(g.size().x + 36.0, 32.0); + let (rect, resp) = ui.allocate_exact_size(size, Sense::click()); + if ui.is_rect_visible(rect) { + let painter = ui.painter(); + let hovered = resp.hovered(); + let (fill, stroke, fg) = match kind { + PillKind::Primary => (p.text_display, Stroke::NONE, p.black), + PillKind::Secondary => ( + Color32::TRANSPARENT, + Stroke::new( + 1.0, + if hovered { + p.text_primary + } else { + p.border_visible + }, + ), + p.text_primary, + ), + PillKind::Ghost => ( + Color32::TRANSPARENT, + Stroke::NONE, + if hovered { + p.text_display + } else { + p.text_secondary + }, + ), + }; + painter.rect( + rect, + CornerRadius::same(255), + fill, + stroke, + StrokeKind::Inside, + ); + let pos = Align2::CENTER_CENTER + .align_size_within_rect(g.size(), rect) + .min; + painter.galley(pos, g, fg); + } + resp.on_hover_cursor(CursorIcon::PointingHand) +} + +/// Segmented control: the active segment is inverted. Returns true if the +/// value changed. +pub fn segmented(ui: &mut Ui, value: &mut T, options: &[(T, &str)]) -> bool { + let p = palette(ui.ctx()); + let galleys: Vec<_> = options + .iter() + .map(|(_, l)| galley(ui, p.label(l))) + .collect(); + let pad = 10.0; + let widths: Vec = galleys.iter().map(|g| g.size().x + 2.0 * pad).collect(); + let size = vec2(widths.iter().sum(), 24.0); + let (rect, _) = ui.allocate_exact_size(size, Sense::hover()); + let radius = CornerRadius::same(4); + let mut changed = false; + let mut x = rect.left(); + for (i, ((v, label), g)) in options.iter().zip(galleys).enumerate() { + let seg = Rect::from_min_size(pos2(x, rect.top()), vec2(widths[i], rect.height())); + x += widths[i]; + let resp = ui + .interact(seg, ui.auto_id_with(("seg", label, i)), Sense::click()) + .on_hover_cursor(CursorIcon::PointingHand); + let active = *value == *v; + if resp.clicked() && !active { + *value = *v; + changed = true; + } + let fg = if active { + ui.painter().rect_filled(seg, radius, p.text_display); + p.black + } else if resp.hovered() { + p.text_display + } else { + p.text_secondary + }; + let pos = Align2::CENTER_CENTER + .align_size_within_rect(g.size(), seg) + .min; + ui.painter().galley(pos, g, fg); + } + ui.painter().rect_stroke( + rect, + radius, + Stroke::new(1.0, p.border_visible), + StrokeKind::Inside, + ); + changed +} + +/// Segmented bar: `filled` of `segments` square blocks with 2 px gaps. +/// Returns the index of a clicked segment. +pub fn segment_bar( + ui: &mut Ui, + width: f32, + height: f32, + segments: usize, + filled: usize, + color: Color32, + clickable: bool, +) -> Option { + let p = palette(ui.ctx()); + let sense = if clickable { + Sense::click() + } else { + Sense::hover() + }; + let (rect, resp) = ui.allocate_exact_size(vec2(width, height), sense); + let gap = 2.0; + let seg_w = (width - gap * (segments as f32 - 1.0)) / segments as f32; + let hover_idx = resp + .hover_pos() + .filter(|_| clickable) + .map(|pos| (((pos.x - rect.left()) / (seg_w + gap)) as usize).min(segments - 1)); + let empty = if ui.visuals().dark_mode { + p.border + } else { + Color32::from_gray(0xE0) + }; + for i in 0..segments { + let x = rect.left() + i as f32 * (seg_w + gap); + let r = Rect::from_min_size(pos2(x, rect.top()), vec2(seg_w, height)); + let c = if i < filled { + color + } else if hover_idx.is_some_and(|h| i <= h) { + p.text_disabled + } else { + empty + }; + ui.painter().rect_filled(r, 0.0, c); + } + if clickable && resp.clicked() { + resp.on_hover_cursor(CursorIcon::PointingHand); + return hover_idx; + } + if clickable { + resp.on_hover_cursor(CursorIcon::PointingHand); + } + None +} + +/// Bit flag as a technical tag: lit when set. Clicking toggles it. +pub fn bit_chip(ui: &mut Ui, name: &str, on: bool) -> Response { + let p = palette(ui.ctx()); + let g = galley( + ui, + RichText::new(name) + .font(FontId::monospace(LABEL)) + .extra_letter_spacing(LABEL_TRACKING * 0.5), + ); + let size = vec2(g.size().x + 12.0, 20.0); + let (rect, resp) = ui.allocate_exact_size(size, Sense::click()); + if ui.is_rect_visible(rect) { + let hovered = resp.hovered(); + let (stroke, fg) = if on { + (p.text_display, p.text_display) + } else if hovered { + (p.text_secondary, p.text_secondary) + } else { + (p.border_visible, p.text_disabled) + }; + ui.painter().rect_stroke( + rect, + CornerRadius::same(4), + Stroke::new(1.0, stroke), + StrokeKind::Inside, + ); + let pos = Align2::CENTER_CENTER + .align_size_within_rect(g.size(), rect) + .min; + ui.painter().galley(pos, g, fg); + } + resp.on_hover_cursor(CursorIcon::PointingHand) +} + +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum Dot { + High, + Low, + /// Held low from outside the chip, like a pressed button. + PulledLow, +} + +/// A port pin as an LED-like dot. +pub fn pin_dot(ui: &mut Ui, state: Dot) -> Response { + let p = palette(ui.ctx()); + let (rect, resp) = ui.allocate_exact_size(vec2(18.0, 18.0), Sense::click()); + if ui.is_rect_visible(rect) { + let c = rect.center(); + let r = 5.0; + match state { + Dot::High => { + ui.painter().circle_filled(c, r, p.text_display); + } + Dot::PulledLow => { + ui.painter().circle_filled(c, r, ACCENT); + } + Dot::Low => { + ui.painter() + .circle_stroke(c, r - 0.5, Stroke::new(1.5, p.text_disabled)); + } + } + if resp.hovered() { + ui.painter() + .circle_stroke(c, r + 3.0, Stroke::new(1.0, p.border_visible)); + } + } + resp.on_hover_cursor(CursorIcon::PointingHand) +} + +/// Label on the left, value on the right of the available width. +pub fn stat_row(ui: &mut Ui, label: &str, value: RichText) { + let p = palette(ui.ctx()); + ui.horizontal(|ui| { + ui.label(p.label(label)); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + ui.label(value); + }); + }); +} + +/// Uniform dot grid, the dot-matrix motif for empty backgrounds. +pub fn dot_grid(painter: &Painter, rect: Rect, color: Color32, pitch: f32) { + let x0 = (rect.left() / pitch).ceil() * pitch; + let y0 = (rect.top() / pitch).ceil() * pitch; + let mut y = y0; + while y < rect.bottom() { + let mut x = x0; + while x < rect.right() { + painter.circle_filled(pos2(x, y), 0.9, color); + x += pitch; + } + y += pitch; + } +} + +/// Centred two-line empty state on a faint dot grid. +pub fn empty_state(ui: &mut Ui, headline: &str, hint: &str) { + let p = palette(ui.ctx()); + let rect = ui.available_rect_before_wrap(); + let grid = if ui.visuals().dark_mode { + p.border + } else { + p.border_visible.gamma_multiply(0.6) + }; + dot_grid(ui.painter(), rect, grid, 16.0); + ui.scope_builder( + egui::UiBuilder::new() + .max_rect(rect) + .layout(Layout::top_down(Align::Center)), + |ui| { + ui.add_space((rect.height() / 2.0 - 24.0).max(8.0)); + ui.label(p.label(headline).color(p.text_secondary)); + ui.add_space(6.0); + ui.label( + RichText::new(hint) + .size(theme::BODY - 1.0) + .color(p.text_disabled), + ); + }, + ); +} + +/// ALL CAPS section heading with breathing room above. +pub fn section(ui: &mut Ui, title: &str) { + let p = palette(ui.ctx()); + ui.add_space(12.0); + ui.label(p.label(title).color(p.text_disabled)); + ui.add_space(2.0); +} + +/// Underlined single-line input in Space Mono. +pub fn underline_input(ui: &mut Ui, text: &mut String, hint: &str, width: f32) -> Response { + let p = palette(ui.ctx()); + let out = egui::TextEdit::singleline(text) + .font(FontId::monospace(13.0)) + .hint_text( + RichText::new(hint) + .font(FontId::monospace(13.0)) + .color(p.text_disabled), + ) + .frame(egui::Frame::NONE) + .margin(egui::Margin::symmetric(0, 3)) + .desired_width(width) + .show(ui); + let resp = out.response.response; + let color = if resp.has_focus() { + p.text_primary + } else { + p.border_visible + }; + let r = resp.rect; + ui.painter() + .hline(r.x_range(), r.bottom(), Stroke::new(1.0, color)); + resp +} diff --git a/docs/screenshots/gui_breakpoint_light.png b/docs/screenshots/gui_breakpoint_light.png new file mode 100644 index 0000000..eb6ccf8 Binary files /dev/null and b/docs/screenshots/gui_breakpoint_light.png differ diff --git a/docs/screenshots/gui_debug.png b/docs/screenshots/gui_debug.png new file mode 100644 index 0000000..68cb749 Binary files /dev/null and b/docs/screenshots/gui_debug.png differ diff --git a/docs/screenshots/gui_edit.png b/docs/screenshots/gui_edit.png new file mode 100644 index 0000000..7002b84 Binary files /dev/null and b/docs/screenshots/gui_edit.png differ diff --git a/docs/screenshots/gui_errors.png b/docs/screenshots/gui_errors.png new file mode 100644 index 0000000..ee27084 Binary files /dev/null and b/docs/screenshots/gui_errors.png differ diff --git a/docs/screenshots/gui_peripherals.png b/docs/screenshots/gui_peripherals.png new file mode 100644 index 0000000..2657238 Binary files /dev/null and b/docs/screenshots/gui_peripherals.png differ diff --git a/src/main.rs b/src/main.rs index 0189edd..79a037f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,9 @@ -mod asm; -mod isa; -mod sfr; -mod sim; mod ui; use std::path::PathBuf; use std::process::ExitCode; +use bench51_core::asm; use clap::Parser; /// Intel 8051 assembler, simulator and TUI debugger. diff --git a/src/ui/app.rs b/src/ui/app.rs index 1feba97..da8a9be 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -1,13 +1,11 @@ -use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; use std::process::Command; +use bench51_core::files::{self, Loaded}; +use bench51_core::session::{MemSpace, SPEEDS, Session}; use ratatui::crossterm::event::{KeyCode, KeyEvent, KeyModifiers, MouseEvent, MouseEventKind}; use ratatui_textarea::{CursorMove, TextArea}; -use crate::asm::{self, AsmOutput}; -use crate::sim::{Sim, Stop, disasm}; - #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Mode { Edit, @@ -31,13 +29,7 @@ pub enum Focus { Serial, } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum MemTab { - Iram, - Sfr, - Xram, - Code, -} +pub type MemTab = MemSpace; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PromptKind { @@ -52,27 +44,6 @@ pub struct Prompt { pub input: String, } -/// Result of the last successful assembly, which the debugger runs. -pub struct Build { - pub source: Vec, - pub out: AsmOutput, - pub addr_to_line: HashMap, -} - -impl Build { - /// First address emitted by `line`, if any. - pub fn line_addr(&self, line: usize) -> Option { - self.out - .lines - .get(line) - .filter(|l| !l.bytes.is_empty()) - .and_then(|l| l.addr) - } -} - -/// Instructions executed per frame (~30 fps) for each speed setting. -pub const SPEEDS: [u32; 8] = [1, 5, 25, 100, 500, 2_000, 10_000, 40_000]; - pub struct App { pub path: Option, pub editor: TextArea<'static>, @@ -82,27 +53,14 @@ pub struct App { pub focus: Focus, pub mem_tab: MemTab, pub mem_scroll: usize, - /// Last assembler result, even if it had errors (for diagnostics). - pub last_asm: Option<(String, AsmOutput)>, - /// Last error-free build, loaded into the simulator. - pub build: Option, - pub sim: Sim, - /// Breakpoints by source line. - pub breakpoints: HashSet, - pub running: bool, - /// The next run chunk starts a fresh run and may leave a breakpoint. - resume: bool, - pub speed: usize, - pub clock_mhz: f64, - pub status: String, + /// Simulator, build, breakpoints and run state. + pub session: Session, /// Selected line in the debug source view. pub src_cursor: usize, pub src_scroll: usize, pub out_scroll: usize, pub port_sel: (usize, u8), pub serial_input: String, - pub prev_iram: [u8; 256], - pub prev_sfr: [u8; 128], pub show_help: bool, pub prompt: Option, pub quit: bool, @@ -123,28 +81,19 @@ impl App { focus: Focus::Source, mem_tab: MemTab::Iram, mem_scroll: 0, - last_asm: None, - build: None, - sim: Sim::new(), - breakpoints: HashSet::new(), - running: false, - resume: false, - speed: 5, - clock_mhz, - status: "F1 help · F7 assemble · F5 run · F11 step".into(), + session: Session::new(clock_mhz), src_cursor: 0, src_scroll: 0, out_scroll: 0, port_sel: (1, 0), serial_input: String::new(), - prev_iram: [0; 256], - prev_sfr: [0; 128], show_help: false, prompt: None, quit: false, quit_armed: false, external_edit: false, }; + app.session.status = "F1 help · F7 assemble · F5 run · F11 step".into(); match path { Some(p) => app.open(&p), None => app.set_text(TEMPLATE), @@ -161,9 +110,7 @@ impl App { }); crate::ui::draw::style_editor(&mut self.editor); self.saved_text = self.text(); - self.breakpoints.clear(); - self.build = None; - self.last_asm = None; + self.session.clear(); self.focus = Focus::Source; self.serial_input.clear(); } @@ -178,9 +125,8 @@ impl App { /// Source differs from what the simulator is running. pub fn stale(&self) -> bool { - self.build - .as_ref() - .is_none_or(|b| b.source != self.editor.lines()) + self.session + .is_stale(self.editor.lines().iter().map(String::as_str)) } pub fn title(&self) -> String { @@ -194,37 +140,24 @@ impl App { // ---- Files ---- fn open(&mut self, path: &Path) { - let text = match std::fs::read_to_string(path) { - Ok(t) => t, - Err(e) => { - self.status = format!("cannot open {}: {e}", path.display()); - return; + match files::load(path) { + Err(e) => self.session.status = e, + Ok(Loaded::Hex { source, bytes }) => { + self.set_text(&source); + self.saved_text.clear(); + self.path = None; + self.assemble(); + self.session.status = format!( + "loaded {} ({bytes} bytes) and disassembled it", + path.display() + ); } - }; - if path - .extension() - .is_some_and(|e| e.eq_ignore_ascii_case("hex") || e.eq_ignore_ascii_case("ihx")) - { - match asm::hex::read(&text) { - Ok(bytes) => { - let src = disassemble_image(&bytes, path); - self.set_text(&src); - self.saved_text.clear(); - self.path = None; - self.assemble(); - self.status = format!( - "loaded {} ({} bytes) and disassembled it", - path.display(), - bytes.len() - ); - } - Err(e) => self.status = format!("invalid HEX file: {e}"), + Ok(Loaded::Source(text)) => { + self.set_text(&text); + self.path = Some(path.to_path_buf()); + self.mode = Mode::Edit; + self.session.status = format!("opened {}", path.display()); } - } else { - self.set_text(&text); - self.path = Some(path.to_path_buf()); - self.mode = Mode::Edit; - self.status = format!("opened {}", path.display()); } } @@ -241,10 +174,10 @@ impl App { match std::fs::write(&path, text) { Ok(()) => { self.saved_text = self.text(); - self.status = format!("saved {}", path.display()); + self.session.status = format!("saved {}", path.display()); self.path = Some(path); } - Err(e) => self.status = format!("cannot save {}: {e}", path.display()), + Err(e) => self.session.status = format!("cannot save {}: {e}", path.display()), } } @@ -266,7 +199,7 @@ impl App { None => { let p = std::env::temp_dir().join(format!("bench51-{}.asm", std::process::id())); if let Err(e) = std::fs::write(&p, self.text() + "\n") { - self.status = format!("cannot write {}: {e}", p.display()); + self.session.status = format!("cannot write {}: {e}", p.display()); return; } (p, true) @@ -280,11 +213,11 @@ impl App { let _ = std::fs::remove_file(&path); } match (result, text) { - (Err(e), _) => self.status = format!("cannot start editor: {e}"), + (Err(e), _) => self.session.status = format!("cannot start editor: {e}"), (Ok(s), _) if !s.success() => { - self.status = format!("editor exited with {s}; changes not loaded") + self.session.status = format!("editor exited with {s}; changes not loaded") } - (Ok(_), Err(e)) => self.status = format!("cannot read {}: {e}", path.display()), + (Ok(_), Err(e)) => self.session.status = format!("cannot read {}: {e}", path.display()), (Ok(_), Ok(text)) => self.reload(&text, !temp), } } @@ -299,7 +232,7 @@ impl App { lines }; if lines == self.editor.lines() { - self.status = "no changes from external editor".into(); + self.session.status = "no changes from external editor".into(); return; } let cursor = self.editor.cursor(); @@ -312,61 +245,33 @@ impl App { self.saved_text = self.text(); } let n = self.editor.lines().len(); - self.breakpoints.retain(|&l| l < n); + self.session.breakpoints.retain(|&l| l < n); if self.assemble() { - self.status = format!("reloaded from external editor; {}", self.status); + self.session.status = format!("reloaded from external editor; {}", self.session.status); } } // ---- Build & run ---- /// Assembles the editor contents. On success the program is loaded - /// into a freshly reset simulator. + /// into a freshly reset simulator; on errors the cursor jumps to the + /// first one. pub fn assemble(&mut self) -> bool { let source = self.text(); - let out = asm::assemble(&source); - let ok = out.ok(); + let ok = self.session.assemble(&source, self.path.as_deref()); if ok { - self.sim.load_code(out.bytes()); - self.sim.reset(); - self.running = false; - self.status = format!("assembled: {} bytes, 0 errors", out.code_size()); - self.write_outputs(&out, &source); - self.build = Some(Build { - source: self.editor.lines().to_vec(), - addr_to_line: out.addr_to_line(), - out: out.clone(), - }); - self.snapshot(); self.follow_pc(); - } else { + } else if let Some((_, out)) = &self.session.last_asm { let first = &out.diagnostics[0]; - self.status = format!( - "{} error(s); line {}: {}", - out.diagnostics.len(), - first.line + 1, - first.msg - ); self.editor .move_cursor(CursorMove::Jump(first.line as u16, first.col as u16)); self.mode = Mode::Edit; self.out_tab = OutTab::Errors; } self.out_scroll = 0; - self.last_asm = Some((source, out)); ok } - /// Writes `.lst` and `.hex` next to a saved source file. - fn write_outputs(&mut self, out: &AsmOutput, source: &str) { - let Some(path) = &self.path else { return }; - let res = std::fs::write(path.with_extension("lst"), out.listing(source)) - .and_then(|_| std::fs::write(path.with_extension("hex"), out.intel_hex())); - if let Err(e) = res { - self.status = format!("assembled, but writing .lst/.hex failed: {e}"); - } - } - /// Makes sure an up-to-date build is loaded; returns false on errors. fn ensure_built(&mut self) -> bool { if self.stale() && !self.assemble() { @@ -379,132 +284,65 @@ impl App { true } - pub fn bp_addrs(&self) -> HashSet { - let Some(b) = &self.build else { - return HashSet::new(); - }; - self.breakpoints - .iter() - .filter_map(|&l| b.line_addr(l)) - .collect() - } - - pub fn snapshot(&mut self) { - self.prev_iram = self.sim.iram; - self.prev_sfr = self.sim.sfr; - } - - pub fn pc_line(&self) -> Option { - self.build.as_ref()?.addr_to_line.get(&self.sim.pc).copied() - } - - /// Scrolls the source view so the PC line is visible. + /// Moves the source cursor to the PC line. pub fn follow_pc(&mut self) { - if let Some(l) = self.pc_line() { + if let Some(l) = self.session.pc_line() { self.src_cursor = l; } } - fn report(&mut self, stop: Stop) { - self.running = false; - self.status = match stop { - Stop::Breakpoint(pc) => format!("breakpoint at {pc:04X}h"), - Stop::ReservedOpcode { pc, opcode } => { - format!("reserved opcode {opcode:02X}h at {pc:04X}h — stopped") - } - Stop::PowerDown => "CPU in power-down mode (PCON.PD) — reset to continue".into(), - Stop::Target | Stop::Budget => format!("stopped at {:04X}h", self.sim.pc), - }; - self.follow_pc(); - } - - fn step_cmd(&mut self, f: impl FnOnce(&mut Sim, &HashSet) -> Stop) { + /// Runs a session command once a build is loaded, then follows the PC. + fn debug_cmd(&mut self, f: impl FnOnce(&mut Session)) { if !self.ensure_built() { return; } - self.running = false; - self.snapshot(); - let bps = self.bp_addrs(); - let stop = f(&mut self.sim, &bps); - match stop { - Stop::Target => { - self.status = format!("PC = {:04X}h", self.sim.pc); - self.follow_pc(); - } - Stop::Budget => self.report(Stop::Budget), - s => self.report(s), - } + f(&mut self.session); + self.follow_pc(); } fn toggle_run(&mut self) { - if self.running { - self.running = false; - self.status = format!("paused at {:04X}h", self.sim.pc); + if self.session.running { + self.session.pause(); self.follow_pc(); } else if self.ensure_built() { - self.running = true; - self.resume = true; - self.status = "running…".into(); + self.session.start(); } } - fn run_to_cursor(&mut self) { - if !self.ensure_built() { - return; - } - let line = if self.mode == Mode::Debug { + /// Source line the cursor is on in the current mode. + fn cursor_line(&self) -> usize { + if self.mode == Mode::Debug { self.src_cursor } else { self.editor.cursor().0 - }; - let Some(target) = self.build.as_ref().and_then(|b| b.line_addr(line)) else { - self.status = "no code on that line".into(); + } + } + + fn run_to_cursor(&mut self) { + if !self.ensure_built() { return; - }; - self.step_cmd(|s, bps| { - let mut bps = bps.clone(); - bps.insert(target); - match s.run(5_000_000, &bps, true) { - Stop::Breakpoint(pc) if pc == target => Stop::Target, - other => other, - } + } + let line = self.cursor_line(); + self.debug_cmd(|s| { + s.run_to_line(line); }); } fn reset(&mut self) { - self.sim.reset(); - self.running = false; - self.snapshot(); + self.session.reset(); self.follow_pc(); - self.status = "reset".into(); } fn toggle_breakpoint(&mut self) { - let line = if self.mode == Mode::Debug { - self.src_cursor - } else { - self.editor.cursor().0 - }; - if !self.breakpoints.remove(&line) { - self.breakpoints.insert(line); - } + let line = self.cursor_line(); + self.session.toggle_breakpoint(line); } /// Called once per frame. pub fn tick(&mut self) { - if !self.running { - return; - } - self.snapshot(); - let bps = self.bp_addrs(); - let resume = std::mem::take(&mut self.resume); - match self.sim.run(SPEEDS[self.speed], &bps, resume) { - Stop::Budget => { - if let Some(l) = self.pc_line() { - self.src_cursor = l; - } - } - s => self.report(s), + if self.session.running { + self.session.tick(); + self.follow_pc(); } } @@ -541,7 +379,7 @@ impl App { (KeyCode::Char('q'), true) => { if self.dirty() && !self.quit_armed { self.quit_armed = true; - self.status = "unsaved changes — press Ctrl-Q again to quit".into(); + self.session.status = "unsaved changes — press Ctrl-Q again to quit".into(); } else { self.quit = true; } @@ -571,12 +409,9 @@ impl App { } (KeyCode::F(8), _) => self.run_to_cursor(), (KeyCode::F(9), _) => self.toggle_breakpoint(), - (KeyCode::F(10), _) => self.step_cmd(|s, b| s.step_over(5_000_000, b)), - (KeyCode::F(11), _) => self.step_cmd(|s, _| match s.step() { - Ok(()) => Stop::Target, - Err(e) => e, - }), - (KeyCode::F(12), _) => self.step_cmd(|s, b| s.step_out(5_000_000, b)), + (KeyCode::F(10), _) => self.debug_cmd(Session::step_over), + (KeyCode::F(11), _) => self.debug_cmd(Session::step_into), + (KeyCode::F(12), _) => self.debug_cmd(Session::step_out), _ => match self.mode { Mode::Edit => self.on_edit_key(key), Mode::Debug => self.on_debug_key(key), @@ -595,7 +430,7 @@ impl App { KeyCode::Down if alt => self.out_scroll += 1, KeyCode::PageUp if alt => self.out_scroll = self.out_scroll.saturating_sub(20), KeyCode::PageDown if alt => self.out_scroll += 20, - KeyCode::Esc if self.running => self.toggle_run(), + KeyCode::Esc if self.session.running => self.toggle_run(), _ => { self.editor.input(key); } @@ -608,7 +443,7 @@ impl App { KeyCode::Enter => { let mut bytes = std::mem::take(&mut self.serial_input).into_bytes(); bytes.push(b'\r'); - self.sim.uart_send(&bytes); + self.session.sim.uart_send(&bytes); return; } KeyCode::Backspace => { @@ -628,7 +463,7 @@ impl App { KeyCode::Tab => self.cycle_focus(true), KeyCode::BackTab => self.cycle_focus(false), KeyCode::Esc => { - if self.running { + if self.session.running { self.toggle_run(); } else if self.focus == Focus::Serial { self.focus = Focus::Source; @@ -637,9 +472,9 @@ impl App { } } KeyCode::Char('+') | KeyCode::Char('=') => { - self.speed = (self.speed + 1).min(SPEEDS.len() - 1) + self.session.speed = (self.session.speed + 1).min(SPEEDS.len() - 1) } - KeyCode::Char('-') => self.speed = self.speed.saturating_sub(1), + KeyCode::Char('-') => self.session.speed = self.session.speed.saturating_sub(1), KeyCode::Char('?') => self.show_help = true, // Letter aliases for terminals that swallow function keys. KeyCode::Char('r') => self.toggle_run(), @@ -684,6 +519,7 @@ impl App { fn move_src(&mut self, code: KeyCode, page: usize) { let max = self + .session .build .as_ref() .map_or(0, |b| b.source.len().saturating_sub(1)); @@ -694,7 +530,7 @@ impl App { KeyCode::PageDown => self.src_cursor + page, KeyCode::Home => 0, KeyCode::End => max, - KeyCode::Char('.') => self.pc_line().unwrap_or(self.src_cursor), + KeyCode::Char('.') => self.session.pc_line().unwrap_or(self.src_cursor), _ => self.src_cursor, } .min(max); @@ -745,7 +581,7 @@ impl App { KeyCode::Left => *bit = (*bit + 1).min(7), KeyCode::Right => *bit = bit.saturating_sub(1), KeyCode::Char(' ') | KeyCode::Enter => { - self.sim.pins[*port] ^= 1 << *bit; + self.session.sim.pins[*port] ^= 1 << *bit; } _ => {} } @@ -786,38 +622,14 @@ impl App { parts.first().and_then(|s| parse(s)), parts.get(1).and_then(|s| parse(s)), ) else { - self.status = "usage: (hex), e.g. 30 FF".into(); + self.session.status = "usage: (hex), e.g. 30 FF".into(); return; }; if val > 0xFF { - self.status = "value must be a byte".into(); + self.session.status = "value must be a byte".into(); return; } - let v = val as u8; - let ok = match self.mem_tab { - MemTab::Iram if addr <= 0xFF => { - self.sim.iram[addr as usize] = v; - true - } - MemTab::Sfr if (0x80..=0xFF).contains(&addr) => { - self.sim.set_sfr(addr as u8, v); - true - } - MemTab::Xram if addr <= 0xFFFF => { - self.sim.xram[addr as usize] = v; - true - } - MemTab::Code if addr <= 0xFFFF => { - self.sim.code[addr as usize] = v; - true - } - _ => false, - }; - self.status = if ok { - format!("wrote {v:02X}h at {addr:X}h") - } else { - "address out of range".into() - }; + self.session.poke(self.mem_tab, addr, val as u8); } } @@ -848,46 +660,6 @@ fn editor_command(path: &Path, line: usize) -> Command { cmd } -/// Builds an assembler source from a HEX image by disassembling each -/// contiguous run of bytes. Reassembling it reproduces the image exactly. -fn disassemble_image(bytes: &[(u16, u8)], path: &Path) -> String { - let mut code = Box::new([0u8; 0x10000]); - let mut used = vec![false; 0x10000]; - for &(a, b) in bytes { - code[a as usize] = b; - used[a as usize] = true; - } - let mut src = format!("; disassembled from {}\n", path.display()); - let mut addr = 0usize; - while addr < 0x10000 { - if !used[addr] { - addr += 1; - continue; - } - src.push_str(&format!( - "\n ORG {}\n", - crate::sfr::hex16(addr as u16) - )); - while addr < 0x10000 && used[addr] { - let d = disasm::disassemble(&code, addr as u16); - let size = d.size as usize; - if (addr..addr + size).all(|a| a < 0x10000 && used[a]) { - src.push_str(&format!(" {:<24}; {:04X}\n", d.text, addr)); - addr += size; - } else { - src.push_str(&format!( - " DB {:<21}; {:04X}\n", - crate::sfr::hex8(code[addr]), - addr - )); - addr += 1; - } - } - } - src.push_str(" END\n"); - src -} - const TEMPLATE: &str = "\ ; New 8051 program. F7 assembles, F5 runs, F11 steps, F1 shows all keys. ORG 0000h diff --git a/src/ui/draw.rs b/src/ui/draw.rs index 36f7db9..050158d 100644 --- a/src/ui/draw.rs +++ b/src/ui/draw.rs @@ -5,9 +5,10 @@ use ratatui::text::{Line, Span}; use ratatui::widgets::{Block, BorderType, Borders, Clear, Paragraph, Tabs, Wrap}; use ratatui_textarea::TextArea; -use super::app::{App, Focus, MemTab, Mode, OutTab, PromptKind, SPEEDS}; +use super::app::{App, Focus, MemTab, Mode, OutTab, PromptKind}; use super::syntax::highlight; -use crate::sfr::{self, IE, IP, PCON, PSW, SCON, TCON, TH0, TH1, TL0, TL1, TMOD}; +use bench51_core::session::{SPEEDS, vector_name}; +use bench51_core::sfr::{self, IE, IP, PCON, PSW, SCON, TCON, TH0, TH1, TL0, TL1, TMOD}; const ACCENT: Color = Color::Cyan; const CHANGED: Style = Style::new().fg(Color::Yellow).add_modifier(Modifier::BOLD); @@ -73,12 +74,12 @@ fn draw_header(f: &mut Frame, app: &App, area: Rect) { Style::new().bg(Color::Magenta).fg(Color::White).bold(), ), }; - let (state, state_style) = if app.running { + let (state, state_style) = if app.session.running { ( " RUNNING ", Style::new().bg(Color::Green).fg(Color::Black).bold(), ) - } else if app.build.is_none() { + } else if app.session.build.is_none() { ( " NOT BUILT ", Style::new().bg(Color::DarkGray).fg(Color::White), @@ -96,14 +97,14 @@ fn draw_header(f: &mut Frame, app: &App, area: Rect) { Span::styled(state, state_style), Span::raw(format!(" {}", app.title())), ]; - if app.build.is_some() && app.stale() { + if app.session.build.is_some() && app.stale() { spans.push(Span::styled( " (source changed — F7 to rebuild)", Style::new().fg(Color::Yellow), )); } spans.push(Span::styled( - format!(" speed {}/frame (+/-)", SPEEDS[app.speed]), + format!(" speed {}/frame (+/-)", SPEEDS[app.session.speed]), DIM, )); f.render_widget(Line::from(spans), area); @@ -137,7 +138,7 @@ fn draw_footer(f: &mut Frame, app: &App, area: Rect) { } }; let width = area.width as usize; - let status = format!(" {}", app.status); + let status = format!(" {}", app.session.status); let pad = width.saturating_sub(status.chars().count() + keys.len() + 1); let line = Line::from(vec![ Span::styled(status, Style::new().fg(Color::White)), @@ -163,16 +164,16 @@ fn draw_edit(f: &mut Frame, app: &mut App, area: Rect) { // Breakpoint / error markers aligned with the editor's scroll position. let top = app.editor.scroll_offset().0 as usize; let errors: Vec = app - .last_asm - .as_ref() - .filter(|(src, _)| *src == app.text()) - .map(|(_, o)| o.diagnostics.iter().map(|d| d.line).collect()) - .unwrap_or_default(); + .session + .diagnostics_for(&app.text()) + .iter() + .map(|d| d.line) + .collect(); let marks: Vec = (top..top + gutter.height as usize) .map(|l| { if errors.contains(&l) { Line::styled("✗", Style::new().fg(Color::Red).bold()) - } else if app.breakpoints.contains(&l) { + } else if app.session.breakpoints.contains(&l) { Line::styled("●", Style::new().fg(Color::Red)) } else { Line::raw("") @@ -186,6 +187,7 @@ fn draw_edit(f: &mut Frame, app: &mut App, area: Rect) { fn draw_output(f: &mut Frame, app: &mut App, area: Rect) { let n_err = app + .session .last_asm .as_ref() .map_or(0, |(_, o)| o.diagnostics.len()); @@ -214,7 +216,7 @@ fn draw_output(f: &mut Frame, app: &mut App, area: Rect) { .highlight_style(Style::new().fg(ACCENT).bold().underlined()); f.render_widget(tabs, tabs_area); - let lines: Vec = match (app.out_tab, &app.last_asm) { + let lines: Vec = match (app.out_tab, &app.session.last_asm) { (_, None) => vec![Line::styled("Press F7 to assemble.", DIM)], (OutTab::Listing, Some((src, out))) => out .listing(src) @@ -312,7 +314,7 @@ fn draw_source(f: &mut Frame, app: &mut App, area: Rect) { let block = panel("Source", focused); let inner = block.inner(area); f.render_widget(block, area); - let Some(build) = &app.build else { + let Some(build) = &app.session.build else { f.render_widget( Paragraph::new("Nothing assembled yet — press F7.").style(DIM), inner, @@ -326,7 +328,7 @@ fn draw_source(f: &mut Frame, app: &mut App, area: Rect) { } else if app.src_cursor >= app.src_scroll + h { app.src_scroll = app.src_cursor + 1 - h; } - let pc_line = build.addr_to_line.get(&app.sim.pc).copied(); + let pc_line = build.addr_to_line.get(&app.session.sim.pc).copied(); let lines: Vec = build .source .iter() @@ -343,7 +345,7 @@ fn draw_source(f: &mut Frame, app: &mut App, area: Rect) { } else { Style::new() }; - let bp = if app.breakpoints.contains(&i) { + let bp = if app.session.breakpoints.contains(&i) { Span::styled("●", bg.fg(Color::Red)) } else { Span::styled(" ", bg) @@ -394,27 +396,20 @@ fn flags(byte: u8, names: [&'static str; 8]) -> Vec> { } fn draw_registers(f: &mut Frame, app: &App, area: Rect) { - let s = &app.sim; + let s = &app.session.sim; let block = panel("Registers", false); let inner = block.inner(area); f.render_widget(block, area); - let ch = |addr: u8| s.sfr(addr) != app.prev_sfr[(addr & 0x7F) as usize]; + let ch = |addr: u8| s.sfr(addr) != app.session.prev_sfr[(addr & 0x7F) as usize]; let reg = |n: u8| { let a = s.reg_addr(n) as usize; vec![ Span::styled(format!("R{n} "), LABEL), - hex2(s.iram[a], s.iram[a] != app.prev_iram[a]), + hex2(s.iram[a], s.iram[a] != app.session.prev_iram[a]), Span::raw(" "), ] }; - let micros = s.cycles as f64 * 12.0 / app.clock_mhz; - let time = if micros >= 1_000_000.0 { - format!("{:.3} s", micros / 1e6) - } else if micros >= 1000.0 { - format!("{:.3} ms", micros / 1e3) - } else { - format!("{micros:.2} µs") - }; + let time = app.session.elapsed(); let lines = vec![ Line::from(vec![ Span::styled("PC ", LABEL), @@ -461,18 +456,18 @@ fn draw_registers(f: &mut Frame, app: &App, area: Rect) { Line::from(vec![ Span::styled("Time ", LABEL), Span::raw(time), - Span::styled(format!(" @{}MHz", app.clock_mhz), DIM), + Span::styled(format!(" @{}MHz", app.session.clock_mhz), DIM), ]), ]; f.render_widget(Paragraph::new(lines), inner); } fn draw_peripherals(f: &mut Frame, app: &App, area: Rect) { - let s = &app.sim; + let s = &app.session.sim; let block = panel("Peripherals", false); let inner = block.inner(area); f.render_widget(block, area); - let ch = |addr: u8| s.sfr(addr) != app.prev_sfr[(addr & 0x7F) as usize]; + let ch = |addr: u8| s.sfr(addr) != app.session.prev_sfr[(addr & 0x7F) as usize]; let sfr_val = |name: &'static str, addr: u8| { vec![ Span::styled(name, LABEL), @@ -609,17 +604,6 @@ fn draw_peripherals(f: &mut Frame, app: &App, area: Rect) { f.render_widget(Paragraph::new(lines), inner); } -fn vector_name(v: u16) -> &'static str { - match v { - 0x03 => "INT0", - 0x0B => "T0", - 0x13 => "INT1", - 0x1B => "T1", - 0x23 => "UART", - _ => "?", - } -} - fn draw_memory(f: &mut Frame, app: &mut App, area: Rect) { let focused = app.focus == Focus::Memory; let block = panel("Memory", focused); @@ -646,7 +630,7 @@ fn draw_memory(f: &mut Frame, app: &mut App, area: Rect) { return; } - let s = &app.sim; + let s = &app.session.sim; let per_row: usize = if content.width >= 74 { 16 } else { 8 }; let total = match app.mem_tab { MemTab::Iram => 256, @@ -655,9 +639,9 @@ fn draw_memory(f: &mut Frame, app: &mut App, area: Rect) { let rows = total / per_row; let h = content.height as usize; app.mem_scroll = app.mem_scroll.min(rows.saturating_sub(h)); - let bps = app.bp_addrs(); + let bps = app.session.bp_addrs(); let pc = s.pc as usize; - let pc_len = crate::isa::info(s.code[pc]).map_or(1, |i| i.size as usize); + let pc_len = bench51_core::isa::info(s.code[pc]).map_or(1, |i| i.size as usize); let bank = s.reg_addr(0) as usize; let lines: Vec = (app.mem_scroll..rows.min(app.mem_scroll + h)) @@ -679,7 +663,7 @@ fn draw_memory(f: &mut Frame, app: &mut App, area: Rect) { let v = s.iram[a]; let st = if a == s.sp() as usize { Style::new().fg(Color::Black).bg(Color::LightMagenta) - } else if v != app.prev_iram[a] { + } else if v != app.session.prev_iram[a] { CHANGED } else if (bank..bank + 8).contains(&a) { Style::new().fg(Color::LightBlue) @@ -724,7 +708,7 @@ fn draw_memory(f: &mut Frame, app: &mut App, area: Rect) { } fn draw_sfr_table(f: &mut Frame, app: &App, area: Rect) { - let s = &app.sim; + let s = &app.session.sim; let cols = if area.width >= 64 { 3 } else { 2 }; let per_col = sfr::SFRS.len().div_ceil(cols); let lines: Vec = (0..per_col) @@ -733,7 +717,7 @@ fn draw_sfr_table(f: &mut Frame, app: &App, area: Rect) { for c in 0..cols { if let Some(&(name, addr)) = sfr::SFRS.get(c * per_col + r) { let v = s.read_direct(addr, true); - let changed = s.sfr(addr) != app.prev_sfr[(addr & 0x7F) as usize]; + let changed = s.sfr(addr) != app.session.prev_sfr[(addr & 0x7F) as usize]; spans.push(Span::styled(format!("{name:<5}"), LABEL)); spans.push(Span::styled(format!("{addr:02X} "), DIM)); spans.push(hex2(v, changed)); @@ -754,7 +738,7 @@ fn draw_ports(f: &mut Frame, app: &App, area: Rect) { let block = panel("Ports", focused); let inner = block.inner(area); f.render_widget(block, area); - let s = &app.sim; + let s = &app.session.sim; let mut lines: Vec = (0..4) .map(|p| { let latch = s.sfr(sfr::P0 + 0x10 * p as u8); @@ -797,7 +781,7 @@ fn draw_serial(f: &mut Frame, app: &App, area: Rect) { Layout::vertical([Constraint::Min(1), Constraint::Length(1)]).areas(inner); let mut text = String::new(); - for &b in &app.sim.uart.tx_log { + for &b in &app.session.sim.uart.tx_log { match b { b'\n' => text.push('\n'), b'\r' => {} diff --git a/src/ui/syntax.rs b/src/ui/syntax.rs index 513450a..665525a 100644 --- a/src/ui/syntax.rs +++ b/src/ui/syntax.rs @@ -1,122 +1,27 @@ -//! Minimal 8051 assembly syntax highlighting. +//! 8051 assembly syntax highlighting for the TUI. +use bench51_core::syntax::{Tok, tokens}; use ratatui::style::{Color, Modifier, Style}; use ratatui::text::Span; -use crate::{isa, sfr}; - -const COMMENT: Style = Style::new().fg(Color::DarkGray); -const LABEL: Style = Style::new().fg(Color::Yellow); -const MNEMONIC: Style = Style::new().fg(Color::Cyan).add_modifier(Modifier::BOLD); -const DIRECTIVE: Style = Style::new().fg(Color::Magenta); -const REGISTER: Style = Style::new().fg(Color::LightBlue); -const NUMBER: Style = Style::new().fg(Color::LightGreen); -const STRING: Style = Style::new().fg(Color::Green); -const SFR: Style = Style::new().fg(Color::LightMagenta); - -fn is_directive(w: &str) -> bool { - matches!( - w, - "ORG" - | "DB" - | "DW" - | "DS" - | "END" - | "EQU" - | "SET" - | "BIT" - | "DATA" - | "IDATA" - | "XDATA" - | "CODE" - | "CSEG" - | "XSEG" - | "DSEG" - | "AT" - | "USING" - | "NAME" - | "BYTE" - | "WORD" - ) -} - -fn word_style(w: &str, first_word: bool) -> Style { - let u = w.to_ascii_uppercase(); - let reg = matches!(u.as_str(), "A" | "AB" | "C" | "DPTR" | "PC") - || (u.len() == 2 - && u.starts_with('R') - && u.as_bytes()[1].is_ascii_digit() - && u.as_bytes()[1] < b'8'); - if reg { - REGISTER - } else if is_directive(&u) { - DIRECTIVE - } else if first_word && isa::is_mnemonic(&u) { - MNEMONIC - } else if sfr::SFRS.iter().chain(sfr::BITS).any(|(n, _)| *n == u) { - SFR - } else if matches!( - u.as_str(), - "HIGH" | "LOW" | "MOD" | "AND" | "OR" | "XOR" | "NOT" | "SHL" | "SHR" - ) { - DIRECTIVE - } else { - Style::new() +fn style(t: Tok) -> Style { + match t { + Tok::Plain => Style::new(), + Tok::Comment => Style::new().fg(Color::DarkGray), + Tok::Label => Style::new().fg(Color::Yellow), + Tok::Mnemonic => Style::new().fg(Color::Cyan).add_modifier(Modifier::BOLD), + Tok::Directive => Style::new().fg(Color::Magenta), + Tok::Register => Style::new().fg(Color::LightBlue), + Tok::Number => Style::new().fg(Color::LightGreen), + Tok::Str => Style::new().fg(Color::Green), + Tok::Sfr => Style::new().fg(Color::LightMagenta), } } /// Splits a source line into styled spans, applying `base` underneath. pub fn highlight(line: &str, base: Style) -> Vec> { - let chars: Vec = line.chars().collect(); - let mut spans = Vec::new(); - let mut i = 0; - let mut seen_word = false; - let push = |spans: &mut Vec>, s: String, st: Style| { - spans.push(Span::styled(s, base.patch(st))) - }; - while i < chars.len() { - let c = chars[i]; - let start = i; - if c == ';' { - push(&mut spans, chars[i..].iter().collect(), COMMENT); - break; - } else if c == '\'' || c == '"' { - i += 1; - while i < chars.len() && chars[i] != c { - i += 1; - } - i = (i + 1).min(chars.len()); - push(&mut spans, chars[start..i].iter().collect(), STRING); - } else if c.is_ascii_alphabetic() || c == '_' || c == '?' { - while i < chars.len() - && (chars[i].is_ascii_alphanumeric() || chars[i] == '_' || chars[i] == '?') - { - i += 1; - } - let w: String = chars[start..i].iter().collect(); - let is_label = !seen_word && chars.get(i) == Some(&':'); - let style = if is_label { - LABEL - } else { - let st = word_style(&w, !seen_word); - seen_word = true; - st - }; - push(&mut spans, w, style); - } else if c.is_ascii_digit() || c == '#' || c == '$' { - i += 1; - while i < chars.len() && chars[i].is_ascii_alphanumeric() { - i += 1; - } - push(&mut spans, chars[start..i].iter().collect(), NUMBER); - } else { - while i < chars.len() - && !(chars[i].is_ascii_alphanumeric() || "_?;'\"#$".contains(chars[i])) - { - i += 1; - } - push(&mut spans, chars[start..i].iter().collect(), Style::new()); - } - } - spans + tokens(line) + .into_iter() + .map(|(r, t)| Span::styled(line[r].to_string(), base.patch(style(t)))) + .collect() }