Files
bshell/bshell/script-block.h
T

66 lines
1.7 KiB
C

#ifndef SCRIPT_BLOCK_H_
#define SCRIPT_BLOCK_H_
#include "runtime/opcode.h"
#include <fx/macros.h>
#include <fx/value.h>
FX_DECLS_BEGIN;
enum bshell_opcode;
#define POOL_INDEX_INVALID ((unsigned long)-1)
#define BSHELL_TYPE_SCRIPTBLOCK (bshell_scriptblock_get_type())
FX_DECLARE_TYPE(bshell_scriptblock);
FX_TYPE_CLASS_DECLARATION_BEGIN(bshell_scriptblock)
FX_TYPE_CLASS_DECLARATION_END(bshell_scriptblock)
extern fx_type_id bshell_scriptblock_get_type(void);
FX_TYPE_DEFAULT_CONSTRUCTOR(bshell_scriptblock, BSHELL_TYPE_SCRIPTBLOCK);
extern size_t bshell_scriptblock_push_instruction(
bshell_scriptblock *block,
enum bshell_opcode opcode,
uint32_t arg);
extern enum bshell_status bshell_scriptblock_read_instruction(
bshell_scriptblock *block,
size_t offset,
enum bshell_opcode *out_opcode,
uint32_t *out_arg);
extern void bshell_scriptblock_patch_instruction(
bshell_scriptblock *block,
size_t offset,
enum bshell_opcode opcode,
uint32_t arg);
extern void bshell_scriptblock_clear_text(bshell_scriptblock *block);
extern void bshell_scriptblock_get_text(
const bshell_scriptblock *block,
bshell_instruction **out_ptr,
size_t *out_count);
extern void bshell_scriptblock_get_pool(
const bshell_scriptblock *block,
fx_value **out_ptr,
size_t *out_count);
extern unsigned long bshell_scriptblock_add_pool_value(
bshell_scriptblock *block,
fx_value *value);
extern fx_value *bshell_scriptblock_get_pool_value(
const bshell_scriptblock *block,
unsigned long index,
fx_type_id expected_type);
extern unsigned long bshell_scriptblock_get_string(
bshell_scriptblock *block,
const char *s);
extern unsigned long bshell_scriptblock_get_double(
bshell_scriptblock *block,
double v);
FX_DECLS_END;
#endif