summaryrefslogtreecommitdiff
path: root/gl/lib/mbsalign.h
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-09-04 13:12:23 +0100
committerPádraig Brady <P@draigBrady.com>2012-09-11 03:23:42 +0100
commit6cf9c59b1635906f3595fc43dcd36dc4433fd7aa (patch)
treeb2a419c97f592646046443bae73191edd5ce3c86 /gl/lib/mbsalign.h
parent4fdd1cc597209b9e85ed66fdb594abca6f148155 (diff)
downloadcoreutils-6cf9c59b1635906f3595fc43dcd36dc4433fd7aa.tar.xz
maint: add more control flags to mbsalign
* gl/lib/mbsalign.h: Add MBA_UNIBYTE_ONLY (to allow faster processing). Also add MBA_NO_LEFT_PAD, MBA_NO_RIGHT_PAD to give greater control of padding, useful with the first or last fields on a line. * gl/lib/mbsalign.c (mbsalign): Implement the new flags. * gl/tests/test-mbsalign.c (main): Test combinations of the new flags.
Diffstat (limited to 'gl/lib/mbsalign.h')
-rw-r--r--gl/lib/mbsalign.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/gl/lib/mbsalign.h b/gl/lib/mbsalign.h
index e9340f926..25d529e48 100644
--- a/gl/lib/mbsalign.h
+++ b/gl/lib/mbsalign.h
@@ -21,20 +21,33 @@ typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t;
enum {
/* Use unibyte mode for invalid multibyte strings
or when heap memory is exhausted. */
- MBA_UNIBYTE_FALLBACK = 0x0001
+ MBA_UNIBYTE_FALLBACK = 0x0001,
+
+ /* As an optimization, don't do multibyte processing
+ when we know no multibyte characters are present. */
+ MBA_UNIBYTE_ONLY = 0x0002,
+
+ /* Don't add leading padding. */
+ MBA_NO_LEFT_PAD = 0x0004,
+
+ /* Don't add trailing padding. */
+ MBA_NO_RIGHT_PAD = 0x0008
#if 0 /* Other possible options. */
- /* Skip invalid multibyte chars rather than failing */
- MBA_IGNORE_INVALID = 0x0002,
+ /* Skip invalid multibyte chars rather than failing. */
+ MBA_IGNORE_INVALID
+
+ /* Align multibyte strings using "figure space" (\u2007). */
+ MBA_USE_FIGURE_SPACE
- /* Align multibyte strings using "figure space" (\u2007) */
- MBA_USE_FIGURE_SPACE = 0x0004,
+ /* Don't truncate. */
+ MBA_NO_TRUNCATE
- /* Don't add any padding */
- MBA_TRUNCATE_ONLY = 0x0008,
+ /* Ensure no leading whitepsace. */
+ MBA_LSTRIP
- /* Don't truncate */
- MBA_PAD_ONLY = 0x0010,
+ /* Ensure no trailing whitepsace. */
+ MBA_RSTRIP
#endif
};