diff --git a/cmake/CompilerOptions.cmake b/cmake/CompilerOptions.cmake index 918ec110..8db8a300 100644 --- a/cmake/CompilerOptions.cmake +++ b/cmake/CompilerOptions.cmake @@ -1,4 +1,4 @@ -function(sourcemeta_includejs_add_compile_options target) +function(includejs_add_compile_options target) if(NOA_COMPILER_MSVC) # See https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-by-category target_compile_options("${target}" PRIVATE diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt index 1d4f5fd9..e54272d3 100644 --- a/src/engine/CMakeLists.txt +++ b/src/engine/CMakeLists.txt @@ -34,20 +34,20 @@ if(INCLUDEJS_INSTALL) endif() endif() -sourcemeta_includejs_add_compile_options(includejs_engine) +includejs_add_compile_options(includejs_engine) if(INCLUDEJS_BACKEND STREQUAL "JavaScriptCore") find_package(JavaScriptCore REQUIRED) target_link_libraries(includejs_engine PRIVATE JavaScriptCore::JavaScriptCore) target_compile_definitions(includejs_engine - PUBLIC SOURCEMETA_INCLUDEJS_ENGINE_JAVASCRIPT_CORE) + PUBLIC INCLUDEJS_ENGINE_JAVASCRIPT_CORE) elseif(INCLUDEJS_BACKEND STREQUAL "V8") find_package(V8 REQUIRED) target_link_libraries(includejs_engine PRIVATE V8::V8) target_compile_definitions(includejs_engine - PUBLIC SOURCEMETA_INCLUDEJS_ENGINE_V8) + PUBLIC INCLUDEJS_ENGINE_V8) else() message(FATAL_ERROR "Unknown IncludeJS backend: ${INCLUDEJS_BACKEND}") endif() diff --git a/src/engine/common/engine.cc b/src/engine/common/engine.cc index b3a309ce..1ea5f3a5 100644 --- a/src/engine/common/engine.cc +++ b/src/engine/common/engine.cc @@ -8,7 +8,7 @@ #include // std::move #include // std::vector -#if !defined(SOURCEMETA_INCLUDEJS_ENGINE_V8) +#if !defined(INCLUDEJS_ENGINE_V8) namespace includejs { diff --git a/src/engine/common/engine_context.cc b/src/engine/common/engine_context.cc index cc59e14a..9875e302 100644 --- a/src/engine/common/engine_context.cc +++ b/src/engine/common/engine_context.cc @@ -1,6 +1,6 @@ #include -#if !defined(SOURCEMETA_INCLUDEJS_ENGINE_V8) +#if !defined(INCLUDEJS_ENGINE_V8) namespace includejs { diff --git a/src/engine/include/includejs/engine.h b/src/engine/include/includejs/engine.h index a86d6853..e2d1c3f8 100644 --- a/src/engine/include/includejs/engine.h +++ b/src/engine/include/includejs/engine.h @@ -1,5 +1,5 @@ -#ifndef SOURCEMETA_INCLUDEJS_ENGINE_H_ -#define SOURCEMETA_INCLUDEJS_ENGINE_H_ +#ifndef INCLUDEJS_ENGINE_H_ +#define INCLUDEJS_ENGINE_H_ /// @defgroup engine Engine /// @brief The IncludeJS higher-level abstraction of a JavaScript engine @@ -35,7 +35,7 @@ class INCLUDEJS_ENGINE_EXPORT Engine { -> Value; // TODO(RaisinTen): Add support for bind_function() to the V8 backend. -#if !defined(SOURCEMETA_INCLUDEJS_ENGINE_V8) +#if !defined(INCLUDEJS_ENGINE_V8) auto bind_function(std::initializer_list location, Function function) -> void; #endif diff --git a/src/engine/include/includejs/engine_context.h b/src/engine/include/includejs/engine_context.h index 01be84c7..80d6c93a 100644 --- a/src/engine/include/includejs/engine_context.h +++ b/src/engine/include/includejs/engine_context.h @@ -1,5 +1,5 @@ -#ifndef SOURCEMETA_INCLUDEJS_ENGINE_CONTEXT_H_ -#define SOURCEMETA_INCLUDEJS_ENGINE_CONTEXT_H_ +#ifndef INCLUDEJS_ENGINE_CONTEXT_H_ +#define INCLUDEJS_ENGINE_CONTEXT_H_ #include "engine_export.h" diff --git a/src/engine/include/includejs/engine_error.h b/src/engine/include/includejs/engine_error.h index d05ce8bc..8e0b27e6 100644 --- a/src/engine/include/includejs/engine_error.h +++ b/src/engine/include/includejs/engine_error.h @@ -1,5 +1,5 @@ -#ifndef SOURCEMETA_INCLUDEJS_ENGINE_ERROR_H_ -#define SOURCEMETA_INCLUDEJS_ENGINE_ERROR_H_ +#ifndef INCLUDEJS_ENGINE_ERROR_H_ +#define INCLUDEJS_ENGINE_ERROR_H_ #include "engine_export.h" diff --git a/src/engine/include/includejs/engine_function.h b/src/engine/include/includejs/engine_function.h index 0a153bc7..e6d4129f 100644 --- a/src/engine/include/includejs/engine_function.h +++ b/src/engine/include/includejs/engine_function.h @@ -1,29 +1,29 @@ -#ifndef SOURCEMETA_INCLUDEJS_ENGINE_FUNCTION_H_ -#define SOURCEMETA_INCLUDEJS_ENGINE_FUNCTION_H_ +#ifndef INCLUDEJS_ENGINE_FUNCTION_H_ +#define INCLUDEJS_ENGINE_FUNCTION_H_ #include "engine_export.h" #include #include -#if defined(SOURCEMETA_INCLUDEJS_ENGINE_JAVASCRIPT_CORE) +#if defined(INCLUDEJS_ENGINE_JAVASCRIPT_CORE) #include // std::exception #include // std::vector #endif #ifdef DOXYGEN /// @ingroup engine -#define SOURCEMETA_INCLUDEJS_ARGS +#define INCLUDEJS_ARGS #else #if __cplusplus >= 202002L #include // std::span -#define SOURCEMETA_INCLUDEJS_ARGS std::span +#define INCLUDEJS_ARGS std::span #else -#define SOURCEMETA_INCLUDEJS_ARGS const std::vector & +#define INCLUDEJS_ARGS const std::vector & #endif #endif -#if defined(SOURCEMETA_INCLUDEJS_ENGINE_JAVASCRIPT_CORE) +#if defined(INCLUDEJS_ENGINE_JAVASCRIPT_CORE) namespace includejs { // This is a opaque function signature that can be force-casted into // JSObjectCallAsFunctionCallback @@ -33,8 +33,8 @@ using Function = const void *(*)(const void *, const void *, const void *, } // namespace includejs #endif -#if defined(SOURCEMETA_INCLUDEJS_ENGINE_JAVASCRIPT_CORE) -#define __SOURCEMETA_INCLUDEJS_EXPOSE_FUNCTION_INTERNAL(function, call_as) \ +#if defined(INCLUDEJS_ENGINE_JAVASCRIPT_CORE) +#define _INCLUDEJS_EXPOSE_FUNCTION_INTERNAL(function, call_as) \ static const void *function(const void *context, const void *, const void *, \ const size_t argc, const void *raw_arguments[], \ const void **exception) { \ @@ -55,15 +55,15 @@ using Function = const void *(*)(const void *, const void *, const void *, #ifdef DOXYGEN /// @ingroup engine -#define SOURCEMETA_INCLUDEJS_EXPOSE_FUNCTION(function) +#define INCLUDEJS_EXPOSE_FUNCTION(function) /// @ingroup engine -#define SOURCEMETA_INCLUDEJS_EXPOSE_TEMPLATE_FUNCTION(function) +#define INCLUDEJS_EXPOSE_TEMPLATE_FUNCTION(function) #else -#define SOURCEMETA_INCLUDEJS_EXPOSE_FUNCTION(function) \ - __SOURCEMETA_INCLUDEJS_EXPOSE_FUNCTION_INTERNAL(function, function) -#define SOURCEMETA_INCLUDEJS_EXPOSE_TEMPLATE_FUNCTION(function) \ +#define INCLUDEJS_EXPOSE_FUNCTION(function) \ + _INCLUDEJS_EXPOSE_FUNCTION_INTERNAL(function, function) +#define INCLUDEJS_EXPOSE_TEMPLATE_FUNCTION(function) \ template \ - __SOURCEMETA_INCLUDEJS_EXPOSE_FUNCTION_INTERNAL(function, function) + _INCLUDEJS_EXPOSE_FUNCTION_INTERNAL(function, function) #endif #endif diff --git a/src/engine/include/includejs/engine_promise.h b/src/engine/include/includejs/engine_promise.h index e8261e2d..b7b1ec08 100644 --- a/src/engine/include/includejs/engine_promise.h +++ b/src/engine/include/includejs/engine_promise.h @@ -1,5 +1,5 @@ -#ifndef SOURCEMETA_INCLUDEJS_ENGINE_PROMISE_H_ -#define SOURCEMETA_INCLUDEJS_ENGINE_PROMISE_H_ +#ifndef INCLUDEJS_ENGINE_PROMISE_H_ +#define INCLUDEJS_ENGINE_PROMISE_H_ #include "engine_export.h" diff --git a/src/engine/include/includejs/engine_value.h b/src/engine/include/includejs/engine_value.h index e36165ef..f69179f1 100644 --- a/src/engine/include/includejs/engine_value.h +++ b/src/engine/include/includejs/engine_value.h @@ -1,5 +1,5 @@ -#ifndef SOURCEMETA_INCLUDEJS_ENGINE_VALUE_H_ -#define SOURCEMETA_INCLUDEJS_ENGINE_VALUE_H_ +#ifndef INCLUDEJS_ENGINE_VALUE_H_ +#define INCLUDEJS_ENGINE_VALUE_H_ #include "engine_export.h" diff --git a/test/engine/CMakeLists.txt b/test/engine/CMakeLists.txt index 75f1ee69..9eb4d4e8 100644 --- a/test/engine/CMakeLists.txt +++ b/test/engine/CMakeLists.txt @@ -13,7 +13,7 @@ add_executable(includejs_engine_unit engine_value_undefined_test.cc engine_value_null_test.cc) -sourcemeta_includejs_add_compile_options(includejs_engine_unit) +includejs_add_compile_options(includejs_engine_unit) target_link_libraries(includejs_engine_unit PRIVATE GTest::gtest GTest::gtest_main) diff --git a/test/engine/engine_binding_test.cc b/test/engine/engine_binding_test.cc index 48ec13e9..3e20de74 100644 --- a/test/engine/engine_binding_test.cc +++ b/test/engine/engine_binding_test.cc @@ -3,28 +3,28 @@ #include static auto is_string(const includejs::Context &context, - SOURCEMETA_INCLUDEJS_ARGS arguments) -> includejs::Value { + INCLUDEJS_ARGS arguments) -> includejs::Value { return context.from(!arguments.empty() && arguments.front().is_string()); } // TODO: Add overload that doesn't take arguments -static auto get_details(const includejs::Context &context, - SOURCEMETA_INCLUDEJS_ARGS) -> includejs::Value { +static auto get_details(const includejs::Context &context, INCLUDEJS_ARGS) + -> includejs::Value { includejs::Value result{context.make_object()}; result.set("version", context.from("1.0.0")); return result; } -static auto promise_test(const includejs::Context &context, - SOURCEMETA_INCLUDEJS_ARGS) -> includejs::Value { +static auto promise_test(const includejs::Context &context, INCLUDEJS_ARGS) + -> includejs::Value { includejs::Promise promise{context.make_promise()}; promise.resolve(context.from(true)); return promise.value(); } -SOURCEMETA_INCLUDEJS_EXPOSE_FUNCTION(is_string); -SOURCEMETA_INCLUDEJS_EXPOSE_FUNCTION(get_details); -SOURCEMETA_INCLUDEJS_EXPOSE_FUNCTION(promise_test); +INCLUDEJS_EXPOSE_FUNCTION(is_string); +INCLUDEJS_EXPOSE_FUNCTION(get_details); +INCLUDEJS_EXPOSE_FUNCTION(promise_test); TEST(IncludeJS_Engine, bind_global_root_integer) { includejs::Engine engine; diff --git a/test/packaging/find_package/hello.cc b/test/packaging/find_package/hello.cc index 9e7eeea4..b218544e 100644 --- a/test/packaging/find_package/hello.cc +++ b/test/packaging/find_package/hello.cc @@ -7,7 +7,7 @@ auto main() -> int { includejs::Engine engine; // TODO(RaisinTen): Remove this once V8 supports this. -#if !defined(SOURCEMETA_INCLUDEJS_ENGINE_V8) +#if !defined(INCLUDEJS_ENGINE_V8) includejs::Value result{engine.evaluate("1 + 3", "index.js")}; assert(result.is_number()); std::cout << result.to_number() << "\n";