-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Posix and Windows wrappers moved here!
— ✨encoding_detection.h C function to determine if the encoding is something unicode-y!
- Loading branch information
Showing
15 changed files
with
677 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// ============================================================================= | ||
// | ||
// ztd.idk | ||
// Copyright © 2021 JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC | ||
// Contact: opensource@soasis.org | ||
// | ||
// Commercial License Usage | ||
// Licensees holding valid commercial ztd.idk licenses may use this file in | ||
// accordance with the commercial license agreement provided with the | ||
// Software or, alternatively, in accordance with the terms contained in | ||
// a written agreement between you and Shepherd's Oasis, LLC. | ||
// For licensing terms and conditions see your agreement. For | ||
// further information contact opensource@soasis.org. | ||
// | ||
// Apache License Version 2 Usage | ||
// Alternatively, this file may be used under the terms of Apache License | ||
// Version 2.0 (the "License") for non-commercial use; you may not use this | ||
// file except in compliance with the License. You may obtain a copy of the | ||
// License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// ============================================================================> | ||
|
||
#pragma once | ||
|
||
#ifndef ZTD_IDK_DETAIL_POSIX_HPP | ||
#define ZTD_IDK_DETAIL_POSIX_HPP | ||
|
||
#include <ztd/idk/version.hpp> | ||
|
||
#include <ztd/idk/encoding_name.hpp> | ||
|
||
#if ZTD_IS_ON(ZTD_PLATFORM_UNIX_I_) || ZTD_IS_ON(ZTD_PLATFORM_POSIX_I_) | ||
|
||
// clang-format off | ||
#include <clocale> | ||
#if ZTD_IS_ON(ZTD_LANGINFO_I_) | ||
extern "C" { | ||
#include <langinfo.h> | ||
} | ||
#elif ZTD_IS_ON(ZTD_NL_LANGINFO_I_) | ||
// IBM-specific?? | ||
extern "C" { | ||
#include <nl_langinfo.h> | ||
} | ||
#endif | ||
|
||
#if ZTD_IS_ON(ZTD_LIBICONV_LOAD_I_) | ||
#if ZTD_IS_ON(ZTD_PLATFORM_POSIX_I_) && ZTD_IS_ON(ZTD_DLFCN_H_I_) | ||
#include <dlfcn.h> | ||
#endif | ||
#endif | ||
// clang-format on | ||
|
||
#include <ztd/prologue.hpp> | ||
|
||
namespace ztd { | ||
|
||
ZTD_IDK_INLINE_ABI_NAMESPACE_OPEN_I_ | ||
|
||
namespace __idk_detail { namespace __posix { | ||
|
||
inline __idk_detail::__encoding_id __determine_active_code_page() noexcept { | ||
#if ZTD_IS_ON(ZTD_LANGINFO_I_) || ZTD_IS_ON(ZTD_NL_LANGINFO_I_) | ||
const char* __name = nl_langinfo(LC_CTYPE); | ||
return __idk_detail::__to_encoding_id(__name); | ||
#else | ||
// fallback to stdlib I guess? | ||
const char* __ctype_name = setlocale(LC_CTYPE, nullptr); | ||
return __idk_detail::__to_encoding_id(__ctype_name); | ||
#endif | ||
} | ||
|
||
}} // namespace __idk_detail::__posix | ||
|
||
ZTD_IDK_INLINE_ABI_NAMESPACE_CLOSE_I_ | ||
|
||
} // namespace ztd | ||
|
||
#endif // POSIX | ||
|
||
#include <ztd/epilogue.hpp> | ||
|
||
#endif // ZTD_IDK_DETAIL_POSIX_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// ============================================================================= | ||
// | ||
// ztd.cuneicode | ||
// Copyright © 2021 JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC | ||
// Contact: opensource@soasis.org | ||
// | ||
// Commercial License Usage | ||
// Licensees holding valid commercial ztd.cuneicode licenses may use this file | ||
// in accordance with the commercial license agreement provided with the | ||
// Software or, alternatively, in accordance with the terms contained in | ||
// a written agreement between you and Shepherd's Oasis, LLC. | ||
// For licensing terms and conditions see your agreement. For | ||
// further information contact opensource@soasis.org. | ||
// | ||
// Apache License Version 2 Usage | ||
// Alternatively, this file may be used under the terms of Apache License | ||
// Version 2.0 (the "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// ============================================================================> | ||
|
||
#ifndef ZTD_IDK_ENCODING_DETECTION_H | ||
#define ZTD_IDK_ENCODING_DETECTION_H | ||
|
||
#pragma once | ||
|
||
#include <ztd/idk/version.h> | ||
|
||
#if ZTD_IS_ON(ZTD_C_I_) | ||
#include <stdbool.h> | ||
#endif // C++ | ||
|
||
ZTD_IDK_C_LANGUAGE_LINKAGE_I_ ZTD_IDK_API_LINKAGE_I_ bool ztdc_is_execution_encoding_unicode( | ||
void) ZTD_NOEXCEPT_IF_CXX_I_; | ||
ZTD_IDK_C_LANGUAGE_LINKAGE_I_ ZTD_IDK_API_LINKAGE_I_ bool ztdc_is_wide_execution_encoding_unicode( | ||
void) ZTD_NOEXCEPT_IF_CXX_I_; | ||
|
||
#endif // ZTD_IDK_ENCODING_DETECTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.