summaryrefslogtreecommitdiffstats
path: root/libnumtext.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-09-02 22:17:14 +0200
committerMattias Andrée <maandree@kth.se>2021-09-02 22:28:08 +0200
commite4a1686d5ca41ad02672c6530588f94c34a1c678 (patch)
treecd143c5dcbc5b8182ce7df521bf48f4de2617628 /libnumtext.h
downloadlibnumtext-e4a1686d5ca41ad02672c6530588f94c34a1c678.tar.gz
libnumtext-e4a1686d5ca41ad02672c6530588f94c34a1c678.tar.bz2
libnumtext-e4a1686d5ca41ad02672c6530588f94c34a1c678.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libnumtext.h')
-rw-r--r--libnumtext.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/libnumtext.h b/libnumtext.h
new file mode 100644
index 0000000..21ad059
--- /dev/null
+++ b/libnumtext.h
@@ -0,0 +1,64 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef LIBNUMTEXT_H
+#define LIBNUMTEXT_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <unistd.h>
+
+
+enum libnumtext_language {
+ LIBNUMTEXT_SWEDISH
+#define LIBNUMTEXT_SWEDISH LIBNUMTEXT_SWEDISH
+};
+
+
+#define LIBNUMTEXT_N2T_SWEDISH_CARDINAL UINT32_C(0x00000000) /* ett/en, två, tre, fyra, fem, … */
+#define LIBNUMTEXT_N2T_SWEDISH_ORDINAL UINT32_C(0x00000001) /* första/-e, andra/-e, tredje, … */
+
+#define LIBNUMTEXT_N2T_SWEDISH_NUMERATOR UINT32_C(0)
+#define LIBNUMTEXT_N2T_SWEDISH_DENOMINATOR UINT32_C(0x00000002) /* hel, halv, tredjedel, … */
+
+#define LIBNUMTEXT_N2T_SWEDISH_SINGULAR_FORM UINT32_C(0)
+#define LIBNUMTEXT_N2T_SWEDISH_PLURAL_FORM UINT32_C(0x00000004) /* hela, halvor, tredjedelar, … [1] */
+
+#define LIBNUMTEXT_N2T_SWEDISH_INDEFINITE_FORM UINT32_C(0)
+#define LIBNUMTEXT_N2T_SWEDISH_DEFINITE_FORM UINT32_C(0x00000008) /* halan, halvan, trejdelen, … [1] */
+
+#define LIBNUMTEXT_N2T_SWEDISH_COMMON_GENDER UINT32_C(0x00000000) /* ett/första, två/andra, … */
+#define LIBNUMTEXT_N2T_SWEDISH_NEUTER_GENDER UINT32_C(0x00000010) /* en/första, två/andra, … */
+#define LIBNUMTEXT_N2T_SWEDISH_MASCULINE_GENDER UINT32_C(0x00000020) /* en/förste, två/andre, … */
+#define LIBNUMTEXT_N2T_SWEDISH_FEMININE_GENDER UINT32_C(0x00000030) /* en/första, två/andra, … */
+
+#define LIBNUMTEXT_N2T_SWEDISH_EXPLICIT_ONE UINT32_C(0x00000000) /* …, ettusen, … */
+#define LIBNUMTEXT_N2T_SWEDISH_IMPLICIT_ONE UINT32_C(0x00000040) /* …, tusen, … */
+
+#define LIBNUMTEXT_N2T_SWEDISH_NOT_HYPHENATED UINT32_C(0)
+#define LIBNUMTEXT_N2T_SWEDISH_HYPHENATED UINT32_C(0x00000080) /* …, femhundra-trettio-två, … */
+
+#define LIBNUMTEXT_N2T_SWEDISH_LOWER_CASE UINT32_C(0) /* …, femhundratrettiotvå, … */
+#define LIBNUMTEXT_N2T_SWEDISH_PASCAL_CASE UINT32_C(0x00000100) /* …, FemhundraTrettioTvå, … */
+#define LIBNUMTEXT_N2T_SWEDISH_UPPER_CASE UINT32_C(0x00000200) /* …, FEMHUNDRATRETTIOTVÅ, … */
+#define LIBNUMTEXT_N2T_SWEDISH_SENTENCE_CASE UINT32_C(0x00000300) /* …, Femhundratrettiotvå, … */
+
+#define LIBNUMTEXT_N2T_SWEDISH_NO_HYPHENATION UINT32_C(0) /* …, femhundratrettiotvå, … */
+#define LIBNUMTEXT_N2T_SWEDISH_COMPONENT_HYPHENATION UINT32_C(0x00000400) /* …, fem|hundra|trettio|två, … */
+#define LIBNUMTEXT_N2T_SWEDISH_SYLLABLE_HYPHENATION UINT32_C(0x00000800) /* …, fem|hun|dra|tret|tio|två, … */
+#define LIBNUMTEXT_N2T_SWEDISH_SECONDARY_HYPHENATION UINT32_C(0x00000C00) /* …, fem|hun¦dra|tret¦tio|två, … */
+
+#define LIBNUMTEXT_N2T_SWEDISH_REDUCED_TRIPLETS UINT32_C(0) /* …, ettusen, … */
+#define LIBNUMTEXT_N2T_SWEDISH_EXPLICIT_TRIPLETS UINT32_C(0x00001000) /* …, etttusen, … (not acceptable Swedish) */
+#define LIBNUMTEXT_N2T_SWEDISH_LATEX_TRIPLETS UINT32_C(0x00002000) /* …, e"ttusen, … (for use in LaTeX) */
+
+/* [1] Requires LIBNUMTEXT_N2T_SWEDISH_ORDINAL (no effect) or LIBNUMTEXT_N2T_SWEDISH_DENOMINATOR */
+
+
+/* input to libnumtext_num2str may not contain separators */
+ssize_t libnumtext_remove_separators(char outbuf[], size_t outbuf_size, const char *num, size_t num_len,
+ enum libnumtext_language lang);
+
+ssize_t libnumtext_num2text(char outbuf[], size_t outbuf_size, const char *num, size_t num_len,
+ enum libnumtext_language lang, uint32_t flags, ...);
+
+
+#endif