bshell: re-organise build into three separate components

bshell: the front-end binary
bshell.runtime: contains the parser, compiler, and classes needed to run bshell scripts
bshell.core: contains the builtin commandlets and aliases
This commit is contained in:
2026-05-25 10:33:29 +01:00
parent 58c76a1f57
commit edfb3e24a3
165 changed files with 5173 additions and 4995 deletions
+26
View File
@@ -0,0 +1,26 @@
#include <bshell/runtime/opcode.h>
#include <fx/int.h>
#define BSHELL_OPCODE_MAX 0xFF
#define ARG_MAX 0xFFFFFF
bshell_instruction bshell_instruction_encode(
enum bshell_opcode opcode,
uint32_t arg)
{
if (opcode > BSHELL_OPCODE_MAX) {
return BSHELL_INSTRUCTION_INVALID;
}
return fx_u32_htob((opcode & BSHELL_OPCODE_MAX) | (arg & ARG_MAX) << 8);
}
void bshell_instruction_decode(
bshell_instruction instr,
enum bshell_opcode *out_opcode,
uint32_t *out_arg)
{
instr = fx_u32_btoh(instr);
*out_opcode = (instr & BSHELL_OPCODE_MAX);
*out_arg = ((instr >> 8) & ARG_MAX);
}