refactor: move kmx_u16 to common and rename to km_u16

This commit is contained in:
Marc Durdin 2024-08-14 10:07:08 +02:00
parent 4a57258afc
commit dde4e2b2c3
11 changed files with 19 additions and 18 deletions

View file

@ -6,7 +6,7 @@
#include <stdarg.h>
#include "utfcodec.hpp"
#include "kmx_u16.h"
#include "km_u16.h"
/** string <- wstring
* @brief Obtain a std::string from a std::wstring

View file

@ -1,13 +1,14 @@
#include "pch.h"
#include "km_u16.h"
#include "../../../../common/windows/cpp/include/vkeys.h"
#include "compfile.h"
#include "kmn_compiler_errors.h"
#include "../../../../common/windows/cpp/include/vkeys.h"
#include "kmcmplib.h"
#include "CharToKeyConversion.h"
#include "kmx_u16.h"
#include "xstring.h"
namespace kmcmp {

View file

@ -1,11 +1,11 @@
#include "pch.h"
#include <km_u16.h>
#include "compfile.h"
#include <kmn_compiler_errors.h>
#include "kmcmplib.h"
#include <xstring.h>
#include "kmx_u16.h"
#include <kmcompx.h>
#include "CheckForDuplicates.h"

View file

@ -102,7 +102,7 @@
#include "UnreachableRules.h"
#include "CheckForDuplicates.h"
#include "kmx_u16.h"
#include "km_u16.h"
/* These macros are adapted from winnt.h and legacy use only */
#define MAKELANGID(p, s) ((((uint16_t)(s)) << 10) | (uint16_t)(p))

View file

@ -78,13 +78,13 @@ lib = library('kmcmplib',
'cp1252.cpp',
'DeprecationChecks.cpp',
'Edition.cpp',
'kmx_u16.cpp',
'NamedCodeConstants.cpp',
'UnreachableRules.cpp',
'uset-api.cpp',
'versioning.cpp',
'virtualcharkeys.cpp',
'xstring.cpp',
'../../../../common/cpp/km_u16.cpp',
'../../../../common/cpp/utfcodec.cpp',
'../../../../common/windows/cpp/src/ConvertUTF.c',
'../../../../common/windows/cpp/src/crc32.cpp',

View file

@ -4,7 +4,7 @@
#define USE_CHAR16_T
#include <kmx_file.h>
#include "kmx_u16.h"
#include <km_u16.h>
#include <kmcompx.h>
#include "../../../../common/windows/cpp/include/crc32.h"

View file

@ -1,7 +1,7 @@
#include <gtest/gtest.h>
#include <km_u16.h>
#include "../include/kmcompx.h"
#include "../include/kmcmplibapi.h"
#include "../src/kmx_u16.h"
#include "../src/compfile.h"
#include "../src/CompilerErrors.h"
#include "../../common/include/kmn_compiler_errors.h"

View file

@ -1,9 +1,9 @@
#include <gtest/gtest.h>
#include "../src/kmx_u16.h"
#include <km_u16.h>
#include <km_types.h>
#include "../src/compfile.h"
#include "../../../../common/include/km_types.h"
TEST(kmx_u16_Test, u16chr) {
TEST(km_u16_Test, u16chr) {
KMX_WCHAR str[LINESIZE];
u16cpy(str, u"abc");
@ -14,7 +14,7 @@ TEST(kmx_u16_Test, u16chr) {
EXPECT_EQ(3, u16chr(str, '\0') - str); // locate null terminator
}
TEST(kmx_u16_Test, u16chr_compare_to_strchr) {
TEST(km_u16_Test, u16chr_compare_to_strchr) {
// Compare behaviour of strchr:
char str[LINESIZE];
@ -26,7 +26,7 @@ TEST(kmx_u16_Test, u16chr_compare_to_strchr) {
EXPECT_EQ(3, strchr(str, '\0') - str); // locate null terminator
}
TEST(kmx_u16_Test, u16tok_char_delim) {
TEST(km_u16_Test, u16tok_char_delim) {
// For char delimiter: KMX_WCHAR * u16tok(KMX_WCHAR *p, const KMX_WCHAR ch, KMX_WCHAR **ctx) ;
KMX_WCHAR str[LINESIZE];
@ -67,7 +67,7 @@ TEST(kmx_u16_Test, u16tok_char_delim) {
EXPECT_TRUE(!u16cmp(u"def", ctx));
}
TEST(kmx_u16_Test, u16tok_str_delim) {
TEST(km_u16_Test, u16tok_str_delim) {
// For string delimiter: KMX_WCHAR * u16tok(KMX_WCHAR* p, const KMX_WCHAR* ch, KMX_WCHAR** ctx) ;
KMX_WCHAR str[LINESIZE];
@ -126,7 +126,7 @@ TEST(kmx_u16_Test, u16tok_str_delim) {
EXPECT_EQ(nullptr, ctx);
}
TEST(kmx_u16_Test, u16tok_str_compare_to_strtok) {
TEST(km_u16_Test, u16tok_str_compare_to_strtok) {
// Compare behaviour of strtok:
char str[LINESIZE];

View file

@ -168,7 +168,7 @@ gtestcompilertest = executable('gtest-compiler-test', 'gtest-compiler-test.cpp',
test('gtest-compiler-test', gtestcompilertest)
gtestkmx_u16test = executable('gtest-kmx_u16-test', 'gtest-kmx_u16-test.cpp',
gtest_km_u16_test = executable('gtest-km_u16-test', 'gtest-km_u16-test.cpp',
cpp_args: defns + flags,
include_directories: inc,
name_suffix: name_suffix,
@ -177,4 +177,4 @@ gtestkmx_u16test = executable('gtest-kmx_u16-test', 'gtest-kmx_u16-test.cpp',
dependencies: [ icuuc_dep, gtest_dep, gmock_dep ],
)
test('gtest-kmx_u16-test', gtestkmx_u16test)
test('gtest-km_u16-test', gtest_km_u16_test)

View file

@ -1,7 +1,7 @@
#pragma once
#include <stdio.h>
#include "../src/kmx_u16.h"
#include <km_u16.h>
// Opens files on windows and non-windows platforms. Datatypes for Filename and mode must be the same.
// returns FILE* if file could be opened; FILE needs to be closed in calling function