Drop the minimal variant of the default port implementation (#4331)
The minimal variant became quite meaningless lately. There were two port APIs originally that had extra functions in the default port in addition to the core-mandated implementations: the I/O and Termination port APIs. However, the extra Termination API code was removed a year ago, leaving some minimal extension in the I/O port only. As the overhead of the extension is negligible, it is not worth maintaining two library variants. Therefore - this commit removes the minimal variant of the default port lib, - rewrites uses of the minimal variant to use the variant with the I/O extension, and - updates targets where I/O port code was copy-n-pasted. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
+3
-24
@@ -25,34 +25,26 @@ static const char TAG[] = "JS";
|
||||
|
||||
static esp_log_level_t crosslog(jerry_log_level_t level)
|
||||
{
|
||||
switch(level)
|
||||
switch(level)
|
||||
{
|
||||
case JERRY_LOG_LEVEL_ERROR: return ESP_LOG_ERROR;
|
||||
case JERRY_LOG_LEVEL_WARNING: return ESP_LOG_WARN;
|
||||
case JERRY_LOG_LEVEL_DEBUG: return ESP_LOG_DEBUG;
|
||||
case JERRY_LOG_LEVEL_TRACE: return ESP_LOG_VERBOSE;
|
||||
}
|
||||
|
||||
|
||||
return ESP_LOG_NONE;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_EXTRA_API
|
||||
|
||||
/**
|
||||
* Actual log level
|
||||
*/
|
||||
static jerry_log_level_t jerry_port_default_log_level = JERRY_LOG_LEVEL_ERROR;
|
||||
|
||||
#define JERRY_PORT_DEFAULT_LOG_LEVEL jerry_port_default_log_level
|
||||
|
||||
/**
|
||||
* Get the log level
|
||||
*
|
||||
* @return current log level
|
||||
*
|
||||
* Note:
|
||||
* This function is only available if the port implementation library is
|
||||
* compiled without the DISABLE_EXTRA_API macro.
|
||||
*/
|
||||
jerry_log_level_t
|
||||
jerry_port_default_get_log_level (void)
|
||||
@@ -62,10 +54,6 @@ jerry_port_default_get_log_level (void)
|
||||
|
||||
/**
|
||||
* Set the log level
|
||||
*
|
||||
* Note:
|
||||
* This function is only available if the port implementation library is
|
||||
* compiled without the DISABLE_EXTRA_API macro.
|
||||
*/
|
||||
void
|
||||
jerry_port_default_set_log_level (jerry_log_level_t level) /**< log level */
|
||||
@@ -73,10 +61,6 @@ jerry_port_default_set_log_level (jerry_log_level_t level) /**< log level */
|
||||
jerry_port_default_log_level = level;
|
||||
} /* jerry_port_default_set_log_level */
|
||||
|
||||
#else /* DISABLE_EXTRA_API */
|
||||
#define JERRY_PORT_DEFAULT_LOG_LEVEL JERRY_LOG_LEVEL_ERROR
|
||||
#endif /* !DISABLE_EXTRA_API */
|
||||
|
||||
/**
|
||||
* Default implementation of jerry_port_log. Prints log message to the standard
|
||||
* error with 'vfprintf' if message log level is less than or equal to the
|
||||
@@ -84,18 +68,13 @@ jerry_port_default_set_log_level (jerry_log_level_t level) /**< log level */
|
||||
*
|
||||
* If debugger support is enabled, printing happens first to an in-memory buffer,
|
||||
* which is then sent both to the standard error and to the debugger client.
|
||||
*
|
||||
* Note:
|
||||
* Changing the log level from JERRY_LOG_LEVEL_ERROR is only possible if
|
||||
* the port implementation library is compiled without the
|
||||
* DISABLE_EXTRA_API macro.
|
||||
*/
|
||||
void
|
||||
jerry_port_log (jerry_log_level_t level, /**< message log level */
|
||||
const char *format, /**< format string */
|
||||
...) /**< parameters */
|
||||
{
|
||||
if (level <= JERRY_PORT_DEFAULT_LOG_LEVEL)
|
||||
if (level <= jerry_port_default_log_level)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
|
||||
@@ -42,7 +42,7 @@ USEMODULE += shell
|
||||
USEMODULE += shell_commands
|
||||
|
||||
# Add the jerry libs
|
||||
USEMODULE += libjerry-core libjerry-port-default-minimal libjerry-ext
|
||||
USEMODULE += libjerry-core libjerry-port-default libjerry-ext
|
||||
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
@@ -52,11 +52,11 @@ libjerry:
|
||||
-DJERRY_PROFILE="es5.1" \
|
||||
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
|
||||
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP)
|
||||
make -C$(BUILD_DIR) jerry-core jerry-port-default-minimal jerry-ext
|
||||
make -C$(BUILD_DIR) jerry-core jerry-port-default jerry-ext
|
||||
|
||||
mkdir -p $(COPYTARGET)
|
||||
cp $(BUILD_DIR)/lib/libjerry-core.a $(COPYTARGET)
|
||||
cp $(BUILD_DIR)/lib/libjerry-port-default-minimal.a $(COPYTARGET)
|
||||
cp $(BUILD_DIR)/lib/libjerry-port-default.a $(COPYTARGET)
|
||||
cp $(BUILD_DIR)/lib/libjerry-ext.a $(COPYTARGET)
|
||||
|
||||
riot-jerry: libjerry
|
||||
|
||||
Reference in New Issue
Block a user