script-block: implement storing double values in constpool
This commit is contained in:
+18
-1
@@ -183,7 +183,7 @@ static unsigned long scriptblock_get_string(
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
*slot = FX_CSTR(s);
|
*slot = FX_VALUE_OBJECT(str);
|
||||||
|
|
||||||
cache_entry->e_index = index;
|
cache_entry->e_index = index;
|
||||||
fx_namemap_put(
|
fx_namemap_put(
|
||||||
@@ -205,6 +205,14 @@ cleanup:
|
|||||||
return POOL_INDEX_INVALID;
|
return POOL_INDEX_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long scriptblock_get_double(
|
||||||
|
struct bshell_scriptblock_p *block,
|
||||||
|
double v)
|
||||||
|
{
|
||||||
|
fx_value value = FX_DOUBLE(v);
|
||||||
|
return scriptblock_add_pool_value(block, &value);
|
||||||
|
}
|
||||||
|
|
||||||
size_t bshell_scriptblock_push_instruction(
|
size_t bshell_scriptblock_push_instruction(
|
||||||
bshell_scriptblock *block,
|
bshell_scriptblock *block,
|
||||||
enum bshell_opcode opcode,
|
enum bshell_opcode opcode,
|
||||||
@@ -317,6 +325,15 @@ unsigned long bshell_scriptblock_get_string(
|
|||||||
s);
|
s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long bshell_scriptblock_get_double(bshell_scriptblock *block, double v)
|
||||||
|
{
|
||||||
|
FX_CLASS_DISPATCH_STATIC(
|
||||||
|
BSHELL_TYPE_SCRIPTBLOCK,
|
||||||
|
scriptblock_get_double,
|
||||||
|
block,
|
||||||
|
v);
|
||||||
|
}
|
||||||
|
|
||||||
FX_TYPE_CLASS_BEGIN(bshell_scriptblock)
|
FX_TYPE_CLASS_BEGIN(bshell_scriptblock)
|
||||||
FX_TYPE_VTABLE_INTERFACE_BEGIN(fx_object, FX_TYPE_OBJECT)
|
FX_TYPE_VTABLE_INTERFACE_BEGIN(fx_object, FX_TYPE_OBJECT)
|
||||||
FX_INTERFACE_ENTRY(to_string) = NULL;
|
FX_INTERFACE_ENTRY(to_string) = NULL;
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ FX_DECLARE_TYPE(bshell_scriptblock);
|
|||||||
FX_TYPE_CLASS_DECLARATION_BEGIN(bshell_scriptblock)
|
FX_TYPE_CLASS_DECLARATION_BEGIN(bshell_scriptblock)
|
||||||
FX_TYPE_CLASS_DECLARATION_END(bshell_scriptblock)
|
FX_TYPE_CLASS_DECLARATION_END(bshell_scriptblock)
|
||||||
|
|
||||||
FX_DECLS_END;
|
|
||||||
|
|
||||||
extern fx_type_id bshell_scriptblock_get_type(void);
|
extern fx_type_id bshell_scriptblock_get_type(void);
|
||||||
|
|
||||||
FX_TYPE_DEFAULT_CONSTRUCTOR(bshell_scriptblock, BSHELL_TYPE_SCRIPTBLOCK);
|
FX_TYPE_DEFAULT_CONSTRUCTOR(bshell_scriptblock, BSHELL_TYPE_SCRIPTBLOCK);
|
||||||
@@ -58,5 +56,10 @@ extern fx_value *bshell_scriptblock_get_pool_value(
|
|||||||
extern unsigned long bshell_scriptblock_get_string(
|
extern unsigned long bshell_scriptblock_get_string(
|
||||||
bshell_scriptblock *block,
|
bshell_scriptblock *block,
|
||||||
const char *s);
|
const char *s);
|
||||||
|
extern unsigned long bshell_scriptblock_get_double(
|
||||||
|
bshell_scriptblock *block,
|
||||||
|
double v);
|
||||||
|
|
||||||
|
FX_DECLS_END;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user