Lines Matching refs:lc
384 lccanon(Lc_t* lc, unsigned long flags, char* buf, size_t siz)
386 if ((flags & LC_local) && (!lc->language || !(lc->language->flags & (LC_debug|LC_default))))
393 if (lc->index &&
394 GetLocaleInfo(lc->index, LOCALE_SENGLANGUAGE, lang, sizeof(lang)) &&
395 GetLocaleInfo(lc->index, LOCALE_SENGCOUNTRY, ctry, sizeof(ctry)))
397 if (!GetLocaleInfo(lc->index, LOCALE_IDEFAULTANSICODEPAGE, code, sizeof(code)))
399 if (!lc->charset || !lc->charset->ms)
401 else if (streq(lc->charset->ms, code))
404 return sfsprintf(buf, siz, "%s_%s.%s,%s", lang, ctry, code, lc->charset->ms);
411 return canonical(lc->language, lc->territory, lc->charset, lc->attributes, flags, buf, siz);
431 Lc_t* lc;
451 for (lc = lcs; lc; lc = lc->next)
452 if (!strcasecmp(t, lc->code) || !strcasecmp(t, lc->name))
453 return lc;
777 if (!(lc = newof(0, Lc_t, 1, n + z)))
779 strcpy((char*)(lc->name = (const char*)(lc + 1)), name);
780 lc->code = lc->name + n;
783 lc->flags |= LC_local;
784 strcpy((char*)lc->code, local[!i].name);
785 strcpy((char*)lc->code + local[!i].size, name + local[i].size);
788 strcpy((char*)lc->code, s);
789 lc->language = lp ? lp : &lc_languages[0];
790 lc->territory = tp ? tp : &lc_territories[0];
791 lc->charset = cp ? cp : &lc_charsets[0];
792 if (streq(lc->charset->code, "utf8"))
793 lc->flags |= LC_utf8;
794 lc->attributes = al;
795 for (i = 0; i < elementsof(lc->info); i++)
796 lc->info[i].lc = lc;
806 lc->index = MAKELCID(MAKELANGID(lp->index, n), SORT_DEFAULT);
808 lc->next = lcs;
809 lcs = lc;
811 sfprintf(sfstderr, "locale make %17s %16s %16s %16s language=%s territory=%s charset=%s%s\n", "", lc->name, lc->code, "", lc->language->name, lc->territory->name, lc->charset->code, (lc->flags & LC_local) ? " local" : "");
812 return lc;
817 * one Lc_t is allocated on the first call with lc==0
824 Lc_t lc;
833 lcscan(Lc_t* lc)
837 if (!(ls = (Lc_scan_t*)lc))
841 ls->lc.code = ls->lc.name = ls->buf;
843 ls->language = elementsof(ls->lc.territory->languages);
844 ls->attribute = elementsof(ls->lc.language->attributes);
846 if (++ls->attribute >= elementsof(ls->lc.language->attributes) || !(ls->list.attribute = ls->lc.language->attributes[ls->attribute]))
848 if (++ls->language >= elementsof(ls->lc.territory->languages) || !(ls->lc.language = ls->lc.territory->languages[ls->language]))
855 ls->lc.territory = &lc_territories[ls->territory];
856 ls->lc.language = ls->lc.territory->languages[ls->language = 0];
858 if (ls->lc.language)
860 ls->lc.charset = ls->lc.language->charset ? ls->lc.language->charset : &lc_charsets[0];
861 ls->list.attribute = ls->lc.language->attributes[ls->attribute = 0];
865 ls->lc.charset = &lc_charsets[0];
869 ls->lc.attributes = ls->list.attribute ? &ls->list : (Lc_attribute_list_t*)0;
871 if (!ls->lc.language || !ls->lc.language->index)
872 ls->lc.index = 0;
875 if ((!ls->list.attribute || !(ls->lc.index = ls->list.attribute->index)) &&
876 (!ls->lc.territory || !(ls->lc.index = ls->lc.territory->indices[ls->language])))
877 ls->lc.index = SUBLANG_DEFAULT;
878 ls->lc.index = MAKELCID(MAKELANGID(ls->lc.language->index, ls->lc.index), SORT_DEFAULT);
881 canonical(ls->lc.language, ls->lc.territory, ls->lc.charset, ls->lc.attributes, 0, ls->buf, sizeof(ls->buf));