Exemple #1
0
void _init_search(PyObject *m)
{
    SearchIteratorType_.tp_iter = (getiterfunc) t_searchiterator_iter;
    SearchIteratorType_.tp_iternext = (iternextfunc) t_searchiterator_iter_next;
    StringSearchType_.tp_str = (reprfunc) t_stringsearch_str;
    StringSearchType_.tp_richcompare = (richcmpfunc) t_stringsearch_richcmp;

    INSTALL_CONSTANTS_TYPE(USearchAttribute, m);
    INSTALL_CONSTANTS_TYPE(USearchAttributeValue, m);

    INSTALL_TYPE(SearchIterator, m);
    REGISTER_TYPE(StringSearch, m);

    INSTALL_ENUM(USearchAttribute, "OVERLAP", USEARCH_OVERLAP);
    INSTALL_ENUM(USearchAttribute, "CANONICAL_MATCH", USEARCH_CANONICAL_MATCH);
#if U_ICU_VERSION_HEX >= 0x04040000
    INSTALL_ENUM(USearchAttribute, "ELEMENT_COMPARISON", USEARCH_ELEMENT_COMPARISON);
#endif

    INSTALL_ENUM(USearchAttributeValue, "DEFAULT", USEARCH_DEFAULT);
    INSTALL_ENUM(USearchAttributeValue, "OFF", USEARCH_OFF);
    INSTALL_ENUM(USearchAttributeValue, "ON", USEARCH_ON);
#if U_ICU_VERSION_HEX >= 0x04040000
    INSTALL_ENUM(USearchAttributeValue, "STANDARD_ELEMENT_COMPARISON", USEARCH_STANDARD_ELEMENT_COMPARISON);
    INSTALL_ENUM(USearchAttributeValue, "PATTERN_BASE_WEIGHT_IS_WILDCARD", USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD);
    INSTALL_ENUM(USearchAttributeValue, "ANY_BASE_WEIGHT_IS_WILDCARD", USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD);
#endif

    INSTALL_ENUM(SearchIterator, "DONE", USEARCH_DONE);
}
Exemple #2
0
void _init_locale(PyObject *m)
{
    LocaleType_.tp_str = (reprfunc) t_locale_str;
    LocaleType_.tp_hash = (hashfunc) t_locale_hash;
    ResourceBundleType_.tp_iter = (getiterfunc) t_resourcebundle_iter;
    ResourceBundleType_.tp_iternext = (iternextfunc) t_resourcebundle_next;
    ResourceBundleType_.tp_str = (reprfunc) t_resourcebundle_str;

    INSTALL_CONSTANTS_TYPE(ULocDataLocaleType, m);
    INSTALL_CONSTANTS_TYPE(UResType, m);
    INSTALL_CONSTANTS_TYPE(ULocaleDataDelimiterType, m);
    INSTALL_CONSTANTS_TYPE(ULocaleDataExemplarSetType, m);
    INSTALL_CONSTANTS_TYPE(UMeasurementSystem, m);
    REGISTER_TYPE(Locale, m);
    REGISTER_TYPE(ResourceBundle, m);
    INSTALL_STRUCT(LocaleData, m);

    INSTALL_ENUM(ULocDataLocaleType, "ACTUAL_LOCALE", ULOC_ACTUAL_LOCALE);
    INSTALL_ENUM(ULocDataLocaleType, "VALID_LOCALE", ULOC_VALID_LOCALE);

    INSTALL_ENUM(UResType, "NONE", URES_NONE);
    INSTALL_ENUM(UResType, "STRING", URES_STRING);
    INSTALL_ENUM(UResType, "BINARY", URES_BINARY);
    INSTALL_ENUM(UResType, "TABLE", URES_TABLE);
    INSTALL_ENUM(UResType, "ALIAS", URES_ALIAS);
    INSTALL_ENUM(UResType, "INT", URES_INT);
    INSTALL_ENUM(UResType, "ARRAY", URES_ARRAY);
    INSTALL_ENUM(UResType, "INT_VECTOR", URES_INT_VECTOR);
    INSTALL_ENUM(UResType, "RESERVED", RES_RESERVED);

    INSTALL_ENUM(ULocaleDataDelimiterType, "QUOTATION_START",
                 ULOCDATA_QUOTATION_START);
    INSTALL_ENUM(ULocaleDataDelimiterType, "QUOTATION_END",
                 ULOCDATA_QUOTATION_END);
    INSTALL_ENUM(ULocaleDataDelimiterType, "ALT_QUOTATION_START",
                 ULOCDATA_ALT_QUOTATION_START);
    INSTALL_ENUM(ULocaleDataDelimiterType, "ALT_QUOTATION_END",
                 ULOCDATA_ALT_QUOTATION_END);

    INSTALL_ENUM(ULocaleDataExemplarSetType, "ES_STANDARD",
                 ULOCDATA_ES_STANDARD);
    INSTALL_ENUM(ULocaleDataExemplarSetType, "ES_AUXILIARY",
                 ULOCDATA_ES_AUXILIARY);
#if U_ICU_VERSION_HEX >= 0x04080000
    INSTALL_ENUM(ULocaleDataExemplarSetType, "ES_INDEX",
                 ULOCDATA_ES_INDEX);
#endif

    INSTALL_ENUM(UMeasurementSystem, "SI", UMS_SI);
    INSTALL_ENUM(UMeasurementSystem, "US", UMS_US);

    // options for LocaleData.getExemplarSet()
    INSTALL_MODULE_INT(m, USET_IGNORE_SPACE);
    INSTALL_MODULE_INT(m, USET_CASE_INSENSITIVE);
    INSTALL_MODULE_INT(m, USET_ADD_CASE_MAPPINGS);
}
Exemple #3
0
void _init_regex(PyObject *m)
{
    RegexPatternType.tp_str = (reprfunc) t_regexpattern_str;
    RegexPatternType.tp_richcompare = (richcmpfunc) t_regexpattern_richcmp;

#if U_ICU_VERSION_HEX >= 0x04000000
    RegexMatcherType.tp_traverse = (traverseproc) t_regexmatcher_traverse;
    RegexMatcherType.tp_clear = (inquiry) t_regexmatcher_clear;
    RegexMatcherType.tp_flags |= Py_TPFLAGS_HAVE_GC;
#endif
    RegexMatcherType.tp_str = (reprfunc) t_regexmatcher_str;

    INSTALL_CONSTANTS_TYPE(URegexpFlag, m);

    REGISTER_TYPE(RegexPattern, m);
    REGISTER_TYPE(RegexMatcher, m);

    INSTALL_ENUM(URegexpFlag, "CANON_EQ", UREGEX_CANON_EQ);
    INSTALL_ENUM(URegexpFlag, "CASE_INSENSITIVE", UREGEX_CASE_INSENSITIVE);
    INSTALL_ENUM(URegexpFlag, "COMMENTS", UREGEX_COMMENTS);
    INSTALL_ENUM(URegexpFlag, "DOTALL", UREGEX_DOTALL);
    INSTALL_ENUM(URegexpFlag, "MULTILINE", UREGEX_MULTILINE);
    INSTALL_ENUM(URegexpFlag, "UWORD", UREGEX_UWORD);
#if U_ICU_VERSION_HEX >= 0x04000000
    INSTALL_ENUM(URegexpFlag, "LITERAL", UREGEX_LITERAL);
    INSTALL_ENUM(URegexpFlag, "UNIX_LINES", UREGEX_UNIX_LINES);
    INSTALL_ENUM(URegexpFlag, "ERROR_ON_UNKNOWN_ESCAPES", UREGEX_ERROR_ON_UNKNOWN_ESCAPES);
#endif
}