Implement IO port API

Related issue: #964

Implemented the IO API of Jerry ports. Removed log file from API level.
The port implementation should define the destination of log messages.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2016-07-13 15:42:16 +02:00
parent 35c0869ef5
commit fa94c67ee7
10 changed files with 164 additions and 158 deletions
+15 -15
View File
@@ -18,30 +18,30 @@
#include "jerry-port.h"
/**
* Provide log message to filestream implementation for the engine.
* Provide console message implementation for the engine.
*/
int jerry_port_logmsg (FILE *stream, /**< stream pointer */
const char *format, /**< format string */
...) /**< parameters */
void
jerry_port_console (const char *format, /**< format string */
...) /**< parameters */
{
va_list args;
int count;
va_start (args, format);
count = vfprintf (stream, format, args);
vfprintf (stdout, format, args);
va_end (args);
return count;
} /* jerry_port_logmsg */
} /* jerry_port_console */
/**
* Provide error message to console implementation for the engine.
* Provide log message implementation for the engine.
*/
int jerry_port_errormsg (const char *format, /**< format string */
...) /**< parameters */
void
jerry_port_log (jerry_log_level_t level, /**< log level */
const char *format, /**< format string */
...) /**< parameters */
{
(void) level; /* default port implementation ignores the log level */
va_list args;
int count;
va_start (args, format);
count = vfprintf (stderr, format, args);
vfprintf (stderr, format, args);
va_end (args);
return count;
} /* jerry_port_errormsg */
} /* jerry_port_log */