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:
@@ -0,0 +1,51 @@
|
||||
#ifndef BSHELL_RUNTIME_SCOPE_H_
|
||||
#define BSHELL_RUNTIME_SCOPE_H_
|
||||
|
||||
#include "var-map.h"
|
||||
|
||||
#include <bshell/runtime/script-block.h>
|
||||
#include <fx/collections/hashtable.h>
|
||||
#include <fx/namemap.h>
|
||||
#include <fx/queue.h>
|
||||
#include <fx/vector.h>
|
||||
|
||||
struct bshell_runtime;
|
||||
|
||||
enum bshell_runtime_scope_type {
|
||||
RUNTIME_SCOPE_OTHER = 0,
|
||||
RUNTIME_SCOPE_SCRIPT,
|
||||
RUNTIME_SCOPE_GLOBAL,
|
||||
};
|
||||
|
||||
struct bshell_runtime_scope {
|
||||
enum bshell_runtime_scope_type s_type;
|
||||
fx_queue_entry s_entry;
|
||||
struct var_map s_vars;
|
||||
fx_hashtable *s_functions;
|
||||
FX_VECTOR_DECLARE(fx_value, s_stack);
|
||||
size_t s_ip;
|
||||
|
||||
bshell_scriptblock *s_block;
|
||||
bshell_instruction *s_instr;
|
||||
size_t s_nr_instr;
|
||||
fx_value *s_pool;
|
||||
size_t s_nr_pool;
|
||||
};
|
||||
|
||||
extern struct bshell_runtime_scope *runtime_push_scope(
|
||||
struct bshell_runtime *rt,
|
||||
enum bshell_runtime_scope_type type,
|
||||
bshell_scriptblock *block);
|
||||
extern void runtime_pop_scope(struct bshell_runtime *rt);
|
||||
extern struct bshell_runtime_scope *runtime_get_scope(struct bshell_runtime *rt);
|
||||
|
||||
extern void bshell_runtime_scope_push_value(
|
||||
struct bshell_runtime_scope *scope,
|
||||
const fx_value *value);
|
||||
extern fx_value bshell_runtime_scope_pop_value(struct bshell_runtime_scope *scope);
|
||||
|
||||
extern void bshell_runtime_scope_set_block(
|
||||
struct bshell_runtime_scope *scope,
|
||||
bshell_scriptblock *block);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user