146b50872SMichael Jones //===-- Implementation of wctob -------------------------------------------===// 246b50872SMichael Jones // 346b50872SMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 446b50872SMichael Jones // See https://llvm.org/LICENSE.txt for license information. 546b50872SMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 646b50872SMichael Jones // 746b50872SMichael Jones //===----------------------------------------------------------------------===// 846b50872SMichael Jones 946b50872SMichael Jones #include "src/wchar/wctob.h" 1046b50872SMichael Jones #include "src/__support/common.h" 115ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 1246b50872SMichael Jones #include "src/__support/wctype_utils.h" 1346b50872SMichael Jones 145aed6d67SMichael Jones #include "hdr/stdio_macros.h" // for EOF. 15*95d4c97aSlntue #include "hdr/types/wint_t.h" 1646b50872SMichael Jones 175ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 1846b50872SMichael Jones 1946b50872SMichael Jones LLVM_LIBC_FUNCTION(int, wctob, (wint_t c)) { 2046b50872SMichael Jones auto result = internal::wctob(c); 2146b50872SMichael Jones if (result.has_value()) { 2246b50872SMichael Jones return result.value(); 2346b50872SMichael Jones } else { 2446b50872SMichael Jones return EOF; 2546b50872SMichael Jones } 2646b50872SMichael Jones } 2746b50872SMichael Jones 285ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 29