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:
@@ -73,24 +73,17 @@ elseif(HAVE_UNISTD_H)
|
||||
set(DEFINES_PORT_DEFAULT ${DEFINES_PORT_DEFAULT} HAVE_UNISTD_H)
|
||||
endif()
|
||||
|
||||
# Default Jerry port implementation library variants:
|
||||
# - default
|
||||
# - default-minimal (no extra termination and log APIs)
|
||||
foreach(JERRY_PORT_LIBRARY_NAME ${JERRY_PORT_DEFAULT_NAME} ${JERRY_PORT_DEFAULT_NAME}-minimal)
|
||||
add_library(${JERRY_PORT_LIBRARY_NAME} ${SOURCE_PORT_DEFAULT})
|
||||
target_include_directories(${JERRY_PORT_LIBRARY_NAME} PUBLIC ${INCLUDE_PORT_DEFAULT})
|
||||
target_include_directories(${JERRY_PORT_LIBRARY_NAME} PRIVATE ${INCLUDE_CORE_PUBLIC})
|
||||
target_include_directories(${JERRY_PORT_LIBRARY_NAME} PRIVATE ${INCLUDE_EXT_PUBLIC})
|
||||
target_compile_definitions(${JERRY_PORT_LIBRARY_NAME} PRIVATE ${DEFINES_PORT_DEFAULT})
|
||||
target_link_libraries(${JERRY_PORT_LIBRARY_NAME} jerry-core) # FIXME: remove this dependency as soon as possible
|
||||
endforeach()
|
||||
|
||||
target_compile_definitions(${JERRY_PORT_DEFAULT_NAME}-minimal PRIVATE DISABLE_EXTRA_API)
|
||||
# Default Jerry port implementation library
|
||||
add_library(${JERRY_PORT_DEFAULT_NAME} ${SOURCE_PORT_DEFAULT})
|
||||
target_include_directories(${JERRY_PORT_DEFAULT_NAME} PUBLIC ${INCLUDE_PORT_DEFAULT})
|
||||
target_include_directories(${JERRY_PORT_DEFAULT_NAME} PRIVATE ${INCLUDE_CORE_PUBLIC})
|
||||
target_include_directories(${JERRY_PORT_DEFAULT_NAME} PRIVATE ${INCLUDE_EXT_PUBLIC})
|
||||
target_compile_definitions(${JERRY_PORT_DEFAULT_NAME} PRIVATE ${DEFINES_PORT_DEFAULT})
|
||||
target_link_libraries(${JERRY_PORT_DEFAULT_NAME} jerry-core) # FIXME: remove this dependency as soon as possible
|
||||
|
||||
# Installation
|
||||
configure_file(libjerry-port-default.pc.in libjerry-port-default.pc @ONLY)
|
||||
configure_file(libjerry-port-default-minimal.pc.in libjerry-port-default-minimal.pc @ONLY)
|
||||
|
||||
install(TARGETS ${JERRY_PORT_DEFAULT_NAME} ${JERRY_PORT_DEFAULT_NAME}-minimal DESTINATION lib)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-port-default.pc ${CMAKE_CURRENT_BINARY_DIR}/libjerry-port-default-minimal.pc DESTINATION lib/pkgconfig)
|
||||
install(TARGETS ${JERRY_PORT_DEFAULT_NAME} DESTINATION lib)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-port-default.pc DESTINATION lib/pkgconfig)
|
||||
install(DIRECTORY ${INCLUDE_PORT_DEFAULT}/ DESTINATION include)
|
||||
|
||||
@@ -21,23 +21,15 @@
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-debugger.h"
|
||||
|
||||
#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)
|
||||
@@ -47,10 +39,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 */
|
||||
@@ -58,10 +46,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
|
||||
@@ -69,18 +53,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);
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: libjerry-port-default-minimal
|
||||
Description: JerryScript: lightweight JavaScript engine (default minimal port library)
|
||||
URL: https://github.com/jerryscript-project/jerryscript
|
||||
Version: 1.0
|
||||
Conflicts: libjerry-port-default
|
||||
Libs: -L${libdir} -ljerry-port-default-minimal
|
||||
Cflags: -I${includedir}
|
||||
@@ -6,6 +6,5 @@ Name: libjerry-port-default
|
||||
Description: JerryScript: lightweight JavaScript engine (default port library)
|
||||
URL: https://github.com/jerryscript-project/jerryscript
|
||||
Version: 1.0
|
||||
Conflicts: libjerry-port-default-minimal
|
||||
Libs: -L${libdir} -ljerry-port-default
|
||||
Cflags: -I${includedir}
|
||||
|
||||
Reference in New Issue
Block a user