Fix API examples after the IO Port update
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
+10
-10
@@ -184,27 +184,27 @@ print_value (const jerry_value_t value)
|
|||||||
{
|
{
|
||||||
if (jerry_value_is_undefined (value))
|
if (jerry_value_is_undefined (value))
|
||||||
{
|
{
|
||||||
jerry_port_logmsg (stdout, "undefined");
|
jerry_port_console ("undefined");
|
||||||
}
|
}
|
||||||
else if (jerry_value_is_null (value))
|
else if (jerry_value_is_null (value))
|
||||||
{
|
{
|
||||||
jerry_port_logmsg (stdout, "null");
|
jerry_port_console ("null");
|
||||||
}
|
}
|
||||||
else if (jerry_value_is_boolean (value))
|
else if (jerry_value_is_boolean (value))
|
||||||
{
|
{
|
||||||
if (jerry_get_boolean_value (value))
|
if (jerry_get_boolean_value (value))
|
||||||
{
|
{
|
||||||
jerry_port_logmsg (stdout, "true");
|
jerry_port_console ("true");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jerry_port_logmsg (stdout, "false");
|
jerry_port_console ("false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Float value */
|
/* Float value */
|
||||||
else if (jerry_value_is_number (value))
|
else if (jerry_value_is_number (value))
|
||||||
{
|
{
|
||||||
jerry_port_logmsg (stdout, "number");
|
jerry_port_console ("number");
|
||||||
}
|
}
|
||||||
/* String value */
|
/* String value */
|
||||||
else if (jerry_value_is_string (value))
|
else if (jerry_value_is_string (value))
|
||||||
@@ -215,15 +215,15 @@ print_value (const jerry_value_t value)
|
|||||||
|
|
||||||
jerry_string_to_char_buffer (value, str_buf_p, req_sz);
|
jerry_string_to_char_buffer (value, str_buf_p, req_sz);
|
||||||
|
|
||||||
jerry_port_logmsg (stdout, "%s", (const char *) str_buf_p);
|
jerry_port_console ("%s", (const char *) str_buf_p);
|
||||||
}
|
}
|
||||||
/* Object reference */
|
/* Object reference */
|
||||||
else if (jerry_value_is_object (value))
|
else if (jerry_value_is_object (value))
|
||||||
{
|
{
|
||||||
jerry_port_logmsg (stdout, "[JS object]");
|
jerry_port_console ("[JS object]");
|
||||||
}
|
}
|
||||||
|
|
||||||
jerry_port_logmsg (stdout, "\n");
|
jerry_port_console ("\n");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ main (int argc, char * argv[])
|
|||||||
char *cmd_tail = cmd;
|
char *cmd_tail = cmd;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
jerry_port_logmsg (stdout, "> ");
|
jerry_port_console ("> ");
|
||||||
|
|
||||||
/* Read next command */
|
/* Read next command */
|
||||||
while (true)
|
while (true)
|
||||||
@@ -295,7 +295,7 @@ main (int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
/* Evaluated JS code thrown an exception
|
/* Evaluated JS code thrown an exception
|
||||||
* and didn't handle it with try-catch-finally */
|
* and didn't handle it with try-catch-finally */
|
||||||
jerry_port_errormsg ("Unhandled JS exception occured: ");
|
jerry_port_console ("Unhandled JS exception occured: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
print_value (ret_val);
|
print_value (ret_val);
|
||||||
|
|||||||
Reference in New Issue
Block a user