/*
 * Header file for mycu.c and icu-shim.c.
 * There aren't separate header files for these, since this one acts
 * as either, depending on whether HAVE_ICU is defined as true or false.
 *
 * This file is part of Beastie <https://purl.org/nxg/dist/beastie>
 * SPDX-FileCopyrightText: 2025 Norman Gray <https://nxg.me.uk>
 * SPDX-License-Identifier: BSD-2-Clause
 */

#ifndef UNIPROPS_H_LOADED
#define UNIPROPS_H_LOADED 1

#include <stdint.h>
#include "unidefs.h"            // codepoint_t

#ifndef HAVE_ICU
#define HAVE_ICU 0
#endif

#if HAVE_ICU
#define UNIPROP_FUNC(n) icu_ ## n
#else
#define UNIPROP_FUNC(n) mycu_ ## n
#endif

int UNIPROP_FUNC(is_icu_p)(void);

int UNIPROP_FUNC(letter_p)(const codepoint_t);
int UNIPROP_FUNC(uppercase_letter_p)(const codepoint_t);
int UNIPROP_FUNC(lowercase_letter_p)(const codepoint_t);
//int UNIPROP_FUNC(other_letter_p)(const codepoint_t);
int UNIPROP_FUNC(number_p)(const codepoint_t); // decimal digit
int UNIPROP_FUNC(alnum_p)(const codepoint_t);
int UNIPROP_FUNC(punctuation_p)(const codepoint_t);
int UNIPROP_FUNC(cntrl_p)(const codepoint_t);
int UNIPROP_FUNC(symbol_p)(const codepoint_t);
int UNIPROP_FUNC(mark_p)(const codepoint_t);

// The following are properties from PropList.txt
int UNIPROP_FUNC(space_p)(const codepoint_t cp);
int UNIPROP_FUNC(wordcharacter_p)(const codepoint_t cp);
// or DerivedCoreProperties.txt
int UNIPROP_FUNC(alphabetic_p)(const codepoint_t cp);

// whitespace_p matches the Unicode u_isWhitespace function,
// which is the one which (a) matches ‘Java whitespace characters’,
// and (b) does not include non-breaking spaces
// (U+00A0 NBSP, U+2007 Figure Space, U+202F Narrow NBSP).
//
// The codepoint U+FEFF ZERO WIDTH NO-BREAK SPACE is not included in this set.
//
// See https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/uchar_8h.html
int UNIPROP_FUNC(whitespace_p)(const codepoint_t cp);
int UNIPROP_FUNC(nonbreakingspace_p)(const codepoint_t cp);

// the following three functions are visible from mycu.c,
// but we have no need to expose them
// int UNIPROP_FUNC(joincontrol_p)(const cp_t cp);
// int UNIPROP_FUNC(diacritic_p)(const cp_t cp);
// int UNIPROP_FUNC(extender_p)(const cp_t cp);

codepoint_t UNIPROP_FUNC(uppercase_character)(const codepoint_t);
codepoint_t UNIPROP_FUNC(lowercase_character)(const codepoint_t);
codepoint_t UNIPROP_FUNC(titlecase_character)(const codepoint_t);

#endif /* UNIPROPS_H_LOADED */
