Lines Matching refs:key
577 list_locale(Sfio_t* sp, Keyword_t* key, Lc_t* lc, unsigned int flags)
597 if (key)
606 sfprintf(sp, "%s=", key->name);
625 * print the numeric value i for key
629 number(Sfio_t* sp, register Keyword_t* key, int i, unsigned int flags)
635 sfprintf(sp, "%s=%d\n", key->name, i);
688 * print the string value(s) v[n] for key
692 string(Sfio_t* sp, register Keyword_t* key, char** v, int n, unsigned int flags)
700 sfprintf(sp, "%s=", key->name);
727 * extact and list info for key with base info at data
731 extract(Sfio_t* sp, register Keyword_t* key, void* data, unsigned int flags)
738 switch (key->type)
741 if (key->offset >= 0)
742 i = *((char*)data + key->offset);
747 number(sp, key, i, flags);
750 if (key->offset >= 0)
751 i = *(int*)((char*)data + key->offset);
754 number(sp, key, i, flags);
758 if (key->offset >= 0)
760 s = nl_langinfo(key->offset);
783 string(sp, key, &s, 1, flags);
786 if (key->offset >= 0)
788 v = (char**)((char*)data + key->offset);
789 i = key->elements;
797 string(sp, key, v, i, flags);
800 lc = (Lc_t*)lcinfo(state.categories[key->index].external)->lc;
802 if (key->offset == CV_language && lc->language)
807 else if (key->offset == CV_territory && lc->territory)
812 else if (key->offset == CV_attributes && lc->attributes)
819 string(sp, key, &s, i, flags);
853 * list info for key
857 list_keyword(Sfio_t* sp, register Keyword_t* key, char* value, unsigned int flags)
865 if ((flags & LC_category) && key->index != AST_LC_ALL)
866 sfprintf(sp, "%s\n", state.categories[key->index].name);
867 switch (key->index)
871 string(sp, key, &s, 1, flags);
874 switch (key->offset)
878 string(sp, key, &s, 1, flags|LC_upper);
881 number(sp, key, ast.mb_cur_max, flags);
884 number(sp, key, MB_CUR_MIN, flags);
892 extract(sp, key, state.conv, flags);
902 extract(sp, key, tmlocale(), flags);
909 if (!setlocale(key->offset, value))
915 if (key->type == AST_LC_ALL)
920 scan(sp, key, flags|LC_recursive);
927 i = n = key->type;
945 error(2, "%s: value expected", key->name);
950 list_locale(sfstdout, key, lcmake(value), flags);
961 scan(Sfio_t* sp, Keyword_t* key, unsigned long flags)
978 if (!key)
981 list_keyword(sp, key, NiL, flags&~LC_quote);
999 Keyword_t* key;
1149 state.disc.key = offsetof(Keyword_t, name);
1158 if (!(key = newof(0, Keyword_t, 1, 0)))
1160 key->name = state.categories[i].name;
1161 key->index = AST_LC_ALL;
1162 key->type = state.categories[i].internal;
1163 key->offset = state.categories[i].external;
1164 dtinsert(state.dict, key);
1170 if (!(key = (Keyword_t*)dtmatch(state.dict, name)))
1188 list_keyword(sfstdout, key, value, flags);