From 2fb5ddf0da9f17c458a0eb89e1fd965df8019e29 Mon Sep 17 00:00:00 2001 From: checkroom Date: Sun, 15 Dec 2024 07:00:40 +0000 Subject: [PATCH] Preliminary work to support the riscv vm in place of wasm --- README.md | 8 +++++--- include/cbindings/vs.h | 3 ++- include/ui-frame.hpp | 1 + include/ui-tree.riscv.hpp | 0 meson.build | 1 + src/ui-tree.riscv.cpp | 0 6 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 include/ui-tree.riscv.hpp create mode 100644 src/ui-tree.riscv.cpp diff --git a/README.md b/README.md index decb0e52..74f5324b 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ Compared to other approaches, `vs` is extremely opinionated and tries to enforce - [ ] JS powered by [QuickJS](https://github.com/quickjs-ng). - [ ] Lua, either based on the reference implementation or LuaJIT. - [ ] WASM to run any language which can be compiled to this target & their compilers. + - [ ] A RISCV simulator to run components from any language supporting this architecture. - [ ] Distribution of components via http/https and [gemini](https://geminiprotocol.net/). - [ ] A self-hosted visual editor to design, code and test new components (something like [gambas](https://gambas.sourceforge.net/en/main.html) or [fluid](https://www.fltk.org/doc-1.4/fluid.html)). - [ ] A robust permission system to decide what components can do based on their origin. @@ -161,7 +162,7 @@ This project is based on the following dependencies: - [fmt](https://github.com/fmtlib/fmt) to format strings and as `printf` replacement. - [pugixml](https://pugixml.org/) to parse xml. - [mio](https://github.com/vimpunk/mio) memory mapping for loading files. -- [hashlib](https://github.com/KaruroChori/hash-library) for cryptographic functions (and not). +- [hashlib](https://github.com/lazy-eggplant/hash-library) for cryptographic functions (and not). - [libuv](https://libuv.org/) for me not to care about portable code. - [vs.templ](https://github.com/lazy-eggplant/vs.templ) a library to parse markdown (not just to HTML). - [vs.robot](https://github.com/lazy-eggplant/vs.robot) a library to perform automatic actions on FLTK. @@ -171,11 +172,12 @@ This project is based on the following dependencies: ### For embedded scripts - [libffi](https://github.com/libffi/libffi) to simplify symbol sharing between languages. -- [tcc](https://github.com/KaruroChori/tcc-vs) the embeddable C compiler used for C scripts. +- [tcc](https://github.com/lazy-eggplant/tcc-vs) the embeddable C compiler used for C scripts. - [cello](https://libcello.org) an unholy macro machine for C to transform it into a dynamic language. - [quickjs](https://github.com/quickjs-ng) the embeddable JS runtime used for JS scripts. - [lua](https://www.lua.org/) and [luajit](http://luajit.org/) to support Lua scripts. -- [wamr](https://github.com/bytecodealliance/wasm-micro-runtime) the embeddable WASM runtime used for scripts, portable compiled components & compilers. +- [wamr](https://github.com/bytecodealliance/wasm-micro-runtime) the embeddable WASM runtime used for scripts, portable compiled components & toolchains. +- [libriscv](https://github.com/libriscv/libriscv) the embeddable riscv vm, used for scripts, portable compiled components & toolchains. ### For custom components diff --git a/include/cbindings/vs.h b/include/cbindings/vs.h index 123edaad..9c0227b2 100644 --- a/include/cbindings/vs.h +++ b/include/cbindings/vs.h @@ -45,7 +45,8 @@ enum vs_symbol_mode_t{ VS_SYMBOL_MODE_QUICKJS, VS_SYMBOL_MODE_WASM, VS_SYMBOL_MODE_EXTERNAL, - VS_SYMBOL_MODE_LUA + VS_SYMBOL_MODE_LUA, + VS_SYMBOL_MODE_RISCV }; typedef enum vs_symbol_mode_t vs_symbol_mode_t; diff --git a/include/ui-frame.hpp b/include/ui-frame.hpp index 575841f5..30421e75 100644 --- a/include/ui-frame.hpp +++ b/include/ui-frame.hpp @@ -53,6 +53,7 @@ enum class symbol_mode_t{ WASM, EXTERNAL, LUA, + RISCV, }; struct symbol_t{ diff --git a/include/ui-tree.riscv.hpp b/include/ui-tree.riscv.hpp new file mode 100644 index 00000000..e69de29b diff --git a/meson.build b/meson.build index 762e6606..184f1cd3 100644 --- a/meson.build +++ b/meson.build @@ -262,6 +262,7 @@ vs_fltk = shared_library( './src/ui-tree.wasm.cpp', './src/ui-tree.cnative.cpp', './src/ui-tree.dylib.cpp', + './src/ui-tree.riscv.cpp', './src/ui-field.types.cpp', diff --git a/src/ui-tree.riscv.cpp b/src/ui-tree.riscv.cpp new file mode 100644 index 00000000..e69de29b