Remove 'print' instrinsic, add 'print' implementation-defined built-in routine to the Global object.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
@@ -31,10 +31,10 @@ ecma_completion_value_t
|
||||
opfunc_native_call (vm_instr_t instr, /**< instruction */
|
||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = instr.data.native_call.lhs;
|
||||
const idx_t dst_var_idx __attr_unused___ = instr.data.native_call.lhs;
|
||||
const idx_t native_call_id_idx = instr.data.native_call.name;
|
||||
const idx_t args_number = instr.data.native_call.arg_list;
|
||||
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
||||
const vm_instr_counter_t __attr_unused___ lit_oc = frame_ctx_p->pos;
|
||||
|
||||
JERRY_ASSERT (native_call_id_idx < OPCODE_NATIVE_CALL__COUNT);
|
||||
|
||||
@@ -67,52 +67,6 @@ opfunc_native_call (vm_instr_t instr, /**< instruction */
|
||||
JERRY_UNIMPLEMENTED ("Device operations are not implemented.");
|
||||
}
|
||||
|
||||
case OPCODE_NATIVE_CALL_PRINT:
|
||||
{
|
||||
for (ecma_length_t arg_index = 0;
|
||||
ecma_is_completion_value_empty (ret_value) && arg_index < args_read;
|
||||
arg_index++)
|
||||
{
|
||||
ECMA_TRY_CATCH (str_value,
|
||||
ecma_op_to_string (arg_values[arg_index]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *str_p = ecma_get_string_from_value (str_value);
|
||||
|
||||
lit_utf8_size_t bytes = ecma_string_get_size (str_p);
|
||||
|
||||
ssize_t utf8_str_size = (ssize_t) (bytes + 1);
|
||||
lit_utf8_byte_t *utf8_str_p = (lit_utf8_byte_t*) mem_heap_alloc_block ((size_t) utf8_str_size,
|
||||
MEM_HEAP_ALLOC_SHORT_TERM);
|
||||
if (utf8_str_p == NULL)
|
||||
{
|
||||
jerry_fatal (ERR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
ecma_string_to_utf8_string (str_p, utf8_str_p, utf8_str_size);
|
||||
utf8_str_p[utf8_str_size - 1] = 0;
|
||||
|
||||
FIXME ("Support unicode in printf.");
|
||||
if (arg_index < args_read - 1)
|
||||
{
|
||||
printf ("%s ", (char*) utf8_str_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("%s", (char*) utf8_str_p);
|
||||
}
|
||||
|
||||
mem_heap_free_block (utf8_str_p);
|
||||
|
||||
ret_value = set_variable_value (frame_ctx_p, lit_oc, dst_var_idx,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED));
|
||||
|
||||
ECMA_FINALIZE (str_value);
|
||||
}
|
||||
printf ("\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case OPCODE_NATIVE_CALL__COUNT:
|
||||
{
|
||||
JERRY_UNREACHABLE ();
|
||||
|
||||
Reference in New Issue
Block a user