From 1a68cff356694902c9f5ae2593bcf0531990b262 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 16 Oct 1997 15:29:15 +0000 Subject: Add comments. From Orn. --- src/sort.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/sort.c') diff --git a/src/sort.c b/src/sort.c index 54e39b72c..e00fc6e97 100644 --- a/src/sort.c +++ b/src/sort.c @@ -1694,9 +1694,7 @@ keycompare (const struct line *a, const struct line *b) #ifdef ENABLE_NLS /* Sorting like this may become slow, so in a simple locale the user - can select a faster sort that is similar to ascii sort, but 8-bit - instead of 7-bit. But can't handle more complex, combined, - character sets. */ + can select a faster sort that is similar to ascii sort */ else if (need_locale) { /* FIXME: rewrite not to use variable size arrays */ @@ -2129,39 +2127,53 @@ nls_numeric_format (const struct line *line, int nlines) { struct nls_keyfield *n_key = nls_keyhead; + /* line = first line, nlines = number of lines, + nls_fraction_found = false */ for (; !nls_fraction_found && nlines > 0; line++, nlines--) { int iter; - for (iter = 0; !nls_fraction_found; ++iter) + for (iter=0; !nls_fraction_found; iter++) { unsigned char *text; unsigned char *lim; struct keyfield *key = n_key->key; + /* text = {}, lim = {}, key = first key */ if (iter || line->keybeg == NULL) { - if (key->eword >= 0) + /* Succeding keys, where the key field is + specified */ + if (key->eword >= 0) /* key->eword = length of key */ lim = limfield (line, key); else lim = line->text + line->length; + /* lim = end of key field */ - if (key->sword >= 0) + if (key->sword >= 0) /* key->sword = start of key */ text = begfield (line, key); else text = line->text; + /* text = start of field */ } else { + /* First key is always the whole line */ text = line->keybeg; lim = line->keylim; } + /* text = start of text to sort + lim = end of text to sort */ look_for_fraction (text, lim); + + /* nls_fraction_found = decimal_point found? */ + if ((n_key = n_key->next) == nls_keyhead) - break; + break; /* No more keys for this line */ } } nls_fraction_found = 1; + /* decide on current decimal_point known */ } #endif -- cgit v1.2.3-54-g00ecf