X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/e4ea58f8cb4dccaa8e99306a3497de1e37600480..5b1d0032b0eb6f4a347c0c2cfdbe6e4bb4f959ab:/misc.c diff --git a/misc.c b/misc.c index 304cb1f..aa05878 100644 --- a/misc.c +++ b/misc.c @@ -194,10 +194,25 @@ int compare_wordlists(word *a, word *b) { } } +#ifdef HAS_WCSCOLL + { + wchar_t a[2], b[2]; + int ret; + + a[0] = pos[0].c; + b[0] = pos[1].c; + a[1] = b[1] = L'\0'; + + ret = wcscoll(a, b); + if (ret) + return ret; + } +#else if (pos[0].c < pos[1].c) return -1; else if (pos[0].c > pos[1].c) return +1; +#endif if (!pos[0].c) break; /* they're equal */ @@ -213,23 +228,22 @@ int compare_wordlists(word *a, word *b) { return compare_wordlists_literally(a, b); } -void mark_attr_ends(paragraph *sourceform) { - paragraph *p; +void mark_attr_ends(word *words) +{ word *w, *wp; - for (p = sourceform; p; p = p->next) { - wp = NULL; - for (w = p->words; w; w = w->next) { - if (isattr(w->type)) { - int before = (wp && isattr(wp->type) && - sameattr(wp->type, w->type)); - int after = (w->next && isattr(w->next->type) && - sameattr(w->next->type, w->type)); - w->aux |= (before ? - (after ? attr_Always : attr_Last) : - (after ? attr_First : attr_Only)); - } - wp = w; + + wp = NULL; + for (w = words; w; w = w->next) { + if (isattr(w->type)) { + int before = (wp && isattr(wp->type) && + sameattr(wp->type, w->type)); + int after = (w->next && isattr(w->next->type) && + sameattr(w->next->type, w->type)); + w->aux |= (before ? + (after ? attr_Always : attr_Last) : + (after ? attr_First : attr_Only)); } + wp = w; } } @@ -497,7 +511,7 @@ void cmdline_cfg_add(paragraph *cfg, char *string) while (cfg->origkeyword[len]) len += 1 + strlen(cfg->origkeyword+len); - ustring = ufroma_dup(string, CS_FIXME); + ustring = ufroma_locale_dup(string); upos = ulen; ulen += 2 + ustrlen(ustring);