From b5c6f31b05049700dd1cde6dc397500768085ec4 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Wed, 18 Oct 2023 15:48:21 +0200 Subject: [PATCH 1/2] chore(linux): Rename KBP to CORE --- common/include/kmx_file.h | 4 ++-- core/include/keyman/keyman_core_api_bits.h | 16 ++++++++-------- core/meson.build | 4 ++-- core/src/kmx/kmx_file_validator.hpp | 4 ++-- core/src/kmx/kmx_processevent.h | 4 ++-- core/src/meson.build | 4 ++-- core/src/path.hpp | 8 ++++---- core/src/processor.hpp | 2 +- core/src/version.rc | 2 +- core/tests/unit/kmnkbd/meson.build | 2 +- core/tests/unit/kmnkbd/test_kmx_xstring.cpp | 4 ++-- core/tools/ldml-const-builder/build.sh | 8 ++++---- windows/src/engine/keyman32/keyboardoptions.cpp | 8 ++++---- windows/src/engine/keyman32/keymanengine.h | 4 ++-- 14 files changed, 37 insertions(+), 37 deletions(-) diff --git a/common/include/kmx_file.h b/common/include/kmx_file.h index 243e5e0d638..714a190aab0 100644 --- a/common/include/kmx_file.h +++ b/common/include/kmx_file.h @@ -25,7 +25,7 @@ typedef KMX_WORD __attribute__((aligned(1))) KMX_WORD_unaligned; #define KMX_WORD_unaligned KMX_WORD #endif -#ifdef KMN_KBP +#ifdef KMN_CORE // TODO: move this to a common namespace keyman::common::kmx_file or similar in the future namespace km { namespace kbp { @@ -402,7 +402,7 @@ static_assert(sizeof(COMP_KEY) == KEYBOARDFILEKEY_SIZE, "COMP_KEY must be KEYBOA static_assert(sizeof(COMP_GROUP) == KEYBOARDFILEGROUP_SIZE, "COMP_GROUP must be KEYBOARDFILEGROUP_SIZE bytes"); static_assert(sizeof(COMP_KEYBOARD) == KEYBOARDFILEHEADER_SIZE, "COMP_KEYBOARD must be KEYBOARDFILEHEADER_SIZE bytes"); -#ifdef KMN_KBP +#ifdef KMN_CORE } // namespace kmx } // namespace kbp } // namespace km diff --git a/core/include/keyman/keyman_core_api_bits.h b/core/include/keyman/keyman_core_api_bits.h index be2886d0583..01ac4489f67 100644 --- a/core/include/keyman/keyman_core_api_bits.h +++ b/core/include/keyman/keyman_core_api_bits.h @@ -28,8 +28,8 @@ #if defined _WIN32 || defined __CYGWIN__ typedef wchar_t const * km_core_path_name; - #define _KM_KBP_PATH_SEPARATOR (L'\\') - #define _KM_KBP_EXT_SEPARATOR (L'.') + #define _KM_CORE_PATH_SEPARATOR (L'\\') + #define _KM_CORE_EXT_SEPARATOR (L'.') #if defined __GNUC__ // These three will be redefined for Windows #undef _kmn_export_flag #undef _kmn_import_flag @@ -44,14 +44,14 @@ #define _kmn_static_flag #else typedef char const * km_core_path_name; - #define _KM_KBP_PATH_SEPARATOR ('/') - #define _KM_KBP_EXT_SEPARATOR ('.') + #define _KM_CORE_PATH_SEPARATOR ('/') + #define _KM_CORE_EXT_SEPARATOR ('.') #endif -#if defined KMN_KBP_STATIC +#if defined KMN_CORE_STATIC #define KMN_API _kmn_tag_fn(_kmn_static_flag) #define KMN_DEPRECATED_API _kmn_tag_fn(_kmn_deprecated_flag _kmn_and _kmn_static_flag) -#elif defined KMN_KBP_EXPORTING +#elif defined KMN_CORE_EXPORTING #define KMN_API _kmn_tag_fn(_kmn_export_flag) #define KMN_DEPRECATED_API _kmn_tag_fn(_kmn_deprecated_flag _kmn_and _kmn_export_flag) #else @@ -59,8 +59,8 @@ #define KMN_DEPRECATED_API _kmn_tag_fn(_kmn_deprecated_flag _kmn_and _kmn_import_flag) #endif -#ifndef KMN_KBP -#define KMN_KBP +#ifndef KMN_CORE +#define KMN_CORE #endif #ifndef USE_CHAR16_T #define USE_CHAR16_T diff --git a/core/meson.build b/core/meson.build index 81d994124c4..a6ef47c57c9 100644 --- a/core/meson.build +++ b/core/meson.build @@ -25,8 +25,8 @@ py = import('python') python = py.find_installation() # TODO: Shared includes may use namespaces, etc which need future tidyup. -# For now, we use KMN_KBP to inject the km::kbp::kmx namespace -defns += ['-DKMN_KBP'] +# For now, we use KMN_CORE to inject the km::kbp::kmx namespace +defns += ['-DKMN_CORE'] # #define DEBUG when we are on a debug build if get_option('buildtype') == 'debug' diff --git a/core/src/kmx/kmx_file_validator.hpp b/core/src/kmx/kmx_file_validator.hpp index 0f6582ad2c9..7d7f1df599f 100644 --- a/core/src/kmx/kmx_file_validator.hpp +++ b/core/src/kmx/kmx_file_validator.hpp @@ -6,7 +6,7 @@ #include -#ifdef KMN_KBP +#ifdef KMN_CORE // TODO: move this to a common namespace keyman::common::kmx_file or similar in the future namespace km { namespace kbp { @@ -27,7 +27,7 @@ class KMX_FileValidator : public COMP_KEYBOARD { }; -#ifdef KMN_KBP +#ifdef KMN_CORE } // namespace kmx } // namespace kbp } // namespace km diff --git a/core/src/kmx/kmx_processevent.h b/core/src/kmx/kmx_processevent.h index f57e8a78fd7..cac71739d59 100644 --- a/core/src/kmx/kmx_processevent.h +++ b/core/src/kmx/kmx_processevent.h @@ -1,8 +1,8 @@ #pragma once -#ifndef KMN_KBP -#define KMN_KBP +#ifndef KMN_CORE +#define KMN_CORE #endif #ifndef USE_CHAR16_T #define USE_CHAR16_T diff --git a/core/src/meson.build b/core/src/meson.build index 96d2c9db022..0eeedac873b 100644 --- a/core/src/meson.build +++ b/core/src/meson.build @@ -7,7 +7,7 @@ version_res = [] # TODO: shouldn't this be defined only for dylib and not static lib? -defns += ['-DKMN_KBP_EXPORTING'] +defns += ['-DKMN_CORE_EXPORTING'] if cpp_compiler.get_id() == 'msvc' defns += ['-DUNICODE'] @@ -18,7 +18,7 @@ endif if cpp_compiler.get_id() == 'emscripten' # TODO: why do we need this defn here? - defns += ['-DKMN_KBP'] + defns += ['-DKMN_CORE'] endif # ICU4C is used for repertoire tests and core implementation diff --git a/core/src/path.hpp b/core/src/path.hpp index 9800f4cc9ae..00b76ef5601 100644 --- a/core/src/path.hpp +++ b/core/src/path.hpp @@ -27,14 +27,14 @@ namespace kbp using char_type = std::remove_const_t< std::remove_pointer_t>; using string_type = std::basic_string; - static constexpr char_type const parent_separator = _KM_KBP_PATH_SEPARATOR, - suffix_separator = _KM_KBP_EXT_SEPARATOR; + static constexpr char_type const parent_separator = _KM_CORE_PATH_SEPARATOR, + suffix_separator = _KM_CORE_EXT_SEPARATOR; private: string_type _path; void normalise() { - #if '/' != _KM_KBP_PATH_SEPARATOR - std::replace(_path.begin(), _path.end(), char_type('/'), _KM_KBP_PATH_SEPARATOR); + #if '/' != _KM_CORE_PATH_SEPARATOR + std::replace(_path.begin(), _path.end(), char_type('/'), _KM_CORE_PATH_SEPARATOR); #endif } diff --git a/core/src/processor.hpp b/core/src/processor.hpp index 15bc577810a..717dc36a7bd 100644 --- a/core/src/processor.hpp +++ b/core/src/processor.hpp @@ -75,7 +75,7 @@ namespace kbp * updateing the state as required. * * @param state An opaque pointer to a state object - * @return km_core_status `KM_CORE_STATUS_OK`: On success. Else KB_KBP_ error code + * @return km_core_status `KM_CORE_STATUS_OK`: On success. Else KB_CORE_ error code */ virtual km_core_status process_queued_actions( diff --git a/core/src/version.rc b/core/src/version.rc index ba1b7ef60a4..055a9fb55fb 100644 --- a/core/src/version.rc +++ b/core/src/version.rc @@ -23,7 +23,7 @@ VALUE "InternalName", "Keyman Core" VALUE "LegalCopyright", "© SIL International" VALUE "LegalTrademarks", "" - VALUE "OriginalFilename", "KMNKBP0-0.DLL" + VALUE "OriginalFilename", "KMNCORE0-0.DLL" VALUE "ProductName", "Keyman Core" VALUE "ProductVersion", KM_CORE_VERSION_STRING VALUE "Comments", "" diff --git a/core/tests/unit/kmnkbd/meson.build b/core/tests/unit/kmnkbd/meson.build index 9d3ee825e84..efd25caa740 100644 --- a/core/tests/unit/kmnkbd/meson.build +++ b/core/tests/unit/kmnkbd/meson.build @@ -14,7 +14,7 @@ else warns = [] endif -local_defns = ['-DKMN_KBP_STATIC'] +local_defns = ['-DKMN_CORE_STATIC'] tests = [ ['context-api', 'context_api.cpp'], ['keyboard-api', 'keyboard_api.cpp'], diff --git a/core/tests/unit/kmnkbd/test_kmx_xstring.cpp b/core/tests/unit/kmnkbd/test_kmx_xstring.cpp index 92404b1bc82..a48bdae9513 100644 --- a/core/tests/unit/kmnkbd/test_kmx_xstring.cpp +++ b/core/tests/unit/kmnkbd/test_kmx_xstring.cpp @@ -4,8 +4,8 @@ * Keyman Core - KMX Extended String unit tests */ -#ifndef KMN_KBP -#define KMN_KBP +#ifndef KMN_CORE +#define KMN_CORE #endif #ifndef USE_CHAR16_T #define USE_CHAR16_T diff --git a/core/tools/ldml-const-builder/build.sh b/core/tools/ldml-const-builder/build.sh index 3b1924e7ee9..e748be1d494 100755 --- a/core/tools/ldml-const-builder/build.sh +++ b/core/tools/ldml-const-builder/build.sh @@ -17,7 +17,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" # This script runs from its own folder cd "$(dirname "$THIS_SCRIPT")" -KBP_LDML_H_FILE="../../include/ldml/keyboardprocessor_ldml.h" +CORE_LDML_H_FILE="../../include/ldml/keyboardprocessor_ldml.h" ################################ Main script ################################ @@ -30,7 +30,7 @@ builder_parse "$@" if builder_start_action clean; then rm -rf ../../include/ldml/build/ - # Not removing ${KBP_LDML_H_FILE} as it is checked in + # Not removing ${CORE_LDML_H_FILE} as it is checked in builder_finish_action success clean fi @@ -42,8 +42,8 @@ if builder_start_action build; then fi if builder_start_action run; then - node --enable-source-maps ../../include/ldml/ldml-const-builder/ldml-const-builder.js > ${KBP_LDML_H_FILE} - echo "Updated ${KBP_LDML_H_FILE}" + node --enable-source-maps ../../include/ldml/ldml-const-builder/ldml-const-builder.js > ${CORE_LDML_H_FILE} + echo "Updated ${CORE_LDML_H_FILE}" builder_finish_action success run fi diff --git a/windows/src/engine/keyman32/keyboardoptions.cpp b/windows/src/engine/keyman32/keyboardoptions.cpp index cc838286254..f3663115709 100644 --- a/windows/src/engine/keyman32/keyboardoptions.cpp +++ b/windows/src/engine/keyman32/keyboardoptions.cpp @@ -22,14 +22,14 @@ BOOL IntLoadKeyboardOptionsRegistrytoCore(LPCSTR key, LPINTKEYBOARDINFO kp, km_core_state* const state); void IntSaveKeyboardOptionCoretoRegistry(LPCSTR REGKey, LPINTKEYBOARDINFO kp, LPCWSTR key, LPWSTR value); -static km_core_cp* CloneKMKBPCP(const km_core_cp* cp) { +static km_core_cp* CloneKMCORECP(const km_core_cp* cp) { LPCWSTR buf = reinterpret_cast(cp); km_core_cp* clone = new km_core_cp[wcslen(buf) + 1]; wcscpy_s(reinterpret_cast(clone), wcslen(buf) + 1, buf); return clone; } -static km_core_cp* CloneKMKBPCPFromWSTR(LPWSTR buf) { +static km_core_cp* CloneKMCORECPFromWSTR(LPWSTR buf) { km_core_cp* clone = new km_core_cp[wcslen(buf) + 1]; wcscpy_s(reinterpret_cast(clone), wcslen(buf) + 1, buf); return clone; @@ -90,9 +90,9 @@ BOOL IntLoadKeyboardOptionsRegistrytoCore(LPCSTR key, LPINTKEYBOARDINFO kp, km_c LPCWSTR coreKey = reinterpret_cast(kpc->key); WCHAR val[256]; if (hasData && r.ReadString(coreKey, val, sizeof(val) / sizeof(val[0])) && val[0]) { - keyboardOpts[n].value = CloneKMKBPCPFromWSTR(val); + keyboardOpts[n].value = CloneKMCORECPFromWSTR(val); } else { - keyboardOpts[n].value = CloneKMKBPCP(kpc->value); + keyboardOpts[n].value = CloneKMCORECP(kpc->value); } n++; } diff --git a/windows/src/engine/keyman32/keymanengine.h b/windows/src/engine/keyman32/keymanengine.h index 65fc9ec1e58..cbf6268ab86 100644 --- a/windows/src/engine/keyman32/keymanengine.h +++ b/windows/src/engine/keyman32/keymanengine.h @@ -19,8 +19,8 @@ #endif // For keyman_core_api_bits.h -#ifndef KMN_KBP_STATIC -#define KMN_KBP_STATIC +#ifndef KMN_CORE_STATIC +#define KMN_CORE_STATIC #endif // For keyman_core_api_bits.h #ifndef _WIN32 From 2f073f77783056397723f6a84627cb97a635a4f9 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Thu, 19 Oct 2023 08:51:29 +0200 Subject: [PATCH 2/2] chore(linux): Rename KMN_CORE to KM_CORE_LIBRARY --- common/include/kmx_file.h | 4 ++-- core/include/keyman/keyman_core_api_bits.h | 8 ++++---- core/meson.build | 6 +++--- core/src/kmx/kmx_file_validator.hpp | 4 ++-- core/src/kmx/kmx_processevent.h | 4 ++-- core/src/meson.build | 4 ++-- core/tests/unit/kmnkbd/meson.build | 2 +- core/tests/unit/kmnkbd/test_kmx_xstring.cpp | 4 ++-- windows/src/engine/keyman32/keymanengine.h | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/common/include/kmx_file.h b/common/include/kmx_file.h index 714a190aab0..fb071ef4e5f 100644 --- a/common/include/kmx_file.h +++ b/common/include/kmx_file.h @@ -25,7 +25,7 @@ typedef KMX_WORD __attribute__((aligned(1))) KMX_WORD_unaligned; #define KMX_WORD_unaligned KMX_WORD #endif -#ifdef KMN_CORE +#ifdef KM_CORE_LIBRARY // TODO: move this to a common namespace keyman::common::kmx_file or similar in the future namespace km { namespace kbp { @@ -402,7 +402,7 @@ static_assert(sizeof(COMP_KEY) == KEYBOARDFILEKEY_SIZE, "COMP_KEY must be KEYBOA static_assert(sizeof(COMP_GROUP) == KEYBOARDFILEGROUP_SIZE, "COMP_GROUP must be KEYBOARDFILEGROUP_SIZE bytes"); static_assert(sizeof(COMP_KEYBOARD) == KEYBOARDFILEHEADER_SIZE, "COMP_KEYBOARD must be KEYBOARDFILEHEADER_SIZE bytes"); -#ifdef KMN_CORE +#ifdef KM_CORE_LIBRARY } // namespace kmx } // namespace kbp } // namespace km diff --git a/core/include/keyman/keyman_core_api_bits.h b/core/include/keyman/keyman_core_api_bits.h index 01ac4489f67..e00f4698a8c 100644 --- a/core/include/keyman/keyman_core_api_bits.h +++ b/core/include/keyman/keyman_core_api_bits.h @@ -48,10 +48,10 @@ #define _KM_CORE_EXT_SEPARATOR ('.') #endif -#if defined KMN_CORE_STATIC +#if defined KM_CORE_LIBRARY_STATIC #define KMN_API _kmn_tag_fn(_kmn_static_flag) #define KMN_DEPRECATED_API _kmn_tag_fn(_kmn_deprecated_flag _kmn_and _kmn_static_flag) -#elif defined KMN_CORE_EXPORTING +#elif defined KM_CORE_LIBRARY_EXPORTING #define KMN_API _kmn_tag_fn(_kmn_export_flag) #define KMN_DEPRECATED_API _kmn_tag_fn(_kmn_deprecated_flag _kmn_and _kmn_export_flag) #else @@ -59,8 +59,8 @@ #define KMN_DEPRECATED_API _kmn_tag_fn(_kmn_deprecated_flag _kmn_and _kmn_import_flag) #endif -#ifndef KMN_CORE -#define KMN_CORE +#ifndef KM_CORE_LIBRARY +#define KM_CORE_LIBRARY #endif #ifndef USE_CHAR16_T #define USE_CHAR16_T diff --git a/core/meson.build b/core/meson.build index a6ef47c57c9..54214aded29 100644 --- a/core/meson.build +++ b/core/meson.build @@ -25,8 +25,8 @@ py = import('python') python = py.find_installation() # TODO: Shared includes may use namespaces, etc which need future tidyup. -# For now, we use KMN_CORE to inject the km::kbp::kmx namespace -defns += ['-DKMN_CORE'] +# For now, we use KM_CORE_LIBRARY to inject the km::kbp::kmx namespace +defns += ['-DKM_CORE_LIBRARY'] # #define DEBUG when we are on a debug build if get_option('buildtype') == 'debug' @@ -36,4 +36,4 @@ endif subdir('doc') subdir('include') subdir('src') -subdir('tests') \ No newline at end of file +subdir('tests') diff --git a/core/src/kmx/kmx_file_validator.hpp b/core/src/kmx/kmx_file_validator.hpp index 7d7f1df599f..48b042ab1bf 100644 --- a/core/src/kmx/kmx_file_validator.hpp +++ b/core/src/kmx/kmx_file_validator.hpp @@ -6,7 +6,7 @@ #include -#ifdef KMN_CORE +#ifdef KM_CORE_LIBRARY // TODO: move this to a common namespace keyman::common::kmx_file or similar in the future namespace km { namespace kbp { @@ -27,7 +27,7 @@ class KMX_FileValidator : public COMP_KEYBOARD { }; -#ifdef KMN_CORE +#ifdef KM_CORE_LIBRARY } // namespace kmx } // namespace kbp } // namespace km diff --git a/core/src/kmx/kmx_processevent.h b/core/src/kmx/kmx_processevent.h index cac71739d59..7beb3f777bf 100644 --- a/core/src/kmx/kmx_processevent.h +++ b/core/src/kmx/kmx_processevent.h @@ -1,8 +1,8 @@ #pragma once -#ifndef KMN_CORE -#define KMN_CORE +#ifndef KM_CORE_LIBRARY +#define KM_CORE_LIBRARY #endif #ifndef USE_CHAR16_T #define USE_CHAR16_T diff --git a/core/src/meson.build b/core/src/meson.build index 0eeedac873b..51df8c6b57f 100644 --- a/core/src/meson.build +++ b/core/src/meson.build @@ -7,7 +7,7 @@ version_res = [] # TODO: shouldn't this be defined only for dylib and not static lib? -defns += ['-DKMN_CORE_EXPORTING'] +defns += ['-DKM_CORE_LIBRARY_EXPORTING'] if cpp_compiler.get_id() == 'msvc' defns += ['-DUNICODE'] @@ -18,7 +18,7 @@ endif if cpp_compiler.get_id() == 'emscripten' # TODO: why do we need this defn here? - defns += ['-DKMN_CORE'] + defns += ['-DKM_CORE_LIBRARY'] endif # ICU4C is used for repertoire tests and core implementation diff --git a/core/tests/unit/kmnkbd/meson.build b/core/tests/unit/kmnkbd/meson.build index efd25caa740..3643a7a11f4 100644 --- a/core/tests/unit/kmnkbd/meson.build +++ b/core/tests/unit/kmnkbd/meson.build @@ -14,7 +14,7 @@ else warns = [] endif -local_defns = ['-DKMN_CORE_STATIC'] +local_defns = ['-DKM_CORE_LIBRARY_STATIC'] tests = [ ['context-api', 'context_api.cpp'], ['keyboard-api', 'keyboard_api.cpp'], diff --git a/core/tests/unit/kmnkbd/test_kmx_xstring.cpp b/core/tests/unit/kmnkbd/test_kmx_xstring.cpp index a48bdae9513..a1bda608b1a 100644 --- a/core/tests/unit/kmnkbd/test_kmx_xstring.cpp +++ b/core/tests/unit/kmnkbd/test_kmx_xstring.cpp @@ -4,8 +4,8 @@ * Keyman Core - KMX Extended String unit tests */ -#ifndef KMN_CORE -#define KMN_CORE +#ifndef KM_CORE_LIBRARY +#define KM_CORE_LIBRARY #endif #ifndef USE_CHAR16_T #define USE_CHAR16_T diff --git a/windows/src/engine/keyman32/keymanengine.h b/windows/src/engine/keyman32/keymanengine.h index cbf6268ab86..c563210a765 100644 --- a/windows/src/engine/keyman32/keymanengine.h +++ b/windows/src/engine/keyman32/keymanengine.h @@ -19,8 +19,8 @@ #endif // For keyman_core_api_bits.h -#ifndef KMN_CORE_STATIC -#define KMN_CORE_STATIC +#ifndef KM_CORE_LIBRARY_STATIC +#define KM_CORE_LIBRARY_STATIC #endif // For keyman_core_api_bits.h #ifndef _WIN32