aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-12-21 14:08:57 +0100
committerMattias Andrée <m@maandree.se>2025-12-21 14:13:45 +0100
commit095193a9905caff27509a299d895d399d42c06aa (patch)
tree48b1bcf860866029d9081cf9ecd72388658cfbb9 /common.h
parentAdd range print functions (diff)
downloadlibcmap-095193a9905caff27509a299d895d399d42c06aa.tar.gz
libcmap-095193a9905caff27509a299d895d399d42c06aa.tar.bz2
libcmap-095193a9905caff27509a299d895d399d42c06aa.tar.xz
Fix truncation issue in libcmap_sprintf_range, and add LIBCMAP_ULTIMATE_CODEPOINT and LIBCMAP_UNIVERSE_RANGE
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'common.h')
-rw-r--r--common.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..c5fc285
--- /dev/null
+++ b/common.h
@@ -0,0 +1,15 @@
+/* See LICENSE file for copyright and license details. */
+#include "libcmap.h"
+#include <limits.h>
+#include <stdio.h>
+
+
+#define SINGLETON_RANGE_FMT "U+%04lX"
+#define SINGLETON_RANGE_ARGS(RANGE)\
+ (unsigned long int)((RANGE)->first)
+
+#define RANGE_FMT "U+%04lX%sU+%04lX"
+#define RANGE_ARGS(RANGE, ENDASH)\
+ (unsigned long int)((RANGE)->first),\
+ ((ENDASH) ? (ENDASH) : "–"),\
+ (unsigned long int)((RANGE)->last)