diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2007-01-21 22:47:36 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-01-21 22:47:36 +0000 |
commit | 553e011320798af097e8de95a1e2a1d2ed6a1a3e (patch) | |
tree | d2e7cd070f33afddb0ce84129e61b4f3034bceb4 /Src/zsh.h | |
parent | f3bf48149a2e86faf35db529d864edd904b52fb4 (diff) | |
download | zsh-553e011320798af097e8de95a1e2a1d2ed6a1a3e.tar.gz zsh-553e011320798af097e8de95a1e2a1d2ed6a1a3e.tar.xz zsh-553e011320798af097e8de95a1e2a1d2ed6a1a3e.zip |
23118: improve sorting to make it work with locales
Diffstat (limited to 'Src/zsh.h')
-rw-r--r-- | Src/zsh.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Src/zsh.h b/Src/zsh.h index e2eb2544a..dcda38b89 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1944,6 +1944,51 @@ struct heap { #define ZSIG_ALIAS (1<<3) /* Trap is stored under an alias */ #define ZSIG_SHIFT 4 +/***********/ +/* Sorting */ +/***********/ + +typedef int (*CompareFn) _((const void *, const void *)); + +enum { + SORTIT_ANYOLDHOW = 0, /* Defaults */ + SORTIT_IGNORING_CASE = 1, + SORTIT_NUMERICALLY = 2, + SORTIT_BACKWARDS = 4, + /* + * Ignore backslashes that quote another character---which may + * be another backslash; the second backslash is active. + */ + SORTIT_IGNORING_BACKSLASHES = 8, + /* + * Ignored by strmetasort(); used by paramsubst() to indicate + * there is some sorting to do. + */ + SORTIT_SOMEHOW = 16, +}; + +/* + * Element of array passed to qsort(). + */ +struct sortelt { + /* The original string. */ + char *orig; + /* The string used for comparison. */ + const char *cmp; + /* + * The length of the string if passed down to the sort algorithm. + * Used to sort the lengths together with the strings. + */ + int origlen; + /* + * The length of the string, if needed, else -1. + * The length is only needed if there are embededded nulls. + */ + int len; +}; + +typedef struct sortelt *SortElt; + /************************/ /* Flags to casemodifiy */ /************************/ |